weapp-tailwindcss 4.12.0 → 5.0.0-next.2

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 (313) hide show
  1. package/dist/babel/index.d.ts +3 -0
  2. package/dist/bundlers/gulp/index.d.ts +7 -0
  3. package/dist/bundlers/shared/cache.d.ts +16 -0
  4. package/dist/bundlers/shared/css-cleanup.d.ts +4 -0
  5. package/dist/bundlers/shared/css-imports.d.ts +8 -0
  6. package/dist/bundlers/shared/generator-candidates.d.ts +5 -0
  7. package/dist/bundlers/shared/generator-css.d.ts +43 -0
  8. package/dist/bundlers/shared/module-graph.d.ts +5 -0
  9. package/dist/bundlers/shared/run-tasks.d.ts +2 -0
  10. package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
  11. package/dist/bundlers/vite/bundle-state.d.ts +43 -0
  12. package/dist/bundlers/vite/css-finalizer.d.ts +22 -0
  13. package/dist/bundlers/vite/generate-bundle.d.ts +33 -0
  14. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
  15. package/dist/bundlers/vite/index.d.ts +3 -0
  16. package/dist/bundlers/vite/js-precheck.d.ts +1 -0
  17. package/dist/bundlers/vite/query.d.ts +15 -0
  18. package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
  19. package/dist/bundlers/vite/rewrite-css-imports.d.ts +11 -0
  20. package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
  21. package/dist/bundlers/vite/source-candidates.d.ts +15 -0
  22. package/dist/bundlers/vite/utils.d.ts +9 -0
  23. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +20 -0
  24. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +14 -0
  25. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +15 -0
  26. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +9 -0
  27. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +17 -0
  28. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +19 -0
  29. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +9 -0
  30. package/dist/bundlers/webpack/index.d.ts +1 -0
  31. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +12 -0
  32. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
  33. package/dist/bundlers/webpack/shared/css-imports.d.ts +6 -0
  34. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
  35. package/dist/cache/index.d.ts +38 -0
  36. package/dist/cache/md5.d.ts +1 -0
  37. package/dist/chunk-8l464Juk.js +28 -0
  38. package/dist/cli/config.d.ts +5 -0
  39. package/dist/cli/context.d.ts +16 -0
  40. package/dist/cli/doctor/constants.d.ts +7 -0
  41. package/dist/cli/doctor/types.d.ts +31 -0
  42. package/dist/cli/doctor.d.ts +4 -0
  43. package/dist/cli/helpers/options/format.d.ts +2 -0
  44. package/dist/cli/helpers/options/parse.d.ts +3 -0
  45. package/dist/cli/helpers/options/resolve.d.ts +1 -0
  46. package/dist/cli/helpers/options.d.ts +3 -0
  47. package/dist/cli/helpers/patch-cwd.d.ts +1 -0
  48. package/dist/cli/helpers.d.ts +5 -0
  49. package/dist/cli/mount-options/patch-status.d.ts +2 -0
  50. package/dist/cli/mount-options.d.ts +2 -0
  51. package/dist/cli/patch-options.d.ts +6 -0
  52. package/dist/cli/tokens.d.ts +4 -0
  53. package/dist/cli/types.d.ts +17 -0
  54. package/dist/cli/vscode-entry.d.ts +14 -0
  55. package/dist/cli/workspace/package-dirs.d.ts +3 -0
  56. package/dist/cli/workspace/patch-package.d.ts +3 -0
  57. package/dist/cli/workspace/patch-utils.d.ts +3 -0
  58. package/dist/cli/workspace/types.d.ts +11 -0
  59. package/dist/cli/workspace/workspace-globs.d.ts +2 -0
  60. package/dist/cli/workspace/workspace-io.d.ts +1 -0
  61. package/dist/cli/workspace/workspace-lock.d.ts +1 -0
  62. package/dist/cli/workspace.d.ts +2 -0
  63. package/dist/cli.d.ts +1 -2
  64. package/dist/cli.js +2425 -3524
  65. package/dist/cli.mjs +2402 -3505
  66. package/dist/constants-B-_T5UnW.mjs +44 -0
  67. package/dist/constants-p1dyh1x1.js +73 -0
  68. package/dist/constants.d.ts +13 -0
  69. package/dist/context/compiler-context-cache.d.ts +3 -0
  70. package/dist/context/custom-attributes.d.ts +2 -0
  71. package/dist/context/handlers.d.ts +6 -0
  72. package/dist/context/index.d.ts +7 -0
  73. package/dist/context/logger.d.ts +4 -0
  74. package/dist/context/tailwindcss/basedir.d.ts +1 -0
  75. package/dist/context/tailwindcss/rax.d.ts +2 -0
  76. package/dist/context/tailwindcss.d.ts +4 -0
  77. package/dist/context/workspace.d.ts +3 -0
  78. package/dist/core.d.ts +5 -21
  79. package/dist/core.js +138 -180
  80. package/dist/core.mjs +135 -180
  81. package/dist/css-imports-BbrbluP9.js +177 -0
  82. package/dist/css-imports-CSdPq_Sc.mjs +128 -0
  83. package/dist/css-macro/constants.d.ts +14 -0
  84. package/dist/css-macro/index.d.ts +15 -0
  85. package/dist/css-macro/postcss.d.ts +3 -7
  86. package/dist/css-macro/postcss.js +44 -58
  87. package/dist/css-macro/postcss.mjs +44 -56
  88. package/dist/css-macro.d.ts +1 -20
  89. package/dist/css-macro.js +37 -50
  90. package/dist/css-macro.mjs +33 -47
  91. package/dist/debug/index.d.ts +5 -0
  92. package/dist/defaults.d.ts +2 -11
  93. package/dist/defaults.js +132 -8
  94. package/dist/defaults.mjs +128 -7
  95. package/dist/escape.js +31 -54
  96. package/dist/escape.mjs +18 -25
  97. package/dist/experimental/index.d.ts +2 -0
  98. package/dist/experimental/oxc/ast-utils.d.ts +30 -0
  99. package/dist/experimental/oxc/index.d.ts +2 -0
  100. package/dist/experimental/oxc/module-specifiers.d.ts +2 -0
  101. package/dist/experimental/shared/cache.d.ts +3 -0
  102. package/dist/experimental/shared/transform.d.ts +3 -0
  103. package/dist/experimental/shared.d.ts +8 -0
  104. package/dist/experimental/swc/ast-utils.d.ts +30 -0
  105. package/dist/experimental/swc/index.d.ts +2 -0
  106. package/dist/experimental/swc/module-specifiers.d.ts +2 -0
  107. package/dist/generator/index.d.ts +11 -0
  108. package/dist/generator/options.d.ts +17 -0
  109. package/dist/generator/types.d.ts +20 -0
  110. package/dist/generator-Y-Ikv4Fu.mjs +1177 -0
  111. package/dist/generator-css-B5ejWUMv.mjs +1098 -0
  112. package/dist/generator-css-D3OdPRiS.js +1125 -0
  113. package/dist/generator-mmhXzZnv.js +1276 -0
  114. package/dist/generator.d.ts +1 -0
  115. package/dist/generator.js +19 -0
  116. package/dist/generator.mjs +2 -0
  117. package/dist/gulp.d.ts +4 -24
  118. package/dist/gulp.js +271 -13
  119. package/dist/gulp.mjs +263 -13
  120. package/dist/index.d.ts +8 -15
  121. package/dist/index.js +12 -24
  122. package/dist/index.mjs +6 -24
  123. package/dist/js/JsTokenUpdater.d.ts +14 -0
  124. package/dist/js/ModuleGraph.d.ts +18 -0
  125. package/dist/js/NodePathWalker.d.ts +33 -0
  126. package/dist/js/babel/parse.d.ts +9 -0
  127. package/dist/js/babel/process.d.ts +4 -0
  128. package/dist/js/babel.d.ts +13 -0
  129. package/dist/js/class-context.d.ts +3 -0
  130. package/dist/js/evalTransforms.d.ts +7 -0
  131. package/dist/js/handlers.d.ts +5 -0
  132. package/dist/js/index.d.ts +4 -0
  133. package/dist/js/module-graph/ignored-exports.d.ts +18 -0
  134. package/dist/js/module-graph/types.d.ts +17 -0
  135. package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
  136. package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
  137. package/dist/js/precheck.d.ts +2 -0
  138. package/dist/js/sourceAnalysis.d.ts +17 -0
  139. package/dist/js/syntax.d.ts +10 -0
  140. package/dist/js/taggedTemplateIgnore.d.ts +13 -0
  141. package/dist/js/types.d.ts +11 -0
  142. package/dist/lightningcss/index.d.ts +8 -0
  143. package/dist/lightningcss/style-handler/options.d.ts +3 -0
  144. package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
  145. package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
  146. package/dist/lightningcss/style-handler.d.ts +17 -0
  147. package/dist/loader-anchors-CNkWT8hx.js +273 -0
  148. package/dist/loader-anchors-TrU7EUr7.mjs +205 -0
  149. package/dist/logger/index.d.ts +2 -0
  150. package/dist/logger-BZ45DZJT.js +1003 -0
  151. package/dist/logger-BoVx1Dbt.mjs +935 -0
  152. package/dist/patcher-options-6gJN2EXy.js +115 -0
  153. package/dist/patcher-options-DQfR5xxT.mjs +92 -0
  154. package/dist/postcss-html-transform.d.ts +3 -3
  155. package/dist/postcss-html-transform.js +7 -10
  156. package/dist/postcss-html-transform.mjs +3 -6
  157. package/dist/postcss.d.ts +15 -0
  158. package/dist/postcss.js +280 -0
  159. package/dist/postcss.mjs +270 -0
  160. package/dist/presets/hbuilderx.d.ts +4 -0
  161. package/dist/presets/index.d.ts +3 -0
  162. package/dist/presets/shared.d.ts +10 -0
  163. package/dist/presets/taro.d.ts +4 -0
  164. package/dist/presets/uni-app-x.d.ts +16 -0
  165. package/dist/presets/uni-app.d.ts +4 -0
  166. package/dist/presets.d.ts +1 -76
  167. package/dist/presets.js +115 -163
  168. package/dist/presets.mjs +107 -163
  169. package/dist/recorder-gYSNLfOP.js +2878 -0
  170. package/dist/recorder-zsgatmkB.mjs +2763 -0
  171. package/dist/reset/index.d.ts +2 -0
  172. package/dist/reset.d.ts +1 -4
  173. package/dist/reset.js +19 -8
  174. package/dist/reset.mjs +2 -8
  175. package/dist/shared/classname-transform.d.ts +14 -0
  176. package/dist/shared/mpx.d.ts +7 -0
  177. package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
  178. package/dist/tailwindcss/index.d.ts +11 -0
  179. package/dist/tailwindcss/miniprogram.d.ts +1 -0
  180. package/dist/tailwindcss/patcher-options.d.ts +56 -0
  181. package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
  182. package/dist/tailwindcss/patcher.d.ts +13 -0
  183. package/dist/tailwindcss/recorder.d.ts +13 -0
  184. package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
  185. package/dist/tailwindcss/runtime/cache.d.ts +11 -0
  186. package/dist/tailwindcss/runtime-logs.d.ts +3 -0
  187. package/dist/tailwindcss/runtime.d.ts +29 -0
  188. package/dist/tailwindcss/targets/paths.d.ts +13 -0
  189. package/dist/tailwindcss/targets/record-io.d.ts +5 -0
  190. package/dist/tailwindcss/targets/recorder.d.ts +3 -0
  191. package/dist/tailwindcss/targets/types.d.ts +35 -0
  192. package/dist/tailwindcss/targets.d.ts +6 -0
  193. package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
  194. package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
  195. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
  196. package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
  197. package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
  198. package/dist/tailwindcss/v4/config.d.ts +5 -0
  199. package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
  200. package/dist/tailwindcss/v4/index.d.ts +2 -0
  201. package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
  202. package/dist/tailwindcss/v4/patcher-options.d.ts +24 -0
  203. package/dist/tailwindcss/v4/patcher.d.ts +14 -0
  204. package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
  205. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
  206. package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
  207. package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
  208. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +5 -0
  209. package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
  210. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
  211. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
  212. package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
  213. package/dist/tailwindcss/v4-engine/types.d.ts +19 -0
  214. package/dist/typedoc.export.d.ts +5 -0
  215. package/dist/types/base.d.ts +1 -0
  216. package/dist/types/disabled-options.d.ts +4 -0
  217. package/dist/types/index.d.ts +104 -0
  218. package/dist/types/shared.d.ts +7 -0
  219. package/dist/types/user-defined-options/general.d.ts +31 -0
  220. package/dist/types/user-defined-options/important.d.ts +37 -0
  221. package/dist/types/user-defined-options/index.d.ts +11 -0
  222. package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
  223. package/dist/types/user-defined-options/matcher.d.ts +9 -0
  224. package/dist/types.d.ts +1 -150
  225. package/dist/types.js +0 -1
  226. package/dist/types.mjs +1 -1
  227. package/dist/uni-app-x/component-local-style.d.ts +19 -0
  228. package/dist/uni-app-x/index.d.ts +2 -0
  229. package/dist/uni-app-x/options.d.ts +12 -0
  230. package/dist/uni-app-x/style-isolation.d.ts +2 -0
  231. package/dist/uni-app-x/transform.d.ts +9 -0
  232. package/dist/uni-app-x/vite.d.ts +36 -0
  233. package/dist/utils/decode.d.ts +2 -0
  234. package/dist/utils/disabled.d.ts +6 -0
  235. package/dist/utils/hbuilderx.d.ts +5 -0
  236. package/dist/utils/index.d.ts +7 -0
  237. package/dist/utils/nameMatcher.d.ts +4 -0
  238. package/dist/utils/resolve-package.d.ts +1 -0
  239. package/dist/utils/uni-platform.d.ts +11 -0
  240. package/dist/utils-7DUGTFED.mjs +48 -0
  241. package/dist/utils-DmC9_In3.js +61 -0
  242. package/dist/vite-BC9U7ahn.js +2199 -0
  243. package/dist/vite-CrlzCNqz.mjs +2186 -0
  244. package/dist/vite.d.ts +4 -17
  245. package/dist/vite.js +5 -14
  246. package/dist/vite.mjs +2 -14
  247. package/dist/weapp-tw-css-import-rewrite-loader.js +59 -92
  248. package/dist/weapp-tw-runtime-classset-loader.js +31 -50
  249. package/dist/webpack-Bu6M-Hbw.mjs +441 -0
  250. package/dist/webpack-DD7A6V0u.js +456 -0
  251. package/dist/webpack.d.ts +4 -25
  252. package/dist/webpack.js +6 -17
  253. package/dist/webpack.mjs +2 -17
  254. package/dist/webpack4.d.ts +4 -26
  255. package/dist/webpack4.js +375 -481
  256. package/dist/webpack4.mjs +366 -482
  257. package/dist/wxml/Tokenizer.d.ts +15 -0
  258. package/dist/wxml/custom-attributes.d.ts +4 -0
  259. package/dist/wxml/index.d.ts +2 -0
  260. package/dist/wxml/shared.d.ts +2 -0
  261. package/dist/wxml/tokenizer/types.d.ts +18 -0
  262. package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
  263. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
  264. package/dist/wxml/utils/codegen.d.ts +2 -0
  265. package/dist/wxml/utils/custom-template.d.ts +3 -0
  266. package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
  267. package/dist/wxml/utils/fragment-updater.d.ts +4 -0
  268. package/dist/wxml/utils/template-fragments.d.ts +3 -0
  269. package/dist/wxml/utils.d.ts +8 -0
  270. package/dist/wxml/whitespace.d.ts +2 -0
  271. package/generator-placeholder.css +1 -0
  272. package/package.json +19 -8
  273. package/dist/chunk-24AGZQVR.js +0 -183
  274. package/dist/chunk-3VQKDHGP.mjs +0 -179
  275. package/dist/chunk-4AFQP74Z.js +0 -24
  276. package/dist/chunk-57SOQCAU.mjs +0 -582
  277. package/dist/chunk-5ZYHNDEK.mjs +0 -2439
  278. package/dist/chunk-76S2EME4.mjs +0 -34
  279. package/dist/chunk-A5PB4KZT.js +0 -138
  280. package/dist/chunk-DUHYLR2R.js +0 -276
  281. package/dist/chunk-DYLQ6UOI.js +0 -71
  282. package/dist/chunk-E7I5TW5K.js +0 -52
  283. package/dist/chunk-FS2NOOEB.js +0 -292
  284. package/dist/chunk-HVNGIKLS.js +0 -3930
  285. package/dist/chunk-JZQBZHN5.js +0 -579
  286. package/dist/chunk-KGTVD4EP.mjs +0 -3930
  287. package/dist/chunk-NNOQDMUP.mjs +0 -10
  288. package/dist/chunk-OF6MFURR.js +0 -34
  289. package/dist/chunk-OFB2KBRP.js +0 -2442
  290. package/dist/chunk-OOHJLO5M.mjs +0 -71
  291. package/dist/chunk-PCDYXXSK.mjs +0 -1515
  292. package/dist/chunk-RKISS72P.js +0 -7
  293. package/dist/chunk-RRQZL7FQ.mjs +0 -292
  294. package/dist/chunk-XAKAD2CR.mjs +0 -138
  295. package/dist/chunk-XZP3MREK.mjs +0 -276
  296. package/dist/chunk-ZAA5ZG3D.js +0 -1518
  297. package/dist/chunk-ZCH4YINE.mjs +0 -52
  298. package/dist/cli.d.mts +0 -2
  299. package/dist/core.d.mts +0 -26
  300. package/dist/css-macro/postcss.d.mts +0 -7
  301. package/dist/css-macro.d.mts +0 -18
  302. package/dist/defaults.d.mts +0 -11
  303. package/dist/gulp.d.mts +0 -24
  304. package/dist/index-BXrmQelt.d.mts +0 -672
  305. package/dist/index-BXrmQelt.d.ts +0 -672
  306. package/dist/index.d.mts +0 -15
  307. package/dist/postcss-html-transform.d.mts +0 -2
  308. package/dist/presets.d.mts +0 -76
  309. package/dist/reset.d.mts +0 -1
  310. package/dist/types.d.mts +0 -150
  311. package/dist/vite.d.mts +0 -17
  312. package/dist/webpack.d.mts +0 -25
  313. package/dist/webpack4.d.mts +0 -26
@@ -1,60 +1,46 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
-
4
-
5
- var _chunkE7I5TW5Kjs = require('../chunk-E7I5TW5K.js');
6
- require('../chunk-RKISS72P.js');
7
-
8
- // src/css-macro/postcss.ts
9
- var IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
10
- var creator = () => {
11
- return {
12
- postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
13
- prepare() {
14
- return {
15
- AtRule(atRule, helper) {
16
- if (atRule.name === "media") {
17
- const values = [];
18
- _chunkE7I5TW5Kjs.matchCustomPropertyFromValue.call(void 0, atRule.params, (arr) => {
19
- values.push(arr[1]);
20
- });
21
- if (values.length > 0) {
22
- const isNegative = atRule.params.includes("not");
23
- const text = values.join(" ");
24
- const comment = isNegative ? _chunkE7I5TW5Kjs.ifndef.call(void 0, text) : _chunkE7I5TW5Kjs.ifdef.call(void 0, text);
25
- const nextNodes = [
26
- helper.comment({
27
- raws: {
28
- before: "\n"
29
- },
30
- text: comment.start
31
- }),
32
- ...(_nullishCoalesce(atRule.nodes, () => ( []))).map((node) => node.clone()),
33
- helper.comment({
34
- raws: {
35
- before: "\n"
36
- },
37
- text: comment.end
38
- })
39
- ];
40
- atRule.replaceWith(nextNodes);
41
- }
42
- }
43
- },
44
- CommentExit(comment) {
45
- if (IFDEF_ENDIF_RE.test(comment.text)) {
46
- comment.raws.left = " ";
47
- comment.raws.right = " ";
48
- }
49
- }
50
- };
51
- }
52
- };
1
+ const require_constants = require("../constants-p1dyh1x1.js");
2
+ //#region src/css-macro/postcss.ts
3
+ const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
4
+ const creator = () => {
5
+ return {
6
+ postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
7
+ prepare() {
8
+ return {
9
+ AtRule(atRule, helper) {
10
+ if (atRule.name === "media") {
11
+ const values = [];
12
+ require_constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
13
+ values.push(arr[1]);
14
+ });
15
+ if (values.length > 0) {
16
+ const isNegative = atRule.params.includes("not");
17
+ const text = values.join(" ");
18
+ const comment = isNegative ? require_constants.ifndef(text) : require_constants.ifdef(text);
19
+ const nextNodes = [
20
+ helper.comment({
21
+ raws: { before: "\n" },
22
+ text: comment.start
23
+ }),
24
+ ...(atRule.nodes ?? []).map((node) => node.clone()),
25
+ helper.comment({
26
+ raws: { before: "\n" },
27
+ text: comment.end
28
+ })
29
+ ];
30
+ atRule.replaceWith(nextNodes);
31
+ }
32
+ }
33
+ },
34
+ CommentExit(comment) {
35
+ if (IFDEF_ENDIF_RE.test(comment.text)) {
36
+ comment.raws.left = " ";
37
+ comment.raws.right = " ";
38
+ }
39
+ }
40
+ };
41
+ }
42
+ };
53
43
  };
54
44
  creator.postcss = true;
55
- var postcss_default = creator;
56
-
57
-
58
- exports.default = postcss_default;
59
-
60
- module.exports = exports.default;
45
+ //#endregion
46
+ module.exports = creator;
@@ -1,58 +1,46 @@
1
- import {
2
- ifdef,
3
- ifndef,
4
- matchCustomPropertyFromValue
5
- } from "../chunk-ZCH4YINE.mjs";
6
- import "../chunk-NNOQDMUP.mjs";
7
-
8
- // src/css-macro/postcss.ts
9
- var IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
10
- var creator = () => {
11
- return {
12
- postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
13
- prepare() {
14
- return {
15
- AtRule(atRule, helper) {
16
- if (atRule.name === "media") {
17
- const values = [];
18
- matchCustomPropertyFromValue(atRule.params, (arr) => {
19
- values.push(arr[1]);
20
- });
21
- if (values.length > 0) {
22
- const isNegative = atRule.params.includes("not");
23
- const text = values.join(" ");
24
- const comment = isNegative ? ifndef(text) : ifdef(text);
25
- const nextNodes = [
26
- helper.comment({
27
- raws: {
28
- before: "\n"
29
- },
30
- text: comment.start
31
- }),
32
- ...(atRule.nodes ?? []).map((node) => node.clone()),
33
- helper.comment({
34
- raws: {
35
- before: "\n"
36
- },
37
- text: comment.end
38
- })
39
- ];
40
- atRule.replaceWith(nextNodes);
41
- }
42
- }
43
- },
44
- CommentExit(comment) {
45
- if (IFDEF_ENDIF_RE.test(comment.text)) {
46
- comment.raws.left = " ";
47
- comment.raws.right = " ";
48
- }
49
- }
50
- };
51
- }
52
- };
1
+ import { a as matchCustomPropertyFromValue, i as ifndef, r as ifdef } from "../constants-B-_T5UnW.mjs";
2
+ //#region src/css-macro/postcss.ts
3
+ const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
4
+ const creator = () => {
5
+ return {
6
+ postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
7
+ prepare() {
8
+ return {
9
+ AtRule(atRule, helper) {
10
+ if (atRule.name === "media") {
11
+ const values = [];
12
+ matchCustomPropertyFromValue(atRule.params, (arr) => {
13
+ values.push(arr[1]);
14
+ });
15
+ if (values.length > 0) {
16
+ const isNegative = atRule.params.includes("not");
17
+ const text = values.join(" ");
18
+ const comment = isNegative ? ifndef(text) : ifdef(text);
19
+ const nextNodes = [
20
+ helper.comment({
21
+ raws: { before: "\n" },
22
+ text: comment.start
23
+ }),
24
+ ...(atRule.nodes ?? []).map((node) => node.clone()),
25
+ helper.comment({
26
+ raws: { before: "\n" },
27
+ text: comment.end
28
+ })
29
+ ];
30
+ atRule.replaceWith(nextNodes);
31
+ }
32
+ }
33
+ },
34
+ CommentExit(comment) {
35
+ if (IFDEF_ENDIF_RE.test(comment.text)) {
36
+ comment.raws.left = " ";
37
+ comment.raws.right = " ";
38
+ }
39
+ }
40
+ };
41
+ }
42
+ };
53
43
  };
54
44
  creator.postcss = true;
55
- var postcss_default = creator;
56
- export {
57
- postcss_default as default
58
- };
45
+ //#endregion
46
+ export { creator as default };
@@ -1,20 +1 @@
1
- import * as tailwindcss_types_config from 'tailwindcss/types/config';
2
-
3
- interface Options {
4
- variantsMap?: Record<string, string | {
5
- value: string;
6
- negative?: boolean;
7
- }>;
8
- dynamic?: boolean;
9
- }
10
- declare const cssMacro: {
11
- (options: Options | undefined): {
12
- handler: tailwindcss_types_config.PluginCreator;
13
- config?: Partial<tailwindcss_types_config.Config>;
14
- };
15
- __isOptionsFunction: true;
16
- };
17
-
18
- // @ts-ignore
19
- export = cssMacro;
20
- export type { Options };
1
+ export * from './css-macro/index'
package/dist/css-macro.js CHANGED
@@ -1,52 +1,39 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
4
-
5
-
6
-
7
- var _chunkE7I5TW5Kjs = require('./chunk-E7I5TW5K.js');
8
- require('./chunk-RKISS72P.js');
9
-
10
- // src/css-macro/index.ts
11
- var _plugin = require('tailwindcss/plugin'); var _plugin2 = _interopRequireDefault(_plugin);
12
- var defaultOptions = {
13
- dynamic: true,
14
- variantsMap: {}
1
+ const require_chunk = require("./chunk-8l464Juk.js");
2
+ require("./utils-DmC9_In3.js");
3
+ const require_constants = require("./constants-p1dyh1x1.js");
4
+ let tailwindcss_plugin = require("tailwindcss/plugin");
5
+ tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
6
+ let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
7
+ //#region src/css-macro/index.ts
8
+ const defaultOptions = {
9
+ dynamic: true,
10
+ variantsMap: {}
15
11
  };
16
- var cssMacro = _plugin2.default.withOptions((options) => {
17
- const { dynamic, variantsMap } = _chunkDYLQ6UOIjs.defu.call(void 0, _nullishCoalesce(options, () => ( {})), defaultOptions);
18
- const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
19
- if (typeof config === "string") {
20
- return {
21
- name,
22
- negative: false,
23
- value: config
24
- };
25
- }
26
- return {
27
- name,
28
- negative: Boolean(config.negative),
29
- value: config.value
30
- };
31
- });
32
- return (api) => {
33
- const { matchVariant, addVariant } = api;
34
- const supportsDynamic = typeof matchVariant === "function";
35
- if (dynamic && supportsDynamic) {
36
- matchVariant("ifdef", (value) => _chunkE7I5TW5Kjs.createMediaQuery.call(void 0, value));
37
- matchVariant("ifndef", (value) => _chunkE7I5TW5Kjs.createNegativeMediaQuery.call(void 0, value));
38
- }
39
- if (typeof addVariant === "function") {
40
- for (const variant of staticVariants) {
41
- const query = variant.negative ? _chunkE7I5TW5Kjs.createNegativeMediaQuery.call(void 0, variant.value) : _chunkE7I5TW5Kjs.createMediaQuery.call(void 0, variant.value);
42
- addVariant(variant.name, query);
43
- }
44
- }
45
- };
12
+ const cssMacro = tailwindcss_plugin.default.withOptions((options) => {
13
+ const { dynamic, variantsMap } = (0, _weapp_tailwindcss_shared.defu)(options ?? {}, defaultOptions);
14
+ const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
15
+ if (typeof config === "string") return {
16
+ name,
17
+ negative: false,
18
+ value: config
19
+ };
20
+ return {
21
+ name,
22
+ negative: Boolean(config.negative),
23
+ value: config.value
24
+ };
25
+ });
26
+ return (api) => {
27
+ const { matchVariant, addVariant } = api;
28
+ if (dynamic && typeof matchVariant === "function") {
29
+ matchVariant("ifdef", (value) => require_constants.createMediaQuery(value));
30
+ matchVariant("ifndef", (value) => require_constants.createNegativeMediaQuery(value));
31
+ }
32
+ if (typeof addVariant === "function") for (const variant of staticVariants) {
33
+ const query = variant.negative ? require_constants.createNegativeMediaQuery(variant.value) : require_constants.createMediaQuery(variant.value);
34
+ addVariant(variant.name, query);
35
+ }
36
+ };
46
37
  });
47
- var css_macro_default = cssMacro;
48
-
49
-
50
- exports.default = css_macro_default;
51
-
52
- module.exports = exports.default;
38
+ //#endregion
39
+ module.exports = cssMacro;
@@ -1,50 +1,36 @@
1
- import {
2
- defu
3
- } from "./chunk-OOHJLO5M.mjs";
4
- import {
5
- createMediaQuery,
6
- createNegativeMediaQuery
7
- } from "./chunk-ZCH4YINE.mjs";
8
- import "./chunk-NNOQDMUP.mjs";
9
-
10
- // src/css-macro/index.ts
1
+ import { t as defu } from "./utils-7DUGTFED.mjs";
2
+ import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-B-_T5UnW.mjs";
11
3
  import plugin from "tailwindcss/plugin";
12
- var defaultOptions = {
13
- dynamic: true,
14
- variantsMap: {}
4
+ //#region src/css-macro/index.ts
5
+ const defaultOptions = {
6
+ dynamic: true,
7
+ variantsMap: {}
15
8
  };
16
- var cssMacro = plugin.withOptions((options) => {
17
- const { dynamic, variantsMap } = defu(options ?? {}, defaultOptions);
18
- const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
19
- if (typeof config === "string") {
20
- return {
21
- name,
22
- negative: false,
23
- value: config
24
- };
25
- }
26
- return {
27
- name,
28
- negative: Boolean(config.negative),
29
- value: config.value
30
- };
31
- });
32
- return (api) => {
33
- const { matchVariant, addVariant } = api;
34
- const supportsDynamic = typeof matchVariant === "function";
35
- if (dynamic && supportsDynamic) {
36
- matchVariant("ifdef", (value) => createMediaQuery(value));
37
- matchVariant("ifndef", (value) => createNegativeMediaQuery(value));
38
- }
39
- if (typeof addVariant === "function") {
40
- for (const variant of staticVariants) {
41
- const query = variant.negative ? createNegativeMediaQuery(variant.value) : createMediaQuery(variant.value);
42
- addVariant(variant.name, query);
43
- }
44
- }
45
- };
9
+ const cssMacro = plugin.withOptions((options) => {
10
+ const { dynamic, variantsMap } = defu(options ?? {}, defaultOptions);
11
+ const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
12
+ if (typeof config === "string") return {
13
+ name,
14
+ negative: false,
15
+ value: config
16
+ };
17
+ return {
18
+ name,
19
+ negative: Boolean(config.negative),
20
+ value: config.value
21
+ };
22
+ });
23
+ return (api) => {
24
+ const { matchVariant, addVariant } = api;
25
+ if (dynamic && typeof matchVariant === "function") {
26
+ matchVariant("ifdef", (value) => createMediaQuery(value));
27
+ matchVariant("ifndef", (value) => createNegativeMediaQuery(value));
28
+ }
29
+ if (typeof addVariant === "function") for (const variant of staticVariants) {
30
+ const query = variant.negative ? createNegativeMediaQuery(variant.value) : createMediaQuery(variant.value);
31
+ addVariant(variant.name, query);
32
+ }
33
+ };
46
34
  });
47
- var css_macro_default = cssMacro;
48
- export {
49
- css_macro_default as default
50
- };
35
+ //#endregion
36
+ export { cssMacro as default };
@@ -0,0 +1,5 @@
1
+ type DebugFunction = ((formatter: any, ...args: any[]) => void) & {
2
+ readonly enabled: boolean;
3
+ };
4
+ declare function createDebug(prefix?: string): DebugFunction;
5
+ export { createDebug };
@@ -1,11 +1,2 @@
1
- import { e as UserDefinedOptions } from './index-BXrmQelt.js';
2
- import '@babel/parser';
3
- import '@weapp-tailwindcss/postcss/types';
4
- import 'tailwindcss-patch';
5
- import 'node:buffer';
6
- import 'webpack';
7
- import 'lru-cache';
8
-
9
- declare function getDefaultOptions(): UserDefinedOptions;
10
-
11
- export { getDefaultOptions };
1
+ import type { UserDefinedOptions } from './types';
2
+ export declare function getDefaultOptions(): UserDefinedOptions;
package/dist/defaults.js CHANGED
@@ -1,8 +1,132 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkA5PB4KZTjs = require('./chunk-A5PB4KZT.js');
4
- require('./chunk-DYLQ6UOI.js');
5
- require('./chunk-RKISS72P.js');
6
-
7
-
8
- exports.getDefaultOptions = _chunkA5PB4KZTjs.getDefaultOptions;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("./chunk-8l464Juk.js");
3
+ require("./utils-DmC9_In3.js");
4
+ let _weapp_core_escape = require("@weapp-core/escape");
5
+ let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
6
+ //#region src/defaults.ts
7
+ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
8
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
9
+ const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
10
+ const BACKSLASH_RE = /\\/g;
11
+ function normalizePath(p) {
12
+ return p.replace(BACKSLASH_RE, "/");
13
+ }
14
+ const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
15
+ const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
16
+ const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
17
+ const MAIN_CSS_CHUNK_MATCHERS = {
18
+ "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
19
+ "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
20
+ "uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
21
+ "mpx": (file) => {
22
+ const normalized = normalizePath(file);
23
+ if (normalized.startsWith("app")) return true;
24
+ return MPX_STYLES_DIR_PATTERN.test(normalized);
25
+ },
26
+ "taro": (file) => file.startsWith("app"),
27
+ "remax": (file) => file.startsWith("app"),
28
+ "rax": (file) => file.startsWith("bundle"),
29
+ "native": (file) => file.startsWith("app"),
30
+ "weapp-vite": (file) => file.startsWith("app"),
31
+ "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
32
+ };
33
+ const alwaysFalse = () => false;
34
+ function createMainCssChunkMatcher() {
35
+ return (file, appType) => {
36
+ if (!appType) {
37
+ const normalized = normalizePath(file);
38
+ return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
39
+ }
40
+ const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
41
+ return matcher ? matcher(file) : true;
42
+ };
43
+ }
44
+ function getDefaultOptions() {
45
+ return {
46
+ /**
47
+ * wxss 微信小程序
48
+ * acss 支付宝小程序
49
+ * jxss 京东小程序
50
+ * ttss 头条小程序
51
+ * qss QQ小程序
52
+ * css 最正常的样式文件
53
+ * tyss 涂鸦小程序
54
+ */
55
+ cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
56
+ /**
57
+ * wxml 微信小程序
58
+ * axml 支付宝小程序
59
+ * jxml 京东小程序
60
+ * ksml 快手小程序
61
+ * ttml 头条小程序
62
+ * qml QQ小程序
63
+ * tyml 涂鸦小程序
64
+ * xhsml 小红书小程序
65
+ * swan 百度小程序
66
+ */
67
+ htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
68
+ jsMatcher: (file) => {
69
+ if (file.includes("node_modules")) return false;
70
+ return JS_FILE_PATTERN.test(file);
71
+ },
72
+ mainCssChunkMatcher: createMainCssChunkMatcher(),
73
+ wxsMatcher: alwaysFalse,
74
+ cssPreflight: {
75
+ "box-sizing": "border-box",
76
+ "border-width": "0",
77
+ "border-style": "solid",
78
+ "border-color": "currentColor"
79
+ },
80
+ disabled: false,
81
+ onLoad: _weapp_tailwindcss_shared.noop,
82
+ onStart: _weapp_tailwindcss_shared.noop,
83
+ onEnd: _weapp_tailwindcss_shared.noop,
84
+ onUpdate: _weapp_tailwindcss_shared.noop,
85
+ customAttributes: {},
86
+ customReplaceDictionary: _weapp_core_escape.MappingChars2String,
87
+ appType: void 0,
88
+ arbitraryValues: { allowDoubleQuotes: false },
89
+ cssChildCombinatorReplaceValue: ["view", "text"],
90
+ inlineWxs: false,
91
+ injectAdditionalCssVarScope: false,
92
+ rewriteCssImports: true,
93
+ jsPreserveClass: (keyword) => {
94
+ /**
95
+ * 默认保留 keyword
96
+ */
97
+ if (keyword === "*") return true;
98
+ return false;
99
+ },
100
+ staleClassNameFallback: void 0,
101
+ disabledDefaultTemplateHandler: false,
102
+ cssSelectorReplacement: {
103
+ root: [
104
+ "page",
105
+ ".tw-root",
106
+ "wx-root-portal-content"
107
+ ],
108
+ universal: ["view", "text"]
109
+ },
110
+ babelParserOptions: {
111
+ sourceType: "unambiguous",
112
+ cache: true,
113
+ cacheKey: "st:unambiguous"
114
+ },
115
+ postcssOptions: {},
116
+ cssRemoveProperty: true,
117
+ cssRemoveHoverPseudoClass: true,
118
+ ignoreCallExpressionIdentifiers: [],
119
+ ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
120
+ replaceRuntimePackages: false,
121
+ generator: {
122
+ mode: "auto",
123
+ target: "weapp"
124
+ },
125
+ tailwindcssPatcherOptions: { filter(className) {
126
+ return !(0, _weapp_core_escape.isAllowedClassName)(className);
127
+ } },
128
+ logLevel: "info"
129
+ };
130
+ }
131
+ //#endregion
132
+ exports.getDefaultOptions = getDefaultOptions;