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