weapp-tailwindcss 4.12.0 → 5.0.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/README.md +4 -5
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/babel/index.d.ts +3 -0
  4. package/dist/bundle-state-BWqi5ZyX.mjs +343 -0
  5. package/dist/bundle-state-EUbcdKqo.js +410 -0
  6. package/dist/bundlers/gulp/index.d.ts +7 -0
  7. package/dist/bundlers/shared/cache.d.ts +16 -0
  8. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
  9. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
  10. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +4 -0
  11. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  12. package/dist/bundlers/shared/css-cleanup.d.ts +3 -0
  13. package/dist/bundlers/shared/css-imports.d.ts +8 -0
  14. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  15. package/dist/bundlers/shared/generator-css/directives.d.ts +13 -0
  16. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  17. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  18. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  19. package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
  20. package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
  21. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
  22. package/dist/bundlers/shared/generator-css.d.ts +33 -0
  23. package/dist/bundlers/shared/module-graph.d.ts +5 -0
  24. package/dist/bundlers/shared/run-tasks.d.ts +2 -0
  25. package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
  26. package/dist/bundlers/vite/bundle-state.d.ts +43 -0
  27. package/dist/bundlers/vite/css-finalizer.d.ts +22 -0
  28. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  29. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
  30. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
  31. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  32. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  33. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  34. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  35. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  36. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  37. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  38. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  39. package/dist/bundlers/vite/generate-bundle.d.ts +34 -0
  40. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
  41. package/dist/bundlers/vite/index.d.ts +3 -0
  42. package/dist/bundlers/vite/js-precheck.d.ts +1 -0
  43. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  44. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  45. package/dist/bundlers/vite/query.d.ts +15 -0
  46. package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
  47. package/dist/bundlers/vite/rewrite-css-imports.d.ts +13 -0
  48. package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
  49. package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
  50. package/dist/bundlers/vite/source-candidates.d.ts +18 -0
  51. package/dist/bundlers/vite/source-scan.d.ts +8 -0
  52. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  53. package/dist/bundlers/vite/utils.d.ts +9 -0
  54. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +21 -0
  55. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +20 -0
  56. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +20 -0
  57. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +10 -0
  58. package/dist/bundlers/webpack/index.d.ts +1 -0
  59. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +14 -0
  60. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
  61. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
  62. package/dist/cache/index.d.ts +38 -0
  63. package/dist/cache/md5.d.ts +1 -0
  64. package/dist/cache-BVAiJV3J.js +502 -0
  65. package/dist/cache-CHs4DXui.mjs +434 -0
  66. package/dist/chunk-8l464Juk.js +28 -0
  67. package/dist/cli/context.d.ts +13 -0
  68. package/dist/cli/doctor/constants.d.ts +7 -0
  69. package/dist/cli/doctor/types.d.ts +31 -0
  70. package/dist/cli/doctor.d.ts +4 -0
  71. package/dist/cli/helpers/options/format.d.ts +2 -0
  72. package/dist/cli/helpers/options/parse.d.ts +3 -0
  73. package/dist/cli/helpers/options/resolve.d.ts +1 -0
  74. package/dist/cli/helpers/options.d.ts +3 -0
  75. package/dist/cli/helpers.d.ts +4 -0
  76. package/dist/cli/mount-options.d.ts +4 -0
  77. package/dist/cli/types.d.ts +15 -0
  78. package/dist/cli/vscode-entry.d.ts +14 -0
  79. package/dist/cli.d.ts +1 -2
  80. package/dist/cli.js +1985 -3574
  81. package/dist/cli.mjs +1962 -3554
  82. package/dist/constants-BG12WAKw.mjs +44 -0
  83. package/dist/constants-BeeyfJ9k.js +73 -0
  84. package/dist/constants.d.ts +12 -0
  85. package/dist/context/compiler-context-cache.d.ts +3 -0
  86. package/dist/context/custom-attributes.d.ts +2 -0
  87. package/dist/context/handlers.d.ts +6 -0
  88. package/dist/context/index.d.ts +7 -0
  89. package/dist/context/logger.d.ts +4 -0
  90. package/dist/context/tailwindcss/basedir.d.ts +1 -0
  91. package/dist/context/tailwindcss/rax.d.ts +2 -0
  92. package/dist/context/tailwindcss.d.ts +4 -0
  93. package/dist/context/workspace.d.ts +3 -0
  94. package/dist/core.d.ts +5 -21
  95. package/dist/core.js +131 -180
  96. package/dist/core.mjs +129 -180
  97. package/dist/css-macro/constants.d.ts +14 -0
  98. package/dist/css-macro/index.d.ts +15 -0
  99. package/dist/css-macro/postcss.d.ts +3 -7
  100. package/dist/css-macro/postcss.js +44 -58
  101. package/dist/css-macro/postcss.mjs +44 -56
  102. package/dist/css-macro.d.ts +2 -20
  103. package/dist/css-macro.js +37 -50
  104. package/dist/css-macro.mjs +33 -47
  105. package/dist/debug/index.d.ts +5 -0
  106. package/dist/defaults.d.ts +16 -11
  107. package/dist/defaults.js +151 -8
  108. package/dist/defaults.mjs +143 -7
  109. package/dist/escape.js +31 -54
  110. package/dist/escape.mjs +18 -25
  111. package/dist/generator/index.d.ts +11 -0
  112. package/dist/generator/options.d.ts +16 -0
  113. package/dist/generator/types.d.ts +20 -0
  114. package/dist/generator-DKkhJbOg.js +1531 -0
  115. package/dist/generator-UBmfduYg.mjs +1432 -0
  116. package/dist/generator.d.ts +1 -0
  117. package/dist/generator.js +19 -0
  118. package/dist/generator.mjs +2 -0
  119. package/dist/gulp.d.ts +4 -24
  120. package/dist/gulp.js +370 -13
  121. package/dist/gulp.mjs +362 -13
  122. package/dist/incremental-runtime-class-set-BYmzQ-_f.js +1555 -0
  123. package/dist/incremental-runtime-class-set-BgMW6wf2.mjs +1510 -0
  124. package/dist/index.d.ts +8 -15
  125. package/dist/index.js +12 -24
  126. package/dist/index.mjs +6 -24
  127. package/dist/js/JsTokenUpdater.d.ts +14 -0
  128. package/dist/js/ModuleGraph.d.ts +18 -0
  129. package/dist/js/NodePathWalker.d.ts +33 -0
  130. package/dist/js/babel/parse.d.ts +9 -0
  131. package/dist/js/babel/process.d.ts +4 -0
  132. package/dist/js/babel.d.ts +13 -0
  133. package/dist/js/class-context.d.ts +3 -0
  134. package/dist/js/evalTransforms.d.ts +7 -0
  135. package/dist/js/handlers.d.ts +5 -0
  136. package/dist/js/index.d.ts +5 -0
  137. package/dist/js/literal-transform.d.ts +2 -0
  138. package/dist/js/module-graph/ignored-exports.d.ts +18 -0
  139. package/dist/js/module-graph/types.d.ts +17 -0
  140. package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
  141. package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
  142. package/dist/js/precheck.d.ts +2 -0
  143. package/dist/js/sourceAnalysis.d.ts +17 -0
  144. package/dist/js/taggedTemplateIgnore.d.ts +13 -0
  145. package/dist/js/types.d.ts +11 -0
  146. package/dist/lightningcss/index.d.ts +8 -0
  147. package/dist/lightningcss/style-handler/options.d.ts +3 -0
  148. package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
  149. package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
  150. package/dist/lightningcss/style-handler.d.ts +17 -0
  151. package/dist/logger/index.d.ts +2 -0
  152. package/dist/logger-CZUxvJJD.mjs +2 -0
  153. package/dist/logger-EVNB9z7i.js +1 -0
  154. package/dist/postcss/config-directive.d.ts +1 -0
  155. package/dist/postcss/context.d.ts +9 -0
  156. package/dist/postcss/source-files.d.ts +8 -0
  157. package/dist/postcss/tailwind-version.d.ts +3 -0
  158. package/dist/postcss-C7efq3hr.mjs +231 -0
  159. package/dist/postcss-Dg-_lyHS.js +240 -0
  160. package/dist/postcss-html-transform.d.ts +3 -3
  161. package/dist/postcss-html-transform.js +7 -10
  162. package/dist/postcss-html-transform.mjs +3 -6
  163. package/dist/postcss.d.ts +15 -0
  164. package/dist/postcss.js +7 -0
  165. package/dist/postcss.mjs +2 -0
  166. package/dist/precheck-B32p-gLI.js +2736 -0
  167. package/dist/precheck-B4RH6ZNN.mjs +2622 -0
  168. package/dist/presets/hbuilderx.d.ts +4 -0
  169. package/dist/presets/index.d.ts +3 -0
  170. package/dist/presets/shared.d.ts +10 -0
  171. package/dist/presets/taro.d.ts +4 -0
  172. package/dist/presets/uni-app-x.d.ts +16 -0
  173. package/dist/presets/uni-app.d.ts +4 -0
  174. package/dist/presets.d.ts +1 -76
  175. package/dist/presets.js +117 -163
  176. package/dist/presets.mjs +109 -163
  177. package/dist/reset/index.d.ts +2 -0
  178. package/dist/reset.d.ts +2 -4
  179. package/dist/reset.js +19 -8
  180. package/dist/reset.mjs +2 -8
  181. package/dist/runtime-patch-CwN5ya72.mjs +71 -0
  182. package/dist/runtime-patch-D6mBo_KB.js +85 -0
  183. package/dist/shared/classname-transform.d.ts +14 -0
  184. package/dist/shared/mpx.d.ts +7 -0
  185. package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
  186. package/dist/source-scan-BaYvNx-k.js +293 -0
  187. package/dist/source-scan-cGZxoJqP.mjs +254 -0
  188. package/dist/tailwindcss/index.d.ts +11 -0
  189. package/dist/tailwindcss/miniprogram.d.ts +5 -0
  190. package/dist/tailwindcss/patcher-options.d.ts +8 -0
  191. package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
  192. package/dist/tailwindcss/patcher.d.ts +12 -0
  193. package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
  194. package/dist/tailwindcss/runtime/cache.d.ts +11 -0
  195. package/dist/tailwindcss/runtime-logs.d.ts +3 -0
  196. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  197. package/dist/tailwindcss/runtime.d.ts +28 -0
  198. package/dist/tailwindcss/source-scan.d.ts +25 -0
  199. package/dist/tailwindcss/targets.d.ts +2 -0
  200. package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
  201. package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
  202. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
  203. package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
  204. package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
  205. package/dist/tailwindcss/v4/config.d.ts +5 -0
  206. package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
  207. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  208. package/dist/tailwindcss/v4/index.d.ts +2 -0
  209. package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
  210. package/dist/tailwindcss/v4/patcher-options.d.ts +2 -0
  211. package/dist/tailwindcss/v4/patcher.d.ts +15 -0
  212. package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
  213. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
  214. package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
  215. package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
  216. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +5 -0
  217. package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
  218. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
  219. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
  220. package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
  221. package/dist/tailwindcss/v4-engine/types.d.ts +19 -0
  222. package/dist/tailwindcss/version.d.ts +4 -0
  223. package/dist/tailwindcss-Bu-RWIHx.js +630 -0
  224. package/dist/tailwindcss-C5IgPlQ0.mjs +579 -0
  225. package/dist/typedoc.export.d.ts +3 -0
  226. package/dist/types/base.d.ts +1 -0
  227. package/dist/types/index.d.ts +97 -0
  228. package/dist/types/shared.d.ts +10 -0
  229. package/dist/types/user-defined-options/general.d.ts +29 -0
  230. package/dist/types/user-defined-options/important.d.ts +37 -0
  231. package/dist/types/user-defined-options/index.d.ts +11 -0
  232. package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
  233. package/dist/types/user-defined-options/matcher.d.ts +9 -0
  234. package/dist/types.d.ts +1 -150
  235. package/dist/types.js +0 -1
  236. package/dist/types.mjs +1 -1
  237. package/dist/uni-app-x/component-local-style.d.ts +19 -0
  238. package/dist/uni-app-x/index.d.ts +2 -0
  239. package/dist/uni-app-x/options.d.ts +12 -0
  240. package/dist/uni-app-x/style-isolation.d.ts +2 -0
  241. package/dist/uni-app-x/transform.d.ts +9 -0
  242. package/dist/uni-app-x/vite.d.ts +36 -0
  243. package/dist/utils/decode.d.ts +2 -0
  244. package/dist/utils/disabled.d.ts +5 -0
  245. package/dist/utils/hbuilderx.d.ts +5 -0
  246. package/dist/utils/index.d.ts +7 -0
  247. package/dist/utils/nameMatcher.d.ts +4 -0
  248. package/dist/utils/resolve-package.d.ts +1 -0
  249. package/dist/utils/uni-platform.d.ts +11 -0
  250. package/dist/utils-BiShvil9.js +61 -0
  251. package/dist/utils-Btw1iOVV.mjs +48 -0
  252. package/dist/vite-BU74SkOi.mjs +2246 -0
  253. package/dist/vite-CKjx_5c3.js +2261 -0
  254. package/dist/vite.d.ts +3 -17
  255. package/dist/vite.js +4 -14
  256. package/dist/vite.mjs +2 -14
  257. package/dist/weapp-tw-css-import-rewrite-loader.js +68 -92
  258. package/dist/weapp-tw-runtime-classset-loader.js +31 -50
  259. package/dist/webpack-CAk_ITq7.mjs +713 -0
  260. package/dist/webpack-damWiYqY.js +723 -0
  261. package/dist/webpack.d.ts +4 -25
  262. package/dist/webpack.js +6 -17
  263. package/dist/webpack.mjs +2 -17
  264. package/dist/wxml/Tokenizer.d.ts +15 -0
  265. package/dist/wxml/custom-attributes.d.ts +4 -0
  266. package/dist/wxml/index.d.ts +2 -0
  267. package/dist/wxml/shared.d.ts +2 -0
  268. package/dist/wxml/tokenizer/types.d.ts +18 -0
  269. package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
  270. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
  271. package/dist/wxml/utils/codegen.d.ts +2 -0
  272. package/dist/wxml/utils/custom-template.d.ts +3 -0
  273. package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
  274. package/dist/wxml/utils/fragment-updater.d.ts +4 -0
  275. package/dist/wxml/utils/template-fragments.d.ts +3 -0
  276. package/dist/wxml/utils.d.ts +8 -0
  277. package/dist/wxml/whitespace.d.ts +2 -0
  278. package/generator-placeholder.css +1 -0
  279. package/package.json +39 -38
  280. package/dist/chunk-24AGZQVR.js +0 -183
  281. package/dist/chunk-3VQKDHGP.mjs +0 -179
  282. package/dist/chunk-4AFQP74Z.js +0 -24
  283. package/dist/chunk-57SOQCAU.mjs +0 -582
  284. package/dist/chunk-5ZYHNDEK.mjs +0 -2439
  285. package/dist/chunk-76S2EME4.mjs +0 -34
  286. package/dist/chunk-A5PB4KZT.js +0 -138
  287. package/dist/chunk-DUHYLR2R.js +0 -276
  288. package/dist/chunk-DYLQ6UOI.js +0 -71
  289. package/dist/chunk-E7I5TW5K.js +0 -52
  290. package/dist/chunk-FS2NOOEB.js +0 -292
  291. package/dist/chunk-HVNGIKLS.js +0 -3930
  292. package/dist/chunk-JZQBZHN5.js +0 -579
  293. package/dist/chunk-KGTVD4EP.mjs +0 -3930
  294. package/dist/chunk-NNOQDMUP.mjs +0 -10
  295. package/dist/chunk-OF6MFURR.js +0 -34
  296. package/dist/chunk-OFB2KBRP.js +0 -2442
  297. package/dist/chunk-OOHJLO5M.mjs +0 -71
  298. package/dist/chunk-PCDYXXSK.mjs +0 -1515
  299. package/dist/chunk-RKISS72P.js +0 -7
  300. package/dist/chunk-RRQZL7FQ.mjs +0 -292
  301. package/dist/chunk-XAKAD2CR.mjs +0 -138
  302. package/dist/chunk-XZP3MREK.mjs +0 -276
  303. package/dist/chunk-ZAA5ZG3D.js +0 -1518
  304. package/dist/chunk-ZCH4YINE.mjs +0 -52
  305. package/dist/cli.d.mts +0 -2
  306. package/dist/core.d.mts +0 -26
  307. package/dist/css-macro/postcss.d.mts +0 -7
  308. package/dist/css-macro.d.mts +0 -18
  309. package/dist/defaults.d.mts +0 -11
  310. package/dist/gulp.d.mts +0 -24
  311. package/dist/index-BXrmQelt.d.mts +0 -672
  312. package/dist/index-BXrmQelt.d.ts +0 -672
  313. package/dist/index.d.mts +0 -15
  314. package/dist/postcss-html-transform.d.mts +0 -2
  315. package/dist/presets.d.mts +0 -76
  316. package/dist/reset.d.mts +0 -1
  317. package/dist/types.d.mts +0 -150
  318. package/dist/vite.d.mts +0 -17
  319. package/dist/webpack.d.mts +0 -25
  320. package/dist/webpack4.d.mts +0 -26
  321. package/dist/webpack4.d.ts +0 -26
  322. package/dist/webpack4.js +0 -493
  323. package/dist/webpack4.mjs +0 -495
  324. package/scripts/postinstall.mjs +0 -59
package/README.md CHANGED
@@ -15,7 +15,6 @@
15
15
 
16
16
  ![star](https://badgen.net/github/stars/sonofmagic/weapp-tailwindcss)
17
17
  ![dm0](https://badgen.net/npm/dm/weapp-tailwindcss)
18
- ![dm1](https://badgen.net/npm/dm/weapp-tailwindcss-webpack-plugin)
19
18
  ![license](https://badgen.net/npm/license/weapp-tailwindcss)
20
19
  [![test](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
21
20
  [![codecov](https://codecov.io/gh/sonofmagic/weapp-tailwindcss/branch/main/graph/badge.svg?token=zn05qXYznt)](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
@@ -55,12 +54,12 @@
55
54
 
56
55
  ## 版本对应
57
56
 
58
- 目前,`weapp-tailwindcss` 的 `4.x` 版本
57
+ 目前,`weapp-tailwindcss` 的 `5.x` 版本
59
58
 
60
- - 支持最新版本的 `tailwindcss v4` 和 `v3` 还有 `v2 jit` 版本。
61
- - 支持 `webpack5`,`webpack4`, `vite` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
59
+ - 支持最新版本的 `tailwindcss v4` 和 `v3`。
60
+ - 支持 `webpack5`、`vite`、`rspack`、`rollup`、`rolldown` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
62
61
 
63
- > 如果你还在使用 `tailwindcss@2` 版本,那你应该使用从 `weapp-tailwindcss/webpack4` 导出的本插件的 `postcss7` `webpack4` 版本。另外请确保你的 `nodejs` 版本 `>=16.6.0`。目前低于 `16` 的长期维护版本(`偶数版本`) 都已经结束了生命周期,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
62
+ > `weapp-tailwindcss@5` 面向 Tailwind CSS v3/v4 和现代构建链路,不再内置 Webpack4、PostCSS7、Tailwind CSS v2 兼容入口。`weapp-tailwindcss@5` 需要 `nodejs` 版本 `^20.19.0 || >=22.12.0`,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
64
63
 
65
64
  ## [安装与使用方式](https://tw.icebreaker.top/docs/quick-start/install)
66
65
 
@@ -1,28 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  const fs = require('node:fs')
3
3
  const path = require('node:path')
4
- const process = require('node:process')
5
-
6
- function isInstallLifecycle() {
7
- return process.env.npm_lifecycle_event === 'postinstall' || process.env.npm_lifecycle_event === 'prepare'
8
- }
9
-
10
- function isMissingRuntimeModuleError(error) {
11
- return error && error.code === 'MODULE_NOT_FOUND'
12
- }
13
4
 
14
5
  const cliPath = path.resolve(__dirname, '../dist/cli.js')
15
6
  if (fs.existsSync(cliPath)) {
16
- try {
17
- require(cliPath)
18
- }
19
- catch (error) {
20
- if (isInstallLifecycle() && isMissingRuntimeModuleError(error)) {
21
- console.error('[weapp-tailwindcss] install lifecycle patch skipped because a runtime module is missing.')
22
- console.error('Run `pnpm --filter weapp-tailwindcss build` before strict CLI validation.')
23
- }
24
- else {
25
- throw error
26
- }
27
- }
7
+ require(cliPath)
28
8
  }
@@ -0,0 +1,3 @@
1
+ import _babelTraverse from '@babel/traverse';
2
+ export { parse, parseExpression } from '@babel/parser';
3
+ export declare const traverse: typeof _babelTraverse;
@@ -0,0 +1,343 @@
1
+ import { d as traverse, u as babelParse } from "./precheck-B4RH6ZNN.mjs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import { Buffer } from "node:buffer";
5
+ import { Parser } from "htmlparser2";
6
+ //#region src/bundlers/shared/module-graph.ts
7
+ const QUERY_HASH_RE = /[?#].*$/u;
8
+ const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
9
+ const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
10
+ const VIRTUAL_PREFIX = "\0";
11
+ const JS_EXTENSIONS = [
12
+ ".js",
13
+ ".mjs",
14
+ ".cjs"
15
+ ];
16
+ function normalizeOutputPathKey(value) {
17
+ return path.normalize(value).replace(/\\/g, "/");
18
+ }
19
+ function stripQueryAndHash(specifier) {
20
+ return specifier.replace(QUERY_HASH_RE, "");
21
+ }
22
+ function isResolvableSpecifier(specifier) {
23
+ if (!specifier) return false;
24
+ const normalized = stripQueryAndHash(specifier);
25
+ if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
26
+ if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
27
+ return !PROTOCOL_RE.test(normalized);
28
+ }
29
+ function toAbsoluteOutputPath(fileName, outDir) {
30
+ if (path.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return path.normalize(fileName);
31
+ return path.resolve(outDir, fileName);
32
+ }
33
+ function matchWithExtensions(candidate, hasOutput) {
34
+ if (hasOutput(candidate)) return candidate;
35
+ if (!path.extname(candidate)) for (const ext of JS_EXTENSIONS) {
36
+ const extended = `${candidate}${ext}`;
37
+ if (hasOutput(extended)) return extended;
38
+ }
39
+ }
40
+ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
41
+ if (!isResolvableSpecifier(specifier)) return;
42
+ const normalized = stripQueryAndHash(specifier);
43
+ let candidate;
44
+ if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = path.normalize(normalized);
45
+ else if (normalized.startsWith("/")) candidate = path.resolve(outDir, normalized.slice(1));
46
+ else candidate = path.resolve(path.dirname(importer), normalized);
47
+ return matchWithExtensions(candidate, hasOutput);
48
+ }
49
+ //#endregion
50
+ //#region src/utils/disabled.ts
51
+ function resolvePluginDisabledState(disabled) {
52
+ if (disabled === true) return { plugin: true };
53
+ if (disabled === false || disabled == null) return { plugin: false };
54
+ return { plugin: disabled.plugin ?? false };
55
+ }
56
+ //#endregion
57
+ //#region src/utils/resolve-package.ts
58
+ const require = createRequire(import.meta.url);
59
+ function resolvePackageDir(name) {
60
+ const pkgPath = require.resolve(`${name}/package.json`);
61
+ return path.dirname(pkgPath);
62
+ }
63
+ //#endregion
64
+ //#region src/bundlers/shared/run-tasks.ts
65
+ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
66
+ if (factories.length === 0) return [];
67
+ const results = Array.from({ length: factories.length });
68
+ const executing = /* @__PURE__ */ new Set();
69
+ let cursor = 0;
70
+ const effectiveLimit = Math.max(1, limit);
71
+ const scheduleNext = () => {
72
+ if (cursor >= factories.length) return;
73
+ const currentIndex = cursor++;
74
+ const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
75
+ results[currentIndex] = value;
76
+ }).finally(() => {
77
+ executing.delete(wrapped);
78
+ });
79
+ executing.add(wrapped);
80
+ };
81
+ while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
82
+ while (cursor < factories.length) {
83
+ await Promise.race(executing);
84
+ scheduleNext();
85
+ }
86
+ await Promise.all(executing);
87
+ return results;
88
+ }
89
+ function pushConcurrentTaskFactories(queue, factories, limit) {
90
+ if (factories.length === 0) return;
91
+ queue.push(runWithConcurrency(factories, limit).then(() => void 0));
92
+ }
93
+ //#endregion
94
+ //#region src/bundlers/vite/bundle-entries.ts
95
+ function readOutputEntry(entry) {
96
+ if (entry.output.type === "chunk") return entry.output.code;
97
+ const source = entry.output.source;
98
+ if (typeof source === "string") return source;
99
+ if (source instanceof Uint8Array) return Buffer.from(source).toString();
100
+ const fallbackSource = source;
101
+ if (fallbackSource == null) return;
102
+ if (typeof fallbackSource.toString === "function") return fallbackSource.toString();
103
+ }
104
+ function isJavaScriptEntry(entry) {
105
+ if (entry.output.type === "chunk") return true;
106
+ return entry.fileName.endsWith(".js");
107
+ }
108
+ function createBundleModuleGraphOptions(outputDir, entries) {
109
+ const normalizedEntries = /* @__PURE__ */ new Map();
110
+ for (const [id, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(id), entry);
111
+ const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
112
+ return {
113
+ resolve(specifier, importer) {
114
+ return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
115
+ },
116
+ load(id) {
117
+ const entry = getEntry(id);
118
+ if (!entry) return;
119
+ return readOutputEntry(entry);
120
+ },
121
+ filter(id) {
122
+ return Boolean(getEntry(id));
123
+ }
124
+ };
125
+ }
126
+ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
127
+ if (!linked) return;
128
+ const normalizedEntries = /* @__PURE__ */ new Map();
129
+ for (const [entryId, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
130
+ for (const [id, { code }] of Object.entries(linked)) {
131
+ const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
132
+ if (!entry) continue;
133
+ const previous = readOutputEntry(entry);
134
+ if (previous == null || previous === code) continue;
135
+ if (entry.output.type === "chunk") entry.output.code = code;
136
+ else entry.output.source = code;
137
+ onApplied?.(entry, code);
138
+ onLinkedUpdate(entry.fileName, previous, code);
139
+ }
140
+ }
141
+ //#endregion
142
+ //#region src/bundlers/vite/runtime-affecting-signature.ts
143
+ const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
144
+ const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
145
+ const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
146
+ const CSS_WHITESPACE_RE = /\s+/g;
147
+ function createHtmlRuntimeAffectingSignature(source) {
148
+ try {
149
+ const parts = [];
150
+ const parser = new Parser({
151
+ onattribute(name, value) {
152
+ parts.push(`a:${name}=${value}`);
153
+ },
154
+ oncomment(data) {
155
+ parts.push(`c:${data}`);
156
+ },
157
+ ontext(data) {
158
+ const value = data.trim();
159
+ if (value.length > 0) parts.push(`t:${value}`);
160
+ }
161
+ }, { xmlMode: true });
162
+ parser.write(source);
163
+ parser.end();
164
+ return parts.join("\n");
165
+ } catch {
166
+ return source;
167
+ }
168
+ }
169
+ function createJsRuntimeAffectingSignature(source) {
170
+ try {
171
+ const ast = babelParse(source, {
172
+ cache: true,
173
+ cacheKey: "vite-runtime-affecting:unambiguous",
174
+ plugins: ["jsx", "typescript"],
175
+ sourceType: "unambiguous"
176
+ });
177
+ const parts = [];
178
+ traverse(ast, {
179
+ noScope: true,
180
+ StringLiteral(path) {
181
+ parts.push(`s:${path.node.value}`);
182
+ },
183
+ TemplateElement(path) {
184
+ parts.push(`t:${path.node.value.raw}`);
185
+ },
186
+ JSXText(path) {
187
+ const value = path.node.value.trim();
188
+ if (value.length > 0) parts.push(`x:${value}`);
189
+ }
190
+ });
191
+ const comments = ast.comments;
192
+ if (Array.isArray(comments)) {
193
+ for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
194
+ }
195
+ return parts.join("\n");
196
+ } catch {
197
+ return source;
198
+ }
199
+ }
200
+ function createCssRuntimeAffectingSignature(source) {
201
+ return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
202
+ }
203
+ function createRuntimeAffectingSourceSignature(source, type) {
204
+ if (type === "html") return createHtmlRuntimeAffectingSignature(source);
205
+ if (type === "js") return createJsRuntimeAffectingSignature(source);
206
+ if (type === "css") return createCssRuntimeAffectingSignature(source);
207
+ return source;
208
+ }
209
+ //#endregion
210
+ //#region src/bundlers/vite/bundle-state.ts
211
+ function createBundleBuildState() {
212
+ return {
213
+ iteration: 0,
214
+ sourceHashByFile: /* @__PURE__ */ new Map(),
215
+ runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
216
+ runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
217
+ linkedByEntry: /* @__PURE__ */ new Map(),
218
+ dependentsByLinkedFile: /* @__PURE__ */ new Map()
219
+ };
220
+ }
221
+ function createChangedByType() {
222
+ return {
223
+ html: /* @__PURE__ */ new Set(),
224
+ js: /* @__PURE__ */ new Set(),
225
+ css: /* @__PURE__ */ new Set(),
226
+ other: /* @__PURE__ */ new Set()
227
+ };
228
+ }
229
+ function createProcessFiles() {
230
+ return {
231
+ html: /* @__PURE__ */ new Set(),
232
+ js: /* @__PURE__ */ new Set(),
233
+ css: /* @__PURE__ */ new Set()
234
+ };
235
+ }
236
+ function readEntrySource(output) {
237
+ if (output.type === "chunk") return output.code;
238
+ return output.source.toString();
239
+ }
240
+ function classifyBundleEntry(file, opts) {
241
+ if (opts.cssMatcher(file)) return "css";
242
+ if (opts.htmlMatcher(file)) return "html";
243
+ if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
244
+ return "other";
245
+ }
246
+ function collectJsEntries(fileName, output, outDir, store) {
247
+ const entry = {
248
+ fileName,
249
+ output
250
+ };
251
+ if (!isJavaScriptEntry(entry)) return;
252
+ const absolute = toAbsoluteOutputPath(fileName, outDir);
253
+ store.set(absolute, entry);
254
+ }
255
+ function markProcessFile(type, file, processFiles) {
256
+ if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
257
+ }
258
+ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
259
+ const sourceHashByFile = /* @__PURE__ */ new Map();
260
+ const runtimeAffectingSignatureByFile = /* @__PURE__ */ new Map();
261
+ const runtimeAffectingHashByFile = /* @__PURE__ */ new Map();
262
+ const changedByType = createChangedByType();
263
+ const runtimeAffectingChangedByType = createChangedByType();
264
+ const processFiles = createProcessFiles();
265
+ const linkedImpactsByEntry = /* @__PURE__ */ new Map();
266
+ const jsEntries = /* @__PURE__ */ new Map();
267
+ const entries = [];
268
+ const firstRun = state.linkedByEntry.size === 0;
269
+ for (const [file, output] of Object.entries(bundle)) {
270
+ const type = classifyBundleEntry(file, opts);
271
+ const source = readEntrySource(output);
272
+ const hash = opts.cache.computeHash(source);
273
+ sourceHashByFile.set(file, hash);
274
+ const previousHash = state.sourceHashByFile.get(file);
275
+ const changed = previousHash == null || previousHash !== hash;
276
+ const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
277
+ const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
278
+ const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
279
+ const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
280
+ const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
281
+ runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
282
+ runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
283
+ if (changed) changedByType[type].add(file);
284
+ if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
285
+ if (forceAll || firstRun) markProcessFile(type, file, processFiles);
286
+ else if (type === "html") processFiles.html.add(file);
287
+ else if (changed && (type === "js" || type === "css")) processFiles[type].add(file);
288
+ collectJsEntries(file, output, outDir, jsEntries);
289
+ entries.push({
290
+ file,
291
+ output,
292
+ source,
293
+ type
294
+ });
295
+ }
296
+ if (!forceAll && !firstRun) for (const changedFile of changedByType.js) {
297
+ const dependents = state.dependentsByLinkedFile.get(changedFile);
298
+ if (!dependents) continue;
299
+ for (const entryFile of dependents) {
300
+ processFiles.js.add(entryFile);
301
+ let impacts = linkedImpactsByEntry.get(entryFile);
302
+ if (!impacts) {
303
+ impacts = /* @__PURE__ */ new Set();
304
+ linkedImpactsByEntry.set(entryFile, impacts);
305
+ }
306
+ impacts.add(changedFile);
307
+ }
308
+ }
309
+ return {
310
+ entries,
311
+ jsEntries,
312
+ sourceHashByFile,
313
+ runtimeAffectingSignatureByFile,
314
+ runtimeAffectingHashByFile,
315
+ changedByType,
316
+ runtimeAffectingChangedByType,
317
+ processFiles,
318
+ linkedImpactsByEntry
319
+ };
320
+ }
321
+ function invertLinkedByEntry(linkedByEntry) {
322
+ const dependentsByLinkedFile = /* @__PURE__ */ new Map();
323
+ for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
324
+ let dependents = dependentsByLinkedFile.get(linkedFile);
325
+ if (!dependents) {
326
+ dependents = /* @__PURE__ */ new Set();
327
+ dependentsByLinkedFile.set(linkedFile, dependents);
328
+ }
329
+ dependents.add(entryFile);
330
+ }
331
+ return dependentsByLinkedFile;
332
+ }
333
+ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
334
+ const incremental = options.incremental === true;
335
+ state.iteration += 1;
336
+ state.sourceHashByFile = incremental ? new Map([...state.sourceHashByFile, ...snapshot.sourceHashByFile]) : snapshot.sourceHashByFile;
337
+ state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
338
+ state.runtimeAffectingHashByFile = incremental ? new Map([...state.runtimeAffectingHashByFile, ...snapshot.runtimeAffectingHashByFile]) : snapshot.runtimeAffectingHashByFile;
339
+ state.linkedByEntry = incremental ? new Map([...state.linkedByEntry, ...linkedByEntry]) : linkedByEntry;
340
+ state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
341
+ }
342
+ //#endregion
343
+ export { createBundleModuleGraphOptions as a, resolvePluginDisabledState as c, toAbsoluteOutputPath as d, applyLinkedResults as i, normalizeOutputPathKey as l, createBundleBuildState as n, pushConcurrentTaskFactories as o, updateBundleBuildState as r, resolvePackageDir as s, buildBundleSnapshot as t, resolveOutputSpecifier as u };