weapp-tailwindcss 5.5.6 → 5.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/dist/{auto-DtU6f3X6.cjs → auto-B1OyRrE8.cjs} +1 -1
  2. package/dist/{auto-2dg_uhEJ.js → auto-ENr4xzzw.js} +1 -1
  3. package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +1 -1
  4. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -1
  5. package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
  6. package/dist/bundlers/shared/css-source-trace.d.ts +2 -5
  7. package/dist/bundlers/shared/final-css-cleanup.d.ts +1 -1
  8. package/dist/bundlers/shared/framework-css-composition.d.ts +1 -1
  9. package/dist/bundlers/shared/framework-postcss.d.ts +1 -25
  10. package/dist/bundlers/shared/framework-user-css.d.ts +1 -4
  11. package/dist/bundlers/shared/generated-css-marker.d.ts +1 -10
  12. package/dist/bundlers/shared/generator-css/candidates.d.ts +1 -2
  13. package/dist/bundlers/shared/generator-css/class-selectors.d.ts +1 -3
  14. package/dist/bundlers/shared/generator-css/config-directive.d.ts +1 -2
  15. package/dist/bundlers/shared/generator-css/directives/fallback.d.ts +1 -11
  16. package/dist/bundlers/shared/generator-css/directives.d.ts +1 -25
  17. package/dist/bundlers/shared/generator-css/generation-helpers/preflight.d.ts +1 -19
  18. package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +1 -23
  19. package/dist/bundlers/shared/generator-css/generation-helpers/runtime-isolation.d.ts +1 -30
  20. package/dist/bundlers/shared/generator-css/generation-helpers/source-order.d.ts +1 -2
  21. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +1 -4
  22. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +1 -12
  23. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +1 -2
  24. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -1
  25. package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
  26. package/dist/bundlers/shared/generator-css/markers.d.ts +1 -28
  27. package/dist/bundlers/shared/generator-css/output-import-shell.d.ts +1 -8
  28. package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +1 -60
  29. package/dist/bundlers/shared/generator-css/pipeline/deferred-output.d.ts +1 -3
  30. package/dist/bundlers/shared/generator-css/pipeline/execution.d.ts +1 -3
  31. package/dist/bundlers/shared/generator-css/pipeline/fallback-output.d.ts +1 -3
  32. package/dist/bundlers/shared/generator-css/pipeline/ordered-output.d.ts +1 -3
  33. package/dist/bundlers/shared/generator-css/pipeline.d.ts +1 -2
  34. package/dist/bundlers/shared/generator-css/result-helpers.d.ts +1 -6
  35. package/dist/bundlers/shared/generator-css/scoped-rules.d.ts +1 -1
  36. package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -21
  37. package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +1 -13
  38. package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +1 -7
  39. package/dist/bundlers/shared/generator-css/source-resolver/configuration.d.ts +1 -33
  40. package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +1 -3
  41. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -28
  42. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +1 -14
  43. package/dist/bundlers/shared/generator-css/source-resolver/resolve-source.d.ts +1 -4
  44. package/dist/bundlers/shared/generator-css/source-resolver/resolve-sources.d.ts +1 -5
  45. package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +1 -16
  46. package/dist/bundlers/shared/generator-css/source-resolver/source-entries.d.ts +1 -3
  47. package/dist/bundlers/shared/generator-css/source-resolver/source-matching.d.ts +1 -5
  48. package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +1 -22
  49. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -7
  50. package/dist/bundlers/shared/generator-css/types.d.ts +1 -64
  51. package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +1 -10
  52. package/dist/bundlers/shared/generator-css/user-css/at-rules.d.ts +1 -3
  53. package/dist/bundlers/shared/generator-css/user-css/compile-functions.d.ts +1 -4
  54. package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +1 -6
  55. package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +1 -15
  56. package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +1 -13
  57. package/dist/bundlers/shared/generator-css/user-css/user-layers.d.ts +1 -15
  58. package/dist/bundlers/shared/generator-css/user-css.d.ts +1 -5
  59. package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +1 -10
  60. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -7
  61. package/dist/bundlers/shared/generator-css.d.ts +1 -9
  62. package/dist/bundlers/shared/run-tasks.d.ts +1 -3
  63. package/dist/bundlers/shared/runtime-class-set.d.ts +1 -1
  64. package/dist/bundlers/shared/source-candidates/collector.d.ts +1 -8
  65. package/dist/bundlers/shared/source-candidates/scan-root.d.ts +1 -12
  66. package/dist/bundlers/shared/source-candidates/script.d.ts +1 -1
  67. package/dist/bundlers/shared/source-candidates/snapshot.d.ts +1 -19
  68. package/dist/bundlers/shared/source-candidates/source-priority.d.ts +1 -1
  69. package/dist/bundlers/shared/source-candidates/store.d.ts +1 -2
  70. package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +1 -75
  71. package/dist/bundlers/shared/source-candidates/views.d.ts +1 -12
  72. package/dist/bundlers/shared/source-candidates.d.ts +1 -4
  73. package/dist/bundlers/shared/source-scan/css-entries.d.ts +1 -18
  74. package/dist/bundlers/shared/source-scan/dependencies.d.ts +1 -2
  75. package/dist/bundlers/shared/source-scan.d.ts +1 -16
  76. package/dist/bundlers/shared/static-config-content.d.ts +1 -5
  77. package/dist/bundlers/shared/style-handler-options.d.ts +1 -7
  78. package/dist/bundlers/shared/style-requests.d.ts +1 -5
  79. package/dist/bundlers/shared/v4-generation-core.d.ts +1 -20
  80. package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
  81. package/dist/bundlers/vite/generate-bundle/css-transform-task.d.ts +2 -2
  82. package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +1 -1
  83. package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +1 -12
  84. package/dist/bundlers/vite/processed-css-assets/injection-plan.d.ts +1 -4
  85. package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +4 -7
  86. package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +1 -13
  87. package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +2 -2
  88. package/dist/bundlers/vite/source-candidates/scan-root.d.ts +1 -1
  89. package/dist/bundlers/vite/source-candidates.d.ts +1 -1
  90. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/finalize.d.ts +1 -1
  91. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/generated-css.d.ts +2 -7
  92. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/preflight-runtime.d.ts +4 -8
  93. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/sources.d.ts +3 -3
  94. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css-markers.d.ts +1 -1
  95. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css.d.ts +2 -7
  96. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +1 -1
  97. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +1 -1
  98. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -1
  99. package/dist/bundlers/webpack/loaders/watch-dependencies.d.ts +6 -0
  100. package/dist/cache/index.d.ts +4 -4
  101. package/dist/cache/source.d.ts +29 -0
  102. package/dist/{cache-CBJFB1HN.cjs → cache-CzvIGfwS.cjs} +1 -0
  103. package/dist/compiler/composition.d.ts +1 -1
  104. package/dist/compiler/runtime-affecting-signature/js.d.ts +1 -0
  105. package/dist/compiler/semantic-css.d.ts +1 -1
  106. package/dist/compiler/types.d.ts +1 -1
  107. package/dist/{compiler-D3GBwxoa.js → compiler-CThodfGH.js} +3098 -3067
  108. package/dist/{compiler-C8FqI-P3.cjs → compiler-DkGY5Nmh.cjs} +5011 -4980
  109. package/dist/core/compiler/generation-cache.d.ts +4 -2
  110. package/dist/core/compiler/types.d.ts +1 -1
  111. package/dist/core.cjs +7 -7
  112. package/dist/core.d.ts +2 -2
  113. package/dist/core.js +2 -2
  114. package/dist/css-cleanup-B6FUJC3z.cjs +1 -0
  115. package/dist/{css-imports-XvtI1zCY.cjs → css-imports-R_RDMjPz.cjs} +7 -21
  116. package/dist/css-macro/auto.d.ts +1 -1
  117. package/dist/css-macro/postcss.cjs +1 -1
  118. package/dist/css-macro.cjs +2 -2
  119. package/dist/css-macro.js +1 -1
  120. package/dist/final-css-cleanup-B6FUJC3z.cjs +1 -0
  121. package/dist/{final-css-cleanup-u_sI2p56.js → final-css-cleanup-BOzhuhGz.js} +3 -2
  122. package/dist/framework.cjs +1 -1
  123. package/dist/{v4-generation-core-Cz1D7wm1.cjs → generated-css-marker-jMNbQHpy.cjs} +638 -1546
  124. package/dist/generation/candidates.d.ts +1 -0
  125. package/dist/generation/class-selectors.d.ts +4 -0
  126. package/dist/generation/config-directive.d.ts +1 -0
  127. package/dist/generation/directives/fallback.d.ts +1 -0
  128. package/dist/generation/directives.d.ts +1 -0
  129. package/dist/generation/framework-css-composition.d.ts +1 -0
  130. package/dist/generation/framework-postcss.d.ts +25 -0
  131. package/dist/generation/framework-user-css.d.ts +5 -0
  132. package/dist/generation/generation-helpers/preflight.d.ts +19 -0
  133. package/dist/generation/generation-helpers/results.d.ts +23 -0
  134. package/dist/generation/generation-helpers/runtime-isolation.d.ts +30 -0
  135. package/dist/generation/generation-helpers/source-order.d.ts +1 -0
  136. package/dist/generation/generation-helpers.d.ts +4 -0
  137. package/dist/generation/index.d.ts +9 -0
  138. package/dist/generation/legacy-compat.d.ts +12 -0
  139. package/dist/generation/legacy-selectors.d.ts +1 -0
  140. package/dist/generation/legacy-units.d.ts +1 -0
  141. package/dist/generation/local-imports.d.ts +1 -0
  142. package/dist/generation/markers.d.ts +1 -0
  143. package/dist/generation/output-import-shell.d.ts +1 -0
  144. package/dist/generation/pipeline/context.d.ts +60 -0
  145. package/dist/generation/pipeline/deferred-output.d.ts +3 -0
  146. package/dist/generation/pipeline/execution.d.ts +3 -0
  147. package/dist/generation/pipeline/fallback-output.d.ts +3 -0
  148. package/dist/generation/pipeline/ordered-output.d.ts +3 -0
  149. package/dist/generation/pipeline/preparation.d.ts +19 -0
  150. package/dist/generation/pipeline.d.ts +2 -0
  151. package/dist/generation/result-helpers.d.ts +6 -0
  152. package/dist/generation/scoped-rules.d.ts +1 -0
  153. package/dist/generation/service.d.ts +20 -0
  154. package/dist/generation/source-files.d.ts +21 -0
  155. package/dist/generation/source-resolver/apply-reference.d.ts +10 -0
  156. package/dist/generation/source-resolver/config.d.ts +7 -0
  157. package/dist/generation/source-resolver/configuration.d.ts +33 -0
  158. package/dist/generation/source-resolver/matching.d.ts +3 -0
  159. package/dist/generation/source-resolver/metadata.d.ts +28 -0
  160. package/dist/generation/source-resolver/postcss-source.d.ts +14 -0
  161. package/dist/generation/source-resolver/resolve-source.d.ts +4 -0
  162. package/dist/generation/source-resolver/resolve-sources.d.ts +5 -0
  163. package/dist/generation/source-resolver/single-source.d.ts +16 -0
  164. package/dist/generation/source-resolver/source-entries.d.ts +3 -0
  165. package/dist/generation/source-resolver/source-matching.d.ts +5 -0
  166. package/dist/generation/source-resolver/types.d.ts +22 -0
  167. package/dist/generation/source-resolver.d.ts +7 -0
  168. package/dist/generation/style-options.d.ts +8 -0
  169. package/dist/generation/style-requests.d.ts +5 -0
  170. package/dist/generation/types.d.ts +65 -0
  171. package/dist/generation/user-css/apply-only.d.ts +5 -0
  172. package/dist/generation/user-css/at-rules.d.ts +1 -0
  173. package/dist/generation/user-css/compile-functions.d.ts +3 -0
  174. package/dist/generation/user-css/generated-cleanup.d.ts +1 -0
  175. package/dist/generation/user-css/source-fragments.d.ts +1 -0
  176. package/dist/generation/user-css/transform.d.ts +1 -0
  177. package/dist/generation/user-css/user-layers.d.ts +1 -0
  178. package/dist/generation/user-css.d.ts +5 -0
  179. package/dist/generation/user-layer-order.d.ts +1 -0
  180. package/dist/generation/validate.d.ts +7 -0
  181. package/dist/generator-CxauQbx3.cjs +1868 -0
  182. package/dist/generator-oKZ5mCJ5.js +1637 -0
  183. package/dist/generator.cjs +10 -4
  184. package/dist/generator.js +1 -1
  185. package/dist/{gulp-BExe5RBF.cjs → gulp-CVvBpIlq.cjs} +27 -26
  186. package/dist/{gulp-BhkIIk7J.js → gulp-DhddVxGA.js} +6 -5
  187. package/dist/gulp.cjs +1 -1
  188. package/dist/gulp.js +1 -1
  189. package/dist/{hmr-timing-CoiJIqDu.cjs → hmr-timing-DfMbbZ1E.cjs} +13 -13
  190. package/dist/{hmr-timing-B9Yt86-U.js → hmr-timing-xPpat-km.js} +518 -1360
  191. package/dist/index.cjs +7 -7
  192. package/dist/index.d.ts +1 -1
  193. package/dist/index.js +5 -5
  194. package/dist/js/ModuleGraph.d.ts +3 -1
  195. package/dist/js/babel/analyze.d.ts +6 -0
  196. package/dist/js/babel.d.ts +1 -2
  197. package/dist/js/fast-path/analysis.d.ts +14 -0
  198. package/dist/js/fast-path/oxc.d.ts +1 -1
  199. package/dist/js/oxc-parser.d.ts +4 -0
  200. package/dist/pipeline-helpers-zMPmp5F3.cjs +516 -0
  201. package/dist/postcss-html-transform.cjs +1 -1
  202. package/dist/postcss.cjs +3 -2
  203. package/dist/postcss.d.ts +1 -1
  204. package/dist/postcss.js +3 -2
  205. package/dist/presets.cjs +3 -3
  206. package/dist/presets.js +2 -2
  207. package/dist/project-sources/candidates/collector.d.ts +8 -0
  208. package/dist/project-sources/candidates/scan-root.d.ts +12 -0
  209. package/dist/project-sources/candidates/script.d.ts +1 -0
  210. package/dist/project-sources/candidates/snapshot.d.ts +19 -0
  211. package/dist/project-sources/candidates/source-priority.d.ts +1 -0
  212. package/dist/project-sources/candidates/store.d.ts +2 -0
  213. package/dist/project-sources/candidates/types-and-cache.d.ts +75 -0
  214. package/dist/project-sources/candidates/views.d.ts +12 -0
  215. package/dist/project-sources/candidates.d.ts +4 -0
  216. package/dist/project-sources/css-entries.d.ts +18 -0
  217. package/dist/project-sources/dependencies.d.ts +2 -0
  218. package/dist/project-sources/index.d.ts +16 -0
  219. package/dist/project-sources/static-config-content.d.ts +5 -0
  220. package/dist/reset.cjs +1 -1
  221. package/dist/{rolldown-runtime-Ctb5zv51.cjs → rolldown-runtime-fg3euq-1.cjs} +7 -0
  222. package/dist/rspack.cjs +4 -4
  223. package/dist/rspack.js +2 -2
  224. package/dist/{runtime-state-XYSycuGu.cjs → runtime-state-BOzuVoKl.cjs} +1 -1
  225. package/dist/{scoped-generator-BUBls_oM.cjs → scoped-generator-BIZ7N_J-.cjs} +9 -9
  226. package/dist/{scoped-generator-B6Y1bxzM.js → scoped-generator-DlQrVbuC.js} +7 -6
  227. package/dist/{source-candidate-scan-signature-DNuGKTqf.js → source-candidate-scan-signature-BjVQYL-C.js} +3 -3
  228. package/dist/{source-candidate-scan-signature-BtJZp28T.cjs → source-candidate-scan-signature-nG-rg809.cjs} +4 -4
  229. package/dist/style-injector/internal.d.ts +35 -35
  230. package/dist/style-injector/options.d.ts +1 -1
  231. package/dist/tailwindcss/miniprogram.d.ts +1 -1
  232. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -1
  233. package/dist/tailwindcss/source-scan/inline-source.d.ts +1 -7
  234. package/dist/tailwindcss/source-scan.d.ts +3 -32
  235. package/dist/tailwindcss/v4/css-sources.d.ts +1 -1
  236. package/dist/tailwindcss/v4/preflight.d.ts +1 -3
  237. package/dist/tailwindcss/v4/rpx-theme-warning.d.ts +4 -0
  238. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
  239. package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +2 -3
  240. package/dist/tailwindcss/v4-engine/generator/native-session.d.ts +1 -1
  241. package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +1 -6
  242. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +5 -2
  243. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +3 -7
  244. package/dist/tailwindcss/v4-engine/source.d.ts +1 -1
  245. package/dist/tailwindcss/v4-engine/types.d.ts +3 -1
  246. package/dist/{tailwindcss-CBYjzRmV.cjs → tailwindcss-U3KIUegn.cjs} +65 -264
  247. package/dist/{tailwindcss-B_4E52WF.js → tailwindcss-kSd0ykiX.js} +71 -243
  248. package/dist/{transform-CkEnJYIP.js → transform-BAon9ykq.js} +25 -16
  249. package/dist/{transform-FkqbTBJR.cjs → transform-D2KFdA3C.cjs} +32 -23
  250. package/dist/types/index.d.ts +2 -2
  251. package/dist/types/user-defined-options/general.d.ts +1 -1
  252. package/dist/uni-app-x/border-preflight.d.ts +1 -1
  253. package/dist/uni-app-x/component-local-style.d.ts +3 -1
  254. package/dist/uni-app-x/vite/style-result.d.ts +1 -1
  255. package/dist/utils/run-tasks.d.ts +3 -0
  256. package/dist/vite/web.cjs +1 -1
  257. package/dist/vite/web.js +1 -1
  258. package/dist/{vite-DxuKPZlp.cjs → vite-BxW0qd7J.cjs} +217 -828
  259. package/dist/{vite-lP35OguX.js → vite-D-RGkmOE.js} +62 -674
  260. package/dist/vite.cjs +1 -1
  261. package/dist/vite.js +1 -1
  262. package/dist/{watch-dependencies-GbC14Rlt.cjs → watch-dependencies-C1so1whD.cjs} +14 -1
  263. package/dist/weapp-tw-css-generation-loader.cjs +4 -3
  264. package/dist/weapp-tw-css-import-rewrite-loader.cjs +33 -28
  265. package/dist/weapp-tw-runtime-classset-loader.cjs +5 -18
  266. package/dist/{web-Dfz_jpNj.js → web--kA4HUTm.js} +16 -115
  267. package/dist/{web-DhDxhlkq.cjs → web-Y-H6I1k6.cjs} +83 -192
  268. package/dist/{webpack-D6jp1o3m.js → webpack-BB-kw4Qr.js} +27 -440
  269. package/dist/{webpack-R2Sbggiy.cjs → webpack-DxrWatNB.cjs} +87 -87
  270. package/dist/webpack.cjs +1 -1
  271. package/dist/webpack.js +1 -1
  272. package/package.json +10 -5
  273. package/dist/final-css-cleanup-CDTmVAye.cjs +0 -1
  274. package/dist/generator-Bvr4WmuF.cjs +0 -3891
  275. package/dist/generator-C0BJjyLM.js +0 -3343
  276. package/dist/pipeline-helpers-BOjTEmMi.cjs +0 -971
@@ -1,3891 +0,0 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
- const require_framework = require("./framework.cjs");
3
- require("./auto-DtU6f3X6.cjs");
4
- require("./utils-CuKLf1Zv.cjs");
5
- let node_fs = require("node:fs");
6
- node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
7
- let node_path = require("node:path");
8
- node_path = require_rolldown_runtime.__toESM(node_path, 1);
9
- let node_process = require("node:process");
10
- node_process = require_rolldown_runtime.__toESM(node_process, 1);
11
- let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
12
- let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
13
- let lru_cache = require("lru-cache");
14
- let node_module = require("node:module");
15
- let node_fs_promises = require("node:fs/promises");
16
- let micromatch = require("micromatch");
17
- micromatch = require_rolldown_runtime.__toESM(micromatch, 1);
18
- //#region src/runtime-branch/generator-target-env.ts
19
- const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
20
- const uniWebPlatformEnvKeys = ["UNI_PLATFORM", "UNI_UTS_PLATFORM"];
21
- const mpxWebPlatformEnvKeys = ["MPX_CLI_MODE", "MPX_CURRENT_TARGET_MODE"];
22
- function getEnvValue(key) {
23
- return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
24
- }
25
- function normalizeGeneratorTargetValue(value) {
26
- return value === "weapp" || value === "web" ? value : void 0;
27
- }
28
- function isUniWebPlatform(value) {
29
- const normalized = value?.trim().toLowerCase();
30
- return normalized === "h5" || normalized?.startsWith("web") === true;
31
- }
32
- function isUniAppWebViewPlatform(value) {
33
- const normalized = value?.trim().toLowerCase();
34
- return normalized === "app" || normalized === "app-plus";
35
- }
36
- function isUniNativeAppPlatform(value) {
37
- return (value?.trim().toLowerCase())?.startsWith("app-") === true;
38
- }
39
- function isMpxWebPlatform(value) {
40
- return value?.trim().toLowerCase() === "web";
41
- }
42
- function inferGeneratorTargetFromExplicitEnv() {
43
- for (const key of explicitGeneratorTargetEnvKeys) {
44
- const target = normalizeGeneratorTargetValue(getEnvValue(key));
45
- if (target !== void 0) return target;
46
- }
47
- }
48
- function shouldUseWebGeneratorTargetFromEnv() {
49
- return uniWebPlatformEnvKeys.some((key) => isUniWebPlatform(getEnvValue(key))) || isUniAppWebViewPlatform(getEnvValue("UNI_PLATFORM")) && !isUniNativeAppPlatform(getEnvValue("UNI_UTS_PLATFORM")) || mpxWebPlatformEnvKeys.some((key) => isMpxWebPlatform(getEnvValue(key))) || getEnvValue("TARO_ENV") === "h5";
50
- }
51
- function shouldUseUniAppWebRpxCompatibility(appType) {
52
- return appType === "uni-app-vite" || appType === "uni-app-x" || shouldUseWebGeneratorTargetFromEnv();
53
- }
54
- function shouldUseUniAppViteWebViewGeneratorTarget(appType, platform = getEnvValue("UNI_PLATFORM")) {
55
- return appType === "uni-app-vite" && isUniAppWebViewPlatform(platform);
56
- }
57
- function inferGeneratorTargetFromEnv() {
58
- return inferGeneratorTargetFromExplicitEnv() ?? (shouldUseWebGeneratorTargetFromEnv() ? "web" : "weapp");
59
- }
60
- //#endregion
61
- //#region src/tailwindcss/v4-engine/candidates.ts
62
- const UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE = /(?:^|:)(?:has-)?(?:group|peer|in|not-in)-[^\s:]*\/|(?:^|:)(?:has-)?(?:in|not-in)-\[/;
63
- function isUnsupportedMiniProgramTailwindV4Candidate(candidate) {
64
- return UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE.test(candidate);
65
- }
66
- function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
67
- if (!candidates) return;
68
- return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
69
- }
70
- //#endregion
71
- //#region src/tailwindcss/v4-engine/generator/rpx-candidates.ts
72
- const RPX_LENGTH_UTILITY_PATTERN = String.raw`text|border(?:-[trblxyse])?|bg|outline|ring`;
73
- const BARE_RPX_LENGTH_CANDIDATE_RE = new RegExp(String.raw`(^|:)(!?)(${RPX_LENGTH_UTILITY_PATTERN})-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$`, "u");
74
- const BARE_RPX_LENGTH_HINT_CANDIDATE_RE = new RegExp(String.raw`(?:^|:)!?(${RPX_LENGTH_UTILITY_PATTERN})-\[length:([-+]?(?:\d+|\d*\.\d+)rpx)\].*$`, "u");
75
- const RPX_LENGTH_SELECTOR_RE = new RegExp(String.raw`(${RPX_LENGTH_UTILITY_PATTERN})-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]`, "g");
76
- function normalizeRpxLengthCandidate(candidate) {
77
- return candidate.replace(BARE_RPX_LENGTH_CANDIDATE_RE, (_match, prefix, important, utility, value, suffix) => {
78
- return `${prefix}${important}${utility}-[length:${value}]${suffix}`;
79
- });
80
- }
81
- function normalizeRpxLengthCandidates(candidates) {
82
- const normalized = /* @__PURE__ */ new Set();
83
- const restoreCandidates = /* @__PURE__ */ new Map();
84
- for (const candidate of candidates) {
85
- const normalizedCandidate = normalizeRpxLengthCandidate(candidate);
86
- normalized.add(normalizedCandidate);
87
- if (normalizedCandidate !== candidate) restoreCandidates.set(normalizedCandidate, candidate);
88
- }
89
- return {
90
- candidates: normalized,
91
- restoreCandidates
92
- };
93
- }
94
- function restoreRpxLengthCandidates(candidates, restoreCandidates) {
95
- if (restoreCandidates.size === 0) return new Set(candidates);
96
- return new Set([...candidates].map((candidate) => restoreCandidates.get(candidate) ?? candidate));
97
- }
98
- function normalizeCssEscapedRpxSelectorValue(value) {
99
- return value.replace(/\\([.+-])/g, "$1");
100
- }
101
- function restoreRpxLengthCssSelectors(css, restoreCandidates) {
102
- if (restoreCandidates.size === 0 || !css.includes("\\[length\\:")) return css;
103
- const restoredUtilities = new Set([...restoreCandidates.keys()].map((candidate) => {
104
- const match = BARE_RPX_LENGTH_HINT_CANDIDATE_RE.exec(candidate);
105
- return match ? `${match[1]}:${match[2]}` : void 0;
106
- }).filter((value) => Boolean(value)));
107
- return css.replace(RPX_LENGTH_SELECTOR_RE, (match, utility, value) => {
108
- return restoredUtilities.has(`${utility}:${normalizeCssEscapedRpxSelectorValue(value)}`) ? `${utility}-\\[${value}\\]` : match;
109
- });
110
- }
111
- const INCREMENTAL_GENERATE_ENTRY_CANDIDATES_MAX = 12e3;
112
- const INCREMENTAL_GENERATE_ENTRY_CSS_BYTES_MAX = 2097152;
113
- const incrementalGenerateCache = new lru_cache.LRUCache({ max: 8 });
114
- const incrementalGenerateTaskCache = new lru_cache.LRUCache({ max: 32 });
115
- function collectCandidates(candidates) {
116
- return new Set(candidates ?? []);
117
- }
118
- function hasRemovedCandidates(previousCandidates, nextCandidates) {
119
- for (const candidate of previousCandidates) if (!nextCandidates.has(candidate)) return true;
120
- return false;
121
- }
122
- function createStableJson(value) {
123
- if (value === void 0) return "undefined";
124
- if (value === null || typeof value !== "object") return JSON.stringify(value);
125
- if (Array.isArray(value)) return `[${value.map((item) => createStableJson(item)).join(",")}]`;
126
- return `{${Object.keys(value).sort().map((key) => {
127
- const record = value;
128
- return `${JSON.stringify(key)}:${createStableJson(record[key])}`;
129
- }).join(",")}}`;
130
- }
131
- function createDependencyFingerprint(files) {
132
- return files.map((file) => {
133
- try {
134
- const stat = node_fs.default.statSync(file);
135
- return `${file}:${stat.size}:${stat.mtimeMs}`;
136
- } catch {
137
- return `${file}:missing`;
138
- }
139
- }).join("|");
140
- }
141
- function createTailwindV4SourceCacheKey(source) {
142
- return [
143
- source.projectRoot,
144
- source.base,
145
- createStableJson(source.baseFallbacks),
146
- source.css,
147
- createDependencyFingerprint(source.dependencies)
148
- ].join("\0");
149
- }
150
- function createIncrementalGenerateCacheKey(source, target, styleOptions) {
151
- return [
152
- createTailwindV4SourceCacheKey(source),
153
- target,
154
- createStableJson(styleOptions)
155
- ].join("\0");
156
- }
157
- function createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources) {
158
- return [
159
- cacheKey,
160
- scanSources === true ? "scan:1" : "scan:0",
161
- [...requestedCandidates].sort().join("\n")
162
- ].join("\0");
163
- }
164
- function runIncrementalGenerateTask(cacheKey, requestedCandidates, scanSources, task) {
165
- const taskKey = createIncrementalGenerateTaskCacheKey(cacheKey, requestedCandidates, scanSources);
166
- const cachedTask = incrementalGenerateTaskCache.get(taskKey);
167
- if (cachedTask) return cachedTask;
168
- const promise = task();
169
- incrementalGenerateTaskCache.set(taskKey, promise);
170
- promise.finally(() => {
171
- if (incrementalGenerateTaskCache.get(taskKey) === promise) incrementalGenerateTaskCache.delete(taskKey);
172
- });
173
- return promise;
174
- }
175
- function createIncrementalDesignSystemPromise(source, cacheKey) {
176
- const promise = (0, _tailwindcss_mangle_engine.loadTailwindV4DesignSystem)(source);
177
- promise.catch(() => {
178
- if (incrementalGenerateCache.get(cacheKey)?.designSystemPromise === promise) incrementalGenerateCache.delete(cacheKey);
179
- });
180
- return promise;
181
- }
182
- function resolveTargetCandidates(candidates, target) {
183
- const collected = collectCandidates(candidates);
184
- return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
185
- }
186
- function collectSeenCandidates(generated) {
187
- return new Set(generated.classSet);
188
- }
189
- function createIncrementalStyleOptions(styleOptions) {
190
- return {
191
- ...styleOptions,
192
- isMainChunk: false
193
- };
194
- }
195
- function resolveStyleOptions(source, options) {
196
- return (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4Source)(source.css) ? (0, _weapp_tailwindcss_postcss.withCssMacroStyleOptions)(options) : options;
197
- }
198
- function collectCustomPropertyValues(css) {
199
- const values = /* @__PURE__ */ new Map();
200
- try {
201
- _weapp_tailwindcss_postcss.postcss.parse(css).walkDecls((decl) => {
202
- if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
203
- });
204
- } catch {}
205
- return values;
206
- }
207
- function mergeCustomPropertyValues(target, css) {
208
- for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
209
- }
210
- function createStableTextSignature(input) {
211
- let hash = 2166136261;
212
- for (let i = 0; i < input.length; i++) {
213
- hash ^= input.charCodeAt(i);
214
- hash = Math.imul(hash, 16777619);
215
- }
216
- return (hash >>> 0).toString(36);
217
- }
218
- function summarizeIncrementalCacheKey(key) {
219
- return {
220
- keyHash: createStableTextSignature(key),
221
- keyBytes: key.length
222
- };
223
- }
224
- function shouldRebuildIncrementalEntry(cached, requestedCandidates, missingCandidates) {
225
- return cached.seenCandidates.size + missingCandidates.length > 12e3 || cached.css.length > 2097152 || cached.rawCss.length > 2097152 || requestedCandidates.size > 12e3;
226
- }
227
- function shouldAdmitIncrementalEntry(requestedCandidates, generated) {
228
- return requestedCandidates.size <= 12e3 && generated.css.length <= 2097152 && generated.rawCss.length <= 2097152;
229
- }
230
- function seedIncrementalGenerateCache(options) {
231
- if (!shouldAdmitIncrementalEntry(options.requestedCandidates, options.generated)) return false;
232
- const cacheKey = createIncrementalGenerateCacheKey(options.compatibleSource, options.target, options.styleOptions);
233
- const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
234
- mergeCustomPropertyValues(customPropertyValues, options.generated.css);
235
- incrementalGenerateCache.set(cacheKey, {
236
- seenCandidates: collectSeenCandidates(options.generated),
237
- classSet: new Set(options.generated.classSet),
238
- css: options.generated.css,
239
- rawCss: options.generated.rawCss,
240
- customPropertyValues,
241
- designSystemPromise: createIncrementalDesignSystemPromise(options.compatibleSource, cacheKey),
242
- dependencies: options.generated.dependencies,
243
- sources: options.generated.sources,
244
- root: options.generated.root,
245
- target: options.generated.target
246
- });
247
- return true;
248
- }
249
- function shouldNormalizeRpxLengthCandidatesForTarget(target, styleOptions) {
250
- if (target !== "web") return true;
251
- return shouldUseUniAppWebRpxCompatibility(styleOptions?.appType);
252
- }
253
- function normalizeTargetRpxLengthCandidates(candidates, target, styleOptions) {
254
- return shouldNormalizeRpxLengthCandidatesForTarget(target, styleOptions) ? normalizeRpxLengthCandidates(candidates) : {
255
- candidates: new Set(candidates),
256
- restoreCandidates: /* @__PURE__ */ new Map()
257
- };
258
- }
259
- //#endregion
260
- //#region src/tailwindcss/v4-engine/generator/cache-stats.ts
261
- function getTailwindV4IncrementalGenerateCacheStats() {
262
- return {
263
- max: 8,
264
- entryCandidatesMax: INCREMENTAL_GENERATE_ENTRY_CANDIDATES_MAX,
265
- entryCssBytesMax: INCREMENTAL_GENERATE_ENTRY_CSS_BYTES_MAX,
266
- size: incrementalGenerateCache.size,
267
- taskMax: 32,
268
- taskSize: incrementalGenerateTaskCache.size,
269
- entries: [...incrementalGenerateCache.entries()].map(([key, entry]) => ({
270
- ...summarizeIncrementalCacheKey(key),
271
- candidates: entry.seenCandidates.size,
272
- classSet: entry.classSet.size,
273
- cssBytes: entry.css.length,
274
- rawCssBytes: entry.rawCss.length
275
- })),
276
- keys: [...incrementalGenerateCache.keys()].map(summarizeIncrementalCacheKey),
277
- taskKeys: [...incrementalGenerateTaskCache.keys()].map(summarizeIncrementalCacheKey)
278
- };
279
- }
280
- //#endregion
281
- //#region src/tailwindcss/v4-engine/css-macro-source.ts
282
- function resolveCssMacroTailwindV4Source(source) {
283
- const css = (0, _weapp_tailwindcss_postcss.transformCssMacroTailwindV4Source)(source.css);
284
- return css === source.css ? source : {
285
- ...source,
286
- css
287
- };
288
- }
289
- //#endregion
290
- //#region src/tailwindcss/v4-engine/miniprogram.ts
291
- const defaultStyleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
292
- cssChildCombinatorReplaceValue: ["view", "text"],
293
- cssRemoveActivePseudoClass: true,
294
- cssRemoveHoverPseudoClass: true,
295
- cssRemoveFocusPseudoClass: true,
296
- isMainChunk: true,
297
- majorVersion: 4
298
- });
299
- const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
300
- function normalizeTailwindV4GeneratedUrlValues(css) {
301
- return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
302
- try {
303
- return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
304
- } catch {
305
- return match;
306
- }
307
- });
308
- }
309
- async function transformTailwindV4CssToWeapp(css, options) {
310
- const compatibleCss = normalizeTailwindV4GeneratedUrlValues((0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options) ? await (0, _weapp_tailwindcss_postcss.transformCssMacroCss)(css, options) : css);
311
- const customPropertyValues = options?.customPropertyValues;
312
- const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(compatibleCss, { customPropertyValues });
313
- const result = await defaultStyleHandler(protectedCss.css, {
314
- cssChildCombinatorReplaceValue: ["view", "text"],
315
- cssRemoveActivePseudoClass: true,
316
- cssRemoveHoverPseudoClass: true,
317
- cssRemoveFocusPseudoClass: true,
318
- isMainChunk: true,
319
- majorVersion: 4,
320
- ...options
321
- });
322
- const pruneOptions = {
323
- ...options?.uniAppX === true && options.uniAppXCssTarget === "uvue" ? { preserveContentInit: false } : {},
324
- preservePreflight: true,
325
- preserveConditionalComments: (0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options)
326
- };
327
- return (0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(protectedCss.restore(result.css), pruneOptions);
328
- }
329
- function transformTailwindV4WebRpxCss(css) {
330
- if (!css.includes("rpx")) return css;
331
- try {
332
- const root = _weapp_tailwindcss_postcss.postcss.parse(css);
333
- return (0, _weapp_tailwindcss_postcss.normalizeTailwindcssWebRpxDeclarations)(root, { majorVersion: 4 }) ? root.toString() : css;
334
- } catch {
335
- return css;
336
- }
337
- }
338
- async function transformTailwindV4CssByTarget(css, target, options) {
339
- if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
340
- const resolvedWebCss = await ((0, _weapp_tailwindcss_postcss.hasCssMacroStyleOptions)(options) ? (0, _weapp_tailwindcss_postcss.transformCssMacroCss)(css, options) : css);
341
- const calculatedWebCss = await (0, _weapp_tailwindcss_postcss.applyConfiguredCssCalc)(resolvedWebCss, options ?? {});
342
- return shouldUseUniAppWebRpxCompatibility(options?.appType) ? transformTailwindV4WebRpxCss(calculatedWebCss) : calculatedWebCss;
343
- }
344
- //#endregion
345
- //#region src/tailwindcss/v4-engine/tailwind-v4-default-colors.ts
346
- const TAILWIND_V4_COLOR_STEPS = [
347
- "50",
348
- "100",
349
- "200",
350
- "300",
351
- "400",
352
- "500",
353
- "600",
354
- "700",
355
- "800",
356
- "900",
357
- "950"
358
- ];
359
- const TAILWIND_V4_COLOR_PALETTE = {
360
- slate: [
361
- "#f8fafc",
362
- "#f1f5f9",
363
- "#e2e8f0",
364
- "#cad5e2",
365
- "#90a1b9",
366
- "#62748e",
367
- "#45556c",
368
- "#314158",
369
- "#1d293d",
370
- "#0f172b",
371
- "#020618"
372
- ],
373
- gray: [
374
- "#f9fafb",
375
- "#f3f4f6",
376
- "#e5e7eb",
377
- "#d1d5dc",
378
- "#99a1af",
379
- "#6a7282",
380
- "#4a5565",
381
- "#364153",
382
- "#1e2939",
383
- "#101828",
384
- "#030712"
385
- ],
386
- zinc: [
387
- "#fafafa",
388
- "#f4f4f5",
389
- "#e4e4e7",
390
- "#d4d4d8",
391
- "#9f9fa9",
392
- "#71717b",
393
- "#52525c",
394
- "#3f3f46",
395
- "#27272a",
396
- "#18181b",
397
- "#09090b"
398
- ],
399
- neutral: [
400
- "#fafafa",
401
- "#f5f5f5",
402
- "#e5e5e5",
403
- "#d4d4d4",
404
- "#a1a1a1",
405
- "#737373",
406
- "#525252",
407
- "#404040",
408
- "#262626",
409
- "#171717",
410
- "#0a0a0a"
411
- ],
412
- stone: [
413
- "#fafaf9",
414
- "#f5f5f4",
415
- "#e7e5e4",
416
- "#d6d3d1",
417
- "#a6a09b",
418
- "#79716b",
419
- "#57534d",
420
- "#44403b",
421
- "#292524",
422
- "#1c1917",
423
- "#0c0a09"
424
- ],
425
- mauve: [
426
- "#fafafa",
427
- "#f3f1f3",
428
- "#e7e4e7",
429
- "#d7d0d7",
430
- "#a89ea9",
431
- "#79697b",
432
- "#594c5b",
433
- "#463947",
434
- "#2a212c",
435
- "#1d161e",
436
- "#0c090c"
437
- ],
438
- olive: [
439
- "#fbfbf9",
440
- "#f4f4f0",
441
- "#e8e8e3",
442
- "#d8d8d0",
443
- "#abab9c",
444
- "#7c7c67",
445
- "#5b5b4b",
446
- "#474739",
447
- "#2b2b22",
448
- "#1d1d16",
449
- "#0c0c09"
450
- ],
451
- mist: [
452
- "#f9fbfb",
453
- "#f1f3f3",
454
- "#e3e7e8",
455
- "#d0d6d8",
456
- "#9ca8ab",
457
- "#67787c",
458
- "#4b585b",
459
- "#394447",
460
- "#22292b",
461
- "#161b1d",
462
- "#090b0c"
463
- ],
464
- taupe: [
465
- "#fbfaf9",
466
- "#f3f1f1",
467
- "#e8e4e3",
468
- "#d8d2d0",
469
- "#aba09c",
470
- "#7c6d67",
471
- "#5b4f4b",
472
- "#473c39",
473
- "#2b2422",
474
- "#1d1816",
475
- "#0c0a09"
476
- ],
477
- red: [
478
- "#fef2f2",
479
- "#ffe2e2",
480
- "#ffc9c9",
481
- "#ffa2a2",
482
- "#ff6467",
483
- "#fb2c36",
484
- "#e7000b",
485
- "#c10007",
486
- "#9f0712",
487
- "#82181a",
488
- "#460809"
489
- ],
490
- orange: [
491
- "#fff7ed",
492
- "#ffedd4",
493
- "#ffd6a7",
494
- "#ffb86a",
495
- "#ff8904",
496
- "#ff6900",
497
- "#f54900",
498
- "#ca3500",
499
- "#9f2d00",
500
- "#7e2a0c",
501
- "#441306"
502
- ],
503
- amber: [
504
- "#fffbeb",
505
- "#fef3c6",
506
- "#fee685",
507
- "#ffd230",
508
- "#ffb900",
509
- "#fe9a00",
510
- "#e17100",
511
- "#bb4d00",
512
- "#973c00",
513
- "#7b3306",
514
- "#461901"
515
- ],
516
- yellow: [
517
- "#fefce8",
518
- "#fef9c2",
519
- "#fff085",
520
- "#ffdf20",
521
- "#fdc700",
522
- "#f0b100",
523
- "#d08700",
524
- "#a65f00",
525
- "#894b00",
526
- "#733e0a",
527
- "#432004"
528
- ],
529
- lime: [
530
- "#f7fee7",
531
- "#ecfcca",
532
- "#d8f999",
533
- "#bbf451",
534
- "#9ae600",
535
- "#7ccf00",
536
- "#5ea500",
537
- "#497d00",
538
- "#3c6300",
539
- "#35530e",
540
- "#192e03"
541
- ],
542
- green: [
543
- "#f0fdf4",
544
- "#dcfce7",
545
- "#b9f8cf",
546
- "#7bf1a8",
547
- "#05df72",
548
- "#00c950",
549
- "#00a63e",
550
- "#008236",
551
- "#016630",
552
- "#0d542b",
553
- "#032e15"
554
- ],
555
- emerald: [
556
- "#ecfdf5",
557
- "#d0fae5",
558
- "#a4f4cf",
559
- "#5ee9b5",
560
- "#00d492",
561
- "#00bc7d",
562
- "#009966",
563
- "#007a55",
564
- "#006045",
565
- "#004f3b",
566
- "#002c22"
567
- ],
568
- teal: [
569
- "#f0fdfa",
570
- "#cbfbf1",
571
- "#96f7e4",
572
- "#46ecd5",
573
- "#00d5be",
574
- "#00bba7",
575
- "#009689",
576
- "#00786f",
577
- "#005f5a",
578
- "#0b4f4a",
579
- "#022f2e"
580
- ],
581
- cyan: [
582
- "#ecfeff",
583
- "#cefafe",
584
- "#a2f4fd",
585
- "#53eafd",
586
- "#00d3f2",
587
- "#00b8db",
588
- "#0092b8",
589
- "#007595",
590
- "#005f78",
591
- "#104e64",
592
- "#053345"
593
- ],
594
- sky: [
595
- "#f0f9ff",
596
- "#dff2fe",
597
- "#b8e6fe",
598
- "#74d4ff",
599
- "#00bcff",
600
- "#00a6f4",
601
- "#0084d1",
602
- "#0069a8",
603
- "#00598a",
604
- "#024a70",
605
- "#052f4a"
606
- ],
607
- blue: [
608
- "#eff6ff",
609
- "#dbeafe",
610
- "#bedbff",
611
- "#8ec5ff",
612
- "#51a2ff",
613
- "#2b7fff",
614
- "#155dfc",
615
- "#1447e6",
616
- "#193cb8",
617
- "#1c398e",
618
- "#162456"
619
- ],
620
- indigo: [
621
- "#eef2ff",
622
- "#e0e7ff",
623
- "#c6d2ff",
624
- "#a3b3ff",
625
- "#7c86ff",
626
- "#615fff",
627
- "#4f39f6",
628
- "#432dd7",
629
- "#372aac",
630
- "#312c85",
631
- "#1e1a4d"
632
- ],
633
- violet: [
634
- "#f5f3ff",
635
- "#ede9fe",
636
- "#ddd6ff",
637
- "#c4b4ff",
638
- "#a684ff",
639
- "#8e51ff",
640
- "#7f22fe",
641
- "#7008e7",
642
- "#5d0ec0",
643
- "#4d179a",
644
- "#2f0d68"
645
- ],
646
- purple: [
647
- "#faf5ff",
648
- "#f3e8ff",
649
- "#e9d4ff",
650
- "#dab2ff",
651
- "#c27aff",
652
- "#ad46ff",
653
- "#9810fa",
654
- "#8200db",
655
- "#6e11b0",
656
- "#59168b",
657
- "#3c0366"
658
- ],
659
- fuchsia: [
660
- "#fdf4ff",
661
- "#fae8ff",
662
- "#f6cfff",
663
- "#f4a8ff",
664
- "#ed6aff",
665
- "#e12afb",
666
- "#c800de",
667
- "#a800b7",
668
- "#8a0194",
669
- "#721378",
670
- "#4b004f"
671
- ],
672
- pink: [
673
- "#fdf2f8",
674
- "#fce7f3",
675
- "#fccee8",
676
- "#fda5d5",
677
- "#fb64b6",
678
- "#f6339a",
679
- "#e60076",
680
- "#c6005c",
681
- "#a3004c",
682
- "#861043",
683
- "#510424"
684
- ],
685
- rose: [
686
- "#fff1f2",
687
- "#ffe4e6",
688
- "#ffccd3",
689
- "#ffa1ad",
690
- "#ff637e",
691
- "#ff2056",
692
- "#ec003f",
693
- "#c70036",
694
- "#a50036",
695
- "#8b0836",
696
- "#4d0218"
697
- ]
698
- };
699
- function createTailwindV4DefaultColorThemeCss() {
700
- const declarations = [" --color-black: #000;", " --color-white: #fff;"];
701
- 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]};`);
702
- return [
703
- "@theme {",
704
- ...declarations,
705
- "}"
706
- ].join("\n");
707
- }
708
- //#endregion
709
- //#region src/tailwindcss/v4-engine/generator/css-compat.ts
710
- const require$2 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
711
- const tailwindThemeCssCache = /* @__PURE__ */ new Map();
712
- function findLeadingImportInsertionIndex(css) {
713
- const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
714
- let insertionIndex = 0;
715
- let match = importPattern.exec(css);
716
- while (match !== null) {
717
- insertionIndex = match.index + match[0].length;
718
- match = importPattern.exec(css);
719
- }
720
- return insertionIndex;
721
- }
722
- function readCachedCss(file) {
723
- const cached = tailwindThemeCssCache.get(file);
724
- if (cached !== void 0) return cached;
725
- const css = (0, node_fs.readFileSync)(file, "utf8");
726
- tailwindThemeCssCache.set(file, css);
727
- return css;
728
- }
729
- function resolveTailwindV4ThemeCssFromImport(css) {
730
- const root = _weapp_tailwindcss_postcss.postcss.parse(css);
731
- let resolved;
732
- root.walkAtRules("import", (rule) => {
733
- if (resolved) return;
734
- const specifier = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(rule.params)?.specifier;
735
- if (!specifier || !node_path.default.isAbsolute(specifier) || node_path.default.basename(specifier) !== "index.css") return;
736
- const themeCss = node_path.default.join(node_path.default.dirname(specifier), "theme.css");
737
- if ((0, node_fs.existsSync)(themeCss)) resolved = themeCss;
738
- });
739
- return resolved;
740
- }
741
- function resolveTailwindV4ThemeCssFromBase(base) {
742
- try {
743
- return (0, node_module.createRequire)(node_path.default.join(base, "package.json")).resolve("tailwindcss/theme.css");
744
- } catch {
745
- try {
746
- return require$2.resolve("tailwindcss/theme.css");
747
- } catch {
748
- return;
749
- }
750
- }
751
- }
752
- function resolveTailwindV4DefaultThemeCss(source) {
753
- try {
754
- const themeCss = resolveTailwindV4ThemeCssFromImport(source.css) ?? resolveTailwindV4ThemeCssFromBase(source.base);
755
- return themeCss ? readCachedCss(themeCss) : createTailwindV4DefaultColorThemeCss();
756
- } catch {
757
- return createTailwindV4DefaultColorThemeCss();
758
- }
759
- }
760
- function applyMiniProgramTailwindV4DefaultColorCss(css, source) {
761
- const themeCss = resolveTailwindV4DefaultThemeCss(source);
762
- const insertionIndex = findLeadingImportInsertionIndex(css);
763
- if (insertionIndex === 0) return `${themeCss}\n${css}`;
764
- return `${css.slice(0, insertionIndex)}\n${themeCss}\n${css.slice(insertionIndex)}`;
765
- }
766
- function createCompatibleSource(source, target) {
767
- const filteredSourceCss = target === "weapp" ? (0, _weapp_tailwindcss_postcss.removeTailwindV4PreflightImports)(source.css) : source.css;
768
- const sourceCss = target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(filteredSourceCss, source) : filteredSourceCss;
769
- const compatibleSourceCss = (0, _weapp_tailwindcss_postcss.removeUnsupportedThemeVendorKeyframes)(sourceCss);
770
- return compatibleSourceCss === source.css ? source : {
771
- ...source,
772
- css: compatibleSourceCss
773
- };
774
- }
775
- //#endregion
776
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/typeof.js
777
- function _typeof(o) {
778
- "@babel/helpers - typeof";
779
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
780
- return typeof o;
781
- } : function(o) {
782
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
783
- }, _typeof(o);
784
- }
785
- //#endregion
786
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPrimitive.js
787
- function toPrimitive(t, r) {
788
- if ("object" != _typeof(t) || !t) return t;
789
- var e = t[Symbol.toPrimitive];
790
- if (void 0 !== e) {
791
- var i = e.call(t, r || "default");
792
- if ("object" != _typeof(i)) return i;
793
- throw new TypeError("@@toPrimitive must return a primitive value.");
794
- }
795
- return ("string" === r ? String : Number)(t);
796
- }
797
- //#endregion
798
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPropertyKey.js
799
- function toPropertyKey(t) {
800
- var i = toPrimitive(t, "string");
801
- return "symbol" == _typeof(i) ? i : i + "";
802
- }
803
- //#endregion
804
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/defineProperty.js
805
- function _defineProperty(e, r, t) {
806
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
807
- value: t,
808
- enumerable: !0,
809
- configurable: !0,
810
- writable: !0
811
- }) : e[r] = t, e;
812
- }
813
- //#endregion
814
- //#region src/tailwindcss/v4-engine/generator/native-session.ts
815
- var TailwindV4NativeSessionPool = class {
816
- constructor(createSession = _tailwindcss_mangle_engine.createTailwindGenerationSession) {
817
- this.createSession = createSession;
818
- _defineProperty(this, "sessions", /* @__PURE__ */ new Map());
819
- _defineProperty(this, "disposed", false);
820
- }
821
- generate(target, sourceKey, source, request) {
822
- const entry = this.getSession(target, sourceKey, source);
823
- const generated = entry.pending.then(() => entry.session.generate(request));
824
- entry.pending = generated.then(() => void 0, () => void 0);
825
- return generated;
826
- }
827
- dispose() {
828
- for (const entry of this.sessions.values()) this.disposeEntry(entry);
829
- this.sessions.clear();
830
- this.disposed = true;
831
- }
832
- get size() {
833
- return this.sessions.size;
834
- }
835
- getSession(target, sourceKey, source) {
836
- if (this.disposed) throw new Error("TailwindV4NativeSessionPool 已释放。");
837
- const cached = this.sessions.get(target);
838
- if (cached?.sourceKey === sourceKey) return cached;
839
- if (cached) this.disposeEntry(cached);
840
- const session = this.createSession(source);
841
- const entry = {
842
- pending: Promise.resolve(),
843
- session,
844
- sourceKey
845
- };
846
- this.sessions.set(target, entry);
847
- return entry;
848
- }
849
- disposeEntry(entry) {
850
- entry.pending.then(() => entry.session.dispose());
851
- }
852
- };
853
- function createEngineSourceEntries(sources, sourceId) {
854
- return sources.map((source, index) => ({
855
- id: `${sourceId}:candidate-source:${index}`,
856
- ...source
857
- }));
858
- }
859
- function serializeTailwindGenerationArtifact(artifact) {
860
- return [...artifact.fragments].sort((left, right) => left.order - right.order).map((fragment) => fragment.root.toString()).join("\n");
861
- }
862
- //#endregion
863
- //#region src/tailwindcss/source-scan.ts
864
- const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
865
- "html",
866
- "wxml",
867
- "axml",
868
- "jxml",
869
- "ksml",
870
- "ttml",
871
- "qml",
872
- "qxml",
873
- "tyml",
874
- "xhsml",
875
- "swan",
876
- "vue",
877
- "mpx",
878
- "js",
879
- "jsx",
880
- "ts",
881
- "tsx"
882
- ];
883
- const FULL_SOURCE_SCAN_EXTENSIONS = [
884
- "js",
885
- "jsx",
886
- "mjs",
887
- "cjs",
888
- "ts",
889
- "tsx",
890
- "mts",
891
- "cts",
892
- "vue",
893
- "uvue",
894
- "nvue",
895
- "svelte",
896
- "mpx",
897
- "html",
898
- "wxml",
899
- "axml",
900
- "jxml",
901
- "ksml",
902
- "ttml",
903
- "qml",
904
- "qxml",
905
- "tyml",
906
- "xhsml",
907
- "swan",
908
- "css",
909
- "wxss",
910
- "acss",
911
- "jxss",
912
- "ttss",
913
- "qss",
914
- "tyss",
915
- "scss",
916
- "sass",
917
- "less",
918
- "styl",
919
- "stylus"
920
- ];
921
- function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
922
- return `**/*.{${extensions.join(",")}}`;
923
- }
924
- const FULL_SOURCE_SCAN_PATTERN = createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
925
- const FULL_SOURCE_SCAN_EXTENSION_RE = new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
926
- function toPosixPath(value) {
927
- return value.split(node_path.default.sep).join("/").split(node_path.default.win32.sep).join("/");
928
- }
929
- function resolveSourceScanPath(value) {
930
- return resolveSourceScanPathWithApi(value, node_path.default);
931
- }
932
- function resolveSourceScanPathWithApi(value, pathApi) {
933
- const resolved = pathApi.resolve(value);
934
- let current = resolved;
935
- const missing = [];
936
- while (true) try {
937
- return pathApi.join(node_fs.realpathSync.native(current), ...missing.reverse());
938
- } catch (error) {
939
- const parent = pathApi.dirname(current);
940
- if (error.code !== "ENOENT" || parent === current) return resolved;
941
- missing.push(pathApi.basename(current));
942
- current = parent;
943
- }
944
- }
945
- function normalizeEntryPattern(entry) {
946
- const pathApi = isWindowsPath(entry.base) || isWindowsPath(entry.pattern) ? node_path.default.win32 : node_path.default;
947
- return pathApi.isAbsolute(entry.pattern) ? toPosixPath(pathApi.relative(pathApi.resolve(entry.base), entry.pattern)) : entry.pattern;
948
- }
949
- function isFileMatchedByTailwindSourceEntry(file, entry) {
950
- const pathApi = isWindowsPath(entry.base) || isWindowsPath(file) ? node_path.default.win32 : node_path.default;
951
- const base = resolveSourceScanPathWithApi(entry.base, pathApi);
952
- const relative = toPosixPath(pathApi.relative(base, file));
953
- return relative && !relative.startsWith("../") && !pathApi.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizeEntryPattern(entry));
954
- }
955
- function isWindowsPath(value) {
956
- return /^[A-Z]:[\\/]/i.test(value) || value.includes("\\");
957
- }
958
- function isFileExcludedByTailwindSourceEntries(file, entries) {
959
- if (!entries?.length) return false;
960
- const resolvedFile = resolveSourceScanMatcherFile(file, entries);
961
- return entries.some((entry) => entry.negated && isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
962
- }
963
- function isFileMatchedByTailwindSourceEntries(file, entries) {
964
- if (!entries?.length) return true;
965
- const resolvedFile = resolveSourceScanMatcherFile(file, entries);
966
- const positiveEntries = entries.filter((entry) => !entry.negated);
967
- const negativeEntries = entries.filter((entry) => entry.negated);
968
- if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
969
- if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
970
- return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
971
- }
972
- function resolveSourceScanMatcherFile(file, entries) {
973
- return isWindowsPath(file) || entries.some((entry) => isWindowsPath(entry.base) || isWindowsPath(entry.pattern)) ? resolveSourceScanPathWithApi(file, node_path.default.win32) : resolveSourceScanPath(file);
974
- }
975
- function resolveTailwindV4CssSourceBase(source, fallbackBase) {
976
- if (typeof source.base === "string" && source.base.length > 0) return source.base;
977
- if (typeof source.file === "string" && source.file.length > 0) return node_path.default.dirname(source.file);
978
- return fallbackBase;
979
- }
980
- function parseConfigParam(params) {
981
- const value = params.trim();
982
- return /^(['"])(.+)\1$/.exec(value)?.[2];
983
- }
984
- function isLegacyContentObject(value) {
985
- return typeof value === "object" && value !== null && "files" in value;
986
- }
987
- function normalizeGlobPattern(pattern) {
988
- return pattern.startsWith("./") ? pattern.slice(2) : pattern;
989
- }
990
- function hasGlobMagic(value) {
991
- return /[*?[\]{}()!+@]/.test(value);
992
- }
993
- function splitStaticGlobPrefix(pattern) {
994
- const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
995
- const prefix = [];
996
- const rest = [];
997
- let reachedGlob = false;
998
- for (const segment of segments) {
999
- if (!reachedGlob && segment && !hasGlobMagic(segment)) {
1000
- prefix.push(segment);
1001
- continue;
1002
- }
1003
- reachedGlob = true;
1004
- rest.push(segment);
1005
- }
1006
- return {
1007
- prefix,
1008
- rest
1009
- };
1010
- }
1011
- function normalizeLegacyContentEntries(content, base, options = {}) {
1012
- if (typeof content === "string") {
1013
- const negated = content.startsWith("!");
1014
- return [{
1015
- base,
1016
- negated,
1017
- pattern: normalizeGlobPattern(negated ? content.slice(1) : content)
1018
- }];
1019
- }
1020
- if (Array.isArray(content)) return content.flatMap((item) => normalizeLegacyContentEntries(item, base, options));
1021
- if (isLegacyContentObject(content)) return normalizeLegacyContentEntries(content.files, content.relative && options.relativeBase ? options.relativeBase : base, options);
1022
- return [];
1023
- }
1024
- async function pathExistsAsDirectory(file) {
1025
- try {
1026
- return (await (0, node_fs_promises.stat)(file)).isDirectory();
1027
- } catch {
1028
- return false;
1029
- }
1030
- }
1031
- async function resolveTailwindSourceEntry(sourcePath, base, negated, defaultPattern = createSourceScanPattern()) {
1032
- const absoluteSource = node_path.default.isAbsolute(sourcePath) ? node_path.default.resolve(sourcePath) : node_path.default.resolve(base, sourcePath);
1033
- if (await pathExistsAsDirectory(absoluteSource)) return {
1034
- base: absoluteSource,
1035
- negated,
1036
- pattern: normalizeGlobPattern(defaultPattern)
1037
- };
1038
- if (node_path.default.isAbsolute(sourcePath) && hasGlobMagic(sourcePath)) {
1039
- const { prefix, rest } = splitStaticGlobPrefix(sourcePath);
1040
- const root = node_path.default.parse(sourcePath).root;
1041
- const normalizedPrefix = prefix[0] === "" ? prefix.slice(1) : prefix;
1042
- if (rest.length > 0) return {
1043
- base: node_path.default.resolve(root, ...normalizedPrefix),
1044
- negated,
1045
- pattern: normalizeGlobPattern(rest.join("/"))
1046
- };
1047
- }
1048
- if (node_path.default.isAbsolute(sourcePath)) return {
1049
- base: node_path.default.dirname(absoluteSource),
1050
- negated,
1051
- pattern: normalizeGlobPattern(node_path.default.basename(absoluteSource))
1052
- };
1053
- const { prefix, rest } = splitStaticGlobPrefix(sourcePath);
1054
- if (prefix.length > 0 && rest.length > 0) return {
1055
- base: node_path.default.resolve(base, ...prefix),
1056
- negated,
1057
- pattern: normalizeGlobPattern(rest.join("/"))
1058
- };
1059
- return {
1060
- base,
1061
- negated,
1062
- pattern: normalizeGlobPattern(sourcePath)
1063
- };
1064
- }
1065
- function parseSourceFileParam(params) {
1066
- const value = params.trim();
1067
- if (!value || value === "none" || value.startsWith("inline(")) return;
1068
- const negated = value.startsWith("not ");
1069
- const sourceValue = negated ? value.slice(4).trim() : value;
1070
- if (sourceValue.startsWith("inline(")) return;
1071
- const match = /^(['"])(.+)\1$/.exec(sourceValue);
1072
- return match?.[2] ? {
1073
- negated,
1074
- sourcePath: match[2]
1075
- } : void 0;
1076
- }
1077
- async function resolveCssSourceEntries(root, base, defaultPattern = createSourceScanPattern()) {
1078
- const entries = [];
1079
- const tasks = [];
1080
- root.walkAtRules("source", (rule) => {
1081
- const parsed = parseSourceFileParam(rule.params);
1082
- if (!parsed) return;
1083
- tasks.push(resolveTailwindSourceEntry(parsed.sourcePath, base, parsed.negated, defaultPattern));
1084
- });
1085
- entries.push(...await Promise.all(tasks));
1086
- return entries;
1087
- }
1088
- async function expandTailwindSourceEntries(entries, options = {}) {
1089
- if (entries.length === 0) return [];
1090
- const files = /* @__PURE__ */ new Set();
1091
- const entriesByBase = /* @__PURE__ */ new Map();
1092
- for (const entry of entries) {
1093
- const base = node_path.default.resolve(entry.base);
1094
- const group = entriesByBase.get(base) ?? [];
1095
- group.push({
1096
- ...entry,
1097
- base
1098
- });
1099
- entriesByBase.set(base, group);
1100
- }
1101
- await Promise.all([...entriesByBase.entries()].map(async ([base, group]) => {
1102
- const ignoredSources = options.ignore?.map((pattern) => ({
1103
- base,
1104
- pattern: normalizeGlobPattern(pattern),
1105
- negated: true
1106
- }));
1107
- const matched = await (0, _tailwindcss_mangle_engine.resolveProjectSourceFiles)({
1108
- cwd: base,
1109
- sources: group,
1110
- ...ignoredSources === void 0 ? {} : { ignoredSources }
1111
- });
1112
- for (const file of matched) files.add(node_path.default.resolve(file));
1113
- }));
1114
- return [...files].filter((file) => !isFileExcludedByTailwindSourceEntries(file, entries));
1115
- }
1116
- //#endregion
1117
- //#region src/tailwindcss/v4-engine/generator/scan-sources.ts
1118
- const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
1119
- "**/.git/**",
1120
- "**/.hg/**",
1121
- "**/.jj/**",
1122
- "**/.next/**",
1123
- "**/.parcel-cache/**",
1124
- "**/.pnpm-store/**",
1125
- "**/.svelte-kit/**",
1126
- "**/.svn/**",
1127
- "**/.turbo/**",
1128
- "**/.venv/**",
1129
- "**/.vercel/**",
1130
- "**/.yarn/**",
1131
- "**/__pycache__/**",
1132
- "**/node_modules/**",
1133
- "**/venv/**",
1134
- "**/*.less",
1135
- "**/*.lock",
1136
- "**/*.sass",
1137
- "**/*.scss",
1138
- "**/*.styl",
1139
- "**/*.log",
1140
- "**/tailwind.config.js",
1141
- "**/tailwind.config.cjs",
1142
- "**/tailwind.config.mjs",
1143
- "**/tailwind.config.ts",
1144
- "**/tailwind.config.cts",
1145
- "**/tailwind.config.mts",
1146
- "**/tailwind.config.*.js",
1147
- "**/tailwind.config.*.cjs",
1148
- "**/tailwind.config.*.mjs",
1149
- "**/tailwind.config.*.ts",
1150
- "**/tailwind.config.*.cts",
1151
- "**/tailwind.config.*.mts",
1152
- "**/package-lock.json",
1153
- "**/pnpm-lock.yaml",
1154
- "**/bun.lockb",
1155
- "**/.gitignore",
1156
- "**/.env",
1157
- "**/.env.*"
1158
- ];
1159
- function resolveSourceBase(base, sourcePath) {
1160
- return node_path.default.isAbsolute(sourcePath) ? sourcePath : node_path.default.resolve(base, sourcePath);
1161
- }
1162
- function createDefaultIgnoredScanSources(base) {
1163
- return TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS.map((pattern) => ({
1164
- base,
1165
- pattern,
1166
- negated: true
1167
- }));
1168
- }
1169
- function normalizeCssDefinedScanSources(base, entries) {
1170
- return entries.length > 0 && entries.every((entry) => entry.negated) ? [{
1171
- base,
1172
- pattern: "**/*",
1173
- negated: false
1174
- }, ...entries] : entries;
1175
- }
1176
- function resolveDefaultSourceBase(source) {
1177
- return source.projectRoot ?? source.cwd ?? source.base;
1178
- }
1179
- async function resolveCssDefinedScanSources(source) {
1180
- let importSourceBase;
1181
- let hasSourceNone = false;
1182
- let hasTailwindImport = false;
1183
- const sourcePatterns = [];
1184
- const definitions = [{
1185
- css: source.css,
1186
- base: source.base,
1187
- ...source.dependencies[0] === void 0 ? {} : { from: source.dependencies[0] }
1188
- }];
1189
- for (const dependency of source.dependencies.slice(1)) {
1190
- if (!(0, node_fs.existsSync)(dependency)) continue;
1191
- try {
1192
- definitions.push({
1193
- css: (0, node_fs.readFileSync)(dependency, "utf8"),
1194
- base: node_path.default.dirname(dependency),
1195
- from: dependency
1196
- });
1197
- } catch {}
1198
- }
1199
- for (const definition of definitions) {
1200
- let root;
1201
- try {
1202
- root = _weapp_tailwindcss_postcss.postcss.parse(definition.css, { from: definition.from });
1203
- } catch {
1204
- continue;
1205
- }
1206
- root.walkAtRules((rule) => {
1207
- if (rule.name !== "import" || !(0, _weapp_tailwindcss_postcss.isTailwindCssImport)(rule.params)) return;
1208
- hasTailwindImport = true;
1209
- const sourceParam = (0, _weapp_tailwindcss_postcss.parseImportSourceParam)(rule.params);
1210
- if (sourceParam?.none) hasSourceNone = true;
1211
- if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase(definition.base, sourceParam.sourcePath);
1212
- });
1213
- sourcePatterns.push(...await resolveCssSourceEntries(root, definition.base, "**/*"));
1214
- }
1215
- let entries;
1216
- if (importSourceBase) entries = [await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"), ...sourcePatterns];
1217
- else if (sourcePatterns.length > 0) entries = normalizeCssDefinedScanSources(source.base, sourcePatterns);
1218
- else if (hasSourceNone) return false;
1219
- else if (hasTailwindImport) entries = [await resolveTailwindSourceEntry(".", resolveDefaultSourceBase(source), false, "**/*")];
1220
- else return;
1221
- const scanBases = /* @__PURE__ */ new Set([importSourceBase ?? (sourcePatterns.length > 0 ? source.base : resolveDefaultSourceBase(source)), ...entries.filter((entry) => !entry.negated).map((entry) => entry.base)]);
1222
- return [...entries, ...[...scanBases].flatMap((base) => createDefaultIgnoredScanSources(base))];
1223
- }
1224
- async function resolveScanSources(source, scanSources) {
1225
- if (scanSources !== true) return scanSources;
1226
- return await resolveCssDefinedScanSources(source) ?? false;
1227
- }
1228
- function resolveCompiledSourceRoot(source) {
1229
- let root = null;
1230
- try {
1231
- _weapp_tailwindcss_postcss.postcss.parse(source.css).walkAtRules("import", (rule) => {
1232
- if (!(0, _weapp_tailwindcss_postcss.isTailwindCssImport)(rule.params)) return;
1233
- const sourceParam = (0, _weapp_tailwindcss_postcss.parseImportSourceParam)(rule.params);
1234
- if (sourceParam?.none) {
1235
- root = "none";
1236
- return false;
1237
- }
1238
- if (sourceParam?.sourcePath) {
1239
- root = {
1240
- base: source.base,
1241
- pattern: sourceParam.sourcePath
1242
- };
1243
- return false;
1244
- }
1245
- });
1246
- } catch {}
1247
- return root;
1248
- }
1249
- //#endregion
1250
- //#region src/tailwindcss/v4-engine/generator/style-context.ts
1251
- function resolveGenerationStyleContext(sourceCss, generatedCss, options) {
1252
- const calc = options?.cssOptions?.cssCalc ?? options?.cssCalc;
1253
- const include = Array.isArray(calc) ? calc : calc && typeof calc === "object" ? calc.includeCustomProperties : void 0;
1254
- if (calc !== true && !include?.length) return options;
1255
- const customPropertyValues = collectCustomPropertyValues(sourceCss);
1256
- mergeCustomPropertyValues(customPropertyValues, generatedCss);
1257
- for (const [name, value] of options?.customPropertyValues ?? []) customPropertyValues.set(name, value);
1258
- return {
1259
- ...options,
1260
- customPropertyValues
1261
- };
1262
- }
1263
- //#endregion
1264
- //#region src/tailwindcss/v4-engine/generator/engine.ts
1265
- function isCssSyntaxError(error) {
1266
- return error instanceof Error && error.name === "CssSyntaxError";
1267
- }
1268
- function createTailwindV4Engine(source) {
1269
- const generationSessions = new TailwindV4NativeSessionPool();
1270
- const incrementalCacheKeys = /* @__PURE__ */ new Set();
1271
- const validationEngine = (0, _tailwindcss_mangle_engine.createTailwindV4Engine)(source);
1272
- async function generateOnce(generateSource, options = {}) {
1273
- const { scanSources = true, styleOptions, target = "weapp", ...patchOptions } = options;
1274
- const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
1275
- const compatibleSource = createCompatibleSource(resolveCssMacroTailwindV4Source(generateSource), target);
1276
- const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
1277
- const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, _tailwindcss_mangle_engine.extractRawCandidates)(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
1278
- const normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(/* @__PURE__ */ new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target), target, resolvedStyleOptions);
1279
- const sourceId = compatibleSource.dependencies[0] ?? compatibleSource.base;
1280
- const generationRequest = {
1281
- ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues },
1282
- ...patchOptions.sources === void 0 ? {} : { sourceEntries: createEngineSourceEntries(patchOptions.sources, sourceId) },
1283
- candidates: normalizedCandidates.candidates
1284
- };
1285
- let generatedCss;
1286
- let classSet;
1287
- let rawCandidates;
1288
- let dependencies;
1289
- try {
1290
- const artifact = await generationSessions.generate(target, createTailwindV4SourceCacheKey(compatibleSource), compatibleSource, generationRequest);
1291
- generatedCss = serializeTailwindGenerationArtifact(artifact);
1292
- classSet = artifact.classSet;
1293
- rawCandidates = artifact.rawCandidates;
1294
- dependencies = artifact.dependencies;
1295
- } catch (error) {
1296
- if (!isCssSyntaxError(error)) throw error;
1297
- const legacyResult = await (0, _tailwindcss_mangle_engine.createTailwindV4Engine)(compatibleSource).generate({
1298
- ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues },
1299
- ...patchOptions.sources === void 0 ? {} : { sources: patchOptions.sources },
1300
- candidates: normalizedCandidates.candidates,
1301
- scanSources: false
1302
- });
1303
- generatedCss = legacyResult.css;
1304
- classSet = legacyResult.classSet;
1305
- rawCandidates = legacyResult.rawCandidates;
1306
- dependencies = legacyResult.dependencies;
1307
- }
1308
- const sources = Array.isArray(resolvedScanSources) ? resolvedScanSources : [];
1309
- const rawCss = restoreRpxLengthCssSelectors(generatedCss, normalizedCandidates.restoreCandidates);
1310
- const css = await transformTailwindV4CssByTarget(rawCss, target, resolveGenerationStyleContext(compatibleSource.css, rawCss, resolvedStyleOptions));
1311
- return {
1312
- classSet: restoreRpxLengthCandidates(classSet, normalizedCandidates.restoreCandidates),
1313
- rawCandidates: restoreRpxLengthCandidates(rawCandidates, normalizedCandidates.restoreCandidates),
1314
- dependencies,
1315
- root: resolveCompiledSourceRoot(compatibleSource),
1316
- sources,
1317
- css,
1318
- rawCss,
1319
- target
1320
- };
1321
- }
1322
- async function generateWithIncrementalCache(options = {}) {
1323
- const target = options.target ?? "weapp";
1324
- const cssMacroSource = resolveCssMacroTailwindV4Source(source);
1325
- const compatibleSource = createCompatibleSource(cssMacroSource, target);
1326
- const requestedCandidates = resolveTargetCandidates(options.candidates, target);
1327
- const styleOptions = resolveStyleOptions(source, options.styleOptions);
1328
- if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(cssMacroSource, options);
1329
- const cacheKey = createIncrementalGenerateCacheKey(compatibleSource, target, styleOptions);
1330
- incrementalCacheKeys.add(cacheKey);
1331
- if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1332
- const generated = await generateOnce(cssMacroSource, options);
1333
- if (!seedIncrementalGenerateCache({
1334
- compatibleSource,
1335
- generated,
1336
- requestedCandidates,
1337
- styleOptions,
1338
- target
1339
- })) incrementalGenerateCache.delete(cacheKey);
1340
- return generated;
1341
- });
1342
- const cached = incrementalGenerateCache.get(cacheKey);
1343
- if (cached) {
1344
- if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1345
- const generated = await generateOnce(cssMacroSource, options);
1346
- if (!seedIncrementalGenerateCache({
1347
- compatibleSource,
1348
- generated,
1349
- requestedCandidates,
1350
- styleOptions,
1351
- target
1352
- })) incrementalGenerateCache.delete(cacheKey);
1353
- return generated;
1354
- });
1355
- const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
1356
- if (missingCandidates.length === 0) return {
1357
- css: cached.css,
1358
- rawCss: cached.rawCss,
1359
- incrementalCss: "",
1360
- incrementalRawCss: "",
1361
- classSet: new Set(cached.classSet),
1362
- rawCandidates: new Set(cached.seenCandidates),
1363
- dependencies: cached.dependencies,
1364
- sources: cached.sources,
1365
- root: cached.root,
1366
- target: cached.target
1367
- };
1368
- if (shouldRebuildIncrementalEntry(cached, requestedCandidates, missingCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1369
- const generated = await generateOnce(cssMacroSource, options);
1370
- if (!seedIncrementalGenerateCache({
1371
- compatibleSource,
1372
- generated,
1373
- requestedCandidates,
1374
- styleOptions,
1375
- target
1376
- })) incrementalGenerateCache.delete(cacheKey);
1377
- return generated;
1378
- });
1379
- return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1380
- const designSystem = await cached.designSystemPromise;
1381
- const normalizedMissing = normalizeTargetRpxLengthCandidates(missingCandidates, target, styleOptions);
1382
- const normalizedMissingCandidates = [...normalizedMissing.candidates];
1383
- const cssByCandidate = designSystem.candidatesToCss(normalizedMissingCandidates);
1384
- const rawCssParts = [];
1385
- const classSet = /* @__PURE__ */ new Set();
1386
- for (let index = 0; index < normalizedMissingCandidates.length; index += 1) {
1387
- const candidate = normalizedMissingCandidates[index];
1388
- const css = cssByCandidate[index];
1389
- if (candidate && typeof css === "string" && css.trim().length > 0) {
1390
- rawCssParts.push(restoreRpxLengthCssSelectors(css, normalizedMissing.restoreCandidates));
1391
- classSet.add(normalizedMissing.restoreCandidates.get(candidate) ?? candidate);
1392
- }
1393
- }
1394
- const rawCss = rawCssParts.join("\n");
1395
- const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
1396
- ...createIncrementalStyleOptions(styleOptions),
1397
- customPropertyValues: cached.customPropertyValues
1398
- }) : "";
1399
- for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
1400
- for (const className of classSet) cached.classSet.add(className);
1401
- cached.css = [cached.css, incrementalCss].filter(Boolean).join("\n");
1402
- cached.rawCss = [cached.rawCss, rawCss].filter(Boolean).join("\n");
1403
- mergeCustomPropertyValues(cached.customPropertyValues, incrementalCss);
1404
- return {
1405
- css: cached.css,
1406
- rawCss: cached.rawCss,
1407
- incrementalCss,
1408
- incrementalRawCss: rawCss,
1409
- classSet: new Set(cached.classSet),
1410
- rawCandidates: new Set(cached.seenCandidates),
1411
- dependencies: cached.dependencies,
1412
- sources: cached.sources,
1413
- root: cached.root,
1414
- target: cached.target
1415
- };
1416
- });
1417
- }
1418
- return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
1419
- const generated = await generateOnce(cssMacroSource, options);
1420
- seedIncrementalGenerateCache({
1421
- compatibleSource,
1422
- generated,
1423
- requestedCandidates,
1424
- styleOptions,
1425
- target
1426
- });
1427
- return generated;
1428
- });
1429
- }
1430
- async function generate(options = {}) {
1431
- return options.incrementalCache ? generateWithIncrementalCache(options) : generateOnce(source, options);
1432
- }
1433
- return {
1434
- source,
1435
- loadDesignSystem: validationEngine.loadDesignSystem,
1436
- validateCandidates: validationEngine.validateCandidates,
1437
- generate,
1438
- dispose() {
1439
- generationSessions.dispose();
1440
- for (const cacheKey of incrementalCacheKeys) incrementalGenerateCache.delete(cacheKey);
1441
- incrementalCacheKeys.clear();
1442
- }
1443
- };
1444
- }
1445
- //#endregion
1446
- //#region src/bundlers/shared/generator-css/config-directive.ts
1447
- function quoteCssString(value) {
1448
- return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
1449
- }
1450
- function toCssPath(value) {
1451
- return value.replaceAll("\\", "/");
1452
- }
1453
- function prependConfigDirective(css, config) {
1454
- if (!config || /@config\s+/.test(css)) return css;
1455
- return `@config "${quoteCssString(toCssPath(config))}";\n${css}`;
1456
- }
1457
- function normalizeConfigDirective(css, config) {
1458
- if (!config || !/@config\s+/.test(css)) return css;
1459
- return css.replace(/@config\s+(["'])(.+?)\1\s*;?/, `@config "${quoteCssString(toCssPath(config))}";`);
1460
- }
1461
- //#endregion
1462
- //#region src/bundlers/shared/generator-css/markers.ts
1463
- const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
1464
- const TAILWIND_ESCAPED_UTILITY_MARKER_RE = /\.[^,{]{0,512}(?:\\:|\\\[|\\#)/;
1465
- const TAILWIND_ROOT_THEME_MARKER_RE = /(?::root\s*,\s*:host|:host\s*,\s*page\s*,\s*\.tw-root\s*,\s*wx-root-portal-content)[^{]{0,256}\{[^}]{0,4096}(?:--spacing\b|--(?:color|text|font|default|radius)-)/;
1466
- const GENERATOR_PLACEHOLDER_MARKER_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\//i;
1467
- const GENERATOR_PLACEHOLDER_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss generator-placeholder\s*\*\/\s*/gi;
1468
- const TAILWIND_BANNER_PREFIX_RE = /^\/\*!\s*tailwindcss v[^*]*\*\/\s*/i;
1469
- const TAILWIND_BANNER_RE = /\/\*!\s*tailwindcss v[^*]*\*\//i;
1470
- const TAILWIND_BANNER_GLOBAL_RE = /\/\*!\s*tailwindcss v[^*]*\*\/\s*/gi;
1471
- const VITE_MARKER_RE = /\/\*\$vite\$:[^*]*\*\//g;
1472
- function createCssAppend(base, extra) {
1473
- if (!base) return extra;
1474
- if (!extra) return base;
1475
- return `${base}\n${extra}`;
1476
- }
1477
- function splitTailwindV4GeneratedCssBySourceOrder(rawSource, rawTailwindCss) {
1478
- const trimmedRaw = rawSource.trim();
1479
- const trimmedTailwind = rawTailwindCss.trim();
1480
- if (trimmedRaw === trimmedTailwind) return {
1481
- before: "",
1482
- after: ""
1483
- };
1484
- if (trimmedTailwind.startsWith(trimmedRaw)) return {
1485
- before: "",
1486
- after: ""
1487
- };
1488
- const start = rawSource.indexOf(rawTailwindCss);
1489
- if (start === -1) return;
1490
- return {
1491
- before: rawSource.slice(0, start),
1492
- after: rawSource.slice(start + rawTailwindCss.length)
1493
- };
1494
- }
1495
- function splitGeneratorPlaceholderCssBySourceOrder(rawSource, rawTailwindCss) {
1496
- const match = GENERATOR_PLACEHOLDER_MARKER_RE.exec(rawSource);
1497
- if (!match || match.index === void 0) return;
1498
- let afterStart = match.index + match[0].length;
1499
- while (/\s/.test(rawSource[afterStart] ?? "")) afterStart++;
1500
- if (rawTailwindCss && rawSource.slice(afterStart).startsWith(rawTailwindCss)) {
1501
- afterStart += rawTailwindCss.length;
1502
- while (/\s/.test(rawSource[afterStart] ?? "")) afterStart++;
1503
- }
1504
- return {
1505
- before: rawSource.slice(0, match.index),
1506
- after: rawSource.slice(afterStart)
1507
- };
1508
- }
1509
- function splitTailwindGeneratedCssByBanner(rawSource, start) {
1510
- const match = start === void 0 ? TAILWIND_BANNER_RE.exec(rawSource) : { index: start };
1511
- if (!match || match.index === void 0) return;
1512
- return {
1513
- before: rawSource.slice(0, match.index),
1514
- after: [...rawSource.slice(match.index).matchAll(VITE_MARKER_RE)].map((item) => item[0]).join("\n")
1515
- };
1516
- }
1517
- function stripTailwindBanner(css) {
1518
- return css.replace(TAILWIND_BANNER_PREFIX_RE, "");
1519
- }
1520
- function stripTailwindBanners(css) {
1521
- return css.replace(TAILWIND_BANNER_GLOBAL_RE, "");
1522
- }
1523
- function stripGeneratorPlaceholderMarkers(css) {
1524
- return css.replace(GENERATOR_PLACEHOLDER_MARKER_GLOBAL_RE, "");
1525
- }
1526
- function hasTailwindGeneratedCss(rawSource) {
1527
- return TAILWIND_V4_BANNER_RE.test(rawSource);
1528
- }
1529
- function hasTailwindGeneratedCssMarkers(rawSource) {
1530
- if (rawSource.includes("--tw-") || rawSource.includes("tailwindcss v") || rawSource.includes(":not(#\\#)") || GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
1531
- if (!rawSource.includes("\\:") && !rawSource.includes("\\[") && !rawSource.includes("\\#") && !rawSource.includes("--color-") && !rawSource.includes("--spacing") && !rawSource.includes("--text-") && !rawSource.includes("--font-") && !rawSource.includes("--font-weight-") && !rawSource.includes("--default-") && !rawSource.includes("--radius-")) return false;
1532
- return TAILWIND_ESCAPED_UTILITY_MARKER_RE.test(rawSource) || TAILWIND_ROOT_THEME_MARKER_RE.test(rawSource);
1533
- }
1534
- //#endregion
1535
- //#region src/bundlers/shared/generator-css/directives/fallback.ts
1536
- const TAILWIND_EXTRACTABLE_DIRECTIVE_RE = /^\s*@(?:import|use|forward|tailwind|config|source|reference|plugin)\b[\s\S]*?(?:;|$)/;
1537
- const TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE = /^\s*@layer\s[^;{]+;\s*$/;
1538
- const TAILWIND_EXTRACTABLE_BLOCK_START_RE = /^\s*@(?:layer|theme|utility|variant|custom-variant|plugin)\b[\s\S]*\{/;
1539
- function parseImportRequest$1(params) {
1540
- return /^(?:url\(\s*)?(["']?)([^"')\s]+)\1\s*\)?/.exec(params.trim())?.[2];
1541
- }
1542
- function parseConfigRequest$1(params) {
1543
- return /^(["'])(.+)\1\s*;?$/.exec(params.trim())?.[2];
1544
- }
1545
- function isPackageJsonImportRequest$1(request) {
1546
- return typeof request === "string" && request.startsWith("#");
1547
- }
1548
- function isWeappTailwindcssImportRequest(request) {
1549
- return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
1550
- }
1551
- function isTailwindImportRequest$1(request) {
1552
- return request === "tailwindcss" || request === "tailwindcss4" || request?.startsWith("tailwindcss/") || request?.startsWith("tailwindcss4/");
1553
- }
1554
- function normalizeTailwindImportRequest$1(request, options = {}) {
1555
- if (options.importFallback && isWeappTailwindcssImportRequest(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
1556
- return request;
1557
- }
1558
- function replaceImportRequest$1(params, request, replacement) {
1559
- const index = params.indexOf(request);
1560
- if (index === -1) return params;
1561
- return `${params.slice(0, index)}${replacement}${params.slice(index + request.length)}`;
1562
- }
1563
- function normalizeTailwindDirectiveLine(line, options = {}) {
1564
- const trimmed = line.trimStart();
1565
- if (/^@(?:use|forward)\b/.test(trimmed)) {
1566
- const request = parseImportRequest$1(trimmed.replace(/^@(?:use|forward)\b/, ""));
1567
- if (isTailwindImportRequest$1(request) || options.importFallback && isWeappTailwindcssImportRequest(request)) {
1568
- const normalizedRequest = normalizeTailwindImportRequest$1(request, options);
1569
- return replaceImportRequest$1(line.replace(/^(\s*)@(?:use|forward)\b/, "$1@import"), request, normalizedRequest);
1570
- }
1571
- return line;
1572
- }
1573
- if (!options.importFallback || !trimmed.startsWith("@import")) return line;
1574
- const request = parseImportRequest$1(trimmed.replace(/^@import\b/, ""));
1575
- if (!request || !isWeappTailwindcssImportRequest(request)) return line;
1576
- return replaceImportRequest$1(line, request, request.replace(/^weapp-tailwindcss/, "tailwindcss"));
1577
- }
1578
- function extractTailwindDirectiveLines(rawSource, options = {}) {
1579
- const directives = [];
1580
- const seenImports = /* @__PURE__ */ new Set();
1581
- for (const line of stripGeneratorPlaceholderMarkers(rawSource).split(/\r?\n/)) {
1582
- const trimmed = line.trim();
1583
- if (!trimmed || trimmed.startsWith("//")) continue;
1584
- const directive = TAILWIND_EXTRACTABLE_DIRECTIVE_RE.exec(line)?.[0] ?? TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE.exec(line)?.[0];
1585
- if (!directive) continue;
1586
- if (TAILWIND_EXTRACTABLE_BLOCK_START_RE.test(directive)) continue;
1587
- const normalized = normalizeTailwindDirectiveLine(directive.trimEnd(), options);
1588
- const normalizedTrimmed = normalized.trim();
1589
- if (options.removeConfig && normalizedTrimmed.startsWith("@config")) continue;
1590
- const request = /^@(?:import|use|forward)\b/.test(normalizedTrimmed) ? parseImportRequest$1(normalizedTrimmed.replace(/^@(?:import|use|forward)\b/, "")) : void 0;
1591
- if (request && !isTailwindImportRequest$1(request) && !isPackageJsonImportRequest$1(request)) continue;
1592
- if (/^@(?:import|use|forward)\b/.test(normalizedTrimmed) && !request) continue;
1593
- if (request && isTailwindImportRequest$1(request)) {
1594
- const key = normalizedTrimmed;
1595
- if (seenImports.has(key)) continue;
1596
- seenImports.add(key);
1597
- }
1598
- directives.push(normalized);
1599
- }
1600
- return directives;
1601
- }
1602
- function stripPreprocessorLineComment(line) {
1603
- let quote;
1604
- let escaped = false;
1605
- for (let index = 0; index < line.length; index++) {
1606
- const char = line[index];
1607
- if (escaped) {
1608
- escaped = false;
1609
- continue;
1610
- }
1611
- if (char === "\\") {
1612
- escaped = true;
1613
- continue;
1614
- }
1615
- if (quote) {
1616
- if (char === quote) quote = void 0;
1617
- continue;
1618
- }
1619
- if (char === "\"" || char === "'") {
1620
- quote = char;
1621
- continue;
1622
- }
1623
- if (char === "/" && line[index + 1] === "/" && (index === 0 || /\s/.test(line[index - 1]))) return line.slice(0, index).trimEnd();
1624
- }
1625
- return line;
1626
- }
1627
- function countBlockBraceDelta(line) {
1628
- let quote;
1629
- let escaped = false;
1630
- let delta = 0;
1631
- for (let index = 0; index < line.length; index++) {
1632
- const char = line[index];
1633
- if (escaped) {
1634
- escaped = false;
1635
- continue;
1636
- }
1637
- if (char === "\\") {
1638
- escaped = true;
1639
- continue;
1640
- }
1641
- if (quote) {
1642
- if (char === quote) quote = void 0;
1643
- continue;
1644
- }
1645
- if (char === "\"" || char === "'") {
1646
- quote = char;
1647
- continue;
1648
- }
1649
- if (char === "{") delta++;
1650
- else if (char === "}") delta--;
1651
- }
1652
- return delta;
1653
- }
1654
- function extractTailwindFallbackBlocks(rawSource) {
1655
- const blocks = [];
1656
- let current;
1657
- let depth = 0;
1658
- for (const rawLine of stripGeneratorPlaceholderMarkers(rawSource).split(/\r?\n/)) {
1659
- const line = stripPreprocessorLineComment(rawLine);
1660
- if (!line.trim()) continue;
1661
- if (!current) {
1662
- if (!TAILWIND_EXTRACTABLE_BLOCK_START_RE.test(line)) continue;
1663
- current = [line];
1664
- depth = countBlockBraceDelta(line);
1665
- if (depth <= 0) {
1666
- blocks.push(current.join("\n"));
1667
- current = void 0;
1668
- depth = 0;
1669
- }
1670
- continue;
1671
- }
1672
- current.push(line);
1673
- depth += countBlockBraceDelta(line);
1674
- if (depth <= 0) {
1675
- blocks.push(current.join("\n"));
1676
- current = void 0;
1677
- depth = 0;
1678
- }
1679
- }
1680
- return blocks;
1681
- }
1682
- function extractTailwindSourceForPostcssFallback(rawSource, options = {}) {
1683
- const directives = [...extractTailwindDirectiveLines(rawSource, options), ...extractTailwindFallbackBlocks(rawSource)];
1684
- return directives.length > 0 ? directives.join("\n") : void 0;
1685
- }
1686
- function extractConfigRequestFromSource(rawSource) {
1687
- for (const line of rawSource.split(/\r?\n/)) {
1688
- const match = /^\s*@config\b([\s\S]*?)(?:;|$)/.exec(line);
1689
- const request = match ? parseConfigRequest$1(match[1] ?? "") : void 0;
1690
- if (request) return request;
1691
- }
1692
- }
1693
- //#endregion
1694
- //#region src/bundlers/shared/generator-css/directives.ts
1695
- const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = /* @__PURE__ */ new Set([
1696
- "config",
1697
- "custom-variant",
1698
- "layer",
1699
- "plugin",
1700
- "reference",
1701
- "source",
1702
- "tailwind",
1703
- "theme",
1704
- "utility",
1705
- "variant"
1706
- ]);
1707
- const TAILWIND_APPLY_CONTEXT_DIRECTIVE_NAMES = /* @__PURE__ */ new Set([
1708
- "config",
1709
- "custom-variant",
1710
- "plugin",
1711
- "reference",
1712
- "theme",
1713
- "utility",
1714
- "variant"
1715
- ]);
1716
- const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|(?:use|forward)\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|tailwind|config|custom-variant|plugin|source|theme|utility|variant)\b/;
1717
- function parseImportRequest(params) {
1718
- return (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
1719
- }
1720
- function hasLocalCssImport(rawSource) {
1721
- return analyzeParseableTailwindDirectives(rawSource)?.hasLocalCssImport ?? false;
1722
- }
1723
- function parseConfigRequest(params) {
1724
- return (0, _weapp_tailwindcss_postcss.parseTailwindCssConfigRequest)(params);
1725
- }
1726
- function isPackageJsonImportRequest(request) {
1727
- return (0, _weapp_tailwindcss_postcss.isTailwindCssPackageJsonImportRequest)(request);
1728
- }
1729
- function normalizeTailwindImportRequest(request, options = {}) {
1730
- return (0, _weapp_tailwindcss_postcss.normalizeTailwindCssImportRequest)(request, options);
1731
- }
1732
- function replaceImportRequest(params, request, replacement) {
1733
- const index = params.indexOf(request);
1734
- if (index === -1) return params;
1735
- return `${params.slice(0, index)}${replacement}${params.slice(index + request.length)}`;
1736
- }
1737
- function normalizeTailwindImportAtRules(root, options = {}) {
1738
- if (!options.importFallback) return false;
1739
- let changed = false;
1740
- const seenCanonicalImports = /* @__PURE__ */ new Set();
1741
- root.walkAtRules("import", (node) => {
1742
- const request = parseImportRequest(node.params);
1743
- const normalizedRequest = normalizeTailwindImportRequest(request, options);
1744
- if (!normalizedRequest || !isTailwindImportRequest(normalizedRequest)) return;
1745
- const normalizedParams = request && normalizedRequest !== request ? replaceImportRequest(node.params, request, normalizedRequest) : node.params;
1746
- const normalizedKey = normalizedParams.trim();
1747
- if (seenCanonicalImports.has(normalizedKey)) {
1748
- node.remove();
1749
- changed = true;
1750
- return;
1751
- }
1752
- seenCanonicalImports.add(normalizedKey);
1753
- if (normalizedParams !== node.params) {
1754
- node.params = normalizedParams;
1755
- changed = true;
1756
- }
1757
- });
1758
- return changed;
1759
- }
1760
- function resolveConfigPath(base, configPath) {
1761
- if (node_path.default.isAbsolute(configPath) || isPackageJsonImportRequest(configPath)) return node_path.default.isAbsolute(configPath) ? configPath : void 0;
1762
- return node_path.default.resolve(base, configPath);
1763
- }
1764
- function normalizeTailwindConfigDirectives(rawSource, base) {
1765
- return rawSource.replace(/@config\s+(["'])(.+?)\1\s*;?/g, (full, quote, request) => {
1766
- if (node_path.default.isAbsolute(request) || isPackageJsonImportRequest(request)) return full;
1767
- return `@config ${quote}${node_path.default.resolve(base, request).replace(/\\/g, "/")}${quote};`;
1768
- });
1769
- }
1770
- function hasPreprocessorOnlySyntax(rawSource) {
1771
- return /(?:^|\n)\s*(?:\/\/|\$[\w-]+\s*:|@[\w-]+\s*:|@(?:mixin|include|function|use|forward)\b)/.test(rawSource);
1772
- }
1773
- function normalizeTailwindSourceForGenerator(rawSource, options = {}) {
1774
- return hasPreprocessorOnlySyntax(rawSource) ? extractTailwindSourceForPostcssFallback(rawSource, options) ?? rawSource : rawSource;
1775
- }
1776
- function normalizeTailwindSourceDirectives(rawSource, options = {}) {
1777
- if (!options.importFallback) return rawSource;
1778
- try {
1779
- const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
1780
- return normalizeTailwindImportAtRules(root, options) ? root.toString() : rawSource;
1781
- } catch {
1782
- return extractTailwindSourceForPostcssFallback(rawSource, options) ?? rawSource;
1783
- }
1784
- }
1785
- function isTailwindImportRequest(request) {
1786
- const normalized = normalizeTailwindImportRequest(request);
1787
- return normalized === "tailwindcss" || normalized === "tailwindcss4" || normalized?.startsWith("tailwindcss/") === true || normalized?.startsWith("tailwindcss4/") === true;
1788
- }
1789
- function isTailwindImportAtRule(node, options = {}) {
1790
- return (0, _weapp_tailwindcss_postcss.isTailwindCssImportAtRule)(node, options);
1791
- }
1792
- function isTailwindSourceDirective(node, options = {}) {
1793
- if (node.type !== "atrule") return false;
1794
- const atRule = node;
1795
- if (isTailwindImportAtRule(atRule, options)) return true;
1796
- if (atRule.name === "import" && isPackageJsonImportRequest(parseImportRequest(atRule.params))) return true;
1797
- if (atRule.name === "layer") return !atRule.nodes || atRule.nodes.length === 0;
1798
- if (options.preserveApplyContext && TAILWIND_APPLY_CONTEXT_DIRECTIVE_NAMES.has(atRule.name)) return false;
1799
- return TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES.has(atRule.name);
1800
- }
1801
- function hasGeneratedCssArtifacts(rawSource) {
1802
- return hasTailwindGeneratedCssMarkers(rawSource) && !GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource);
1803
- }
1804
- function isTailwindGenerationDirective(node, options = {}) {
1805
- return (0, _weapp_tailwindcss_postcss.isTailwindCssGenerationDirective)(node, options);
1806
- }
1807
- function analyzeParseableTailwindDirectives(rawSource, options = {}) {
1808
- try {
1809
- const ignoreLayer = options.ignoreLayer ?? hasGeneratedCssArtifacts(rawSource);
1810
- return (0, _weapp_tailwindcss_postcss.analyzeTailwindCssDirectives)(_weapp_tailwindcss_postcss.postcss.parse(rawSource), {
1811
- ...options,
1812
- ignoreLayer
1813
- });
1814
- } catch {
1815
- return;
1816
- }
1817
- }
1818
- function removeTailwindSourceDirectives(rawSource, options = {}) {
1819
- try {
1820
- const source = hasPreprocessorOnlySyntax(rawSource) ? extractTailwindSourceForPostcssFallback(rawSource, options) : stripGeneratorPlaceholderMarkers(rawSource);
1821
- if (!source) return "";
1822
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
1823
- let removed = false;
1824
- root.walk((node) => {
1825
- if (isTailwindSourceDirective(node, options)) {
1826
- node.remove();
1827
- removed = true;
1828
- }
1829
- });
1830
- return removed ? root.toString() : source;
1831
- } catch {
1832
- return stripGeneratorPlaceholderMarkers(rawSource);
1833
- }
1834
- }
1835
- function hasTailwindSourceDirectives(rawSource, options = {}) {
1836
- if (GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
1837
- return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindSourceDirectives ?? extractTailwindDirectiveLines(rawSource, options).length > 0;
1838
- }
1839
- function hasTailwindNonRootGenerationDirectives(rawSource, options = {}) {
1840
- if (GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
1841
- return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindNonRootGenerationDirectives ?? /@(?:apply|config|custom-variant|plugin|source|theme|utility|variant)\b/.test(rawSource);
1842
- }
1843
- function hasTailwindRootImportDirectives(rawSource, options = {}) {
1844
- if (!TAILWIND_ROOT_DIRECTIVE_RE.test(rawSource) && !(options.importFallback && rawSource.includes("weapp-tailwindcss"))) return false;
1845
- return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindRootImportDirectives ?? extractTailwindDirectiveLines(rawSource, options).some((line) => /@(?:import|use|forward)\b/.test(line));
1846
- }
1847
- function hasTailwindRootDirectives(rawSource, options = {}) {
1848
- if (!TAILWIND_ROOT_DIRECTIVE_RE.test(rawSource) && !(options.importFallback && rawSource.includes("weapp-tailwindcss"))) return false;
1849
- return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindRootDirectives ?? extractTailwindDirectiveLines(rawSource, options).length > 0;
1850
- }
1851
- function hasTailwindApplyDirective(rawSource) {
1852
- if (!rawSource.includes("@apply")) return false;
1853
- const analysis = analyzeParseableTailwindDirectives(rawSource);
1854
- if (analysis) return analysis.hasTailwindApplyDirective;
1855
- const fallback = extractTailwindSourceForPostcssFallback(rawSource);
1856
- return typeof fallback === "string" && /@apply\s[^;{}]+;/.test(fallback);
1857
- }
1858
- function resolveCssEntrySource(rawSource, base, options = {}) {
1859
- try {
1860
- const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
1861
- const normalizedImports = normalizeTailwindImportAtRules(root, options);
1862
- let found = false;
1863
- let config;
1864
- let configRequest;
1865
- let removedConfig = false;
1866
- const removeConfig = options.removeConfig ?? true;
1867
- const ignoreLayer = hasGeneratedCssArtifacts(rawSource);
1868
- root.walk((node) => {
1869
- if (isTailwindGenerationDirective(node, {
1870
- ...options,
1871
- ignoreLayer
1872
- })) found = true;
1873
- if (node.type === "atrule" && node.name === "config") {
1874
- const configPath = parseConfigRequest(node.params);
1875
- if (configPath && !config) {
1876
- configRequest = configPath;
1877
- config = resolveConfigPath(base, configPath);
1878
- }
1879
- if (removeConfig) {
1880
- node.remove();
1881
- removedConfig = true;
1882
- }
1883
- }
1884
- });
1885
- if (!found) return;
1886
- if (hasPreprocessorOnlySyntax(rawSource)) {
1887
- const css = extractTailwindSourceForPostcssFallback(rawSource, {
1888
- ...options,
1889
- removeConfig
1890
- });
1891
- if (css) return {
1892
- css,
1893
- config,
1894
- configRequest,
1895
- base
1896
- };
1897
- }
1898
- return {
1899
- css: removedConfig || normalizedImports ? root.toString() : rawSource,
1900
- config,
1901
- configRequest,
1902
- base
1903
- };
1904
- } catch {
1905
- const css = extractTailwindSourceForPostcssFallback(rawSource, options);
1906
- const configRequest = extractConfigRequestFromSource(rawSource);
1907
- const config = configRequest ? resolveConfigPath(base, configRequest) : void 0;
1908
- return css ? {
1909
- css,
1910
- config,
1911
- configRequest,
1912
- base
1913
- } : void 0;
1914
- }
1915
- }
1916
- //#endregion
1917
- //#region src/bundlers/shared/generator-css/scoped-rules.ts
1918
- const VUE_SCOPED_SELECTOR_RE = /\.data-v-[\w-]+|\[data-v-[^\]]+\]/g;
1919
- function normalizeGeneratedSelector$1(selector) {
1920
- return selector.replace(/:not\(#\\#\)/g, "").trim();
1921
- }
1922
- function normalizeVueScopedSelector(selector) {
1923
- let scoped = false;
1924
- return {
1925
- normalized: normalizeGeneratedSelector$1(selector).replace(VUE_SCOPED_SELECTOR_RE, () => {
1926
- scoped = true;
1927
- return "";
1928
- }).trim(),
1929
- scoped
1930
- };
1931
- }
1932
- function normalizeCssComparableValue(value) {
1933
- const normalizeUnquotedSegment = (segment) => segment.replace(/(^|[^\w.-])(-?)0+\.(\d+)/g, "$1$2.$3");
1934
- let result = "";
1935
- let segmentStart = 0;
1936
- let index = 0;
1937
- while (index < value.length) {
1938
- const quote = value[index];
1939
- if (quote !== "\"" && quote !== "'") {
1940
- index++;
1941
- continue;
1942
- }
1943
- result += normalizeUnquotedSegment(value.slice(segmentStart, index));
1944
- const stringStart = index;
1945
- index++;
1946
- while (index < value.length) {
1947
- if (value[index] === "\\") {
1948
- index += 2;
1949
- continue;
1950
- }
1951
- if (value[index] === quote) {
1952
- index++;
1953
- break;
1954
- }
1955
- index++;
1956
- }
1957
- result += value.slice(stringStart, index);
1958
- segmentStart = index;
1959
- }
1960
- return result + normalizeUnquotedSegment(value.slice(segmentStart));
1961
- }
1962
- function createCssNodeSignature(node) {
1963
- if (node.type === "decl") return JSON.stringify([
1964
- "decl",
1965
- node.prop,
1966
- normalizeCssComparableValue(node.value),
1967
- node.important
1968
- ]);
1969
- if (node.type === "atrule") return JSON.stringify([
1970
- "atrule",
1971
- node.name,
1972
- normalizeCssComparableValue(node.params),
1973
- node.nodes?.map(createCssNodeSignature) ?? null
1974
- ]);
1975
- if (node.type === "rule") return JSON.stringify([
1976
- "rule",
1977
- node.selector,
1978
- node.nodes?.map(createCssNodeSignature) ?? null
1979
- ]);
1980
- return JSON.stringify(["comment", node.text]);
1981
- }
1982
- function createRuleBodySignature(rule) {
1983
- return JSON.stringify(rule.nodes?.map(createCssNodeSignature) ?? []);
1984
- }
1985
- function createRuleAtRuleContextSignature(rule) {
1986
- const context = [];
1987
- let parent = rule.parent;
1988
- while (parent && parent.type !== "root") {
1989
- if (parent.type === "atrule") context.unshift(JSON.stringify([parent.name, parent.params]));
1990
- parent = parent.parent;
1991
- }
1992
- return JSON.stringify(context);
1993
- }
1994
- function createScopedRuleCoverageKey(rule, selector) {
1995
- return JSON.stringify([
1996
- createRuleAtRuleContextSignature(rule),
1997
- createRuleBodySignature(rule),
1998
- selector
1999
- ]);
2000
- }
2001
- function removeUnscopedRulesCoveredByScopedRules(root) {
2002
- const scopedCoverage = /* @__PURE__ */ new Set();
2003
- root.walkRules((rule) => {
2004
- for (const selector of rule.selectors ?? [rule.selector]) {
2005
- const normalized = normalizeVueScopedSelector(selector);
2006
- if (normalized.scoped && normalized.normalized) scopedCoverage.add(createScopedRuleCoverageKey(rule, normalized.normalized));
2007
- }
2008
- });
2009
- if (scopedCoverage.size === 0) return;
2010
- root.walkRules((rule) => {
2011
- const normalizedSelectors = (rule.selectors ?? [rule.selector]).map(normalizeVueScopedSelector);
2012
- if (normalizedSelectors.some((selector) => selector.scoped || !selector.normalized) || !normalizedSelectors.every((selector) => scopedCoverage.has(createScopedRuleCoverageKey(rule, selector.normalized)))) return;
2013
- rule.remove();
2014
- });
2015
- }
2016
- function preferScopedGeneratedCssRules(css) {
2017
- if (!css.includes("data-v-")) return css;
2018
- try {
2019
- const root = _weapp_tailwindcss_postcss.postcss.parse(css);
2020
- removeUnscopedRulesCoveredByScopedRules(root);
2021
- root.walkAtRules((rule) => {
2022
- if (rule.nodes !== void 0 && rule.nodes.length === 0) rule.remove();
2023
- });
2024
- return root.toString();
2025
- } catch {
2026
- return css;
2027
- }
2028
- }
2029
- //#endregion
2030
- //#region src/bundlers/shared/generator-css/user-css/user-layers.ts
2031
- function splitUserCssLayerBlocks(source) {
2032
- if (!source.includes("@layer")) return {
2033
- layer: "",
2034
- rest: source
2035
- };
2036
- try {
2037
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2038
- const layerRoot = _weapp_tailwindcss_postcss.postcss.root();
2039
- const restRoot = _weapp_tailwindcss_postcss.postcss.root();
2040
- for (const node of root.nodes) (node.type === "atrule" && node.name === "layer" && node.nodes?.length ? layerRoot : restRoot).append(node.clone());
2041
- return {
2042
- layer: layerRoot.toString(),
2043
- rest: restRoot.toString()
2044
- };
2045
- } catch {
2046
- return {
2047
- layer: source,
2048
- rest: ""
2049
- };
2050
- }
2051
- }
2052
- function hasUserCssLayerBlocks(source) {
2053
- if (!source.includes("@layer")) return false;
2054
- try {
2055
- let hasLayerBlock = false;
2056
- _weapp_tailwindcss_postcss.postcss.parse(source).walkAtRules("layer", (node) => {
2057
- if (node.nodes?.length) hasLayerBlock = true;
2058
- });
2059
- return hasLayerBlock;
2060
- } catch {
2061
- return true;
2062
- }
2063
- }
2064
- function collectUserLayerSelectors(source) {
2065
- const selectors = /* @__PURE__ */ new Set();
2066
- try {
2067
- _weapp_tailwindcss_postcss.postcss.parse(source).walkRules((rule) => {
2068
- for (const selector of rule.selectors ?? [rule.selector]) {
2069
- const normalized = selector.trim();
2070
- if (normalized) selectors.add(normalized);
2071
- }
2072
- });
2073
- } catch {}
2074
- return selectors;
2075
- }
2076
- function matchesUserLayerSelector(selector, userLayerSelector) {
2077
- if (selector === userLayerSelector) return true;
2078
- if (!selector.startsWith(userLayerSelector)) return false;
2079
- const next = selector[userLayerSelector.length];
2080
- return next === ":" || next === "[";
2081
- }
2082
- function extractGeneratedCssForUserLayerSelectors(css, userLayerSource) {
2083
- const selectors = collectUserLayerSelectors(userLayerSource);
2084
- if (selectors.size === 0) return {
2085
- layer: "",
2086
- rest: css
2087
- };
2088
- try {
2089
- const root = _weapp_tailwindcss_postcss.postcss.parse(css);
2090
- const layerRoot = _weapp_tailwindcss_postcss.postcss.root();
2091
- const selectorList = [...selectors];
2092
- root.walkRules((rule) => {
2093
- if ((rule.selectors ?? [rule.selector]).some((selector) => selectorList.some((userSelector) => matchesUserLayerSelector(selector.trim(), userSelector)))) {
2094
- layerRoot.append(rule.clone());
2095
- rule.remove();
2096
- }
2097
- });
2098
- return {
2099
- layer: layerRoot.toString(),
2100
- rest: root.toString()
2101
- };
2102
- } catch {
2103
- return {
2104
- layer: "",
2105
- rest: css
2106
- };
2107
- }
2108
- }
2109
- function normalizeGeneratedSelector(selector) {
2110
- return selector.replace(/:not\(#\\#\)/g, "").trim();
2111
- }
2112
- function collectApplyOnlySourceSelectors(source) {
2113
- const selectors = /* @__PURE__ */ new Set();
2114
- try {
2115
- _weapp_tailwindcss_postcss.postcss.parse(source).walkRules((rule) => {
2116
- if (!rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) return;
2117
- for (const selector of rule.selectors ?? [rule.selector]) {
2118
- const normalized = normalizeGeneratedSelector(selector);
2119
- if (normalized) selectors.add(normalized);
2120
- }
2121
- });
2122
- } catch {}
2123
- return selectors;
2124
- }
2125
- function hasOnlyApplyBackedSourceRules(source) {
2126
- let hasApplyRule = false;
2127
- let hasNonApplyRule = false;
2128
- try {
2129
- _weapp_tailwindcss_postcss.postcss.parse(source).walkRules((rule) => {
2130
- if (rule.nodes?.some((node) => node.type === "atrule" && node.name === "apply")) hasApplyRule = true;
2131
- else hasNonApplyRule = true;
2132
- });
2133
- } catch {
2134
- return false;
2135
- }
2136
- return hasApplyRule && !hasNonApplyRule;
2137
- }
2138
- function removeCssComments(css) {
2139
- return css.replace(/\/\*[\s\S]*?\*\//g, "");
2140
- }
2141
- function isEmptyCustomVariantBlock(rule) {
2142
- if (rule.name !== "custom-variant") return false;
2143
- if (!/^[\w-]+$/.test(rule.params.trim())) return false;
2144
- if (rule.nodes === void 0) return true;
2145
- return rule.nodes.every((node) => node.type === "comment");
2146
- }
2147
- //#endregion
2148
- //#region src/bundlers/shared/generator-css/user-css/apply-only.ts
2149
- function normalizeEmptyTailwindCustomVariants(css) {
2150
- if (!css.includes("@custom-variant")) return css;
2151
- try {
2152
- const root = _weapp_tailwindcss_postcss.postcss.parse(css);
2153
- let changed = false;
2154
- root.walkAtRules("custom-variant", (rule) => {
2155
- if (!isEmptyCustomVariantBlock(rule)) return;
2156
- rule.remove();
2157
- changed = true;
2158
- });
2159
- return changed ? root.toString() : css;
2160
- } catch {
2161
- return css;
2162
- }
2163
- }
2164
- function filterApplyOnlyGeneratedCss(css, source, options = {}) {
2165
- const selectors = collectApplyOnlySourceSelectors(source);
2166
- if (selectors.size === 0) return css;
2167
- const selectorList = [...selectors];
2168
- const preserveVariables = options.preserveVariables !== false;
2169
- try {
2170
- const root = _weapp_tailwindcss_postcss.postcss.parse(css);
2171
- root.walkRules((rule) => {
2172
- const isApplySelector = (rule.selectors ?? [rule.selector]).some((selector) => {
2173
- const normalized = normalizeGeneratedSelector(selector);
2174
- return selectorList.some((sourceSelector) => {
2175
- if (normalized === sourceSelector) return true;
2176
- if (!normalized.startsWith(sourceSelector)) return false;
2177
- const next = normalized[sourceSelector.length];
2178
- return next === ":" || next === "[" || next === ".";
2179
- });
2180
- });
2181
- const isVariableRule = rule.nodes?.some((node) => node.type === "decl" && node.prop.startsWith("--"));
2182
- if (options.preserveRuntimeProperties && (0, _weapp_tailwindcss_postcss.isTailwindRuntimePropertyRule)(rule)) return;
2183
- if (!isApplySelector && (!preserveVariables || !isVariableRule)) rule.remove();
2184
- });
2185
- root.walkAtRules((rule) => {
2186
- if (rule.nodes !== void 0 && rule.nodes.length === 0) rule.remove();
2187
- });
2188
- const filteredCss = root.toString();
2189
- return removeCssComments(options.preferScopedRules ? preferScopedGeneratedCssRules(filteredCss) : filteredCss).trim();
2190
- } catch {
2191
- return css;
2192
- }
2193
- }
2194
- function shouldFilterApplyOnlyGeneratedCss(_majorVersion, target, source, options) {
2195
- return (target === "weapp" || target === "web") && hasTailwindApplyDirective(source) && !hasTailwindRootDirectives(source) && !options.hasGeneratedCss && !options.hasGeneratedMarkers && collectApplyOnlySourceSelectors(source).size > 0 && hasOnlyApplyBackedSourceRules(source);
2196
- }
2197
- //#endregion
2198
- //#region src/bundlers/shared/generator-css/user-css/generated-cleanup.ts
2199
- const TAILWIND_V4_GENERATOR_AT_RULES = /* @__PURE__ */ new Set([
2200
- "config",
2201
- "custom-variant",
2202
- "plugin",
2203
- "source",
2204
- "theme",
2205
- "utility",
2206
- "variant"
2207
- ]);
2208
- function removeBalancedAtRuleBlock(source, atRuleStart) {
2209
- const blockStart = source.indexOf("{", atRuleStart);
2210
- if (blockStart === -1) {
2211
- const semicolon = source.indexOf(";", atRuleStart);
2212
- return semicolon === -1 ? source.slice(0, atRuleStart) : `${source.slice(0, atRuleStart)}${source.slice(semicolon + 1)}`;
2213
- }
2214
- let depth = 0;
2215
- for (let index = blockStart; index < source.length; index++) {
2216
- const char = source[index];
2217
- if (char === "{") {
2218
- depth++;
2219
- continue;
2220
- }
2221
- if (char !== "}") continue;
2222
- depth--;
2223
- if (depth === 0) return `${source.slice(0, atRuleStart)}${source.slice(index + 1)}`;
2224
- }
2225
- return source.slice(0, atRuleStart);
2226
- }
2227
- function removeTailwindV4GeneratorAtRulesFallback(source) {
2228
- let next = source;
2229
- let changed = false;
2230
- const sourceMediaRE = /@media\s+source\([^)]*\)\s*\{/g;
2231
- for (;;) {
2232
- sourceMediaRE.lastIndex = 0;
2233
- const match = sourceMediaRE.exec(next);
2234
- if (!match) break;
2235
- next = removeBalancedAtRuleBlock(next, match.index);
2236
- changed = true;
2237
- }
2238
- const atRuleRE = /@(?:config|custom-variant|plugin|source|theme|utility|variant)\b/g;
2239
- for (;;) {
2240
- atRuleRE.lastIndex = 0;
2241
- const match = atRuleRE.exec(next);
2242
- if (!match) break;
2243
- next = removeBalancedAtRuleBlock(next, match.index);
2244
- changed = true;
2245
- }
2246
- return changed ? next : source;
2247
- }
2248
- function isTailwindGeneratedPreflightComment(text) {
2249
- return text.includes("cssremedy") || text.includes("Use the user's configured") || text.includes("tailwindlabs/tailwindcss") || text.includes("Prevent padding and border from affecting element width") || text.includes("Remove default margins and padding") || text.includes("Deprecated") || text.includes("Reset all borders") || text.includes("Add the correct text decoration") || text.includes("Make elements with the HTML hidden attribute stay hidden") || text.includes("Inherit font styles in all browsers") || text.includes("Add the correct height in Firefox") || text.includes("Remove the default font size and weight for headings") || text.includes("Reset links to optimize for opt-in styling") || text.includes("Add the correct font weight in Edge and Safari") || text.includes("Use the user's configured `mono` font-family") || text.includes("Add the correct font size in all browsers") || text.includes("Prevent `sub` and `sup` elements from affecting the line height") || text.includes("Remove text indentation from table contents") || text.includes("Use the modern Firefox focus style") || text.includes("Add the correct vertical alignment") || text.includes("Add the correct display") || text.includes("Make lists unstyled by default") || text.includes("Make replaced elements `display: block` by default") || text.includes("Constrain images and videos to the parent width") || text.includes("Restore default font weight") || text.includes("Restore indentation") || text.includes("Restore space after button") || text.includes("Prevent resizing textareas horizontally") || text.includes("Remove the inner padding in Chrome and Safari") || text.includes("Ensure date/time inputs have the same height") || text.includes("Prevent height from changing on date/time inputs") || text.includes("Remove excess padding from pseudo-elements") || text.includes("Center dropdown marker shown on inputs") || text.includes("Remove the additional `:invalid` styles") || text.includes("Correct the inability to style the border radius") || text.includes("Correct the cursor style of increment and decrement buttons");
2250
- }
2251
- const TAILWIND_GENERATED_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
2252
- ":host",
2253
- ":root",
2254
- "page",
2255
- ".tw-root",
2256
- "wx-root-portal-content"
2257
- ]);
2258
- function isTailwindGeneratedThemeScopeSelector(selector) {
2259
- const selectors = selector.split(",").map((item) => item.trim()).filter(Boolean);
2260
- const selectorSet = new Set(selectors);
2261
- if (selectorSet.size !== selectors.length) return false;
2262
- if (!selectors.every((item) => TAILWIND_GENERATED_THEME_SCOPE_SELECTORS.has(item))) return false;
2263
- return selectorSet.size === 2 && selectorSet.has(":root") && selectorSet.has(":host") || selectorSet.size === 4 && selectorSet.has(":host") && selectorSet.has("page") && selectorSet.has(".tw-root") && selectorSet.has("wx-root-portal-content");
2264
- }
2265
- function themeDeclarationContext(declaration) {
2266
- const context = [];
2267
- let parent = declaration.parent?.parent;
2268
- while (parent && parent.type !== "root") {
2269
- if (parent.type === "atrule" && parent.name !== "layer") context.unshift(`@${parent.name} ${parent.params}`);
2270
- parent = parent.parent;
2271
- }
2272
- return context;
2273
- }
2274
- function themeDeclarationKey(declaration) {
2275
- const value = declaration.value.trim().replace(/^(-?)0\.(\d+(?:[a-z]+|%)?)$/i, "$1.$2");
2276
- return JSON.stringify([
2277
- themeDeclarationContext(declaration),
2278
- declaration.prop,
2279
- value,
2280
- Boolean(declaration.important)
2281
- ]);
2282
- }
2283
- function collectGeneratedThemeDeclarations(source) {
2284
- const declarations = /* @__PURE__ */ new Set();
2285
- try {
2286
- _weapp_tailwindcss_postcss.postcss.parse(source).walkRules((rule) => {
2287
- if (!isTailwindGeneratedThemeScopeSelector(rule.selector.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").trim())) return;
2288
- for (const child of rule.nodes ?? []) if (child.type === "decl") declarations.add(themeDeclarationKey(child));
2289
- });
2290
- } catch {}
2291
- return declarations;
2292
- }
2293
- /** 同一轮框架恢复共享声明索引;只有遇到根变量时才解析生成产物。 */
2294
- function createGeneratedThemeDeclarationResolver(source) {
2295
- let declarations;
2296
- return () => declarations ?? (declarations = collectGeneratedThemeDeclarations(source));
2297
- }
2298
- function isTailwindGeneratedPreflightRule(selector, node) {
2299
- if (selector === "view,text,::after,::before" || selector === "view, text, ::after, ::before" || selector === "*" || selector === "::after" || selector === "::before" || selector === "::backdrop" || selector === ":host" || selector === "[hidden]:not([hidden=\"until-found\"])" || selector === "[hidden]:not([hidden='until-found'])" || selector === "button,input[type=\"button\"],input[type=\"reset\"],input[type=\"submit\"]" || selector === "button, input[type=\"button\"], input[type=\"reset\"], input[type=\"submit\"]" || selector === "button,input[type='button'],input[type='reset'],input[type='submit']" || selector === "button, input[type='button'], input[type='reset'], input[type='submit']") return true;
2300
- if (selector === "abbr[title]") return node.nodes?.some((child) => child.type === "decl" && child.prop === "text-decoration") ?? false;
2301
- if (selector === ":host") return node.nodes?.some((child) => child.type === "decl" && child.value?.includes("--theme(")) ?? false;
2302
- return false;
2303
- }
2304
- function removeTailwindV4GeneratedUserCssArtifacts(source, generatedSource) {
2305
- try {
2306
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2307
- let changed = false;
2308
- root.walkComments((comment) => {
2309
- if (!isTailwindGeneratedPreflightComment(comment.text)) return;
2310
- comment.remove();
2311
- changed = true;
2312
- });
2313
- let generatedDeclarations;
2314
- const overriddenProperties = /* @__PURE__ */ new Set();
2315
- root.walkRules((rule) => {
2316
- const selector = rule.selector.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").trim();
2317
- if (isTailwindGeneratedThemeScopeSelector(selector) || TAILWIND_GENERATED_THEME_SCOPE_SELECTORS.has(selector) && rule.nodes.some((child) => child.type === "decl" && child.prop.startsWith("--"))) {
2318
- generatedDeclarations ?? (generatedDeclarations = typeof generatedSource === "function" ? generatedSource() : generatedSource ? collectGeneratedThemeDeclarations(generatedSource) : /* @__PURE__ */ new Set());
2319
- for (const child of [...rule.nodes]) {
2320
- if (child.type !== "decl") continue;
2321
- const propertyKey = JSON.stringify([themeDeclarationContext(child), child.prop]);
2322
- if (generatedDeclarations?.has(themeDeclarationKey(child)) && !overriddenProperties.has(propertyKey)) {
2323
- child.remove();
2324
- changed = true;
2325
- } else overriddenProperties.add(propertyKey);
2326
- }
2327
- if (rule.nodes.length === 0) {
2328
- rule.remove();
2329
- changed = true;
2330
- }
2331
- return;
2332
- }
2333
- if (isTailwindGeneratedPreflightRule(selector, rule)) {
2334
- rule.remove();
2335
- changed = true;
2336
- }
2337
- });
2338
- root.walkAtRules((rule) => {
2339
- if (rule.nodes !== void 0 && rule.nodes.length === 0) {
2340
- rule.remove();
2341
- changed = true;
2342
- }
2343
- });
2344
- return changed ? root.toString() : source;
2345
- } catch {
2346
- return source;
2347
- }
2348
- }
2349
- //#endregion
2350
- //#region src/bundlers/shared/generator-css/user-css/at-rules.ts
2351
- function removeTailwindSourceMediaBlocks(source) {
2352
- let next = source;
2353
- let changed = false;
2354
- const sourceMediaRE = /@media\s+source\([^)]*\)\s*\{/g;
2355
- for (;;) {
2356
- sourceMediaRE.lastIndex = 0;
2357
- const match = sourceMediaRE.exec(next);
2358
- if (!match) break;
2359
- const blockStart = next.indexOf("{", match.index);
2360
- if (blockStart === -1) break;
2361
- let depth = 0;
2362
- let blockEnd = -1;
2363
- for (let index = blockStart; index < next.length; index++) {
2364
- const char = next[index];
2365
- if (char === "{") {
2366
- depth++;
2367
- continue;
2368
- }
2369
- if (char !== "}") continue;
2370
- depth--;
2371
- if (depth === 0) {
2372
- blockEnd = index;
2373
- break;
2374
- }
2375
- }
2376
- if (blockEnd === -1) break;
2377
- next = `${next.slice(0, match.index)}${next.slice(blockEnd + 1)}`;
2378
- changed = true;
2379
- }
2380
- for (;;) {
2381
- const atRuleStart = findTailwindSourceWrapperBlockStart(next);
2382
- if (atRuleStart === -1) break;
2383
- next = removeBalancedAtRuleBlock(next, atRuleStart);
2384
- changed = true;
2385
- }
2386
- return changed ? next : source;
2387
- }
2388
- function terminateTailwindSourceAtRulesBeforeNextDirective(source) {
2389
- if (!source.includes("@source")) return source;
2390
- let next = "";
2391
- let searchIndex = 0;
2392
- for (;;) {
2393
- const atRuleStart = source.indexOf("@source", searchIndex);
2394
- if (atRuleStart === -1) {
2395
- next += source.slice(searchIndex);
2396
- break;
2397
- }
2398
- const nextChar = source[atRuleStart + 7];
2399
- if (nextChar && /[\w-]/.test(nextChar)) {
2400
- next += source.slice(searchIndex, atRuleStart + 7);
2401
- searchIndex = atRuleStart + 7;
2402
- continue;
2403
- }
2404
- next += source.slice(searchIndex, atRuleStart);
2405
- let quote;
2406
- let parenDepth = 0;
2407
- let terminated = false;
2408
- let index = atRuleStart + 7;
2409
- for (; index < source.length; index++) {
2410
- const char = source[index];
2411
- if (quote) {
2412
- if (char === "\\") {
2413
- index++;
2414
- continue;
2415
- }
2416
- if (char === quote) quote = void 0;
2417
- continue;
2418
- }
2419
- if (char === "\"" || char === "'") {
2420
- quote = char;
2421
- continue;
2422
- }
2423
- if (char === "(") {
2424
- parenDepth++;
2425
- continue;
2426
- }
2427
- if (char === ")" && parenDepth > 0) {
2428
- parenDepth--;
2429
- continue;
2430
- }
2431
- if (parenDepth > 0) continue;
2432
- if (char === ";" || char === "{") {
2433
- terminated = true;
2434
- index++;
2435
- break;
2436
- }
2437
- if (char === "@" && /^(?:config|custom-variant|plugin|source|theme|utility|variant)\b/.test(source.slice(index + 1))) break;
2438
- }
2439
- const segment = source.slice(atRuleStart, index);
2440
- const trimmedSegment = segment.trimEnd();
2441
- next += terminated || trimmedSegment.endsWith(";") || trimmedSegment.endsWith("{") ? segment : `${trimmedSegment};${segment.slice(trimmedSegment.length)}`;
2442
- searchIndex = index;
2443
- }
2444
- return next;
2445
- }
2446
- function findTailwindSourceWrapperBlockStart(source) {
2447
- let searchIndex = 0;
2448
- for (;;) {
2449
- const atRuleStart = source.indexOf("@source", searchIndex);
2450
- if (atRuleStart === -1) return -1;
2451
- const nextChar = source[atRuleStart + 7];
2452
- if (nextChar && /[\w-]/.test(nextChar)) {
2453
- searchIndex = atRuleStart + 7;
2454
- continue;
2455
- }
2456
- let quote;
2457
- let parenDepth = 0;
2458
- for (let index = atRuleStart + 7; index < source.length; index++) {
2459
- const char = source[index];
2460
- if (quote) {
2461
- if (char === "\\") {
2462
- index++;
2463
- continue;
2464
- }
2465
- if (char === quote) quote = void 0;
2466
- continue;
2467
- }
2468
- if (char === "\"" || char === "'") {
2469
- quote = char;
2470
- continue;
2471
- }
2472
- if (char === "(") {
2473
- parenDepth++;
2474
- continue;
2475
- }
2476
- if (char === ")" && parenDepth > 0) {
2477
- parenDepth--;
2478
- continue;
2479
- }
2480
- if (parenDepth > 0) continue;
2481
- if (char === ";") {
2482
- searchIndex = index + 1;
2483
- break;
2484
- }
2485
- if (char === "{") return atRuleStart;
2486
- }
2487
- if (searchIndex <= atRuleStart) return -1;
2488
- }
2489
- }
2490
- function removeTailwindApplyAtRules(source) {
2491
- if (!source.includes("@apply")) return source;
2492
- try {
2493
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2494
- let changed = false;
2495
- root.walkAtRules("apply", (rule) => {
2496
- rule.remove();
2497
- changed = true;
2498
- });
2499
- root.walk((node) => {
2500
- if ("nodes" in node && node.nodes?.length === 0) node.remove();
2501
- });
2502
- return changed ? root.toString() : source;
2503
- } catch {
2504
- return source;
2505
- }
2506
- }
2507
- //#endregion
2508
- //#region src/bundlers/shared/generator-css/user-css/source-fragments.ts
2509
- function removeTailwindV4GeneratorAtRules(source) {
2510
- try {
2511
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2512
- let changed = false;
2513
- root.walkAtRules((rule) => {
2514
- if (rule.name === "media" && /^source\(/.test(rule.params.trim())) {
2515
- rule.remove();
2516
- changed = true;
2517
- return;
2518
- }
2519
- if (!TAILWIND_V4_GENERATOR_AT_RULES.has(rule.name)) return;
2520
- rule.remove();
2521
- changed = true;
2522
- });
2523
- return changed ? root.toString() : source;
2524
- } catch {
2525
- return removeTailwindV4GeneratorAtRulesFallback(source);
2526
- }
2527
- }
2528
- function isCommentOnlyCss(source) {
2529
- try {
2530
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2531
- return root.nodes.length > 0 && root.nodes.every((node) => node.type === "comment");
2532
- } catch {
2533
- return false;
2534
- }
2535
- }
2536
- function removeMiniProgramInteractiveSelectors(source, options = {
2537
- active: true,
2538
- hover: true
2539
- }) {
2540
- const removeActive = options.active === true;
2541
- const removeHover = options.hover === true;
2542
- const removeFocus = options.focus === true;
2543
- const unsupportedPseudoClasses = [
2544
- ...removeActive ? [":active"] : [],
2545
- ...removeHover ? [":hover"] : [],
2546
- ...removeFocus ? [":focus"] : []
2547
- ];
2548
- if (unsupportedPseudoClasses.length === 0 || !source.includes(":active") && !source.includes(":hover") && !source.includes(":focus")) return source;
2549
- try {
2550
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2551
- let changed = false;
2552
- root.walkRules((rule) => {
2553
- const selectors = rule.selectors ?? [rule.selector];
2554
- const keptSelectors = selectors.filter((selector) => {
2555
- if (!unsupportedPseudoClasses.some((pseudoClass) => selector.includes(pseudoClass))) return true;
2556
- return !(0, _weapp_tailwindcss_postcss.selectorContainsPseudoClass)(selector, unsupportedPseudoClasses);
2557
- });
2558
- if (keptSelectors.length === selectors.length) return;
2559
- changed = true;
2560
- if (keptSelectors.length === 0) {
2561
- rule.remove();
2562
- return;
2563
- }
2564
- rule.selectors = keptSelectors;
2565
- });
2566
- root.walk((node) => {
2567
- if ("nodes" in node && node.nodes?.length === 0) {
2568
- node.remove();
2569
- changed = true;
2570
- }
2571
- });
2572
- return changed ? root.toString() : source;
2573
- } catch {
2574
- return source;
2575
- }
2576
- }
2577
- function removeProcessedMiniProgramUnsupportedCss(source, options) {
2578
- return removeMiniProgramInteractiveSelectors((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(source), {
2579
- active: options.cssRemoveActivePseudoClass ?? true,
2580
- hover: options.cssRemoveHoverPseudoClass ?? true,
2581
- focus: options.cssRemoveFocusPseudoClass ?? true
2582
- });
2583
- }
2584
- function unwrapMiniProgramCascadeLayers(source) {
2585
- if (!source.includes("@layer")) return source;
2586
- try {
2587
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2588
- (0, _weapp_tailwindcss_postcss.removeUnsupportedCascadeLayers)(root);
2589
- return root.toString();
2590
- } catch {
2591
- return source;
2592
- }
2593
- }
2594
- function hasClassSelector(selector) {
2595
- return /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i.test(selector);
2596
- }
2597
- function collectBareSelectorUserCss(source, transformedCss) {
2598
- try {
2599
- const root = _weapp_tailwindcss_postcss.postcss.parse(source);
2600
- const representedSelectors = /* @__PURE__ */ new Set();
2601
- const rootSelectors = /* @__PURE__ */ new Set([
2602
- ":root",
2603
- ":host",
2604
- "page",
2605
- ".tw-root",
2606
- "wx-root-portal-content"
2607
- ]);
2608
- const selectorKey = (rule, selector) => {
2609
- const context = [];
2610
- let parent = rule.parent;
2611
- while (parent && parent.type !== "root") {
2612
- if (parent.type === "atrule") context.unshift(`@${parent.name} ${parent.params}`);
2613
- parent = parent.parent;
2614
- }
2615
- return JSON.stringify([...context, rootSelectors.has(selector.trim()) ? ":root" : selector.trim()]);
2616
- };
2617
- if (transformedCss !== void 0) _weapp_tailwindcss_postcss.postcss.parse(transformedCss).walkRules((rule) => {
2618
- for (const selector of rule.selectors) representedSelectors.add(selectorKey(rule, selector));
2619
- });
2620
- let changed = false;
2621
- root.walkAtRules("import", (rule) => {
2622
- rule.remove();
2623
- changed = true;
2624
- });
2625
- root.walkRules((rule) => {
2626
- const selectors = rule.selectors?.length ? rule.selectors : [rule.selector];
2627
- if (selectors.some((selector) => hasClassSelector(selector)) || selectors.every((selector) => representedSelectors.has(selectorKey(rule, selector)))) {
2628
- rule.remove();
2629
- changed = true;
2630
- }
2631
- });
2632
- root.walkAtRules((rule) => {
2633
- if (rule.nodes !== void 0 && rule.nodes.length === 0) {
2634
- rule.remove();
2635
- changed = true;
2636
- }
2637
- });
2638
- return changed ? root.toString() : source;
2639
- } catch {
2640
- return "";
2641
- }
2642
- }
2643
- function stripTailwindSourceMediaFragments(source) {
2644
- let removedSourceMediaStart = false;
2645
- return terminateTailwindSourceAtRulesBeforeNextDirective(removeTailwindSourceMediaBlocks(source)).split(/\r?\n/).filter((line) => {
2646
- if (/^\s*@media\s+source\([^)]*\)\s*\{\s*$/.test(line)) {
2647
- removedSourceMediaStart = true;
2648
- return false;
2649
- }
2650
- if (/^\s*\}\s*\/\*\s*source\([^)]*\)\s*\*\/\s*$/.test(line)) return false;
2651
- if (removedSourceMediaStart && /^\s*\}\s*$/.test(line)) {
2652
- removedSourceMediaStart = false;
2653
- return false;
2654
- }
2655
- return true;
2656
- }).join("\n");
2657
- }
2658
- function stripLeadingTailwindSourceMediaCloseFragment(source) {
2659
- return source.replace(/^\s*\}\s*(?:\n|$)/, "");
2660
- }
2661
- function stripUnmatchedTailwindSourceMediaCloseFragments(source) {
2662
- try {
2663
- _weapp_tailwindcss_postcss.postcss.parse(source);
2664
- return source;
2665
- } catch {
2666
- return stripLeadingTailwindSourceMediaCloseFragment(source).replace(/\s*\}\s*$/, "");
2667
- }
2668
- }
2669
- //#endregion
2670
- //#region src/bundlers/shared/generator-css/user-css/transform.ts
2671
- async function transformGeneratorUserCss(source, options) {
2672
- if (source.trim().length === 0) return "";
2673
- if (options.processed) {
2674
- const compiledSource = await options.compileAuthorCssFunctions?.(source) ?? source;
2675
- return stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(removeTailwindV4GeneratorAtRules(options.generatorTarget === "weapp" ? removeTailwindV4GeneratedUserCssArtifacts(unwrapMiniProgramCascadeLayers(removeProcessedMiniProgramUnsupportedCss(compiledSource, {
2676
- ...options.generatorStyleOptions,
2677
- ...options.cssUserHandlerOptions
2678
- })), options.generatedSource) : compiledSource)));
2679
- }
2680
- const cleanedSource = removeTailwindSourceDirectives(removeTailwindV4GeneratorAtRules(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(source))), { importFallback: options.importFallback });
2681
- if (cleanedSource.trim().length === 0) return "";
2682
- const authorSource = stripUnmatchedTailwindSourceMediaCloseFragments(removeTailwindApplyAtRules(removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(options.generatorTarget === "weapp" ? removeTailwindV4GeneratedUserCssArtifacts((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(unwrapMiniProgramCascadeLayers(stripTailwindBanners(cleanedSource))), options.generatedSource) : cleanedSource)), { importFallback: options.importFallback })));
2683
- const userSource = await options.compileAuthorCssFunctions?.(authorSource) ?? authorSource;
2684
- if (userSource.trim().length === 0) return "";
2685
- if (isCommentOnlyCss(userSource)) return userSource;
2686
- if (options.generatorTarget !== "weapp") return (0, _weapp_tailwindcss_postcss.applyConfiguredCssCalc)(userSource, {
2687
- cssCalc: options.generatorStyleOptions.cssOptions?.cssCalc ?? options.generatorStyleOptions.cssCalc ?? options.cssUserHandlerOptions.cssOptions?.cssCalc ?? options.cssUserHandlerOptions.cssCalc,
2688
- customPropertyValues: options.generatorStyleOptions.customPropertyValues ?? options.cssUserHandlerOptions.customPropertyValues,
2689
- contextCss: typeof options.generatedSource === "string" ? options.generatedSource : void 0
2690
- });
2691
- const { css } = await options.styleHandler(userSource, {
2692
- ...options.generatorStyleOptions,
2693
- ...options.cssUserHandlerOptions
2694
- });
2695
- const transformedCss = removeTailwindV4GeneratedUserCssArtifacts((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(stripTailwindBanners(css)), options.generatedSource);
2696
- const bareSelectorUserCss = collectBareSelectorUserCss(userSource, transformedCss);
2697
- const missingBareSelectorUserCss = bareSelectorUserCss.trim().length > 0 ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(transformedCss, bareSelectorUserCss) : "";
2698
- return missingBareSelectorUserCss.trim().length > 0 ? `${transformedCss}\n${missingBareSelectorUserCss}` : transformedCss;
2699
- }
2700
- //#endregion
2701
- //#region src/utils/options.ts
2702
- function resolveBooleanObjectOption(value, enabledValue) {
2703
- if (!value) return false;
2704
- if (value === true) return enabledValue;
2705
- return value;
2706
- }
2707
- function normalizeStringListOption(value) {
2708
- if (!value) return;
2709
- const values = typeof value === "string" ? [value] : Array.isArray(value) ? value : void 0;
2710
- if (!values) return;
2711
- const normalized = values.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
2712
- return normalized.length > 0 ? normalized : void 0;
2713
- }
2714
- //#endregion
2715
- //#region src/tailwindcss/runtime-options.ts
2716
- function resolveTailwindcssOptions(options) {
2717
- return options?.tailwindcss ?? options?.tailwind;
2718
- }
2719
- function normalizeExtendLengthUnits(value) {
2720
- if (value === void 0) return;
2721
- const resolved = resolveBooleanObjectOption(value, { enabled: true });
2722
- return resolved && typeof resolved === "object" ? {
2723
- enabled: true,
2724
- ...resolved
2725
- } : resolved;
2726
- }
2727
- function normalizeTailwindcssRuntimeOptions(options) {
2728
- return options;
2729
- }
2730
- /** 清除可选字段中的 undefined,再交给引擎候选校验与生成契约。 */
2731
- function resolveRuntimeBareArbitraryValues(options) {
2732
- const value = resolveTailwindcssOptions(options)?.v4?.bareArbitraryValues;
2733
- return value && typeof value === "object" ? value.units === void 0 ? {} : { units: value.units } : value;
2734
- }
2735
- //#endregion
2736
- //#region src/utils/object.ts
2737
- function definedEntries(value) {
2738
- return Object.entries(value).filter(([, item]) => item !== void 0);
2739
- }
2740
- function omitUndefined(value) {
2741
- return Object.fromEntries(definedEntries(value));
2742
- }
2743
- //#endregion
2744
- //#region src/context/workspace.ts
2745
- const IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
2746
- "node_modules",
2747
- ".git",
2748
- ".hg",
2749
- ".svn",
2750
- ".turbo",
2751
- ".output",
2752
- ".next",
2753
- "dist",
2754
- "build"
2755
- ]);
2756
- function findWorkspaceRoot(startDir) {
2757
- if (!startDir) return;
2758
- let current = node_path.default.resolve(startDir);
2759
- while (true) {
2760
- const workspaceFile = node_path.default.join(current, "pnpm-workspace.yaml");
2761
- if ((0, node_fs.existsSync)(workspaceFile)) return current;
2762
- const parent = node_path.default.dirname(current);
2763
- if (parent === current) return;
2764
- current = parent;
2765
- }
2766
- }
2767
- function findNearestPackageRoot(startDir) {
2768
- if (!startDir) return;
2769
- let current = node_path.default.resolve(startDir);
2770
- while (true) {
2771
- const pkgPath = node_path.default.join(current, "package.json");
2772
- if ((0, node_fs.existsSync)(pkgPath)) return current;
2773
- const parent = node_path.default.dirname(current);
2774
- if (parent === current) return;
2775
- current = parent;
2776
- }
2777
- }
2778
- function findWorkspacePackageDir(rootDir, packageName) {
2779
- const visited = /* @__PURE__ */ new Set();
2780
- const queue = [node_path.default.resolve(rootDir)];
2781
- while (queue.length > 0) {
2782
- const current = queue.shift();
2783
- const normalized = node_path.default.normalize(current);
2784
- if (visited.has(normalized)) continue;
2785
- visited.add(normalized);
2786
- try {
2787
- const pkgPath = node_path.default.join(normalized, "package.json");
2788
- if ((0, node_fs.existsSync)(pkgPath)) {
2789
- if (JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf8"))?.name === packageName) return normalized;
2790
- }
2791
- } catch {}
2792
- let entries;
2793
- try {
2794
- entries = (0, node_fs.readdirSync)(normalized, { withFileTypes: true });
2795
- } catch {
2796
- continue;
2797
- }
2798
- for (const entry of entries) {
2799
- if (!entry.isDirectory() || IGNORED_WORKSPACE_DIRS.has(entry.name) || entry.isSymbolicLink?.()) continue;
2800
- queue.push(node_path.default.join(normalized, entry.name));
2801
- }
2802
- }
2803
- }
2804
- //#endregion
2805
- //#region src/tailwindcss/v4/css-entries.ts
2806
- const TAILWIND_V4_CSS_ENTRY_RE = /\.css(?:[?#].*)?$/i;
2807
- function isTailwindV4CssEntry(entry) {
2808
- return typeof entry === "string" && TAILWIND_V4_CSS_ENTRY_RE.test(entry.trim());
2809
- }
2810
- function guessBasedirFromEntries(entries) {
2811
- if (!entries) return;
2812
- for (const entry of entries) {
2813
- if (typeof entry !== "string") continue;
2814
- const trimmed = entry.trim();
2815
- if (!trimmed || !node_path.default.isAbsolute(trimmed)) continue;
2816
- if (!isTailwindV4CssEntry(trimmed)) continue;
2817
- const entryDir = node_path.default.dirname(trimmed);
2818
- const resolved = findNearestPackageRoot(entryDir) ?? entryDir;
2819
- if (resolved) return resolved;
2820
- }
2821
- }
2822
- function normalizeCssEntries(entries, anchor) {
2823
- if (!entries || entries.length === 0) return;
2824
- const normalized = /* @__PURE__ */ new Set();
2825
- for (const entry of entries) {
2826
- if (typeof entry !== "string") continue;
2827
- const trimmed = entry.trim();
2828
- if (trimmed.length === 0) continue;
2829
- if (!isTailwindV4CssEntry(trimmed)) continue;
2830
- const resolved = node_path.default.isAbsolute(trimmed) ? node_path.default.normalize(trimmed) : node_path.default.normalize(node_path.default.resolve(anchor, trimmed));
2831
- normalized.add(resolved);
2832
- }
2833
- return normalized.size > 0 ? [...normalized] : void 0;
2834
- }
2835
- function isSubPath(parent, child) {
2836
- if (!parent || !child) return false;
2837
- const relative = node_path.default.relative(parent, child);
2838
- return relative === "" || !relative.startsWith("..") && !node_path.default.isAbsolute(relative);
2839
- }
2840
- function resolveCssEntryBase(entryDir, options) {
2841
- const normalizedDir = node_path.default.normalize(entryDir);
2842
- const { preferredBaseDir, workspaceRoot } = options;
2843
- if (preferredBaseDir && isSubPath(preferredBaseDir, normalizedDir)) return preferredBaseDir;
2844
- if (workspaceRoot && isSubPath(workspaceRoot, normalizedDir)) return workspaceRoot;
2845
- const packageRoot = findNearestPackageRoot(normalizedDir);
2846
- if (packageRoot) return node_path.default.normalize(packageRoot);
2847
- return normalizedDir;
2848
- }
2849
- function groupCssEntriesByBase(entries, options = {}) {
2850
- const normalizedOptions = {
2851
- preferredBaseDir: options.preferredBaseDir ? node_path.default.normalize(options.preferredBaseDir) : void 0,
2852
- workspaceRoot: options.workspaceRoot ? node_path.default.normalize(options.workspaceRoot) : void 0
2853
- };
2854
- const groups = /* @__PURE__ */ new Map();
2855
- for (const entry of entries) {
2856
- const baseDir = resolveCssEntryBase(node_path.default.dirname(entry), normalizedOptions);
2857
- const bucket = groups.get(baseDir);
2858
- if (bucket) bucket.push(entry);
2859
- else groups.set(baseDir, [entry]);
2860
- }
2861
- return groups;
2862
- }
2863
- //#endregion
2864
- //#region src/tailwindcss/v4/css-sources.ts
2865
- function hasCssEntriesValue(value) {
2866
- if (typeof value === "string") return isTailwindV4CssEntry(value);
2867
- return Array.isArray(value) && value.some(isTailwindV4CssEntry);
2868
- }
2869
- function hasCssSourcesValue(value) {
2870
- return Array.isArray(value) && value.some((source) => {
2871
- const file = source?.file;
2872
- return typeof source === "object" && source !== null && typeof file === "string" && isTailwindV4CssEntry(file) && typeof source.css === "string" && source.css.trim().length > 0;
2873
- });
2874
- }
2875
- function isTailwindV4CssSourceRoot(source) {
2876
- return typeof source === "object" && source !== null && typeof source.file === "string" && isTailwindV4CssEntry(source.file);
2877
- }
2878
- function filterTailwindV4CssSourceRoots(sources) {
2879
- const filtered = sources?.filter(isTailwindV4CssSourceRoot);
2880
- return filtered && filtered.length > 0 ? filtered : void 0;
2881
- }
2882
- function hasConfiguredTailwindV4CssRoots(options) {
2883
- return hasCssEntriesValue(options.cssEntries) || hasCssEntriesValue(options.tailwindcss?.v4?.cssEntries) || hasCssEntriesValue(options.tailwindcssRuntimeOptions?.tailwindcss?.v4?.cssEntries) || hasCssSourcesValue(options.tailwindcss?.v4?.cssSources) || hasCssSourcesValue(options.tailwindcssRuntimeOptions?.tailwindcss?.v4?.cssSources);
2884
- }
2885
- function normalizeCssSourceFile(file) {
2886
- if (!file) return;
2887
- return node_path.default.isAbsolute(file) ? node_path.default.normalize(file) : file;
2888
- }
2889
- function normalizeCssSourceBase(base) {
2890
- if (!base) return;
2891
- return node_path.default.resolve(base);
2892
- }
2893
- function normalizeDependencies(dependencies) {
2894
- return dependencies?.map(normalizeCssSourceFile).filter((dependency) => typeof dependency === "string" && dependency.length > 0);
2895
- }
2896
- function isSameCssSource(a, b) {
2897
- 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));
2898
- }
2899
- function upsertTailwindV4CssSource(opts, source) {
2900
- if (!isTailwindV4CssEntry(source.file)) return false;
2901
- const normalizedSource = omitUndefined({
2902
- ...source,
2903
- ...source.base === void 0 ? {} : { base: normalizeCssSourceBase(source.base) },
2904
- ...source.file === void 0 ? {} : { file: normalizeCssSourceFile(source.file) },
2905
- ...source.dependencies === void 0 ? {} : { dependencies: normalizeDependencies(source.dependencies) }
2906
- });
2907
- const tailwindcss = opts.tailwindcss ?? {};
2908
- const v4 = tailwindcss.v4 ?? {};
2909
- const cssSources = [...v4.cssSources ?? []];
2910
- const sourceFile = normalizeCssSourceFile(normalizedSource.file);
2911
- const existingIndex = cssSources.findIndex((candidate) => normalizeCssSourceFile(candidate.file) === sourceFile);
2912
- if (existingIndex >= 0) {
2913
- const existing = cssSources[existingIndex];
2914
- if (!existing) {
2915
- cssSources[existingIndex] = normalizedSource;
2916
- return true;
2917
- }
2918
- const nextSource = {
2919
- ...existing,
2920
- ...normalizedSource
2921
- };
2922
- if (isSameCssSource(existing, nextSource)) return false;
2923
- cssSources[existingIndex] = nextSource;
2924
- } else cssSources.push(normalizedSource);
2925
- opts.tailwindcss = {
2926
- ...tailwindcss,
2927
- v4: {
2928
- ...v4,
2929
- cssSources
2930
- }
2931
- };
2932
- return true;
2933
- }
2934
- function removeTailwindV4CssSource(opts, file) {
2935
- const tailwindcss = opts.tailwindcss;
2936
- const v4 = tailwindcss?.v4;
2937
- const cssSources = v4?.cssSources;
2938
- if (!cssSources || cssSources.length === 0) return false;
2939
- const sourceFile = normalizeCssSourceFile(file);
2940
- const nextCssSources = cssSources.filter((source) => normalizeCssSourceFile(source.file) !== sourceFile);
2941
- if (nextCssSources.length === cssSources.length) return false;
2942
- opts.tailwindcss = {
2943
- ...tailwindcss,
2944
- v4: {
2945
- ...v4,
2946
- cssSources: nextCssSources
2947
- }
2948
- };
2949
- return true;
2950
- }
2951
- //#endregion
2952
- //#region src/tailwindcss/v4-engine/source.ts
2953
- const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
2954
- function isCssEntryPoint(file) {
2955
- return typeof file === "string" && node_path.default.basename(file) === "index.css" && (0, node_fs.existsSync)(file);
2956
- }
2957
- function resolvePackageCssEntryPoint(specifier) {
2958
- try {
2959
- const resolved = require$1.resolve(specifier);
2960
- if (isCssEntryPoint(resolved)) return resolved;
2961
- } catch {}
2962
- const packageName = specifier.replace(/\/index\.css$/, "");
2963
- if (packageName !== "tailwindcss") return;
2964
- try {
2965
- const packageJson = require$1.resolve(`${packageName}/package.json`);
2966
- const cssEntry = node_path.default.resolve(node_path.default.dirname(packageJson), "index.css");
2967
- if (isCssEntryPoint(cssEntry)) return cssEntry;
2968
- } catch {}
2969
- try {
2970
- let current = node_path.default.dirname(require$1.resolve("@tailwindcss-mangle/engine"));
2971
- while (true) {
2972
- const cssEntry = node_path.default.resolve(current, "..", "tailwindcss", "index.css");
2973
- if (isCssEntryPoint(cssEntry)) return cssEntry;
2974
- const parent = node_path.default.dirname(current);
2975
- if (parent === current) break;
2976
- current = parent;
2977
- }
2978
- } catch {}
2979
- }
2980
- function isPostcssPluginImportTarget(value) {
2981
- if (!value) return false;
2982
- return value === "@tailwindcss/postcss" || value.includes("/postcss");
2983
- }
2984
- function uniqueDefined(values) {
2985
- return [...new Set(values.filter((value) => typeof value === "string" && value.length > 0))];
2986
- }
2987
- function resolveCssImportFile(base, specifier) {
2988
- const normalizedSpecifier = node_path.default.sep === "\\" ? specifier.replaceAll("/", "\\") : specifier.replaceAll("\\", "/");
2989
- return node_path.default.resolve(base, normalizedSpecifier);
2990
- }
2991
- function getProjectRoot(runtime) {
2992
- return runtime.options?.projectRoot ?? node_process.default.cwd();
2993
- }
2994
- function resolveBase(value, fallback) {
2995
- return value === void 0 ? fallback : node_path.default.isAbsolute(value) ? node_path.default.resolve(value) : node_path.default.resolve(fallback, value);
2996
- }
2997
- function resolveConfigDir(config, projectRoot) {
2998
- if (!config) return;
2999
- const configPath = node_path.default.isAbsolute(config) ? config : node_path.default.resolve(projectRoot, config);
3000
- return node_path.default.dirname(configPath);
3001
- }
3002
- function isBarePackageSpecifier(specifier) {
3003
- return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("#") && !specifier.includes("\\") && !/^[a-z][a-z\d+.-]*:/i.test(specifier);
3004
- }
3005
- function isPackageJsonImportSpecifier(specifier) {
3006
- return typeof specifier === "string" && specifier.startsWith("#");
3007
- }
3008
- function createTailwindV4CssImportSpecifierSet(packageName) {
3009
- const specifiers = /* @__PURE__ */ new Set(["tailwindcss"]);
3010
- if (packageName && isBarePackageSpecifier(packageName)) specifiers.add(packageName);
3011
- return specifiers;
3012
- }
3013
- function normalizeTailwindV4CssPackageImports(css, packageName) {
3014
- if (!css.includes("tailwindcss")) return css;
3015
- let root;
3016
- try {
3017
- root = _weapp_tailwindcss_postcss.postcss.parse(css);
3018
- } catch {
3019
- return css;
3020
- }
3021
- const importSpecifiers = createTailwindV4CssImportSpecifierSet(packageName);
3022
- let changed = false;
3023
- root.walkAtRules((rule) => {
3024
- if (rule.name !== "import" && rule.name !== "reference") return;
3025
- const parsed = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(rule.params);
3026
- if (!parsed || !importSpecifiers.has(parsed.specifier)) return;
3027
- const cssEntryPoint = resolvePackageCssEntryPoint(`${parsed.specifier}/index.css`);
3028
- if (!cssEntryPoint) return;
3029
- rule.params = rule.params.replace(parsed.raw, (0, _weapp_tailwindcss_postcss.quoteCssImportSpecifier)(cssEntryPoint, parsed.quote));
3030
- changed = true;
3031
- });
3032
- return changed ? root.toString() : css;
3033
- }
3034
- function normalizeTailwindV4CssSources(cssSources, packageName, projectRoot) {
3035
- if (!cssSources?.length) return cssSources;
3036
- let changed = false;
3037
- const normalizedCssSources = cssSources.map((cssSource) => {
3038
- const file = typeof cssSource.file === "string" && cssSource.file.length > 0 ? node_path.default.isAbsolute(cssSource.file) ? node_path.default.resolve(cssSource.file) : node_path.default.resolve(projectRoot ?? node_process.default.cwd(), cssSource.file) : void 0;
3039
- const base = typeof cssSource.base === "string" && cssSource.base.length > 0 ? node_path.default.isAbsolute(cssSource.base) ? node_path.default.resolve(cssSource.base) : node_path.default.resolve(projectRoot ?? node_process.default.cwd(), cssSource.base) : file ? node_path.default.dirname(file) : void 0;
3040
- if (typeof cssSource.css !== "string") {
3041
- if (file === cssSource.file && base === cssSource.base) return cssSource;
3042
- changed = true;
3043
- return {
3044
- ...cssSource,
3045
- ...base === void 0 ? {} : { base },
3046
- ...file === void 0 ? {} : { file }
3047
- };
3048
- }
3049
- const configBase = base ?? projectRoot ?? node_process.default.cwd();
3050
- const css = normalizeTailwindV4CssPackageImports(normalizeEmptyTailwindCustomVariants(normalizeTailwindConfigDirectives(cssSource.css, configBase)), packageName);
3051
- if (css === cssSource.css && file === cssSource.file && base === cssSource.base) return cssSource;
3052
- changed = true;
3053
- return {
3054
- ...cssSource,
3055
- css,
3056
- ...base === void 0 ? {} : { base },
3057
- ...file === void 0 ? {} : { file }
3058
- };
3059
- });
3060
- return changed ? normalizedCssSources : cssSources;
3061
- }
3062
- function normalizeTailwindV4CssEntrySources(cssEntries, packageName) {
3063
- if (!cssEntries?.length) return;
3064
- const remainingCssEntries = [];
3065
- const cssSources = [];
3066
- const graphs = /* @__PURE__ */ new Map();
3067
- const collectCssGraph = (file, visiting = /* @__PURE__ */ new Set()) => {
3068
- const normalizedFile = node_path.default.resolve(file);
3069
- const cached = graphs.get(normalizedFile);
3070
- if (cached) return cached;
3071
- const graph = /* @__PURE__ */ new Set([normalizedFile]);
3072
- graphs.set(normalizedFile, graph);
3073
- if (visiting.has(normalizedFile) || !(0, node_fs.existsSync)(normalizedFile)) return graph;
3074
- const nextVisiting = new Set(visiting).add(normalizedFile);
3075
- let root;
3076
- try {
3077
- root = _weapp_tailwindcss_postcss.postcss.parse((0, node_fs.readFileSync)(normalizedFile, "utf8"));
3078
- } catch {
3079
- return graph;
3080
- }
3081
- const base = node_path.default.dirname(normalizedFile);
3082
- root.walkAtRules("import", (rule) => {
3083
- const parsed = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(rule.params);
3084
- if (!parsed || !parsed.specifier.startsWith(".")) return;
3085
- const importedFile = resolveCssImportFile(base, parsed.specifier);
3086
- const resolved = (node_path.default.extname(importedFile) ? [importedFile] : [
3087
- importedFile,
3088
- `${importedFile}.css`,
3089
- `${importedFile}.pcss`,
3090
- `${importedFile}.scss`,
3091
- `${importedFile}.sass`
3092
- ]).find((candidate) => (0, node_fs.existsSync)(candidate));
3093
- if (!resolved) return;
3094
- for (const dependency of collectCssGraph(resolved, nextVisiting)) graph.add(dependency);
3095
- });
3096
- return graph;
3097
- };
3098
- const createCssSource = (file, dependencies) => {
3099
- const normalizedFile = node_path.default.resolve(file);
3100
- const base = node_path.default.dirname(normalizedFile);
3101
- const rawCss = (0, node_fs.readFileSync)(normalizedFile, "utf8");
3102
- const entrySource = resolveCssEntrySource(rawCss, base, { removeConfig: false });
3103
- return {
3104
- file: normalizedFile,
3105
- base,
3106
- css: normalizeTailwindV4CssPackageImports(normalizeEmptyTailwindCustomVariants(normalizeConfigDirective(rawCss, entrySource?.config && (0, node_fs.existsSync)(entrySource.config) ? entrySource.config : entrySource?.configRequest && !node_path.default.isAbsolute(entrySource.configRequest) && !isPackageJsonImportSpecifier(entrySource.configRequest) ? node_path.default.resolve(base, entrySource.configRequest) : entrySource?.config)), packageName),
3107
- dependencies: [...dependencies]
3108
- };
3109
- };
3110
- const rootEntries = [];
3111
- for (const cssEntry of cssEntries) {
3112
- const normalizedCssEntry = cssEntry.replace(/[?#].*$/, "");
3113
- const file = node_path.default.resolve(normalizedCssEntry);
3114
- if (!(0, node_fs.existsSync)(file)) {
3115
- remainingCssEntries.push(normalizedCssEntry);
3116
- continue;
3117
- }
3118
- rootEntries.push(file);
3119
- }
3120
- const entryGraphs = rootEntries.map((entry) => [entry, collectCssGraph(entry)]);
3121
- const nestedEntries = /* @__PURE__ */ new Set();
3122
- for (const [entry] of entryGraphs) for (const [otherEntry, otherGraph] of entryGraphs) if (entry !== otherEntry && otherGraph.has(entry)) {
3123
- nestedEntries.add(entry);
3124
- break;
3125
- }
3126
- const selectedEntries = entryGraphs.filter(([entry]) => !nestedEntries.has(entry));
3127
- const roots = selectedEntries.length > 0 ? selectedEntries : entryGraphs.slice(0, 1);
3128
- for (const [rootEntry, dependencies] of roots) cssSources.push(createCssSource(rootEntry, dependencies));
3129
- return {
3130
- cssEntries: remainingCssEntries,
3131
- cssSources
3132
- };
3133
- }
3134
- function normalizeTailwindV4SourceOptions(options) {
3135
- if (!options) return options;
3136
- const cssBase = resolveBase(options.base, options.projectRoot ?? options.cwd ?? node_process.default.cwd());
3137
- const css = options.css === void 0 ? void 0 : normalizeTailwindV4CssPackageImports(normalizeEmptyTailwindCustomVariants(normalizeTailwindConfigDirectives(options.css, cssBase)), options.packageName);
3138
- const entrySources = normalizeTailwindV4CssEntrySources(options.cssEntries, options.packageName);
3139
- const configuredCssSources = filterTailwindV4CssSourceRoots(options.cssSources);
3140
- const cssSources = normalizeTailwindV4CssSources(configuredCssSources || entrySources?.cssSources ? [...configuredCssSources ?? [], ...entrySources?.cssSources ?? []] : void 0, options.packageName, options.projectRoot);
3141
- const cssEntries = entrySources?.cssEntries ?? options.cssEntries;
3142
- if (css === options.css && cssSources === options.cssSources && cssEntries === options.cssEntries) return options;
3143
- return {
3144
- ...options,
3145
- ...css === void 0 ? {} : { css },
3146
- ...cssEntries === void 0 ? {} : { cssEntries },
3147
- ...cssSources === void 0 ? {} : { cssSources }
3148
- };
3149
- }
3150
- function resolveTailwindCssImportTarget(runtime) {
3151
- const configuredPackageName = resolveTailwindcssOptions(runtime.options)?.packageName;
3152
- if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) return configuredPackageName;
3153
- const packageName = runtime.packageInfo?.name;
3154
- if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) return packageName;
3155
- return "tailwindcss";
3156
- }
3157
- function readTailwindV4Options(runtime) {
3158
- return resolveTailwindcssOptions(runtime.options)?.v4 ?? runtime.options?.tailwind?.v4;
3159
- }
3160
- function isRawTailwindcssPatchOptions(options) {
3161
- return Boolean(options && "tailwindcss" in options);
3162
- }
3163
- function resolveEngineTailwindV4SourceOptions(runtime) {
3164
- if (runtime.options) {
3165
- const projectRoot = getProjectRoot(runtime);
3166
- const tailwindOptions = resolveTailwindcssOptions(runtime.options);
3167
- const tailwindV4Options = readTailwindV4Options(runtime);
3168
- const cwd = resolveBase(tailwindOptions?.cwd, projectRoot);
3169
- const configuredBase = tailwindV4Options?.configuredBase ?? (isRawTailwindcssPatchOptions(runtime.options) ? tailwindV4Options?.base : void 0);
3170
- const baseFallbacks = uniqueDefined([
3171
- configuredBase,
3172
- cwd,
3173
- projectRoot,
3174
- resolveConfigDir(tailwindOptions?.config, projectRoot)
3175
- ]);
3176
- return {
3177
- projectRoot,
3178
- cwd,
3179
- ...configuredBase === void 0 ? {} : { base: configuredBase },
3180
- baseFallbacks,
3181
- ...tailwindV4Options?.cssSources === void 0 ? {} : { cssSources: tailwindV4Options.cssSources },
3182
- ...tailwindV4Options?.cssEntries === void 0 ? {} : { cssEntries: tailwindV4Options.cssEntries },
3183
- packageName: resolveTailwindCssImportTarget(runtime)
3184
- };
3185
- }
3186
- return {
3187
- projectRoot: getProjectRoot(runtime),
3188
- packageName: resolveTailwindCssImportTarget(runtime)
3189
- };
3190
- }
3191
- function resolveTailwindV4SourceOptionsFromRuntime(runtime) {
3192
- const tailwindV4Options = readTailwindV4Options(runtime);
3193
- return normalizeTailwindV4SourceOptions(omitUndefined({
3194
- ...resolveEngineTailwindV4SourceOptions(runtime),
3195
- sources: tailwindV4Options?.sources
3196
- }));
3197
- }
3198
- function resolveTailwindV4Source(options) {
3199
- const normalizedOptions = normalizeTailwindV4SourceOptions(options);
3200
- return (0, _tailwindcss_mangle_engine.resolveTailwindV4Source)(normalizedOptions);
3201
- }
3202
- function resolveTailwindV4SourceFromRuntimeOptions(options) {
3203
- const projectRoot = options?.projectRoot ?? node_process.default.cwd();
3204
- const tailwindOptions = options?.tailwindcss;
3205
- const v4Options = tailwindOptions?.v4;
3206
- return resolveTailwindV4Source({
3207
- projectRoot,
3208
- cwd: resolveBase(tailwindOptions?.cwd, projectRoot),
3209
- packageName: tailwindOptions?.packageName ?? "tailwindcss",
3210
- ...v4Options ?? {}
3211
- });
3212
- }
3213
- async function resolveTailwindV4SourceFromRuntime(runtime) {
3214
- return resolveTailwindV4Source(resolveTailwindV4SourceOptionsFromRuntime(runtime));
3215
- }
3216
- //#endregion
3217
- //#region src/runtime-branch/create-branch.ts
3218
- function createRuntimeBranch(base, platformFamily, options) {
3219
- const { context, tailwindcssVersion } = base;
3220
- return {
3221
- tailwindcssVersion,
3222
- generatorTarget: context.generatorTarget,
3223
- platformFamily,
3224
- platform: options.platform,
3225
- nativeAppPlatform: options.nativeAppPlatform,
3226
- isTailwindV4: tailwindcssVersion === 4,
3227
- isWeb: platformFamily === "web",
3228
- isMiniProgram: platformFamily === "mini-program",
3229
- isNativeApp: platformFamily === "native-app"
3230
- };
3231
- }
3232
- //#endregion
3233
- //#region src/runtime-branch/mini-program.ts
3234
- function createMiniProgramRuntimeBranch(base) {
3235
- const { context, uniUtsPlatform } = base;
3236
- return createRuntimeBranch(base, "mini-program", { platform: typeof context.platform === "string" && context.platform.length > 0 ? context.platform : uniUtsPlatform.isMp ? uniUtsPlatform.normalized : context.platform });
3237
- }
3238
- //#endregion
3239
- //#region src/utils/uni-platform.ts
3240
- function resolveUniUtsPlatform(value = node_process.default.env["UNI_UTS_PLATFORM"]) {
3241
- return require_framework.resolveUniUtsPlatform(value);
3242
- }
3243
- //#endregion
3244
- //#region src/runtime-branch/platform.ts
3245
- function isRuntimeUniAppXEnabled(value) {
3246
- return value === true || typeof value === "object" && value?.enabled !== false;
3247
- }
3248
- function normalizeRuntimeUniUtsPlatform(value) {
3249
- return typeof value === "object" && value !== null ? value : resolveUniUtsPlatform(value);
3250
- }
3251
- function resolveNativeAppPlatform(platform) {
3252
- if (platform.isAppAndroid) return "android";
3253
- if (platform.isAppIos) return "ios";
3254
- if (platform.isAppHarmony) return "harmony";
3255
- return "unknown";
3256
- }
3257
- function resolveExplicitOrEnvPlatform(context, uniUtsPlatform) {
3258
- if (typeof context.platform === "string" && context.platform.length > 0) return context.platform;
3259
- return uniUtsPlatform.normalized;
3260
- }
3261
- //#endregion
3262
- //#region src/runtime-branch/native-app.ts
3263
- function createNativeAppRuntimeBranch(base) {
3264
- return createRuntimeBranch(base, "native-app", {
3265
- platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform),
3266
- nativeAppPlatform: resolveNativeAppPlatform(base.uniUtsPlatform)
3267
- });
3268
- }
3269
- //#endregion
3270
- //#region src/runtime-branch/tailwind-version.ts
3271
- function resolveTailwindcssBranchVersion(_majorVersion) {
3272
- return 4;
3273
- }
3274
- //#endregion
3275
- //#region src/runtime-branch/web.ts
3276
- function createWebRuntimeBranch(base) {
3277
- return createRuntimeBranch(base, "web", { platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform) });
3278
- }
3279
- //#endregion
3280
- //#region src/runtime-branch/index.ts
3281
- function shouldUseNativeAppBranch(base, uniUtsPlatform) {
3282
- return base.appType === "uni-app-x" && isRuntimeUniAppXEnabled(base.uniAppX) && uniUtsPlatform.isApp;
3283
- }
3284
- function resolveRuntimeBranch(context) {
3285
- const uniUtsPlatform = normalizeRuntimeUniUtsPlatform(context.uniUtsPlatform);
3286
- const base = {
3287
- context,
3288
- tailwindcssVersion: resolveTailwindcssBranchVersion(context.tailwindcssMajorVersion),
3289
- uniUtsPlatform
3290
- };
3291
- if (context.generatorTarget === "web") return createWebRuntimeBranch(base);
3292
- if (shouldUseNativeAppBranch(context, uniUtsPlatform)) return createNativeAppRuntimeBranch(base);
3293
- return createMiniProgramRuntimeBranch(base);
3294
- }
3295
- function resolveGeneratorRuntimeBranch(options, context = {}) {
3296
- return options.branch ?? resolveRuntimeBranch({
3297
- ...context,
3298
- generatorTarget: options.target
3299
- });
3300
- }
3301
- function shouldUseMiniProgramCssBranch(branch) {
3302
- return branch.platformFamily === "mini-program" || branch.platformFamily === "native-app";
3303
- }
3304
- function shouldUseNativeAppCssBranch(branch) {
3305
- return branch.platformFamily === "native-app";
3306
- }
3307
- //#endregion
3308
- //#region src/generator/options.ts
3309
- function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
3310
- const enabled = options !== false;
3311
- const objectOptions = enabled ? options : void 0;
3312
- const target = objectOptions?.target ?? (shouldUseUniAppViteWebViewGeneratorTarget(context.appType, context.platform) ? "web" : inferGeneratorTargetFromEnv());
3313
- const branch = resolveRuntimeBranch({
3314
- ...context,
3315
- generatorTarget: target
3316
- });
3317
- const hasExplicitTarget = objectOptions !== void 0 && Object.hasOwn(objectOptions, "target");
3318
- const webCompat = objectOptions?.webCompat ?? (!hasExplicitTarget && branch.isWeb ? true : void 0);
3319
- if (objectOptions == null) return {
3320
- enabled,
3321
- target,
3322
- branch,
3323
- webCompat,
3324
- hmr: { preserveDeletedCss: true },
3325
- importFallback: false,
3326
- bareArbitraryValues: void 0
3327
- };
3328
- return {
3329
- enabled,
3330
- target,
3331
- branch,
3332
- config: objectOptions.config,
3333
- styleOptions: objectOptions.styleOptions,
3334
- webCompat,
3335
- hmr: { preserveDeletedCss: objectOptions.hmr?.preserveDeletedCss ?? true },
3336
- importFallback: objectOptions.importFallback ?? false,
3337
- bareArbitraryValues: objectOptions.bareArbitraryValues
3338
- };
3339
- }
3340
- //#endregion
3341
- //#region src/generator/index.ts
3342
- function createWeappTailwindcssGenerator(source) {
3343
- return createTailwindV4Engine(source);
3344
- }
3345
- async function resolveTailwindSourceFromRuntime(tailwindRuntime) {
3346
- return resolveTailwindV4SourceFromRuntime(tailwindRuntime);
3347
- }
3348
- async function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime) {
3349
- return createWeappTailwindcssGenerator(await resolveTailwindSourceFromRuntime(tailwindRuntime));
3350
- }
3351
- //#endregion
3352
- Object.defineProperty(exports, "FULL_SOURCE_SCAN_EXTENSION_RE", {
3353
- enumerable: true,
3354
- get: function() {
3355
- return FULL_SOURCE_SCAN_EXTENSION_RE;
3356
- }
3357
- });
3358
- Object.defineProperty(exports, "FULL_SOURCE_SCAN_PATTERN", {
3359
- enumerable: true,
3360
- get: function() {
3361
- return FULL_SOURCE_SCAN_PATTERN;
3362
- }
3363
- });
3364
- Object.defineProperty(exports, "GENERATOR_PLACEHOLDER_MARKER_RE", {
3365
- enumerable: true,
3366
- get: function() {
3367
- return GENERATOR_PLACEHOLDER_MARKER_RE;
3368
- }
3369
- });
3370
- Object.defineProperty(exports, "VITE_MARKER_RE", {
3371
- enumerable: true,
3372
- get: function() {
3373
- return VITE_MARKER_RE;
3374
- }
3375
- });
3376
- Object.defineProperty(exports, "_defineProperty", {
3377
- enumerable: true,
3378
- get: function() {
3379
- return _defineProperty;
3380
- }
3381
- });
3382
- Object.defineProperty(exports, "createCssAppend", {
3383
- enumerable: true,
3384
- get: function() {
3385
- return createCssAppend;
3386
- }
3387
- });
3388
- Object.defineProperty(exports, "createGeneratedThemeDeclarationResolver", {
3389
- enumerable: true,
3390
- get: function() {
3391
- return createGeneratedThemeDeclarationResolver;
3392
- }
3393
- });
3394
- Object.defineProperty(exports, "createTailwindV4Engine", {
3395
- enumerable: true,
3396
- get: function() {
3397
- return createTailwindV4Engine;
3398
- }
3399
- });
3400
- Object.defineProperty(exports, "createWeappTailwindcssGenerator", {
3401
- enumerable: true,
3402
- get: function() {
3403
- return createWeappTailwindcssGenerator;
3404
- }
3405
- });
3406
- Object.defineProperty(exports, "createWeappTailwindcssGeneratorFromRuntime", {
3407
- enumerable: true,
3408
- get: function() {
3409
- return createWeappTailwindcssGeneratorFromRuntime;
3410
- }
3411
- });
3412
- Object.defineProperty(exports, "expandTailwindSourceEntries", {
3413
- enumerable: true,
3414
- get: function() {
3415
- return expandTailwindSourceEntries;
3416
- }
3417
- });
3418
- Object.defineProperty(exports, "extractGeneratedCssForUserLayerSelectors", {
3419
- enumerable: true,
3420
- get: function() {
3421
- return extractGeneratedCssForUserLayerSelectors;
3422
- }
3423
- });
3424
- Object.defineProperty(exports, "filterApplyOnlyGeneratedCss", {
3425
- enumerable: true,
3426
- get: function() {
3427
- return filterApplyOnlyGeneratedCss;
3428
- }
3429
- });
3430
- Object.defineProperty(exports, "filterTailwindV4CssSourceRoots", {
3431
- enumerable: true,
3432
- get: function() {
3433
- return filterTailwindV4CssSourceRoots;
3434
- }
3435
- });
3436
- Object.defineProperty(exports, "filterUnsupportedMiniProgramTailwindV4Candidates", {
3437
- enumerable: true,
3438
- get: function() {
3439
- return filterUnsupportedMiniProgramTailwindV4Candidates;
3440
- }
3441
- });
3442
- Object.defineProperty(exports, "findNearestPackageRoot", {
3443
- enumerable: true,
3444
- get: function() {
3445
- return findNearestPackageRoot;
3446
- }
3447
- });
3448
- Object.defineProperty(exports, "findWorkspacePackageDir", {
3449
- enumerable: true,
3450
- get: function() {
3451
- return findWorkspacePackageDir;
3452
- }
3453
- });
3454
- Object.defineProperty(exports, "findWorkspaceRoot", {
3455
- enumerable: true,
3456
- get: function() {
3457
- return findWorkspaceRoot;
3458
- }
3459
- });
3460
- Object.defineProperty(exports, "getTailwindV4IncrementalGenerateCacheStats", {
3461
- enumerable: true,
3462
- get: function() {
3463
- return getTailwindV4IncrementalGenerateCacheStats;
3464
- }
3465
- });
3466
- Object.defineProperty(exports, "groupCssEntriesByBase", {
3467
- enumerable: true,
3468
- get: function() {
3469
- return groupCssEntriesByBase;
3470
- }
3471
- });
3472
- Object.defineProperty(exports, "guessBasedirFromEntries", {
3473
- enumerable: true,
3474
- get: function() {
3475
- return guessBasedirFromEntries;
3476
- }
3477
- });
3478
- Object.defineProperty(exports, "hasConfiguredTailwindV4CssRoots", {
3479
- enumerable: true,
3480
- get: function() {
3481
- return hasConfiguredTailwindV4CssRoots;
3482
- }
3483
- });
3484
- Object.defineProperty(exports, "hasLocalCssImport", {
3485
- enumerable: true,
3486
- get: function() {
3487
- return hasLocalCssImport;
3488
- }
3489
- });
3490
- Object.defineProperty(exports, "hasTailwindApplyDirective", {
3491
- enumerable: true,
3492
- get: function() {
3493
- return hasTailwindApplyDirective;
3494
- }
3495
- });
3496
- Object.defineProperty(exports, "hasTailwindGeneratedCss", {
3497
- enumerable: true,
3498
- get: function() {
3499
- return hasTailwindGeneratedCss;
3500
- }
3501
- });
3502
- Object.defineProperty(exports, "hasTailwindGeneratedCssMarkers", {
3503
- enumerable: true,
3504
- get: function() {
3505
- return hasTailwindGeneratedCssMarkers;
3506
- }
3507
- });
3508
- Object.defineProperty(exports, "hasTailwindNonRootGenerationDirectives", {
3509
- enumerable: true,
3510
- get: function() {
3511
- return hasTailwindNonRootGenerationDirectives;
3512
- }
3513
- });
3514
- Object.defineProperty(exports, "hasTailwindRootDirectives", {
3515
- enumerable: true,
3516
- get: function() {
3517
- return hasTailwindRootDirectives;
3518
- }
3519
- });
3520
- Object.defineProperty(exports, "hasTailwindRootImportDirectives", {
3521
- enumerable: true,
3522
- get: function() {
3523
- return hasTailwindRootImportDirectives;
3524
- }
3525
- });
3526
- Object.defineProperty(exports, "hasTailwindSourceDirectives", {
3527
- enumerable: true,
3528
- get: function() {
3529
- return hasTailwindSourceDirectives;
3530
- }
3531
- });
3532
- Object.defineProperty(exports, "hasUserCssLayerBlocks", {
3533
- enumerable: true,
3534
- get: function() {
3535
- return hasUserCssLayerBlocks;
3536
- }
3537
- });
3538
- Object.defineProperty(exports, "isCommentOnlyCss", {
3539
- enumerable: true,
3540
- get: function() {
3541
- return isCommentOnlyCss;
3542
- }
3543
- });
3544
- Object.defineProperty(exports, "isFileExcludedByTailwindSourceEntries", {
3545
- enumerable: true,
3546
- get: function() {
3547
- return isFileExcludedByTailwindSourceEntries;
3548
- }
3549
- });
3550
- Object.defineProperty(exports, "isFileMatchedByTailwindSourceEntries", {
3551
- enumerable: true,
3552
- get: function() {
3553
- return isFileMatchedByTailwindSourceEntries;
3554
- }
3555
- });
3556
- Object.defineProperty(exports, "isTailwindV4CssEntry", {
3557
- enumerable: true,
3558
- get: function() {
3559
- return isTailwindV4CssEntry;
3560
- }
3561
- });
3562
- Object.defineProperty(exports, "normalizeConfigDirective", {
3563
- enumerable: true,
3564
- get: function() {
3565
- return normalizeConfigDirective;
3566
- }
3567
- });
3568
- Object.defineProperty(exports, "normalizeCssEntries", {
3569
- enumerable: true,
3570
- get: function() {
3571
- return normalizeCssEntries;
3572
- }
3573
- });
3574
- Object.defineProperty(exports, "normalizeEmptyTailwindCustomVariants", {
3575
- enumerable: true,
3576
- get: function() {
3577
- return normalizeEmptyTailwindCustomVariants;
3578
- }
3579
- });
3580
- Object.defineProperty(exports, "normalizeExtendLengthUnits", {
3581
- enumerable: true,
3582
- get: function() {
3583
- return normalizeExtendLengthUnits;
3584
- }
3585
- });
3586
- Object.defineProperty(exports, "normalizeLegacyContentEntries", {
3587
- enumerable: true,
3588
- get: function() {
3589
- return normalizeLegacyContentEntries;
3590
- }
3591
- });
3592
- Object.defineProperty(exports, "normalizeStringListOption", {
3593
- enumerable: true,
3594
- get: function() {
3595
- return normalizeStringListOption;
3596
- }
3597
- });
3598
- Object.defineProperty(exports, "normalizeTailwindConfigDirectives", {
3599
- enumerable: true,
3600
- get: function() {
3601
- return normalizeTailwindConfigDirectives;
3602
- }
3603
- });
3604
- Object.defineProperty(exports, "normalizeTailwindSourceDirectives", {
3605
- enumerable: true,
3606
- get: function() {
3607
- return normalizeTailwindSourceDirectives;
3608
- }
3609
- });
3610
- Object.defineProperty(exports, "normalizeTailwindSourceForGenerator", {
3611
- enumerable: true,
3612
- get: function() {
3613
- return normalizeTailwindSourceForGenerator;
3614
- }
3615
- });
3616
- Object.defineProperty(exports, "normalizeTailwindcssRuntimeOptions", {
3617
- enumerable: true,
3618
- get: function() {
3619
- return normalizeTailwindcssRuntimeOptions;
3620
- }
3621
- });
3622
- Object.defineProperty(exports, "normalizeWeappTailwindcssGeneratorOptions", {
3623
- enumerable: true,
3624
- get: function() {
3625
- return normalizeWeappTailwindcssGeneratorOptions;
3626
- }
3627
- });
3628
- Object.defineProperty(exports, "omitUndefined", {
3629
- enumerable: true,
3630
- get: function() {
3631
- return omitUndefined;
3632
- }
3633
- });
3634
- Object.defineProperty(exports, "parseConfigParam", {
3635
- enumerable: true,
3636
- get: function() {
3637
- return parseConfigParam;
3638
- }
3639
- });
3640
- Object.defineProperty(exports, "parseImportRequest", {
3641
- enumerable: true,
3642
- get: function() {
3643
- return parseImportRequest;
3644
- }
3645
- });
3646
- Object.defineProperty(exports, "preferScopedGeneratedCssRules", {
3647
- enumerable: true,
3648
- get: function() {
3649
- return preferScopedGeneratedCssRules;
3650
- }
3651
- });
3652
- Object.defineProperty(exports, "prependConfigDirective", {
3653
- enumerable: true,
3654
- get: function() {
3655
- return prependConfigDirective;
3656
- }
3657
- });
3658
- Object.defineProperty(exports, "removeMiniProgramInteractiveSelectors", {
3659
- enumerable: true,
3660
- get: function() {
3661
- return removeMiniProgramInteractiveSelectors;
3662
- }
3663
- });
3664
- Object.defineProperty(exports, "removeTailwindSourceDirectives", {
3665
- enumerable: true,
3666
- get: function() {
3667
- return removeTailwindSourceDirectives;
3668
- }
3669
- });
3670
- Object.defineProperty(exports, "removeTailwindV4CssSource", {
3671
- enumerable: true,
3672
- get: function() {
3673
- return removeTailwindV4CssSource;
3674
- }
3675
- });
3676
- Object.defineProperty(exports, "removeTailwindV4GeneratedUserCssArtifacts", {
3677
- enumerable: true,
3678
- get: function() {
3679
- return removeTailwindV4GeneratedUserCssArtifacts;
3680
- }
3681
- });
3682
- Object.defineProperty(exports, "removeTailwindV4GeneratorAtRules", {
3683
- enumerable: true,
3684
- get: function() {
3685
- return removeTailwindV4GeneratorAtRules;
3686
- }
3687
- });
3688
- Object.defineProperty(exports, "resolveBooleanObjectOption", {
3689
- enumerable: true,
3690
- get: function() {
3691
- return resolveBooleanObjectOption;
3692
- }
3693
- });
3694
- Object.defineProperty(exports, "resolveCssEntrySource", {
3695
- enumerable: true,
3696
- get: function() {
3697
- return resolveCssEntrySource;
3698
- }
3699
- });
3700
- Object.defineProperty(exports, "resolveCssMacroTailwindV4Source", {
3701
- enumerable: true,
3702
- get: function() {
3703
- return resolveCssMacroTailwindV4Source;
3704
- }
3705
- });
3706
- Object.defineProperty(exports, "resolveCssSourceEntries", {
3707
- enumerable: true,
3708
- get: function() {
3709
- return resolveCssSourceEntries;
3710
- }
3711
- });
3712
- Object.defineProperty(exports, "resolveGeneratorRuntimeBranch", {
3713
- enumerable: true,
3714
- get: function() {
3715
- return resolveGeneratorRuntimeBranch;
3716
- }
3717
- });
3718
- Object.defineProperty(exports, "resolveRuntimeBareArbitraryValues", {
3719
- enumerable: true,
3720
- get: function() {
3721
- return resolveRuntimeBareArbitraryValues;
3722
- }
3723
- });
3724
- Object.defineProperty(exports, "resolveRuntimeBranch", {
3725
- enumerable: true,
3726
- get: function() {
3727
- return resolveRuntimeBranch;
3728
- }
3729
- });
3730
- Object.defineProperty(exports, "resolveSourceScanPath", {
3731
- enumerable: true,
3732
- get: function() {
3733
- return resolveSourceScanPath;
3734
- }
3735
- });
3736
- Object.defineProperty(exports, "resolveTailwindSourceFromRuntime", {
3737
- enumerable: true,
3738
- get: function() {
3739
- return resolveTailwindSourceFromRuntime;
3740
- }
3741
- });
3742
- Object.defineProperty(exports, "resolveTailwindV4CssSourceBase", {
3743
- enumerable: true,
3744
- get: function() {
3745
- return resolveTailwindV4CssSourceBase;
3746
- }
3747
- });
3748
- Object.defineProperty(exports, "resolveTailwindV4Source", {
3749
- enumerable: true,
3750
- get: function() {
3751
- return resolveTailwindV4Source;
3752
- }
3753
- });
3754
- Object.defineProperty(exports, "resolveTailwindV4SourceFromRuntime", {
3755
- enumerable: true,
3756
- get: function() {
3757
- return resolveTailwindV4SourceFromRuntime;
3758
- }
3759
- });
3760
- Object.defineProperty(exports, "resolveTailwindV4SourceFromRuntimeOptions", {
3761
- enumerable: true,
3762
- get: function() {
3763
- return resolveTailwindV4SourceFromRuntimeOptions;
3764
- }
3765
- });
3766
- Object.defineProperty(exports, "resolveTailwindV4SourceOptionsFromRuntime", {
3767
- enumerable: true,
3768
- get: function() {
3769
- return resolveTailwindV4SourceOptionsFromRuntime;
3770
- }
3771
- });
3772
- Object.defineProperty(exports, "resolveTailwindcssOptions", {
3773
- enumerable: true,
3774
- get: function() {
3775
- return resolveTailwindcssOptions;
3776
- }
3777
- });
3778
- Object.defineProperty(exports, "resolveUniUtsPlatform", {
3779
- enumerable: true,
3780
- get: function() {
3781
- return resolveUniUtsPlatform;
3782
- }
3783
- });
3784
- Object.defineProperty(exports, "shouldFilterApplyOnlyGeneratedCss", {
3785
- enumerable: true,
3786
- get: function() {
3787
- return shouldFilterApplyOnlyGeneratedCss;
3788
- }
3789
- });
3790
- Object.defineProperty(exports, "shouldUseMiniProgramCssBranch", {
3791
- enumerable: true,
3792
- get: function() {
3793
- return shouldUseMiniProgramCssBranch;
3794
- }
3795
- });
3796
- Object.defineProperty(exports, "shouldUseNativeAppCssBranch", {
3797
- enumerable: true,
3798
- get: function() {
3799
- return shouldUseNativeAppCssBranch;
3800
- }
3801
- });
3802
- Object.defineProperty(exports, "shouldUseUniAppWebRpxCompatibility", {
3803
- enumerable: true,
3804
- get: function() {
3805
- return shouldUseUniAppWebRpxCompatibility;
3806
- }
3807
- });
3808
- Object.defineProperty(exports, "splitGeneratorPlaceholderCssBySourceOrder", {
3809
- enumerable: true,
3810
- get: function() {
3811
- return splitGeneratorPlaceholderCssBySourceOrder;
3812
- }
3813
- });
3814
- Object.defineProperty(exports, "splitTailwindGeneratedCssByBanner", {
3815
- enumerable: true,
3816
- get: function() {
3817
- return splitTailwindGeneratedCssByBanner;
3818
- }
3819
- });
3820
- Object.defineProperty(exports, "splitTailwindV4GeneratedCssBySourceOrder", {
3821
- enumerable: true,
3822
- get: function() {
3823
- return splitTailwindV4GeneratedCssBySourceOrder;
3824
- }
3825
- });
3826
- Object.defineProperty(exports, "splitUserCssLayerBlocks", {
3827
- enumerable: true,
3828
- get: function() {
3829
- return splitUserCssLayerBlocks;
3830
- }
3831
- });
3832
- Object.defineProperty(exports, "stripGeneratorPlaceholderMarkers", {
3833
- enumerable: true,
3834
- get: function() {
3835
- return stripGeneratorPlaceholderMarkers;
3836
- }
3837
- });
3838
- Object.defineProperty(exports, "stripTailwindBanner", {
3839
- enumerable: true,
3840
- get: function() {
3841
- return stripTailwindBanner;
3842
- }
3843
- });
3844
- Object.defineProperty(exports, "stripTailwindBanners", {
3845
- enumerable: true,
3846
- get: function() {
3847
- return stripTailwindBanners;
3848
- }
3849
- });
3850
- Object.defineProperty(exports, "stripTailwindSourceMediaFragments", {
3851
- enumerable: true,
3852
- get: function() {
3853
- return stripTailwindSourceMediaFragments;
3854
- }
3855
- });
3856
- Object.defineProperty(exports, "stripUnmatchedTailwindSourceMediaCloseFragments", {
3857
- enumerable: true,
3858
- get: function() {
3859
- return stripUnmatchedTailwindSourceMediaCloseFragments;
3860
- }
3861
- });
3862
- Object.defineProperty(exports, "toPosixPath", {
3863
- enumerable: true,
3864
- get: function() {
3865
- return toPosixPath;
3866
- }
3867
- });
3868
- Object.defineProperty(exports, "transformGeneratorUserCss", {
3869
- enumerable: true,
3870
- get: function() {
3871
- return transformGeneratorUserCss;
3872
- }
3873
- });
3874
- Object.defineProperty(exports, "transformTailwindV4CssByTarget", {
3875
- enumerable: true,
3876
- get: function() {
3877
- return transformTailwindV4CssByTarget;
3878
- }
3879
- });
3880
- Object.defineProperty(exports, "transformTailwindV4CssToWeapp", {
3881
- enumerable: true,
3882
- get: function() {
3883
- return transformTailwindV4CssToWeapp;
3884
- }
3885
- });
3886
- Object.defineProperty(exports, "upsertTailwindV4CssSource", {
3887
- enumerable: true,
3888
- get: function() {
3889
- return upsertTailwindV4CssSource;
3890
- }
3891
- });