weapp-tailwindcss 5.0.13 → 5.1.1

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 (200) 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/class-selectors.d.ts +2 -0
  7. package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
  8. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +10 -6
  9. package/dist/bundlers/shared/generator-css/local-imports.d.ts +3 -0
  10. package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +3 -0
  11. package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +0 -1
  12. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -1
  13. package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +3 -3
  14. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +2 -2
  15. package/dist/bundlers/shared/generator-css/types.d.ts +13 -1
  16. package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -1
  17. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
  18. package/dist/bundlers/shared/run-tasks.d.ts +1 -0
  19. package/dist/bundlers/shared/v4-generation-core.d.ts +11 -0
  20. package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
  21. package/dist/bundlers/vite/css-memory.d.ts +16 -0
  22. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +0 -1
  23. package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
  24. package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
  25. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
  26. package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +39 -0
  27. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +1 -0
  28. package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +1 -1
  29. package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +13 -0
  30. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +7 -0
  31. package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +26 -0
  32. package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +4 -0
  33. package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +21 -18
  34. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -1
  35. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
  36. package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +6 -0
  37. package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +25 -0
  38. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +3 -1
  39. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -0
  40. package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +9 -0
  41. package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +9 -0
  42. package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +15 -0
  43. package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -1
  44. package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +1 -1
  45. package/dist/bundlers/vite/generate-bundle.d.ts +2 -1
  46. package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -0
  47. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +3 -3
  48. package/dist/bundlers/vite/plugin-cache.d.ts +15 -0
  49. package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
  50. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -4
  51. package/dist/bundlers/vite/source-candidates/script.d.ts +1 -7
  52. package/dist/bundlers/vite/source-candidates.d.ts +9 -2
  53. package/dist/bundlers/vite/source-scan/css-entries.d.ts +2 -6
  54. package/dist/bundlers/vite/source-scan.d.ts +2 -2
  55. package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
  56. package/dist/bundlers/vite/utils.d.ts +1 -0
  57. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +26 -2
  58. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +34 -0
  59. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -11
  60. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +37 -0
  61. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +199 -0
  62. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
  63. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +11 -0
  64. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -0
  65. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -2
  66. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +10 -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 +138 -444
  71. package/dist/cli.mjs +134 -440
  72. package/dist/context/index.d.ts +3 -3
  73. package/dist/context/style-options.d.ts +5 -1
  74. package/dist/context/tailwindcss.d.ts +1 -1
  75. package/dist/{precheck-B0Z8yW7E.js → context-B6hVF7dr.js} +405 -156
  76. package/dist/{precheck-CRI90iL1.mjs → context-DlpKD7aN.mjs} +377 -141
  77. package/dist/core.js +15 -12
  78. package/dist/core.mjs +10 -7
  79. package/dist/css-macro/index.d.ts +3 -7
  80. package/dist/css-macro.js +1 -1
  81. package/dist/css-macro.mjs +1 -1
  82. package/dist/{defaults-Bqx18S1f.mjs → defaults-BhE26nSw.mjs} +12 -13
  83. package/dist/{defaults-C_J_kBpw.js → defaults-CmFBmxsr.js} +11 -18
  84. package/dist/defaults.d.ts +2 -8
  85. package/dist/defaults.js +1 -2
  86. package/dist/defaults.mjs +2 -2
  87. package/dist/generator/index.d.ts +6 -7
  88. package/dist/generator/options.d.ts +3 -3
  89. package/dist/generator/types.d.ts +9 -10
  90. package/dist/generator-6oMJtTDO.js +170 -0
  91. package/dist/generator-CjzBK7h-.mjs +123 -0
  92. package/dist/generator.js +10 -16
  93. package/dist/generator.mjs +3 -3
  94. package/dist/{gulp-XT8Jc7lH.js → gulp-BtGq6LP9.js} +49 -87
  95. package/dist/{gulp-DfOQERcV.mjs → gulp-DNU10Vtc.mjs} +42 -80
  96. package/dist/gulp.js +1 -1
  97. package/dist/gulp.mjs +1 -1
  98. package/dist/{hmr-timing-DQIP_8qP.mjs → hmr-timing-B0KuWDjV.mjs} +1197 -858
  99. package/dist/{hmr-timing-BMftW7Us.js → hmr-timing-CegXR9O4.js} +1356 -927
  100. package/dist/index.js +4 -4
  101. package/dist/index.mjs +4 -4
  102. package/dist/js/fast-path/oxc.d.ts +4 -0
  103. package/dist/js/precheck.d.ts +1 -0
  104. package/dist/postcss.js +3 -4
  105. package/dist/postcss.mjs +2 -3
  106. package/dist/presets.js +9 -19
  107. package/dist/presets.mjs +8 -18
  108. package/dist/runtime-branch/create-branch.d.ts +2 -0
  109. package/dist/runtime-branch/generator-target-env.d.ts +4 -0
  110. package/dist/runtime-branch/index.d.ts +6 -0
  111. package/dist/runtime-branch/mini-program.d.ts +2 -0
  112. package/dist/runtime-branch/native-app.d.ts +2 -0
  113. package/dist/runtime-branch/platform.d.ts +6 -0
  114. package/dist/runtime-branch/tailwind-version.d.ts +2 -0
  115. package/dist/runtime-branch/types.d.ts +37 -0
  116. package/dist/runtime-branch/web.d.ts +2 -0
  117. package/dist/runtime-branch.d.ts +1 -0
  118. package/dist/{bundle-state-zQ2MrDdi.mjs → source-candidate-scan-signature-B5af2Ahe.mjs} +187 -17
  119. package/dist/{bundle-state-CKWeTEhv.js → source-candidate-scan-signature-BKYb9jxa.js} +261 -19
  120. package/dist/tailwindcss/candidates.d.ts +7 -0
  121. package/dist/tailwindcss/index.d.ts +2 -2
  122. package/dist/tailwindcss/runtime/cache.d.ts +6 -6
  123. package/dist/tailwindcss/runtime-factory.d.ts +12 -0
  124. package/dist/tailwindcss/runtime-options.d.ts +8 -0
  125. package/dist/tailwindcss/runtime-types.d.ts +87 -0
  126. package/dist/tailwindcss/runtime.d.ts +6 -6
  127. package/dist/tailwindcss/source-scan.d.ts +1 -1
  128. package/dist/tailwindcss/targets.d.ts +2 -2
  129. package/dist/tailwindcss/v4/config.d.ts +3 -3
  130. package/dist/tailwindcss/v4/css-entries.d.ts +1 -0
  131. package/dist/tailwindcss/v4/css-sources.d.ts +4 -2
  132. package/dist/tailwindcss/v4/index.d.ts +1 -1
  133. package/dist/tailwindcss/v4/multi-runtime.d.ts +2 -0
  134. package/dist/tailwindcss/v4/runtime-factory.d.ts +15 -0
  135. package/dist/tailwindcss/v4/runtime-options.d.ts +2 -0
  136. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
  137. package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
  138. package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +3 -3
  139. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +1 -1
  140. package/dist/tailwindcss/v4-engine/generator.d.ts +10 -3
  141. package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
  142. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +7 -1
  143. package/dist/tailwindcss/v4-engine/source.d.ts +15 -7
  144. package/dist/tailwindcss/v4-engine/types.d.ts +17 -10
  145. package/dist/tailwindcss/version.d.ts +1 -1
  146. package/dist/tailwindcss-B5mRo0-M.mjs +1423 -0
  147. package/dist/tailwindcss-dbrbY4cd.js +1528 -0
  148. package/dist/{transform-DfcEjsZF.mjs → transform-fRBeuuK-.mjs} +2 -2
  149. package/dist/{transform-YmrmxuF3.js → transform-vLwZpiTE.js} +17 -17
  150. package/dist/typedoc.export.d.ts +1 -1
  151. package/dist/types/index.d.ts +16 -17
  152. package/dist/types/shared.d.ts +1 -1
  153. package/dist/types/{typedoc-tailwindcss-patch.d.ts → typedoc-tailwindcss-runtime.d.ts} +4 -10
  154. package/dist/types/user-defined-options/general.d.ts +5 -3
  155. package/dist/types/user-defined-options/important.d.ts +2 -2
  156. package/dist/types/user-defined-options/matcher.d.ts +7 -0
  157. package/dist/uni-app-x/style-asset.d.ts +1 -0
  158. package/dist/v4-engine-C3qSwQ-e.mjs +2376 -0
  159. package/dist/v4-engine-ON_oSLfO.js +2752 -0
  160. package/dist/{vite-DjI09vVN.mjs → vite-CWRooooa.mjs} +1417 -540
  161. package/dist/{vite-CXHVsHmX.js → vite-w-RkgaTY.js} +1575 -698
  162. package/dist/vite.js +1 -1
  163. package/dist/vite.mjs +1 -1
  164. package/dist/weapp-tw-css-import-rewrite-loader.js +5665 -4443
  165. package/dist/weapp-tw-runtime-classset-loader.js +15 -4
  166. package/dist/webpack-8PaV1gG3.mjs +2334 -0
  167. package/dist/webpack-CGgBOx9l.js +2346 -0
  168. package/dist/webpack.js +1 -1
  169. package/dist/webpack.mjs +1 -1
  170. package/package.json +6 -7
  171. package/dist/auto-CTp6wE5a.js +0 -33
  172. package/dist/auto-Cl8_hsG6.mjs +0 -22
  173. package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +0 -13
  174. package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +0 -1
  175. package/dist/context/tailwindcss/rax.d.ts +0 -2
  176. package/dist/generator-CzpArpCL.js +0 -92
  177. package/dist/generator-ITLd7PTl.mjs +0 -67
  178. package/dist/tailwindcss/patcher-options.d.ts +0 -8
  179. package/dist/tailwindcss/patcher.d.ts +0 -12
  180. package/dist/tailwindcss/runtime-patch.d.ts +0 -5
  181. package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +0 -3
  182. package/dist/tailwindcss/v3-engine/generator/content.d.ts +0 -10
  183. package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +0 -2
  184. package/dist/tailwindcss/v3-engine/generator.d.ts +0 -19
  185. package/dist/tailwindcss/v3-engine/index.d.ts +0 -4
  186. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +0 -4
  187. package/dist/tailwindcss/v3-engine/source.d.ts +0 -5
  188. package/dist/tailwindcss/v3-engine/types.d.ts +0 -61
  189. package/dist/tailwindcss/v4/multi-patcher.d.ts +0 -2
  190. package/dist/tailwindcss/v4/patcher-options.d.ts +0 -2
  191. package/dist/tailwindcss/v4/patcher.d.ts +0 -15
  192. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +0 -1
  193. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +0 -1
  194. package/dist/tailwindcss-DTq3uYBK.mjs +0 -556
  195. package/dist/tailwindcss-DZEwT3C_.js +0 -613
  196. package/dist/v3-engine-2rrgylhn.js +0 -4686
  197. package/dist/v3-engine-C6eJ0YzK.mjs +0 -4272
  198. package/dist/webpack-BcPpnT90.mjs +0 -1184
  199. package/dist/webpack-CfkUkMXG.js +0 -1196
  200. /package/dist/tailwindcss/{patcher-resolve.d.ts → runtime-resolve.d.ts} +0 -0
package/dist/cli.mjs CHANGED
@@ -1,8 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  import process from "node:process";
3
3
  import semver from "semver";
4
- import * as tailwindcssPatch from "tailwindcss-patch";
5
- import { createTailwindcssPatchCli, splitCandidateTokens } from "tailwindcss-patch";
6
4
  import path from "node:path";
7
5
  import { access, mkdir, writeFile } from "node:fs/promises";
8
6
  import { logger } from "@weapp-tailwindcss/logger";
@@ -12,10 +10,11 @@ import { MappingChars2String, escape } from "@weapp-core/escape";
12
10
  import "@weapp-tailwindcss/shared";
13
11
  import { constants, existsSync, readFileSync } from "node:fs";
14
12
  import _createDebug from "debug";
13
+ import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
15
14
  import { createStyleHandler } from "@weapp-tailwindcss/postcss";
16
15
  import "micromatch";
17
- import "tailwindcss-config";
18
16
  import "fast-glob";
17
+ import "tailwindcss-config";
19
18
  import _babelTraverse from "@babel/traverse";
20
19
  import { parse } from "@babel/parser";
21
20
  import MagicString from "magic-string";
@@ -49,367 +48,11 @@ function omitUndefined(value) {
49
48
  return Object.fromEntries(definedEntries(value));
50
49
  }
51
50
  //#endregion
52
- //#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
53
- const TAILWIND_V3_COLOR_STEPS = [
54
- "50",
55
- "100",
56
- "200",
57
- "300",
58
- "400",
59
- "500",
60
- "600",
61
- "700",
62
- "800",
63
- "900",
64
- "950"
65
- ];
66
- const TAILWIND_V3_COLOR_PALETTE = {
67
- slate: [
68
- "#f8fafc",
69
- "#f1f5f9",
70
- "#e2e8f0",
71
- "#cbd5e1",
72
- "#94a3b8",
73
- "#64748b",
74
- "#475569",
75
- "#334155",
76
- "#1e293b",
77
- "#0f172a",
78
- "#020617"
79
- ],
80
- gray: [
81
- "#f9fafb",
82
- "#f3f4f6",
83
- "#e5e7eb",
84
- "#d1d5db",
85
- "#9ca3af",
86
- "#6b7280",
87
- "#4b5563",
88
- "#374151",
89
- "#1f2937",
90
- "#111827",
91
- "#030712"
92
- ],
93
- zinc: [
94
- "#fafafa",
95
- "#f4f4f5",
96
- "#e4e4e7",
97
- "#d4d4d8",
98
- "#a1a1aa",
99
- "#71717a",
100
- "#52525b",
101
- "#3f3f46",
102
- "#27272a",
103
- "#18181b",
104
- "#09090b"
105
- ],
106
- neutral: [
107
- "#fafafa",
108
- "#f5f5f5",
109
- "#e5e5e5",
110
- "#d4d4d4",
111
- "#a3a3a3",
112
- "#737373",
113
- "#525252",
114
- "#404040",
115
- "#262626",
116
- "#171717",
117
- "#0a0a0a"
118
- ],
119
- stone: [
120
- "#fafaf9",
121
- "#f5f5f4",
122
- "#e7e5e4",
123
- "#d6d3d1",
124
- "#a8a29e",
125
- "#78716c",
126
- "#57534e",
127
- "#44403c",
128
- "#292524",
129
- "#1c1917",
130
- "#0c0a09"
131
- ],
132
- red: [
133
- "#fef2f2",
134
- "#fee2e2",
135
- "#fecaca",
136
- "#fca5a5",
137
- "#f87171",
138
- "#ef4444",
139
- "#dc2626",
140
- "#b91c1c",
141
- "#991b1b",
142
- "#7f1d1d",
143
- "#450a0a"
144
- ],
145
- orange: [
146
- "#fff7ed",
147
- "#ffedd5",
148
- "#fed7aa",
149
- "#fdba74",
150
- "#fb923c",
151
- "#f97316",
152
- "#ea580c",
153
- "#c2410c",
154
- "#9a3412",
155
- "#7c2d12",
156
- "#431407"
157
- ],
158
- amber: [
159
- "#fffbeb",
160
- "#fef3c7",
161
- "#fde68a",
162
- "#fcd34d",
163
- "#fbbf24",
164
- "#f59e0b",
165
- "#d97706",
166
- "#b45309",
167
- "#92400e",
168
- "#78350f",
169
- "#451a03"
170
- ],
171
- yellow: [
172
- "#fefce8",
173
- "#fef9c3",
174
- "#fef08a",
175
- "#fde047",
176
- "#facc15",
177
- "#eab308",
178
- "#ca8a04",
179
- "#a16207",
180
- "#854d0e",
181
- "#713f12",
182
- "#422006"
183
- ],
184
- lime: [
185
- "#f7fee7",
186
- "#ecfccb",
187
- "#d9f99d",
188
- "#bef264",
189
- "#a3e635",
190
- "#84cc16",
191
- "#65a30d",
192
- "#4d7c0f",
193
- "#3f6212",
194
- "#365314",
195
- "#1a2e05"
196
- ],
197
- green: [
198
- "#f0fdf4",
199
- "#dcfce7",
200
- "#bbf7d0",
201
- "#86efac",
202
- "#4ade80",
203
- "#22c55e",
204
- "#16a34a",
205
- "#15803d",
206
- "#166534",
207
- "#14532d",
208
- "#052e16"
209
- ],
210
- emerald: [
211
- "#ecfdf5",
212
- "#d1fae5",
213
- "#a7f3d0",
214
- "#6ee7b7",
215
- "#34d399",
216
- "#10b981",
217
- "#059669",
218
- "#047857",
219
- "#065f46",
220
- "#064e3b",
221
- "#022c22"
222
- ],
223
- teal: [
224
- "#f0fdfa",
225
- "#ccfbf1",
226
- "#99f6e4",
227
- "#5eead4",
228
- "#2dd4bf",
229
- "#14b8a6",
230
- "#0d9488",
231
- "#0f766e",
232
- "#115e59",
233
- "#134e4a",
234
- "#042f2e"
235
- ],
236
- cyan: [
237
- "#ecfeff",
238
- "#cffafe",
239
- "#a5f3fc",
240
- "#67e8f9",
241
- "#22d3ee",
242
- "#06b6d4",
243
- "#0891b2",
244
- "#0e7490",
245
- "#155e75",
246
- "#164e63",
247
- "#083344"
248
- ],
249
- sky: [
250
- "#f0f9ff",
251
- "#e0f2fe",
252
- "#bae6fd",
253
- "#7dd3fc",
254
- "#38bdf8",
255
- "#0ea5e9",
256
- "#0284c7",
257
- "#0369a1",
258
- "#075985",
259
- "#0c4a6e",
260
- "#082f49"
261
- ],
262
- blue: [
263
- "#eff6ff",
264
- "#dbeafe",
265
- "#bfdbfe",
266
- "#93c5fd",
267
- "#60a5fa",
268
- "#3b82f6",
269
- "#2563eb",
270
- "#1d4ed8",
271
- "#1e40af",
272
- "#1e3a8a",
273
- "#172554"
274
- ],
275
- indigo: [
276
- "#eef2ff",
277
- "#e0e7ff",
278
- "#c7d2fe",
279
- "#a5b4fc",
280
- "#818cf8",
281
- "#6366f1",
282
- "#4f46e5",
283
- "#4338ca",
284
- "#3730a3",
285
- "#312e81",
286
- "#1e1b4b"
287
- ],
288
- violet: [
289
- "#f5f3ff",
290
- "#ede9fe",
291
- "#ddd6fe",
292
- "#c4b5fd",
293
- "#a78bfa",
294
- "#8b5cf6",
295
- "#7c3aed",
296
- "#6d28d9",
297
- "#5b21b6",
298
- "#4c1d95",
299
- "#2e1065"
300
- ],
301
- purple: [
302
- "#faf5ff",
303
- "#f3e8ff",
304
- "#e9d5ff",
305
- "#d8b4fe",
306
- "#c084fc",
307
- "#a855f7",
308
- "#9333ea",
309
- "#7e22ce",
310
- "#6b21a8",
311
- "#581c87",
312
- "#3b0764"
313
- ],
314
- fuchsia: [
315
- "#fdf4ff",
316
- "#fae8ff",
317
- "#f5d0fe",
318
- "#f0abfc",
319
- "#e879f9",
320
- "#d946ef",
321
- "#c026d3",
322
- "#a21caf",
323
- "#86198f",
324
- "#701a75",
325
- "#4a044e"
326
- ],
327
- pink: [
328
- "#fdf2f8",
329
- "#fce7f3",
330
- "#fbcfe8",
331
- "#f9a8d4",
332
- "#f472b6",
333
- "#ec4899",
334
- "#db2777",
335
- "#be185d",
336
- "#9d174d",
337
- "#831843",
338
- "#500724"
339
- ],
340
- rose: [
341
- "#fff1f2",
342
- "#ffe4e6",
343
- "#fecdd3",
344
- "#fda4af",
345
- "#fb7185",
346
- "#f43f5e",
347
- "#e11d48",
348
- "#be123c",
349
- "#9f1239",
350
- "#881337",
351
- "#4c0519"
352
- ]
353
- };
354
- function createTailwindV3DefaultColorThemeCss() {
355
- const declarations = [" --color-black: #000;", " --color-white: #fff;"];
356
- 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]};`);
357
- return [
358
- "@theme {",
359
- ...declarations,
360
- "}"
361
- ].join("\n");
362
- }
363
- [
364
- "@theme {",
365
- " --default-ring-width: 3px;",
366
- " --default-ring-color: var(--color-blue-500, #3b82f6);",
367
- " --default-outline-width: 3px;",
368
- "",
369
- " --shadow-xs: 0 1px rgb(0 0 0 / 0.05);",
370
- " --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);",
371
- " --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
372
- " --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);",
373
- " --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);",
374
- " --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);",
375
- "",
376
- " --blur-xs: 4px;",
377
- " --blur-sm: 4px;",
378
- " --blur: 8px;",
379
- " --backdrop-blur-xs: 4px;",
380
- " --backdrop-blur-sm: 4px;",
381
- " --backdrop-blur: 8px;",
382
- "",
383
- " --radius-xs: 0.125rem;",
384
- " --radius-sm: 0.125rem;",
385
- " --radius: 0.25rem;",
386
- "}",
387
- createTailwindV3DefaultColorThemeCss()
388
- ].join("\n");
389
- [
390
- "*,",
391
- "::after,",
392
- "::before,",
393
- "::backdrop,",
394
- "::file-selector-button {",
395
- " border-color: var(--color-gray-200, currentcolor);",
396
- "}",
397
- "",
398
- "input::placeholder,",
399
- "textarea::placeholder {",
400
- " opacity: 1;",
401
- " color: var(--color-gray-400, currentcolor);",
402
- "}",
403
- "",
404
- "button:not(:disabled),",
405
- "[role=\"button\"]:not(:disabled) {",
406
- " cursor: pointer;",
407
- "}",
408
- "",
409
- "dialog {",
410
- " margin: auto;",
411
- "}"
412
- ].join("\n");
51
+ //#region src/tailwindcss/v4-engine/generator/rpx-candidates.ts
52
+ const RPX_LENGTH_UTILITY_PATTERN = String.raw`text|border(?:-[trblxyse])?|bg|outline|ring`;
53
+ new RegExp(String.raw`(^|:)(!?)(${RPX_LENGTH_UTILITY_PATTERN})-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$`, "u");
54
+ new RegExp(String.raw`(?:^|:)!?(${RPX_LENGTH_UTILITY_PATTERN})-\[length:([-+]?(?:\d+|\d*\.\d+)rpx)\].*$`, "u");
55
+ new RegExp(String.raw`(${RPX_LENGTH_UTILITY_PATTERN})-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]`, "g");
413
56
  //#endregion
414
57
  //#region src/tailwindcss/source-scan.ts
415
58
  const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
@@ -480,33 +123,17 @@ createStyleHandler({
480
123
  });
481
124
  //#endregion
482
125
  //#region src/tailwindcss/v4-engine/generator.ts
483
- const INCREMENTAL_GENERATE_CACHE_MAX$1 = 8;
126
+ const INCREMENTAL_GENERATE_CACHE_MAX = 8;
484
127
  const INCREMENTAL_GENERATE_TASK_CACHE_MAX = 32;
485
- new LRUCache({ max: INCREMENTAL_GENERATE_CACHE_MAX$1 });
128
+ new LRUCache({ max: INCREMENTAL_GENERATE_CACHE_MAX });
486
129
  new LRUCache({ max: INCREMENTAL_GENERATE_TASK_CACHE_MAX });
487
130
  createRequire(import.meta.url);
488
- createStyleHandler({
489
- cssChildCombinatorReplaceValue: ["view", "text"],
490
- cssRemoveHoverPseudoClass: true,
491
- isMainChunk: true,
492
- majorVersion: 3
493
- });
494
- new LRUCache({ max: 8 });
495
- typeof tailwindcssPatch.generateTailwindV3RawStyle === "function" && tailwindcssPatch.generateTailwindV3RawStyle;
496
- [
497
- "@tailwind base;",
498
- "@tailwind components;",
499
- "@tailwind utilities;"
500
- ].join("\n");
501
- createDebug("[tailwindcss:runtime-patch] ");
502
- createRequire(import.meta.url);
503
131
  createDebug("[tailwindcss:runtime] ");
504
132
  //#endregion
505
133
  //#region src/tailwindcss/runtime-logs.ts
506
134
  const runtimeLogDedupeHolder = globalThis;
507
135
  runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
508
- //#endregion
509
- //#region src/context/compiler-context-cache.ts
136
+ createRequire(import.meta.url);
510
137
  const globalCacheHolder = globalThis;
511
138
  globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
512
139
  //#endregion
@@ -863,6 +490,19 @@ function hasIgnoreComment(node) {
863
490
  }
864
491
  return false;
865
492
  }
493
+ function isConditionTestLiteral(path) {
494
+ let current = path;
495
+ while (current?.parentPath) {
496
+ const parent = current.parentPath;
497
+ if (parent.isConditionalExpression()) return parent.node.test === current.node;
498
+ if (parent.isBinaryExpression() || parent.isCallExpression() || parent.isLogicalExpression() || parent.isMemberExpression() || parent.isUnaryExpression()) {
499
+ current = parent;
500
+ continue;
501
+ }
502
+ return false;
503
+ }
504
+ return false;
505
+ }
866
506
  function extractLiteralValue(path, { unescapeUnicode }) {
867
507
  const { node } = path;
868
508
  let offset = 0;
@@ -928,6 +568,7 @@ function replaceHandleValue(path, options) {
928
568
  const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
929
569
  if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
930
570
  if (hasIgnoreComment(path.node)) return;
571
+ if (isConditionTestLiteral(path)) return;
931
572
  const { literal, original, offset } = extractLiteralValue(path, options);
932
573
  const candidates = splitCandidateTokens(literal);
933
574
  if (candidates.length === 0) return;
@@ -1942,6 +1583,7 @@ function jsHandler(rawSource, options) {
1942
1583
  return result;
1943
1584
  }
1944
1585
  defaultEvalHandler = jsHandler;
1586
+ createRequire(import.meta.url);
1945
1587
  Object.freeze({ wrapExpression: true });
1946
1588
  //#endregion
1947
1589
  //#region src/wxml/whitespace.ts
@@ -2126,8 +1768,7 @@ const FRAMEWORK_DEPS = [
2126
1768
  ["@tarojs/taro", "Taro"],
2127
1769
  ["@dcloudio/uni-app", "uni-app"],
2128
1770
  ["@mpxjs/core", "MPX"],
2129
- ["remax", "Remax"],
2130
- ["rax", "Rax"]
1771
+ ["remax", "Remax"]
2131
1772
  ];
2132
1773
  //#endregion
2133
1774
  //#region src/cli/doctor.ts
@@ -2277,7 +1918,7 @@ function createDoctorReport(options = {}) {
2277
1918
  title: "Tailwind 配置",
2278
1919
  status: tailwindMajor === 4 ? "info" : "warn",
2279
1920
  message: "未检测到 tailwind.config.*。",
2280
- suggestion: tailwindMajor === 4 ? "Tailwind CSS v4 可以采用 CSS-first 配置;如果使用 v3 或复杂 content/source,请补充配置文件。" : "请确认 Tailwind content/source 配置能够覆盖小程序页面、组件和脚本文件。"
1921
+ suggestion: tailwindMajor === 4 ? "Tailwind CSS v4 可以采用 CSS-first 配置;复杂 content/source 场景请补充配置文件。" : "请确认 Tailwind content/source 配置能够覆盖小程序页面、组件和脚本文件。"
2281
1922
  });
2282
1923
  addCheck(checks, postcssConfig ? {
2283
1924
  id: "postcss-config",
@@ -2307,7 +1948,7 @@ function createDoctorReport(options = {}) {
2307
1948
  id: "framework",
2308
1949
  title: "框架识别",
2309
1950
  status: "info",
2310
- message: "未从依赖中识别出 Taro、uni-app、MPX、RemaxRax。"
1951
+ message: "未从依赖中识别出 Taro、uni-app、MPX 或 Remax。"
2311
1952
  });
2312
1953
  addCheck(checks, viteConfig || webpackConfig ? {
2313
1954
  id: "bundler-config",
@@ -2393,7 +2034,7 @@ function resolveCliCwd(value) {
2393
2034
  async function ensureDir(dir) {
2394
2035
  await mkdir(dir, { recursive: true });
2395
2036
  }
2396
- function handleCliError$1(error) {
2037
+ function handleCliError(error) {
2397
2038
  if (error instanceof Error) {
2398
2039
  logger.error(error.message);
2399
2040
  if (error.stack && process.env["WEAPP_TW_DEBUG"] === "1") logger.error(error.stack);
@@ -2404,7 +2045,7 @@ function commandAction(handler) {
2404
2045
  try {
2405
2046
  await handler(...args);
2406
2047
  } catch (error) {
2407
- handleCliError$1(error);
2048
+ handleCliError(error);
2408
2049
  process.exitCode = 1;
2409
2050
  }
2410
2051
  };
@@ -2412,27 +2053,7 @@ function commandAction(handler) {
2412
2053
  //#endregion
2413
2054
  //#region src/cli/mount-options.ts
2414
2055
  const PATCH_COMMAND_OBSOLETE_NOTICE = "提示:weapp-tailwindcss@5 已由构建运行时接管 Tailwind CSS 处理,weapp-tw patch 已无需执行;请移除 package.json 中的 postinstall 钩子。";
2415
- function logPatchCommandObsoleteNotice() {
2416
- logger.warn(PATCH_COMMAND_OBSOLETE_NOTICE);
2417
- }
2418
- function handleCliError(error) {
2419
- if (error instanceof Error) {
2420
- logger.error(error.message);
2421
- if (error.stack && process.env["WEAPP_TW_DEBUG"] === "1") logger.error(error.stack);
2422
- } else logger.error(String(error));
2423
- }
2424
- function withCommandErrorHandling(handler) {
2425
- return (async (ctx, next) => {
2426
- try {
2427
- return await handler(ctx, next);
2428
- } catch (error) {
2429
- handleCliError(error);
2430
- process.exitCode = 1;
2431
- return;
2432
- }
2433
- });
2434
- }
2435
- const forwardedCommands = [
2056
+ const obsoletePatchCommands = [
2436
2057
  "extract",
2437
2058
  "tokens",
2438
2059
  "init",
@@ -2440,14 +2061,13 @@ const forwardedCommands = [
2440
2061
  "restore",
2441
2062
  "validate"
2442
2063
  ];
2443
- const commandHandlers = Object.fromEntries(forwardedCommands.map((command) => [command, withCommandErrorHandling(async (_ctx, next) => next())]));
2444
- const mountOptions = {
2445
- commands: [...forwardedCommands],
2446
- commandHandlers
2447
- };
2448
- //#endregion
2449
- //#region src/cli/vscode-entry.ts
2450
- const DEFAULT_VSCODE_ENTRY_OUTPUT = ".vscode/weapp-tailwindcss.intellisense.css";
2064
+ function logPatchCommandObsoleteNotice() {
2065
+ logger.warn(PATCH_COMMAND_OBSOLETE_NOTICE);
2066
+ }
2067
+ function logObsoletePatchCommand(command) {
2068
+ logPatchCommandObsoleteNotice();
2069
+ logger.warn(`命令 "${command}" 来自旧版 tailwindcss-patch 工作流,当前版本无需执行。`);
2070
+ }
2451
2071
  const DEFAULT_VSCODE_SOURCES = [
2452
2072
  "not \"./dist\"",
2453
2073
  "not \"./unpackage\"",
@@ -2547,49 +2167,123 @@ async function generateVscodeIntellisenseEntry(options) {
2547
2167
  //#region src/cli.ts
2548
2168
  process.title = "node (weapp-tailwindcss)";
2549
2169
  if (!semver.satisfies(process.versions.node, "^20.19.0 || >=22.12.0")) logger.warn(`You are using Node.js ${process.versions.node}. For weapp-tailwindcss, Node.js version ${WEAPP_TW_REQUIRED_NODE_VERSION_RANGE} is required.`);
2550
- const cli = createTailwindcssPatchCli({
2551
- name: "weapp-tailwindcss",
2552
- mountOptions
2553
- });
2554
- 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) => {
2170
+ function parseArgs(argv) {
2171
+ const options = {};
2172
+ const positional = [];
2173
+ for (let index = 0; index < argv.length; index++) {
2174
+ const arg = argv[index];
2175
+ if (arg === void 0) continue;
2176
+ if (!arg.startsWith("--")) {
2177
+ positional.push(arg);
2178
+ continue;
2179
+ }
2180
+ const [rawKey, inlineValue] = arg.slice(2).split("=", 2);
2181
+ if (!rawKey) continue;
2182
+ const key = rawKey.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
2183
+ const next = argv[index + 1];
2184
+ let value = true;
2185
+ if (inlineValue !== void 0) value = inlineValue;
2186
+ else if (next !== void 0 && !next.startsWith("-")) {
2187
+ index++;
2188
+ value = next;
2189
+ }
2190
+ const current = options[key];
2191
+ if (current === void 0) options[key] = value;
2192
+ else if (Array.isArray(current)) current.push(String(value));
2193
+ else options[key] = [String(current), String(value)];
2194
+ }
2195
+ return {
2196
+ command: positional[0],
2197
+ options
2198
+ };
2199
+ }
2200
+ function printHelp() {
2201
+ logger.log(`weapp-tailwindcss
2202
+
2203
+ Usage:
2204
+ weapp-tw <command> [options]
2205
+
2206
+ Commands:
2207
+ patch Deprecated no-op: v5 runtime handles Tailwind CSS automatically
2208
+ status Deprecated no-op: patch status is no longer required
2209
+ vscode-entry Generate a VS Code helper CSS for Tailwind IntelliSense
2210
+ doctor Check project setup for weapp-tailwindcss
2211
+ `);
2212
+ }
2213
+ async function runPatch() {
2555
2214
  logPatchCommandObsoleteNotice();
2556
2215
  logger.success("已跳过:当前版本不需要手动执行 Tailwind CSS patch。");
2557
- }));
2558
- 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) => {
2216
+ }
2217
+ async function runStatus(options) {
2559
2218
  const payload = {
2560
2219
  required: false,
2561
2220
  status: "unnecessary",
2562
2221
  message: PATCH_COMMAND_OBSOLETE_NOTICE
2563
2222
  };
2564
- if (toBoolean(options.json, false)) {
2223
+ if (toBoolean(options["json"], false)) {
2565
2224
  logger.log(JSON.stringify(payload, null, 2));
2566
2225
  return;
2567
2226
  }
2568
2227
  logPatchCommandObsoleteNotice();
2569
2228
  logger.success("无需检查 Tailwind CSS patch 状态。");
2570
- }));
2571
- 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) => {
2229
+ }
2230
+ async function runVscodeEntry(options) {
2572
2231
  const resolvedCwd = resolveCliCwd(options.cwd);
2573
2232
  const baseDir = resolvedCwd ?? process.cwd();
2574
- const cssEntry = readStringOption("css", options.css);
2233
+ const cssEntry = readStringOption("css", options["css"]);
2575
2234
  if (!cssEntry) throw new Error("Option \"--css\" is required.");
2576
2235
  const result = await generateVscodeIntellisenseEntry({
2577
2236
  baseDir,
2578
2237
  cssEntry,
2579
- output: readStringOption("output", options.output),
2580
- sources: readStringArrayOption("source", options.source),
2581
- force: toBoolean(options.force, false)
2238
+ output: readStringOption("output", options["output"]),
2239
+ sources: readStringArrayOption("source", options["source"]),
2240
+ force: toBoolean(options["force"], false)
2582
2241
  });
2583
2242
  logger.success(`VS Code helper generated -> ${formatOutputPath(result.outputPath, resolvedCwd)}`);
2584
- }));
2585
- 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) => {
2243
+ }
2244
+ async function runDoctor(options) {
2586
2245
  const report = createDoctorReport({ cwd: resolveCliCwd(options.cwd) });
2587
- if (toBoolean(options.json, false)) logger.log(JSON.stringify(report, null, 2));
2246
+ if (toBoolean(options["json"], false)) logger.log(JSON.stringify(report, null, 2));
2588
2247
  else logger.log(formatDoctorReport(report));
2589
- if (hasDoctorFailure(report, toBoolean(options.strict, false))) process.exitCode = 1;
2590
- }));
2591
- cli.help();
2592
- cli.version(process.env["npm_package_version"] ?? "0.0.0");
2593
- cli.parse();
2248
+ if (hasDoctorFailure(report, toBoolean(options["strict"], false))) process.exitCode = 1;
2249
+ }
2250
+ async function main() {
2251
+ const { command, options } = parseArgs(process.argv.slice(2));
2252
+ await commandAction(async () => {
2253
+ switch (command) {
2254
+ case void 0:
2255
+ case "-h":
2256
+ case "--help":
2257
+ case "help":
2258
+ printHelp();
2259
+ return;
2260
+ case "-v":
2261
+ case "--version":
2262
+ case "version":
2263
+ logger.log(process.env["npm_package_version"] ?? "0.0.0");
2264
+ return;
2265
+ case "patch":
2266
+ case "install":
2267
+ await runPatch();
2268
+ return;
2269
+ case "status":
2270
+ await runStatus(options);
2271
+ return;
2272
+ case "vscode-entry":
2273
+ await runVscodeEntry(options);
2274
+ return;
2275
+ case "doctor":
2276
+ await runDoctor(options);
2277
+ return;
2278
+ default:
2279
+ if (obsoletePatchCommands.includes(command)) {
2280
+ logObsoletePatchCommand(command);
2281
+ return;
2282
+ }
2283
+ throw new Error(`Unknown command: ${command}`);
2284
+ }
2285
+ })();
2286
+ }
2287
+ main();
2594
2288
  //#endregion
2595
2289
  export {};