weapp-tailwindcss 5.0.12 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/auto-Ba6hDrse.mjs +13 -0
  4. package/dist/auto-DtU6f3X6.js +18 -0
  5. package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
  6. package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
  7. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +27 -10
  8. package/dist/bundlers/shared/generator-css/local-imports.d.ts +3 -0
  9. package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -0
  10. package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +6 -0
  11. package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +7 -0
  12. package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +3 -0
  13. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +15 -0
  14. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +12 -0
  15. package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +22 -0
  16. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +6 -23
  17. package/dist/bundlers/shared/generator-css/types.d.ts +15 -1
  18. package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -1
  19. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
  20. package/dist/bundlers/shared/run-tasks.d.ts +1 -0
  21. package/dist/bundlers/shared/v4-generation-core.d.ts +11 -0
  22. package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
  23. package/dist/bundlers/vite/css-memory.d.ts +37 -0
  24. package/dist/bundlers/vite/generate-bundle/bundle-file-names.d.ts +2 -0
  25. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +0 -1
  26. package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +8 -0
  27. package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +4 -0
  28. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -0
  29. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +9 -7
  30. package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +6 -0
  31. package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +12 -0
  32. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +63 -0
  33. package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +31 -0
  34. package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +80 -0
  35. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +53 -0
  36. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
  37. package/dist/bundlers/vite/generate-bundle/runtime-linked-css.d.ts +4 -0
  38. package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +21 -0
  39. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +5 -2
  40. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +30 -0
  41. package/dist/bundlers/vite/generate-bundle/timing.d.ts +1 -0
  42. package/dist/bundlers/vite/generate-bundle/types.d.ts +3 -1
  43. package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +20 -0
  44. package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +6 -0
  45. package/dist/bundlers/vite/generate-bundle.d.ts +4 -1
  46. package/dist/bundlers/vite/hot-css-modules.d.ts +5 -0
  47. package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -0
  48. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +3 -3
  49. package/dist/bundlers/vite/map-cache.d.ts +2 -0
  50. package/dist/bundlers/vite/processed-css-assets.d.ts +16 -0
  51. package/dist/bundlers/vite/resolve-app-type.d.ts +1 -2
  52. package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
  53. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -5
  54. package/dist/bundlers/vite/source-candidate-scan-signature.d.ts +13 -0
  55. package/dist/bundlers/vite/source-candidates/script.d.ts +1 -7
  56. package/dist/bundlers/vite/source-candidates.d.ts +12 -2
  57. package/dist/bundlers/vite/source-scan/css-entries.d.ts +3 -6
  58. package/dist/bundlers/vite/source-scan.d.ts +3 -3
  59. package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
  60. package/dist/bundlers/vite/utils.d.ts +1 -0
  61. package/dist/bundlers/vite/weapp-vite-config.d.ts +3 -1
  62. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +24 -0
  63. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -10
  64. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
  65. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +5 -1
  66. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +15 -1
  67. package/dist/bundlers/webpack/shared/css-loader-runtime.d.ts +1 -0
  68. package/dist/cache/index.d.ts +1 -0
  69. package/dist/cli/mount-options.d.ts +2 -2
  70. package/dist/cli.js +126 -439
  71. package/dist/cli.mjs +121 -434
  72. package/dist/context/index.d.ts +3 -3
  73. package/dist/context/style-options.d.ts +4 -1
  74. package/dist/context/tailwindcss.d.ts +1 -1
  75. package/dist/{precheck-30zNPRlI.js → context-BHxLe743.js} +484 -175
  76. package/dist/{precheck-CsFr1q2l.mjs → context-Mbzkek1q.mjs} +461 -159
  77. package/dist/core.js +15 -12
  78. package/dist/core.mjs +10 -7
  79. package/dist/css-macro.js +2 -2
  80. package/dist/css-macro.mjs +2 -2
  81. package/dist/{defaults-Boc26eel.js → defaults-CVcKbXBG.js} +6 -50
  82. package/dist/{defaults-DH0ZQRhy.mjs → defaults-ZElj1zKc.mjs} +7 -45
  83. package/dist/defaults.d.ts +1 -7
  84. package/dist/defaults.js +1 -2
  85. package/dist/defaults.mjs +2 -2
  86. package/dist/framework/index.d.ts +59 -0
  87. package/dist/framework.d.ts +1 -0
  88. package/dist/framework.js +198 -0
  89. package/dist/framework.mjs +180 -0
  90. package/dist/generator/index.d.ts +6 -7
  91. package/dist/generator/options.d.ts +3 -3
  92. package/dist/generator/types.d.ts +9 -10
  93. package/dist/generator-9rUz4Hcb.js +170 -0
  94. package/dist/generator-Dc4qaPmT.mjs +123 -0
  95. package/dist/generator.js +10 -16
  96. package/dist/generator.mjs +3 -3
  97. package/dist/{gulp-CxGZU0-v.js → gulp-B_sdP6dx.js} +80 -92
  98. package/dist/{gulp-BfZpaYSQ.mjs → gulp-uM36oIJs.mjs} +73 -85
  99. package/dist/gulp.js +1 -1
  100. package/dist/gulp.mjs +1 -1
  101. package/dist/{hmr-timing-DNjF8bWA.mjs → hmr-timing-BXMLsF4b.mjs} +1289 -909
  102. package/dist/{hmr-timing-DFR51wgo.js → hmr-timing-CogqkFaF.js} +1397 -939
  103. package/dist/index.d.ts +1 -0
  104. package/dist/index.js +20 -4
  105. package/dist/index.mjs +6 -5
  106. package/dist/js/fast-path/oxc.d.ts +4 -0
  107. package/dist/js/precheck.d.ts +1 -0
  108. package/dist/postcss.js +3 -4
  109. package/dist/postcss.mjs +2 -3
  110. package/dist/presets.js +10 -20
  111. package/dist/presets.mjs +9 -19
  112. package/dist/runtime-branch/create-branch.d.ts +2 -0
  113. package/dist/runtime-branch/generator-target-env.d.ts +4 -0
  114. package/dist/runtime-branch/index.d.ts +6 -0
  115. package/dist/runtime-branch/mini-program.d.ts +2 -0
  116. package/dist/runtime-branch/native-app.d.ts +2 -0
  117. package/dist/runtime-branch/platform.d.ts +6 -0
  118. package/dist/runtime-branch/tailwind-version.d.ts +2 -0
  119. package/dist/runtime-branch/types.d.ts +37 -0
  120. package/dist/runtime-branch/web.d.ts +2 -0
  121. package/dist/runtime-branch.d.ts +1 -0
  122. package/dist/{bundle-state-DU2ATDhw.js → source-candidate-scan-signature-2ybpptAK.js} +262 -20
  123. package/dist/{bundle-state-BxMNKjBV.mjs → source-candidate-scan-signature-Cvb5z1ha.mjs} +187 -17
  124. package/dist/tailwindcss/candidates.d.ts +7 -0
  125. package/dist/tailwindcss/index.d.ts +2 -2
  126. package/dist/tailwindcss/runtime/cache.d.ts +6 -6
  127. package/dist/tailwindcss/runtime-factory.d.ts +12 -0
  128. package/dist/tailwindcss/runtime-options.d.ts +8 -0
  129. package/dist/tailwindcss/runtime-types.d.ts +86 -0
  130. package/dist/tailwindcss/runtime.d.ts +6 -6
  131. package/dist/tailwindcss/source-scan.d.ts +1 -1
  132. package/dist/tailwindcss/targets.d.ts +2 -2
  133. package/dist/tailwindcss/v4/config.d.ts +3 -3
  134. package/dist/tailwindcss/v4/css-entries.d.ts +1 -0
  135. package/dist/tailwindcss/v4/css-sources.d.ts +4 -2
  136. package/dist/tailwindcss/v4/index.d.ts +1 -1
  137. package/dist/tailwindcss/v4/multi-runtime.d.ts +2 -0
  138. package/dist/tailwindcss/v4/runtime-factory.d.ts +15 -0
  139. package/dist/tailwindcss/v4/runtime-options.d.ts +2 -0
  140. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
  141. package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
  142. package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +3 -3
  143. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +1 -1
  144. package/dist/tailwindcss/v4-engine/generator.d.ts +10 -3
  145. package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
  146. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +7 -1
  147. package/dist/tailwindcss/v4-engine/source.d.ts +23 -6
  148. package/dist/tailwindcss/v4-engine/types.d.ts +8 -9
  149. package/dist/tailwindcss/version.d.ts +1 -1
  150. package/dist/tailwindcss-DHIYcqXT.js +1523 -0
  151. package/dist/tailwindcss-wyUHrfil.mjs +1418 -0
  152. package/dist/{transform-CaVEBOuR.js → transform-CQVOgmzM.js} +45 -37
  153. package/dist/{transform-Cju08-aJ.mjs → transform-tExdt40m.mjs} +30 -22
  154. package/dist/typedoc.export.d.ts +1 -1
  155. package/dist/types/index.d.ts +16 -17
  156. package/dist/types/shared.d.ts +1 -1
  157. package/dist/types/{typedoc-tailwindcss-patch.d.ts → typedoc-tailwindcss-runtime.d.ts} +4 -10
  158. package/dist/types/user-defined-options/general.d.ts +8 -4
  159. package/dist/types/user-defined-options/important.d.ts +2 -2
  160. package/dist/uni-app-x/style-asset.d.ts +1 -0
  161. package/dist/{utils-Dolmt8EO.js → utils-BCa37Wqj.js} +2 -17
  162. package/dist/{utils-DsaS975I.mjs → utils-DodxWHGz.mjs} +2 -17
  163. package/dist/v4-engine-CF9zt4Cw.mjs +2396 -0
  164. package/dist/v4-engine-D4ubP7N5.js +2778 -0
  165. package/dist/{vite-BBGOjh9e.js → vite-CP0ylSxZ.js} +2887 -1683
  166. package/dist/{vite-CS5DE-HD.mjs → vite-CPO83EhA.mjs} +2753 -1548
  167. package/dist/vite.js +1 -1
  168. package/dist/vite.mjs +1 -1
  169. package/dist/weapp-tw-css-import-rewrite-loader.js +5741 -4396
  170. package/dist/weapp-tw-runtime-classset-loader.js +36 -0
  171. package/dist/webpack-Bsek8VhR.js +2094 -0
  172. package/dist/webpack-BzqhJ8yK.mjs +2082 -0
  173. package/dist/webpack.js +1 -1
  174. package/dist/webpack.mjs +1 -1
  175. package/package.json +11 -7
  176. package/dist/auto-CTp6wE5a.js +0 -33
  177. package/dist/auto-Cl8_hsG6.mjs +0 -22
  178. package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +0 -13
  179. package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +0 -1
  180. package/dist/context/tailwindcss/rax.d.ts +0 -2
  181. package/dist/generator-Cb1Zp3Al.js +0 -92
  182. package/dist/generator-mvNFUvns.mjs +0 -67
  183. package/dist/tailwindcss/patcher-options.d.ts +0 -8
  184. package/dist/tailwindcss/patcher.d.ts +0 -12
  185. package/dist/tailwindcss/runtime-patch.d.ts +0 -5
  186. package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +0 -3
  187. package/dist/tailwindcss/v3-engine/generator/content.d.ts +0 -10
  188. package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +0 -2
  189. package/dist/tailwindcss/v3-engine/generator.d.ts +0 -19
  190. package/dist/tailwindcss/v3-engine/index.d.ts +0 -4
  191. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +0 -4
  192. package/dist/tailwindcss/v3-engine/source.d.ts +0 -5
  193. package/dist/tailwindcss/v3-engine/types.d.ts +0 -61
  194. package/dist/tailwindcss/v4/multi-patcher.d.ts +0 -2
  195. package/dist/tailwindcss/v4/patcher-options.d.ts +0 -2
  196. package/dist/tailwindcss/v4/patcher.d.ts +0 -15
  197. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +0 -1
  198. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +0 -1
  199. package/dist/tailwindcss-CK84uGBp.mjs +0 -556
  200. package/dist/tailwindcss-Clpkz1oR.js +0 -613
  201. package/dist/v3-engine-CQE5JJNZ.js +0 -4639
  202. package/dist/v3-engine-DKBaKWGL.mjs +0 -4231
  203. package/dist/webpack-DIWrcpRo.js +0 -1066
  204. package/dist/webpack-SPcri_D8.mjs +0 -1054
  205. /package/dist/tailwindcss/{patcher-resolve.d.ts → runtime-resolve.d.ts} +0 -0
package/dist/cli.js CHANGED
@@ -24,8 +24,6 @@ let node_process = require("node:process");
24
24
  node_process = __toESM(node_process);
25
25
  let semver = require("semver");
26
26
  semver = __toESM(semver);
27
- let tailwindcss_patch = require("tailwindcss-patch");
28
- tailwindcss_patch = __toESM(tailwindcss_patch);
29
27
  let node_path = require("node:path");
30
28
  node_path = __toESM(node_path);
31
29
  let node_fs_promises = require("node:fs/promises");
@@ -34,15 +32,16 @@ let lru_cache = require("lru-cache");
34
32
  let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
35
33
  let _weapp_core_escape = require("@weapp-core/escape");
36
34
  require("@weapp-tailwindcss/shared");
37
- let debug = require("debug");
38
- debug = __toESM(debug);
39
35
  let node_fs = require("node:fs");
40
36
  node_fs = __toESM(node_fs);
37
+ let debug = require("debug");
38
+ debug = __toESM(debug);
39
+ let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
41
40
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
42
41
  require("micromatch");
43
42
  let node_module = require("node:module");
44
- require("tailwindcss-config");
45
43
  require("fast-glob");
44
+ require("tailwindcss-config");
46
45
  let _babel_traverse = require("@babel/traverse");
47
46
  _babel_traverse = __toESM(_babel_traverse);
48
47
  let _babel_parser = require("@babel/parser");
@@ -57,17 +56,17 @@ const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
57
56
  //#region src/debug/index.ts
58
57
  const _debug = (0, debug.default)("weapp-tw");
59
58
  function createDebug(prefix) {
60
- const debug$4 = ((formatter, ...args) => {
59
+ const debug$3 = ((formatter, ...args) => {
61
60
  return _debug((prefix ?? "") + formatter, ...args);
62
61
  });
63
- Object.defineProperty(debug$4, "enabled", {
62
+ Object.defineProperty(debug$3, "enabled", {
64
63
  enumerable: false,
65
64
  configurable: false,
66
65
  get() {
67
66
  return _debug.enabled;
68
67
  }
69
68
  });
70
- return debug$4;
69
+ return debug$3;
71
70
  }
72
71
  //#endregion
73
72
  //#region src/utils/object.ts
@@ -78,367 +77,11 @@ function omitUndefined(value) {
78
77
  return Object.fromEntries(definedEntries(value));
79
78
  }
80
79
  //#endregion
81
- //#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
82
- const TAILWIND_V3_COLOR_STEPS = [
83
- "50",
84
- "100",
85
- "200",
86
- "300",
87
- "400",
88
- "500",
89
- "600",
90
- "700",
91
- "800",
92
- "900",
93
- "950"
94
- ];
95
- const TAILWIND_V3_COLOR_PALETTE = {
96
- slate: [
97
- "#f8fafc",
98
- "#f1f5f9",
99
- "#e2e8f0",
100
- "#cbd5e1",
101
- "#94a3b8",
102
- "#64748b",
103
- "#475569",
104
- "#334155",
105
- "#1e293b",
106
- "#0f172a",
107
- "#020617"
108
- ],
109
- gray: [
110
- "#f9fafb",
111
- "#f3f4f6",
112
- "#e5e7eb",
113
- "#d1d5db",
114
- "#9ca3af",
115
- "#6b7280",
116
- "#4b5563",
117
- "#374151",
118
- "#1f2937",
119
- "#111827",
120
- "#030712"
121
- ],
122
- zinc: [
123
- "#fafafa",
124
- "#f4f4f5",
125
- "#e4e4e7",
126
- "#d4d4d8",
127
- "#a1a1aa",
128
- "#71717a",
129
- "#52525b",
130
- "#3f3f46",
131
- "#27272a",
132
- "#18181b",
133
- "#09090b"
134
- ],
135
- neutral: [
136
- "#fafafa",
137
- "#f5f5f5",
138
- "#e5e5e5",
139
- "#d4d4d4",
140
- "#a3a3a3",
141
- "#737373",
142
- "#525252",
143
- "#404040",
144
- "#262626",
145
- "#171717",
146
- "#0a0a0a"
147
- ],
148
- stone: [
149
- "#fafaf9",
150
- "#f5f5f4",
151
- "#e7e5e4",
152
- "#d6d3d1",
153
- "#a8a29e",
154
- "#78716c",
155
- "#57534e",
156
- "#44403c",
157
- "#292524",
158
- "#1c1917",
159
- "#0c0a09"
160
- ],
161
- red: [
162
- "#fef2f2",
163
- "#fee2e2",
164
- "#fecaca",
165
- "#fca5a5",
166
- "#f87171",
167
- "#ef4444",
168
- "#dc2626",
169
- "#b91c1c",
170
- "#991b1b",
171
- "#7f1d1d",
172
- "#450a0a"
173
- ],
174
- orange: [
175
- "#fff7ed",
176
- "#ffedd5",
177
- "#fed7aa",
178
- "#fdba74",
179
- "#fb923c",
180
- "#f97316",
181
- "#ea580c",
182
- "#c2410c",
183
- "#9a3412",
184
- "#7c2d12",
185
- "#431407"
186
- ],
187
- amber: [
188
- "#fffbeb",
189
- "#fef3c7",
190
- "#fde68a",
191
- "#fcd34d",
192
- "#fbbf24",
193
- "#f59e0b",
194
- "#d97706",
195
- "#b45309",
196
- "#92400e",
197
- "#78350f",
198
- "#451a03"
199
- ],
200
- yellow: [
201
- "#fefce8",
202
- "#fef9c3",
203
- "#fef08a",
204
- "#fde047",
205
- "#facc15",
206
- "#eab308",
207
- "#ca8a04",
208
- "#a16207",
209
- "#854d0e",
210
- "#713f12",
211
- "#422006"
212
- ],
213
- lime: [
214
- "#f7fee7",
215
- "#ecfccb",
216
- "#d9f99d",
217
- "#bef264",
218
- "#a3e635",
219
- "#84cc16",
220
- "#65a30d",
221
- "#4d7c0f",
222
- "#3f6212",
223
- "#365314",
224
- "#1a2e05"
225
- ],
226
- green: [
227
- "#f0fdf4",
228
- "#dcfce7",
229
- "#bbf7d0",
230
- "#86efac",
231
- "#4ade80",
232
- "#22c55e",
233
- "#16a34a",
234
- "#15803d",
235
- "#166534",
236
- "#14532d",
237
- "#052e16"
238
- ],
239
- emerald: [
240
- "#ecfdf5",
241
- "#d1fae5",
242
- "#a7f3d0",
243
- "#6ee7b7",
244
- "#34d399",
245
- "#10b981",
246
- "#059669",
247
- "#047857",
248
- "#065f46",
249
- "#064e3b",
250
- "#022c22"
251
- ],
252
- teal: [
253
- "#f0fdfa",
254
- "#ccfbf1",
255
- "#99f6e4",
256
- "#5eead4",
257
- "#2dd4bf",
258
- "#14b8a6",
259
- "#0d9488",
260
- "#0f766e",
261
- "#115e59",
262
- "#134e4a",
263
- "#042f2e"
264
- ],
265
- cyan: [
266
- "#ecfeff",
267
- "#cffafe",
268
- "#a5f3fc",
269
- "#67e8f9",
270
- "#22d3ee",
271
- "#06b6d4",
272
- "#0891b2",
273
- "#0e7490",
274
- "#155e75",
275
- "#164e63",
276
- "#083344"
277
- ],
278
- sky: [
279
- "#f0f9ff",
280
- "#e0f2fe",
281
- "#bae6fd",
282
- "#7dd3fc",
283
- "#38bdf8",
284
- "#0ea5e9",
285
- "#0284c7",
286
- "#0369a1",
287
- "#075985",
288
- "#0c4a6e",
289
- "#082f49"
290
- ],
291
- blue: [
292
- "#eff6ff",
293
- "#dbeafe",
294
- "#bfdbfe",
295
- "#93c5fd",
296
- "#60a5fa",
297
- "#3b82f6",
298
- "#2563eb",
299
- "#1d4ed8",
300
- "#1e40af",
301
- "#1e3a8a",
302
- "#172554"
303
- ],
304
- indigo: [
305
- "#eef2ff",
306
- "#e0e7ff",
307
- "#c7d2fe",
308
- "#a5b4fc",
309
- "#818cf8",
310
- "#6366f1",
311
- "#4f46e5",
312
- "#4338ca",
313
- "#3730a3",
314
- "#312e81",
315
- "#1e1b4b"
316
- ],
317
- violet: [
318
- "#f5f3ff",
319
- "#ede9fe",
320
- "#ddd6fe",
321
- "#c4b5fd",
322
- "#a78bfa",
323
- "#8b5cf6",
324
- "#7c3aed",
325
- "#6d28d9",
326
- "#5b21b6",
327
- "#4c1d95",
328
- "#2e1065"
329
- ],
330
- purple: [
331
- "#faf5ff",
332
- "#f3e8ff",
333
- "#e9d5ff",
334
- "#d8b4fe",
335
- "#c084fc",
336
- "#a855f7",
337
- "#9333ea",
338
- "#7e22ce",
339
- "#6b21a8",
340
- "#581c87",
341
- "#3b0764"
342
- ],
343
- fuchsia: [
344
- "#fdf4ff",
345
- "#fae8ff",
346
- "#f5d0fe",
347
- "#f0abfc",
348
- "#e879f9",
349
- "#d946ef",
350
- "#c026d3",
351
- "#a21caf",
352
- "#86198f",
353
- "#701a75",
354
- "#4a044e"
355
- ],
356
- pink: [
357
- "#fdf2f8",
358
- "#fce7f3",
359
- "#fbcfe8",
360
- "#f9a8d4",
361
- "#f472b6",
362
- "#ec4899",
363
- "#db2777",
364
- "#be185d",
365
- "#9d174d",
366
- "#831843",
367
- "#500724"
368
- ],
369
- rose: [
370
- "#fff1f2",
371
- "#ffe4e6",
372
- "#fecdd3",
373
- "#fda4af",
374
- "#fb7185",
375
- "#f43f5e",
376
- "#e11d48",
377
- "#be123c",
378
- "#9f1239",
379
- "#881337",
380
- "#4c0519"
381
- ]
382
- };
383
- function createTailwindV3DefaultColorThemeCss() {
384
- const declarations = [" --color-black: #000;", " --color-white: #fff;"];
385
- for (const [color, values] of Object.entries(TAILWIND_V3_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V3_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V3_COLOR_STEPS[index]}: ${values[index]};`);
386
- return [
387
- "@theme {",
388
- ...declarations,
389
- "}"
390
- ].join("\n");
391
- }
392
- [
393
- "@theme {",
394
- " --default-ring-width: 3px;",
395
- " --default-ring-color: var(--color-blue-500, #3b82f6);",
396
- " --default-outline-width: 3px;",
397
- "",
398
- " --shadow-xs: 0 1px rgb(0 0 0 / 0.05);",
399
- " --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);",
400
- " --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
401
- " --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);",
402
- " --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);",
403
- " --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);",
404
- "",
405
- " --blur-xs: 4px;",
406
- " --blur-sm: 4px;",
407
- " --blur: 8px;",
408
- " --backdrop-blur-xs: 4px;",
409
- " --backdrop-blur-sm: 4px;",
410
- " --backdrop-blur: 8px;",
411
- "",
412
- " --radius-xs: 0.125rem;",
413
- " --radius-sm: 0.125rem;",
414
- " --radius: 0.25rem;",
415
- "}",
416
- createTailwindV3DefaultColorThemeCss()
417
- ].join("\n");
418
- [
419
- "*,",
420
- "::after,",
421
- "::before,",
422
- "::backdrop,",
423
- "::file-selector-button {",
424
- " border-color: var(--color-gray-200, currentcolor);",
425
- "}",
426
- "",
427
- "input::placeholder,",
428
- "textarea::placeholder {",
429
- " opacity: 1;",
430
- " color: var(--color-gray-400, currentcolor);",
431
- "}",
432
- "",
433
- "button:not(:disabled),",
434
- "[role=\"button\"]:not(:disabled) {",
435
- " cursor: pointer;",
436
- "}",
437
- "",
438
- "dialog {",
439
- " margin: auto;",
440
- "}"
441
- ].join("\n");
80
+ //#region src/tailwindcss/v4-engine/generator/rpx-candidates.ts
81
+ const RPX_LENGTH_UTILITY_PATTERN = String.raw`text|border(?:-[trblxyse])?|bg|outline|ring`;
82
+ new RegExp(String.raw`(^|:)(!?)(${RPX_LENGTH_UTILITY_PATTERN})-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$`, "u");
83
+ new RegExp(String.raw`(?:^|:)!?(${RPX_LENGTH_UTILITY_PATTERN})-\[length:([-+]?(?:\d+|\d*\.\d+)rpx)\].*$`, "u");
84
+ new RegExp(String.raw`(${RPX_LENGTH_UTILITY_PATTERN})-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]`, "g");
442
85
  //#endregion
443
86
  //#region src/tailwindcss/source-scan.ts
444
87
  const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
@@ -509,33 +152,17 @@ new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.rep
509
152
  });
510
153
  //#endregion
511
154
  //#region src/tailwindcss/v4-engine/generator.ts
512
- const INCREMENTAL_GENERATE_CACHE_MAX$1 = 8;
155
+ const INCREMENTAL_GENERATE_CACHE_MAX = 8;
513
156
  const INCREMENTAL_GENERATE_TASK_CACHE_MAX = 32;
514
- new lru_cache.LRUCache({ max: INCREMENTAL_GENERATE_CACHE_MAX$1 });
157
+ new lru_cache.LRUCache({ max: INCREMENTAL_GENERATE_CACHE_MAX });
515
158
  new lru_cache.LRUCache({ max: INCREMENTAL_GENERATE_TASK_CACHE_MAX });
516
159
  (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
517
- (0, _weapp_tailwindcss_postcss.createStyleHandler)({
518
- cssChildCombinatorReplaceValue: ["view", "text"],
519
- cssRemoveHoverPseudoClass: true,
520
- isMainChunk: true,
521
- majorVersion: 3
522
- });
523
- new lru_cache.LRUCache({ max: 8 });
524
- typeof tailwindcss_patch.generateTailwindV3RawStyle === "function" && tailwindcss_patch.generateTailwindV3RawStyle;
525
- [
526
- "@tailwind base;",
527
- "@tailwind components;",
528
- "@tailwind utilities;"
529
- ].join("\n");
530
- createDebug("[tailwindcss:runtime-patch] ");
531
- (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
532
160
  createDebug("[tailwindcss:runtime] ");
533
161
  //#endregion
534
162
  //#region src/tailwindcss/runtime-logs.ts
535
163
  const runtimeLogDedupeHolder = globalThis;
536
164
  runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
537
- //#endregion
538
- //#region src/context/compiler-context-cache.ts
165
+ (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
539
166
  const globalCacheHolder = globalThis;
540
167
  globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
541
168
  //#endregion
@@ -892,6 +519,19 @@ function hasIgnoreComment(node) {
892
519
  }
893
520
  return false;
894
521
  }
522
+ function isConditionTestLiteral(path) {
523
+ let current = path;
524
+ while (current?.parentPath) {
525
+ const parent = current.parentPath;
526
+ if (parent.isConditionalExpression()) return parent.node.test === current.node;
527
+ if (parent.isBinaryExpression() || parent.isCallExpression() || parent.isLogicalExpression() || parent.isMemberExpression() || parent.isUnaryExpression()) {
528
+ current = parent;
529
+ continue;
530
+ }
531
+ return false;
532
+ }
533
+ return false;
534
+ }
895
535
  function extractLiteralValue(path, { unescapeUnicode }) {
896
536
  const { node } = path;
897
537
  let offset = 0;
@@ -957,8 +597,9 @@ function replaceHandleValue(path, options) {
957
597
  const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
958
598
  if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
959
599
  if (hasIgnoreComment(path.node)) return;
600
+ if (isConditionTestLiteral(path)) return;
960
601
  const { literal, original, offset } = extractLiteralValue(path, options);
961
- const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
602
+ const candidates = (0, _tailwindcss_mangle_engine.splitCandidateTokens)(literal);
962
603
  if (candidates.length === 0) return;
963
604
  const debugEnabled = debug$1.enabled;
964
605
  const classContext = options.wrapExpression || isClassContextLiteralPath(path);
@@ -1971,6 +1612,7 @@ function jsHandler(rawSource, options) {
1971
1612
  return result;
1972
1613
  }
1973
1614
  defaultEvalHandler = jsHandler;
1615
+ (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
1974
1616
  Object.freeze({ wrapExpression: true });
1975
1617
  //#endregion
1976
1618
  //#region src/wxml/whitespace.ts
@@ -2155,8 +1797,7 @@ const FRAMEWORK_DEPS = [
2155
1797
  ["@tarojs/taro", "Taro"],
2156
1798
  ["@dcloudio/uni-app", "uni-app"],
2157
1799
  ["@mpxjs/core", "MPX"],
2158
- ["remax", "Remax"],
2159
- ["rax", "Rax"]
1800
+ ["remax", "Remax"]
2160
1801
  ];
2161
1802
  //#endregion
2162
1803
  //#region src/cli/doctor.ts
@@ -2306,7 +1947,7 @@ function createDoctorReport(options = {}) {
2306
1947
  title: "Tailwind 配置",
2307
1948
  status: tailwindMajor === 4 ? "info" : "warn",
2308
1949
  message: "未检测到 tailwind.config.*。",
2309
- suggestion: tailwindMajor === 4 ? "Tailwind CSS v4 可以采用 CSS-first 配置;如果使用 v3 或复杂 content/source,请补充配置文件。" : "请确认 Tailwind content/source 配置能够覆盖小程序页面、组件和脚本文件。"
1950
+ suggestion: tailwindMajor === 4 ? "Tailwind CSS v4 可以采用 CSS-first 配置;复杂 content/source 场景请补充配置文件。" : "请确认 Tailwind content/source 配置能够覆盖小程序页面、组件和脚本文件。"
2310
1951
  });
2311
1952
  addCheck(checks, postcssConfig ? {
2312
1953
  id: "postcss-config",
@@ -2336,7 +1977,7 @@ function createDoctorReport(options = {}) {
2336
1977
  id: "framework",
2337
1978
  title: "框架识别",
2338
1979
  status: "info",
2339
- message: "未从依赖中识别出 Taro、uni-app、MPX、RemaxRax。"
1980
+ message: "未从依赖中识别出 Taro、uni-app、MPX 或 Remax。"
2340
1981
  });
2341
1982
  addCheck(checks, viteConfig || webpackConfig ? {
2342
1983
  id: "bundler-config",
@@ -2422,7 +2063,7 @@ function resolveCliCwd(value) {
2422
2063
  async function ensureDir(dir) {
2423
2064
  await (0, node_fs_promises.mkdir)(dir, { recursive: true });
2424
2065
  }
2425
- function handleCliError$1(error) {
2066
+ function handleCliError(error) {
2426
2067
  if (error instanceof Error) {
2427
2068
  _weapp_tailwindcss_logger.logger.error(error.message);
2428
2069
  if (error.stack && node_process.default.env["WEAPP_TW_DEBUG"] === "1") _weapp_tailwindcss_logger.logger.error(error.stack);
@@ -2433,7 +2074,7 @@ function commandAction(handler) {
2433
2074
  try {
2434
2075
  await handler(...args);
2435
2076
  } catch (error) {
2436
- handleCliError$1(error);
2077
+ handleCliError(error);
2437
2078
  node_process.default.exitCode = 1;
2438
2079
  }
2439
2080
  };
@@ -2441,27 +2082,7 @@ function commandAction(handler) {
2441
2082
  //#endregion
2442
2083
  //#region src/cli/mount-options.ts
2443
2084
  const PATCH_COMMAND_OBSOLETE_NOTICE = "提示:weapp-tailwindcss@5 已由构建运行时接管 Tailwind CSS 处理,weapp-tw patch 已无需执行;请移除 package.json 中的 postinstall 钩子。";
2444
- function logPatchCommandObsoleteNotice() {
2445
- _weapp_tailwindcss_logger.logger.warn(PATCH_COMMAND_OBSOLETE_NOTICE);
2446
- }
2447
- function handleCliError(error) {
2448
- if (error instanceof Error) {
2449
- _weapp_tailwindcss_logger.logger.error(error.message);
2450
- if (error.stack && node_process.default.env["WEAPP_TW_DEBUG"] === "1") _weapp_tailwindcss_logger.logger.error(error.stack);
2451
- } else _weapp_tailwindcss_logger.logger.error(String(error));
2452
- }
2453
- function withCommandErrorHandling(handler) {
2454
- return (async (ctx, next) => {
2455
- try {
2456
- return await handler(ctx, next);
2457
- } catch (error) {
2458
- handleCliError(error);
2459
- node_process.default.exitCode = 1;
2460
- return;
2461
- }
2462
- });
2463
- }
2464
- const forwardedCommands = [
2085
+ const obsoletePatchCommands = [
2465
2086
  "extract",
2466
2087
  "tokens",
2467
2088
  "init",
@@ -2469,14 +2090,13 @@ const forwardedCommands = [
2469
2090
  "restore",
2470
2091
  "validate"
2471
2092
  ];
2472
- const commandHandlers = Object.fromEntries(forwardedCommands.map((command) => [command, withCommandErrorHandling(async (_ctx, next) => next())]));
2473
- const mountOptions = {
2474
- commands: [...forwardedCommands],
2475
- commandHandlers
2476
- };
2477
- //#endregion
2478
- //#region src/cli/vscode-entry.ts
2479
- const DEFAULT_VSCODE_ENTRY_OUTPUT = ".vscode/weapp-tailwindcss.intellisense.css";
2093
+ function logPatchCommandObsoleteNotice() {
2094
+ _weapp_tailwindcss_logger.logger.warn(PATCH_COMMAND_OBSOLETE_NOTICE);
2095
+ }
2096
+ function logObsoletePatchCommand(command) {
2097
+ logPatchCommandObsoleteNotice();
2098
+ _weapp_tailwindcss_logger.logger.warn(`命令 "${command}" 来自旧版 tailwindcss-patch 工作流,当前版本无需执行。`);
2099
+ }
2480
2100
  const DEFAULT_VSCODE_SOURCES = [
2481
2101
  "not \"./dist\"",
2482
2102
  "not \"./unpackage\"",
@@ -2576,15 +2196,47 @@ async function generateVscodeIntellisenseEntry(options) {
2576
2196
  //#region src/cli.ts
2577
2197
  node_process.default.title = "node (weapp-tailwindcss)";
2578
2198
  if (!semver.default.satisfies(node_process.default.versions.node, "^20.19.0 || >=22.12.0")) _weapp_tailwindcss_logger.logger.warn(`You are using Node.js ${node_process.default.versions.node}. For weapp-tailwindcss, Node.js version ${WEAPP_TW_REQUIRED_NODE_VERSION_RANGE} is required.`);
2579
- const cli = (0, tailwindcss_patch.createTailwindcssPatchCli)({
2580
- name: "weapp-tailwindcss",
2581
- mountOptions
2582
- });
2583
- cli.command("patch", "Deprecated no-op: v5 runtime handles Tailwind CSS automatically").alias("install").option("--cwd <dir>", "Ignored working directory").option("--clear-cache", "Ignored compatibility option").option("--record-target [enabled]", "Ignored compatibility option").option("--workspace", "Ignored compatibility option").action(commandAction(async (_options) => {
2199
+ function parseArgs(argv) {
2200
+ const options = {};
2201
+ const positional = [];
2202
+ for (let index = 0; index < argv.length; index++) {
2203
+ const arg = argv[index];
2204
+ if (!arg.startsWith("--")) {
2205
+ positional.push(arg);
2206
+ continue;
2207
+ }
2208
+ const [rawKey, inlineValue] = arg.slice(2).split("=", 2);
2209
+ const key = rawKey.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
2210
+ const next = argv[index + 1];
2211
+ const value = inlineValue ?? (next && !next.startsWith("-") ? argv[++index] : true);
2212
+ const current = options[key];
2213
+ if (current === void 0) options[key] = value;
2214
+ else if (Array.isArray(current)) current.push(String(value));
2215
+ else options[key] = [String(current), String(value)];
2216
+ }
2217
+ return {
2218
+ command: positional[0],
2219
+ options
2220
+ };
2221
+ }
2222
+ function printHelp() {
2223
+ _weapp_tailwindcss_logger.logger.log(`weapp-tailwindcss
2224
+
2225
+ Usage:
2226
+ weapp-tw <command> [options]
2227
+
2228
+ Commands:
2229
+ patch Deprecated no-op: v5 runtime handles Tailwind CSS automatically
2230
+ status Deprecated no-op: patch status is no longer required
2231
+ vscode-entry Generate a VS Code helper CSS for Tailwind IntelliSense
2232
+ doctor Check project setup for weapp-tailwindcss
2233
+ `);
2234
+ }
2235
+ async function runPatch() {
2584
2236
  logPatchCommandObsoleteNotice();
2585
2237
  _weapp_tailwindcss_logger.logger.success("已跳过:当前版本不需要手动执行 Tailwind CSS patch。");
2586
- }));
2587
- cli.command("status", "Deprecated no-op: patch status is no longer required").option("--cwd <dir>", "Ignored working directory").option("--json", "Print a JSON no-op report").action(commandAction(async (options) => {
2238
+ }
2239
+ async function runStatus(options) {
2588
2240
  const payload = {
2589
2241
  required: false,
2590
2242
  status: "unnecessary",
@@ -2596,8 +2248,8 @@ cli.command("status", "Deprecated no-op: patch status is no longer required").op
2596
2248
  }
2597
2249
  logPatchCommandObsoleteNotice();
2598
2250
  _weapp_tailwindcss_logger.logger.success("无需检查 Tailwind CSS patch 状态。");
2599
- }));
2600
- cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliSense").option("--cwd <dir>", "Working directory").option("--css <file>", "Path to the CSS file that imports weapp-tailwindcss (required)").option("--output <file>", `Helper output path. Defaults to ${DEFAULT_VSCODE_ENTRY_OUTPUT}`).option("--source <pattern>", "Additional @source glob (can be repeated)").option("--force", "Overwrite the helper file when it already exists").action(commandAction(async (options) => {
2251
+ }
2252
+ async function runVscodeEntry(options) {
2601
2253
  const resolvedCwd = resolveCliCwd(options.cwd);
2602
2254
  const baseDir = resolvedCwd ?? node_process.default.cwd();
2603
2255
  const cssEntry = readStringOption("css", options.css);
@@ -2610,14 +2262,49 @@ cli.command("vscode-entry", "Generate a VS Code helper CSS for Tailwind IntelliS
2610
2262
  force: toBoolean(options.force, false)
2611
2263
  });
2612
2264
  _weapp_tailwindcss_logger.logger.success(`VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`);
2613
- }));
2614
- cli.command("doctor", "Check project setup for weapp-tailwindcss").option("--cwd <dir>", "Working directory").option("--json", "Print a JSON report").option("--strict", "Exit with code 1 when warnings are found").action(commandAction(async (options) => {
2265
+ }
2266
+ async function runDoctor(options) {
2615
2267
  const report = createDoctorReport({ cwd: resolveCliCwd(options.cwd) });
2616
2268
  if (toBoolean(options.json, false)) _weapp_tailwindcss_logger.logger.log(JSON.stringify(report, null, 2));
2617
2269
  else _weapp_tailwindcss_logger.logger.log(formatDoctorReport(report));
2618
2270
  if (hasDoctorFailure(report, toBoolean(options.strict, false))) node_process.default.exitCode = 1;
2619
- }));
2620
- cli.help();
2621
- cli.version(node_process.default.env["npm_package_version"] ?? "0.0.0");
2622
- cli.parse();
2271
+ }
2272
+ async function main() {
2273
+ const { command, options } = parseArgs(node_process.default.argv.slice(2));
2274
+ await commandAction(async () => {
2275
+ switch (command) {
2276
+ case void 0:
2277
+ case "-h":
2278
+ case "--help":
2279
+ case "help":
2280
+ printHelp();
2281
+ return;
2282
+ case "-v":
2283
+ case "--version":
2284
+ case "version":
2285
+ _weapp_tailwindcss_logger.logger.log(node_process.default.env["npm_package_version"] ?? "0.0.0");
2286
+ return;
2287
+ case "patch":
2288
+ case "install":
2289
+ await runPatch();
2290
+ return;
2291
+ case "status":
2292
+ await runStatus(options);
2293
+ return;
2294
+ case "vscode-entry":
2295
+ await runVscodeEntry(options);
2296
+ return;
2297
+ case "doctor":
2298
+ await runDoctor(options);
2299
+ return;
2300
+ default:
2301
+ if (obsoletePatchCommands.includes(command)) {
2302
+ logObsoletePatchCommand(command);
2303
+ return;
2304
+ }
2305
+ throw new Error(`Unknown command: ${command}`);
2306
+ }
2307
+ })();
2308
+ }
2309
+ main();
2623
2310
  //#endregion