weapp-tailwindcss 5.0.0-next.3 → 5.0.0-next.31

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 (244) hide show
  1. package/README.md +6 -7
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/auto-TH1jG2UW.js +115 -0
  4. package/dist/auto-XyKTOP7B.mjs +78 -0
  5. package/dist/bundle-state-Bi-cQua6.mjs +413 -0
  6. package/dist/bundle-state-Ct_8GcSR.js +529 -0
  7. package/dist/bundlers/shared/cache.d.ts +6 -6
  8. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -0
  9. package/dist/bundlers/shared/css-cleanup.d.ts +1 -4
  10. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  11. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  12. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  13. package/dist/bundlers/shared/generator-css/directives.d.ts +21 -0
  14. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  15. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  16. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  17. package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
  18. package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
  19. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
  20. package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
  21. package/dist/bundlers/shared/generator-css.d.ts +16 -22
  22. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  23. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  24. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  25. package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
  26. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  27. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
  28. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
  29. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  30. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  31. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  32. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  33. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  34. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  35. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  36. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  37. package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
  38. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
  39. package/dist/bundlers/vite/index.d.ts +5 -2
  40. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  41. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  42. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  43. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
  44. package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
  45. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  46. package/dist/bundlers/vite/source-candidates.d.ts +19 -1
  47. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  48. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  49. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  50. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  51. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
  52. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
  53. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +2 -1
  54. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  55. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
  56. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  57. package/dist/cache/index.d.ts +6 -6
  58. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  59. package/dist/cli/context.d.ts +1 -14
  60. package/dist/cli/doctor/types.d.ts +11 -11
  61. package/dist/cli/helpers.d.ts +1 -2
  62. package/dist/cli/mount-options.d.ts +2 -0
  63. package/dist/cli/types.d.ts +0 -2
  64. package/dist/cli/vscode-entry.d.ts +3 -3
  65. package/dist/cli.js +758 -604
  66. package/dist/cli.mjs +766 -612
  67. package/dist/constants.d.ts +1 -2
  68. package/dist/context/runtime-package-replacements.d.ts +2 -0
  69. package/dist/context/style-options.d.ts +3 -0
  70. package/dist/core.js +12 -20
  71. package/dist/core.mjs +8 -14
  72. package/dist/css-macro/auto.d.ts +10 -0
  73. package/dist/css-macro/constants.d.ts +5 -2
  74. package/dist/css-macro/postcss.d.ts +1 -0
  75. package/dist/css-macro/postcss.js +7 -46
  76. package/dist/css-macro/postcss.mjs +2 -46
  77. package/dist/css-macro.d.ts +1 -0
  78. package/dist/css-macro.js +16 -7
  79. package/dist/css-macro.mjs +15 -6
  80. package/dist/defaults-8xrgzxFY.mjs +151 -0
  81. package/dist/defaults-zKUH2mDe.js +193 -0
  82. package/dist/defaults.d.ts +15 -1
  83. package/dist/defaults.js +6 -131
  84. package/dist/defaults.mjs +2 -129
  85. package/dist/escape.js +10 -2
  86. package/dist/escape.mjs +10 -2
  87. package/dist/generator/index.d.ts +1 -1
  88. package/dist/generator/options.d.ts +9 -8
  89. package/dist/generator/types.d.ts +3 -3
  90. package/dist/generator-CrU-Ghc1.js +90 -0
  91. package/dist/generator-Qw-tZ0Z2.mjs +65 -0
  92. package/dist/generator.js +12 -12
  93. package/dist/generator.mjs +2 -1
  94. package/dist/gulp.js +187 -48
  95. package/dist/gulp.mjs +180 -41
  96. package/dist/incremental-runtime-class-set-Boqi1QlB.mjs +2224 -0
  97. package/dist/incremental-runtime-class-set-FAOHZmzh.js +2293 -0
  98. package/dist/index.d.ts +3 -2
  99. package/dist/index.js +19 -7
  100. package/dist/index.mjs +6 -5
  101. package/dist/js/babel/cache-options.d.ts +3 -0
  102. package/dist/js/babel/parse.d.ts +7 -4
  103. package/dist/js/index.d.ts +1 -0
  104. package/dist/js/literal-transform.d.ts +2 -0
  105. package/dist/js/precheck.d.ts +2 -2
  106. package/dist/logger-BNzxZbZj.mjs +2 -0
  107. package/dist/logger-TlKT3xmR.js +1 -0
  108. package/dist/postcss/config-directive.d.ts +1 -0
  109. package/dist/postcss/context.d.ts +9 -0
  110. package/dist/postcss/source-files.d.ts +8 -0
  111. package/dist/postcss/tailwind-version.d.ts +3 -0
  112. package/dist/postcss-C6zOQqlL.mjs +228 -0
  113. package/dist/postcss-C7BMYpEF.mjs +169 -0
  114. package/dist/postcss-CiYLsqZn.js +192 -0
  115. package/dist/postcss-DAWf9D3C.js +237 -0
  116. package/dist/postcss-html-transform.js +1 -1
  117. package/dist/postcss.d.ts +2 -2
  118. package/dist/postcss.js +3 -276
  119. package/dist/postcss.mjs +1 -269
  120. package/dist/precheck-D7K12zeX.mjs +4716 -0
  121. package/dist/precheck-D7gJSmJz.js +4842 -0
  122. package/dist/presets/index.d.ts +1 -0
  123. package/dist/presets/uni-app-x.d.ts +1 -0
  124. package/dist/presets.js +29 -13
  125. package/dist/presets.mjs +25 -11
  126. package/dist/reset.d.ts +1 -0
  127. package/dist/reset.js +1 -1
  128. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  129. package/dist/shared/mpx.d.ts +1 -0
  130. package/dist/source-candidates-CX2ozpKM.mjs +322 -0
  131. package/dist/source-candidates-DNM8iwXW.js +335 -0
  132. package/dist/tailwindcss/miniprogram.d.ts +1 -1
  133. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  134. package/dist/tailwindcss/patcher.d.ts +1 -2
  135. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  136. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  137. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  138. package/dist/tailwindcss/runtime.d.ts +11 -12
  139. package/dist/tailwindcss/source-scan.d.ts +35 -0
  140. package/dist/tailwindcss/targets.d.ts +1 -5
  141. package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
  142. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  143. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  144. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  145. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  146. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  147. package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
  148. package/dist/tailwindcss/version.d.ts +4 -0
  149. package/dist/tailwindcss-B-e2RiXr.js +642 -0
  150. package/dist/tailwindcss-C7dJHZ0G.mjs +591 -0
  151. package/dist/typedoc.export.d.ts +0 -2
  152. package/dist/types/index.d.ts +52 -49
  153. package/dist/types/shared.d.ts +6 -0
  154. package/dist/types/user-defined-options/general.d.ts +25 -24
  155. package/dist/types/user-defined-options/important.d.ts +33 -28
  156. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  157. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  158. package/dist/uni-app-x/vite.d.ts +1 -1
  159. package/dist/unocss/index.d.ts +2 -0
  160. package/dist/utils/disabled.d.ts +2 -3
  161. package/dist/utils/object.d.ts +9 -0
  162. package/dist/utils/options.d.ts +2 -0
  163. package/dist/utils/regex.d.ts +1 -0
  164. package/dist/{utils-DmC9_In3.js → utils-D7Ygohep.js} +2 -2
  165. package/dist/{utils-7DUGTFED.mjs → utils-DsaS975I.mjs} +1 -1
  166. package/dist/v3-engine-CHItlVq5.js +3616 -0
  167. package/dist/v3-engine-DcvCCHfs.mjs +3321 -0
  168. package/dist/vite-BgTPSkQS.js +24446 -0
  169. package/dist/vite-fFRpSvyz.mjs +24432 -0
  170. package/dist/vite.d.ts +1 -2
  171. package/dist/vite.js +3 -4
  172. package/dist/vite.mjs +2 -2
  173. package/dist/weapp-tw-css-import-rewrite-loader.js +5227 -18
  174. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  175. package/dist/webpack-BXSWVdXh.js +851 -0
  176. package/dist/webpack-Dx2AZpGU.mjs +841 -0
  177. package/dist/webpack.d.ts +1 -3
  178. package/dist/webpack.js +3 -4
  179. package/dist/webpack.mjs +2 -2
  180. package/package.json +38 -48
  181. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  182. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  183. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  184. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  185. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  186. package/dist/cli/config.d.ts +0 -5
  187. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  188. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  189. package/dist/cli/patch-options.d.ts +0 -6
  190. package/dist/cli/tokens.d.ts +0 -4
  191. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  192. package/dist/cli/workspace/patch-package.d.ts +0 -3
  193. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  194. package/dist/cli/workspace/types.d.ts +0 -11
  195. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  196. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  197. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  198. package/dist/cli/workspace.d.ts +0 -2
  199. package/dist/constants-B-_T5UnW.mjs +0 -44
  200. package/dist/constants-p1dyh1x1.js +0 -73
  201. package/dist/css-imports-BbrbluP9.js +0 -177
  202. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  203. package/dist/experimental/index.d.ts +0 -2
  204. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  205. package/dist/experimental/oxc/index.d.ts +0 -2
  206. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  207. package/dist/experimental/shared/cache.d.ts +0 -3
  208. package/dist/experimental/shared/transform.d.ts +0 -3
  209. package/dist/experimental/shared.d.ts +0 -8
  210. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  211. package/dist/experimental/swc/index.d.ts +0 -2
  212. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  213. package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
  214. package/dist/generator-css-Bwy_Uz89.mjs +0 -1097
  215. package/dist/generator-css-CRLrHW4F.js +0 -1124
  216. package/dist/generator-mmhXzZnv.js +0 -1276
  217. package/dist/js/syntax.d.ts +0 -10
  218. package/dist/lightningcss/index.d.ts +0 -8
  219. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  220. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  221. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  222. package/dist/lightningcss/style-handler.d.ts +0 -17
  223. package/dist/loader-anchors-1MumTAtA.mjs +0 -205
  224. package/dist/loader-anchors-TrFvT6g1.js +0 -273
  225. package/dist/logger-BZ45DZJT.js +0 -1003
  226. package/dist/logger-BoVx1Dbt.mjs +0 -935
  227. package/dist/patcher-options-6gJN2EXy.js +0 -115
  228. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  229. package/dist/recorder-GdTJ3QqX.js +0 -2878
  230. package/dist/recorder-XdFvVASS.mjs +0 -2763
  231. package/dist/tailwindcss/recorder.d.ts +0 -13
  232. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  233. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  234. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  235. package/dist/tailwindcss/targets/types.d.ts +0 -35
  236. package/dist/types/disabled-options.d.ts +0 -4
  237. package/dist/vite-BDywuCjn.mjs +0 -2186
  238. package/dist/vite-DgRh_GXn.js +0 -2199
  239. package/dist/webpack-CAJR4hhP.js +0 -456
  240. package/dist/webpack-CiHqVZTg.mjs +0 -441
  241. package/dist/webpack4.d.ts +0 -4
  242. package/dist/webpack4.js +0 -387
  243. package/dist/webpack4.mjs +0 -379
  244. package/scripts/postinstall.mjs +0 -59
@@ -0,0 +1,193 @@
1
+ require("./utils-D7Ygohep.js");
2
+ let _weapp_core_escape = require("@weapp-core/escape");
3
+ let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
4
+ //#region src/js/babel/cache-options.ts
5
+ const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
6
+ const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
7
+ //#endregion
8
+ //#region src/defaults.ts
9
+ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
10
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
11
+ const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
12
+ const BACKSLASH_RE = /\\/g;
13
+ function normalizePath(p) {
14
+ return p.replace(BACKSLASH_RE, "/");
15
+ }
16
+ const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
17
+ const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
18
+ const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
19
+ const MAIN_CSS_CHUNK_MATCHERS = {
20
+ "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
21
+ "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
22
+ "uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
23
+ "mpx": (file) => {
24
+ const normalized = normalizePath(file);
25
+ if (normalized.startsWith("app")) return true;
26
+ return MPX_STYLES_DIR_PATTERN.test(normalized);
27
+ },
28
+ "taro": (file) => file.startsWith("app"),
29
+ "remax": (file) => file.startsWith("app"),
30
+ "rax": (file) => file.startsWith("bundle"),
31
+ "native": (file) => file.startsWith("app"),
32
+ "weapp-vite": (file) => file.startsWith("app"),
33
+ "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
34
+ };
35
+ const alwaysFalse = () => false;
36
+ const TAILWIND_V3_CSS_PREFLIGHT = {
37
+ "box-sizing": "border-box",
38
+ "border-width": "0",
39
+ "border-style": "solid",
40
+ "border-color": "currentColor"
41
+ };
42
+ const TAILWIND_V4_CSS_PREFLIGHT = {
43
+ "box-sizing": "border-box",
44
+ "margin": "0",
45
+ "padding": "0",
46
+ "border": "0 solid"
47
+ };
48
+ function getDefaultCssPreflight(tailwindcssMajorVersion) {
49
+ return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
50
+ }
51
+ function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
52
+ if (cssPreflight === false) return false;
53
+ return {
54
+ ...getDefaultCssPreflight(tailwindcssMajorVersion),
55
+ ...cssPreflight ?? {}
56
+ };
57
+ }
58
+ function createMainCssChunkMatcher() {
59
+ return (file, appType) => {
60
+ if (!appType) {
61
+ const normalized = normalizePath(file);
62
+ return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
63
+ }
64
+ const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
65
+ return matcher ? matcher(file) : true;
66
+ };
67
+ }
68
+ function getDefaultOptions() {
69
+ return {
70
+ /**
71
+ * wxss 微信小程序
72
+ * acss 支付宝小程序
73
+ * jxss 京东小程序
74
+ * ttss 头条小程序
75
+ * qss QQ小程序
76
+ * css 最正常的样式文件
77
+ * tyss 涂鸦小程序
78
+ */
79
+ cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
80
+ /**
81
+ * wxml 微信小程序
82
+ * axml 支付宝小程序
83
+ * jxml 京东小程序
84
+ * ksml 快手小程序
85
+ * ttml 头条小程序
86
+ * qml QQ小程序
87
+ * tyml 涂鸦小程序
88
+ * xhsml 小红书小程序
89
+ * swan 百度小程序
90
+ */
91
+ htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
92
+ jsMatcher: (file) => {
93
+ if (file.includes("node_modules")) return false;
94
+ return JS_FILE_PATTERN.test(file);
95
+ },
96
+ mainCssChunkMatcher: createMainCssChunkMatcher(),
97
+ wxsMatcher: alwaysFalse,
98
+ cssPreflight: getDefaultCssPreflight(3),
99
+ disabled: false,
100
+ onLoad: _weapp_tailwindcss_shared.noop,
101
+ onStart: _weapp_tailwindcss_shared.noop,
102
+ onEnd: _weapp_tailwindcss_shared.noop,
103
+ onUpdate: _weapp_tailwindcss_shared.noop,
104
+ customAttributes: {},
105
+ customReplaceDictionary: _weapp_core_escape.MappingChars2String,
106
+ appType: void 0,
107
+ arbitraryValues: {
108
+ allowDoubleQuotes: false,
109
+ bareArbitraryValues: false
110
+ },
111
+ unocss: false,
112
+ cssChildCombinatorReplaceValue: ["view", "text"],
113
+ inlineWxs: false,
114
+ injectAdditionalCssVarScope: false,
115
+ jsPreserveClass: (keyword) => {
116
+ /**
117
+ * 默认保留 keyword
118
+ */
119
+ if (keyword === "*") return true;
120
+ return false;
121
+ },
122
+ disabledDefaultTemplateHandler: false,
123
+ cssSelectorReplacement: {
124
+ root: [
125
+ "page",
126
+ ".tw-root",
127
+ "wx-root-portal-content"
128
+ ],
129
+ universal: ["view", "text"]
130
+ },
131
+ babelParserOptions: {
132
+ sourceType: "unambiguous",
133
+ cache: true,
134
+ cacheKey: "st:unambiguous",
135
+ cacheMaxEntries: 128,
136
+ cacheMaxSourceLength: DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH
137
+ },
138
+ postcssOptions: {},
139
+ cssRemoveProperty: true,
140
+ cssRemoveHoverPseudoClass: true,
141
+ ignoreCallExpressionIdentifiers: [],
142
+ ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
143
+ replaceRuntimePackages: false,
144
+ generator: {},
145
+ tailwindcssPatcherOptions: { filter(className) {
146
+ return !(0, _weapp_core_escape.isAllowedClassName)(className);
147
+ } },
148
+ logLevel: "info"
149
+ };
150
+ }
151
+ //#endregion
152
+ Object.defineProperty(exports, "DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH", {
153
+ enumerable: true,
154
+ get: function() {
155
+ return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
156
+ }
157
+ });
158
+ Object.defineProperty(exports, "HARD_PARSE_CACHE_MAX_ENTRIES", {
159
+ enumerable: true,
160
+ get: function() {
161
+ return HARD_PARSE_CACHE_MAX_ENTRIES;
162
+ }
163
+ });
164
+ Object.defineProperty(exports, "TAILWIND_V3_CSS_PREFLIGHT", {
165
+ enumerable: true,
166
+ get: function() {
167
+ return TAILWIND_V3_CSS_PREFLIGHT;
168
+ }
169
+ });
170
+ Object.defineProperty(exports, "TAILWIND_V4_CSS_PREFLIGHT", {
171
+ enumerable: true,
172
+ get: function() {
173
+ return TAILWIND_V4_CSS_PREFLIGHT;
174
+ }
175
+ });
176
+ Object.defineProperty(exports, "getDefaultCssPreflight", {
177
+ enumerable: true,
178
+ get: function() {
179
+ return getDefaultCssPreflight;
180
+ }
181
+ });
182
+ Object.defineProperty(exports, "getDefaultOptions", {
183
+ enumerable: true,
184
+ get: function() {
185
+ return getDefaultOptions;
186
+ }
187
+ });
188
+ Object.defineProperty(exports, "resolveDefaultCssPreflight", {
189
+ enumerable: true,
190
+ get: function() {
191
+ return resolveDefaultCssPreflight;
192
+ }
193
+ });
@@ -1,2 +1,16 @@
1
- import type { UserDefinedOptions } from './types';
1
+ import type { CssPreflightOptions, UserDefinedOptions } from './types';
2
+ export declare const TAILWIND_V3_CSS_PREFLIGHT: {
3
+ 'box-sizing': string;
4
+ 'border-width': string;
5
+ 'border-style': string;
6
+ 'border-color': string;
7
+ };
8
+ export declare const TAILWIND_V4_CSS_PREFLIGHT: {
9
+ 'box-sizing': string;
10
+ margin: string;
11
+ padding: string;
12
+ border: string;
13
+ };
14
+ export declare function getDefaultCssPreflight(tailwindcssMajorVersion?: number): Exclude<CssPreflightOptions, false>;
15
+ export declare function resolveDefaultCssPreflight(cssPreflight: CssPreflightOptions | undefined, tailwindcssMajorVersion?: number): CssPreflightOptions;
2
16
  export declare function getDefaultOptions(): UserDefinedOptions;
package/dist/defaults.js CHANGED
@@ -1,132 +1,7 @@
1
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;
2
+ const require_defaults = require("./defaults-zKUH2mDe.js");
3
+ exports.TAILWIND_V3_CSS_PREFLIGHT = require_defaults.TAILWIND_V3_CSS_PREFLIGHT;
4
+ exports.TAILWIND_V4_CSS_PREFLIGHT = require_defaults.TAILWIND_V4_CSS_PREFLIGHT;
5
+ exports.getDefaultCssPreflight = require_defaults.getDefaultCssPreflight;
6
+ exports.getDefaultOptions = require_defaults.getDefaultOptions;
7
+ exports.resolveDefaultCssPreflight = require_defaults.resolveDefaultCssPreflight;
package/dist/defaults.mjs CHANGED
@@ -1,129 +1,2 @@
1
- import { a as noop } from "./utils-7DUGTFED.mjs";
2
- import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
3
- //#region src/defaults.ts
4
- const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
5
- const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
6
- const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
7
- const BACKSLASH_RE = /\\/g;
8
- function normalizePath(p) {
9
- return p.replace(BACKSLASH_RE, "/");
10
- }
11
- const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
12
- const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
13
- const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
14
- const MAIN_CSS_CHUNK_MATCHERS = {
15
- "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
16
- "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
17
- "uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
18
- "mpx": (file) => {
19
- const normalized = normalizePath(file);
20
- if (normalized.startsWith("app")) return true;
21
- return MPX_STYLES_DIR_PATTERN.test(normalized);
22
- },
23
- "taro": (file) => file.startsWith("app"),
24
- "remax": (file) => file.startsWith("app"),
25
- "rax": (file) => file.startsWith("bundle"),
26
- "native": (file) => file.startsWith("app"),
27
- "weapp-vite": (file) => file.startsWith("app"),
28
- "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
29
- };
30
- const alwaysFalse = () => false;
31
- function createMainCssChunkMatcher() {
32
- return (file, appType) => {
33
- if (!appType) {
34
- const normalized = normalizePath(file);
35
- return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
36
- }
37
- const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
38
- return matcher ? matcher(file) : true;
39
- };
40
- }
41
- function getDefaultOptions() {
42
- return {
43
- /**
44
- * wxss 微信小程序
45
- * acss 支付宝小程序
46
- * jxss 京东小程序
47
- * ttss 头条小程序
48
- * qss QQ小程序
49
- * css 最正常的样式文件
50
- * tyss 涂鸦小程序
51
- */
52
- cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
53
- /**
54
- * wxml 微信小程序
55
- * axml 支付宝小程序
56
- * jxml 京东小程序
57
- * ksml 快手小程序
58
- * ttml 头条小程序
59
- * qml QQ小程序
60
- * tyml 涂鸦小程序
61
- * xhsml 小红书小程序
62
- * swan 百度小程序
63
- */
64
- htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
65
- jsMatcher: (file) => {
66
- if (file.includes("node_modules")) return false;
67
- return JS_FILE_PATTERN.test(file);
68
- },
69
- mainCssChunkMatcher: createMainCssChunkMatcher(),
70
- wxsMatcher: alwaysFalse,
71
- cssPreflight: {
72
- "box-sizing": "border-box",
73
- "border-width": "0",
74
- "border-style": "solid",
75
- "border-color": "currentColor"
76
- },
77
- disabled: false,
78
- onLoad: noop,
79
- onStart: noop,
80
- onEnd: noop,
81
- onUpdate: noop,
82
- customAttributes: {},
83
- customReplaceDictionary: MappingChars2String,
84
- appType: void 0,
85
- arbitraryValues: { allowDoubleQuotes: false },
86
- cssChildCombinatorReplaceValue: ["view", "text"],
87
- inlineWxs: false,
88
- injectAdditionalCssVarScope: false,
89
- rewriteCssImports: true,
90
- jsPreserveClass: (keyword) => {
91
- /**
92
- * 默认保留 keyword
93
- */
94
- if (keyword === "*") return true;
95
- return false;
96
- },
97
- staleClassNameFallback: void 0,
98
- disabledDefaultTemplateHandler: false,
99
- cssSelectorReplacement: {
100
- root: [
101
- "page",
102
- ".tw-root",
103
- "wx-root-portal-content"
104
- ],
105
- universal: ["view", "text"]
106
- },
107
- babelParserOptions: {
108
- sourceType: "unambiguous",
109
- cache: true,
110
- cacheKey: "st:unambiguous"
111
- },
112
- postcssOptions: {},
113
- cssRemoveProperty: true,
114
- cssRemoveHoverPseudoClass: true,
115
- ignoreCallExpressionIdentifiers: [],
116
- ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
117
- replaceRuntimePackages: false,
118
- generator: {
119
- mode: "auto",
120
- target: "weapp"
121
- },
122
- tailwindcssPatcherOptions: { filter(className) {
123
- return !isAllowedClassName(className);
124
- } },
125
- logLevel: "info"
126
- };
127
- }
128
- //#endregion
129
- export { getDefaultOptions };
1
+ import { a as resolveDefaultCssPreflight, i as getDefaultOptions, n as TAILWIND_V4_CSS_PREFLIGHT, r as getDefaultCssPreflight, t as TAILWIND_V3_CSS_PREFLIGHT } from "./defaults-8xrgzxFY.mjs";
2
+ export { TAILWIND_V3_CSS_PREFLIGHT, TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
package/dist/escape.js CHANGED
@@ -1,5 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _weapp_core_escape = require("@weapp-core/escape");
3
+ //#region src/utils/object.ts
4
+ function definedEntries(value) {
5
+ return Object.entries(value).filter(([, item]) => item !== void 0);
6
+ }
7
+ function omitUndefined(value) {
8
+ return Object.fromEntries(definedEntries(value));
9
+ }
10
+ //#endregion
3
11
  //#region src/wxml/shared.ts
4
12
  const NEWLINE_RE = /[\n\r]+/g;
5
13
  function replaceWxml(original, options = {
@@ -9,10 +17,10 @@ function replaceWxml(original, options = {
9
17
  const { keepEOL, escapeMap, ignoreHead } = options;
10
18
  let res = original;
11
19
  if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
12
- res = (0, _weapp_core_escape.escape)(res, {
20
+ res = (0, _weapp_core_escape.escape)(res, omitUndefined({
13
21
  map: escapeMap,
14
22
  ignoreHead
15
- });
23
+ }));
16
24
  return res;
17
25
  }
18
26
  //#endregion
package/dist/escape.mjs CHANGED
@@ -1,4 +1,12 @@
1
1
  import { MappingChars2String, escape, isAllowedClassName, unescape } from "@weapp-core/escape";
2
+ //#region src/utils/object.ts
3
+ function definedEntries(value) {
4
+ return Object.entries(value).filter(([, item]) => item !== void 0);
5
+ }
6
+ function omitUndefined(value) {
7
+ return Object.fromEntries(definedEntries(value));
8
+ }
9
+ //#endregion
2
10
  //#region src/wxml/shared.ts
3
11
  const NEWLINE_RE = /[\n\r]+/g;
4
12
  function replaceWxml(original, options = {
@@ -8,10 +16,10 @@ function replaceWxml(original, options = {
8
16
  const { keepEOL, escapeMap, ignoreHead } = options;
9
17
  let res = original;
10
18
  if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
11
- res = escape(res, {
19
+ res = escape(res, omitUndefined({
12
20
  map: escapeMap,
13
21
  ignoreHead
14
- });
22
+ }));
15
23
  return res;
16
24
  }
17
25
  //#endregion
@@ -7,5 +7,5 @@ export declare function resolveTailwindSourceFromPatcher(patcher: TailwindcssPat
7
7
  export declare function createWeappTailwindcssGeneratorFromPatcher(patcher: TailwindcssPatcherLike): Promise<WeappTailwindcssGenerator>;
8
8
  export { normalizeWeappTailwindcssGeneratorOptions, } from './options';
9
9
  export { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
10
- export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorMode, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
10
+ export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
11
11
  export type { TailwindCandidateSource, TailwindGeneratorVersion, TailwindResolvedSource, TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, } from './types';
@@ -1,17 +1,18 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  import type { WeappTailwindcssGeneratorTarget } from './types';
3
- export type WeappTailwindcssGeneratorMode = 'auto' | 'force' | 'off';
4
3
  export interface WeappTailwindcssGeneratorOptions {
5
- mode?: WeappTailwindcssGeneratorMode;
6
- target?: WeappTailwindcssGeneratorTarget;
7
- styleOptions?: Partial<IStyleHandlerOptions>;
8
- tailwindcssV3Compatibility?: boolean;
4
+ target?: WeappTailwindcssGeneratorTarget | undefined;
5
+ config?: string | undefined;
6
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
7
+ importFallback?: boolean | undefined;
8
+ tailwindcssV3Compatibility?: boolean | undefined;
9
9
  }
10
- export type WeappTailwindcssGeneratorUserOptions = boolean | WeappTailwindcssGeneratorOptions;
10
+ export type WeappTailwindcssGeneratorUserOptions = WeappTailwindcssGeneratorOptions;
11
11
  export interface NormalizedWeappTailwindcssGeneratorOptions {
12
- mode: WeappTailwindcssGeneratorMode;
13
12
  target: WeappTailwindcssGeneratorTarget;
14
- styleOptions?: Partial<IStyleHandlerOptions>;
13
+ config?: string | undefined;
14
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
15
+ importFallback: boolean;
15
16
  tailwindcssV3Compatibility: boolean;
16
17
  }
17
18
  export declare function normalizeWeappTailwindcssGeneratorOptions(options: WeappTailwindcssGeneratorUserOptions | undefined): NormalizedWeappTailwindcssGeneratorOptions;
@@ -6,9 +6,9 @@ export type TailwindGeneratorVersion = 3 | 4;
6
6
  export type TailwindCandidateSource = TailwindV3CandidateSource | TailwindV4CandidateSource;
7
7
  export type TailwindResolvedSource = TailwindV3ResolvedSource | TailwindV4ResolvedSource;
8
8
  export interface WeappTailwindcssGenerateOptions extends Omit<TailwindV3GenerateOptions & TailwindV4GenerateOptions, 'target'> {
9
- target?: WeappTailwindcssGeneratorTarget;
10
- styleOptions?: Partial<IStyleHandlerOptions>;
11
- tailwindcssV3Compatibility?: boolean;
9
+ target?: WeappTailwindcssGeneratorTarget | undefined;
10
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
11
+ tailwindcssV3Compatibility?: boolean | undefined;
12
12
  }
13
13
  export type WeappTailwindcssGenerateResult = (TailwindV3GenerateResult | TailwindV4GenerateResult) & {
14
14
  target: WeappTailwindcssGeneratorTarget;
@@ -0,0 +1,90 @@
1
+ const require_chunk = require("./chunk-C5U5_Hdc.js");
2
+ const require_v3_engine = require("./v3-engine-CHItlVq5.js");
3
+ let node_process = require("node:process");
4
+ node_process = require_chunk.__toESM(node_process);
5
+ //#region src/generator/options.ts
6
+ const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
7
+ const uniWebPlatformEnvKeys = ["UNI_PLATFORM", "UNI_UTS_PLATFORM"];
8
+ const mpxWebPlatformEnvKeys = ["MPX_CLI_MODE", "MPX_CURRENT_TARGET_MODE"];
9
+ function getEnvValue(key) {
10
+ return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
11
+ }
12
+ function normalizeGeneratorTargetValue(value) {
13
+ return value === "weapp" || value === "web" || value === "tailwind" ? value : void 0;
14
+ }
15
+ function isUniWebPlatform(value) {
16
+ const normalized = value?.trim().toLowerCase();
17
+ return normalized === "h5" || normalized?.startsWith("web") === true;
18
+ }
19
+ function isUniAppWebViewPlatform(value) {
20
+ const normalized = value?.trim().toLowerCase();
21
+ return normalized === "app" || normalized === "app-plus";
22
+ }
23
+ function isUniNativeAppPlatform(value) {
24
+ return (value?.trim().toLowerCase())?.startsWith("app-") === true;
25
+ }
26
+ function isMpxWebPlatform(value) {
27
+ return value?.trim().toLowerCase() === "web";
28
+ }
29
+ function inferGeneratorTargetFromEnv() {
30
+ for (const key of explicitGeneratorTargetEnvKeys) {
31
+ const target = normalizeGeneratorTargetValue(getEnvValue(key));
32
+ if (target !== void 0) return target;
33
+ }
34
+ if (uniWebPlatformEnvKeys.some((key) => isUniWebPlatform(getEnvValue(key))) || isUniAppWebViewPlatform(getEnvValue("UNI_PLATFORM")) && !isUniNativeAppPlatform(getEnvValue("UNI_UTS_PLATFORM")) || mpxWebPlatformEnvKeys.some((key) => isMpxWebPlatform(getEnvValue(key))) || getEnvValue("TARO_ENV") === "h5") return "web";
35
+ return "weapp";
36
+ }
37
+ function normalizeWeappTailwindcssGeneratorOptions(options) {
38
+ const target = options?.target ?? inferGeneratorTargetFromEnv();
39
+ if (options == null) return {
40
+ target,
41
+ importFallback: true,
42
+ tailwindcssV3Compatibility: target === "weapp"
43
+ };
44
+ return {
45
+ target,
46
+ config: options.config,
47
+ styleOptions: options.styleOptions,
48
+ importFallback: options.importFallback ?? true,
49
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility ?? target === "weapp"
50
+ };
51
+ }
52
+ //#endregion
53
+ //#region src/generator/index.ts
54
+ function isTailwindV3Source(source) {
55
+ return "version" in source && source.version === 3;
56
+ }
57
+ function createWeappTailwindcssGenerator(source) {
58
+ return isTailwindV3Source(source) ? require_v3_engine.createTailwindV3Engine(source) : require_v3_engine.createTailwindV4Engine(source);
59
+ }
60
+ async function resolveTailwindSourceFromPatcher(patcher) {
61
+ return patcher.majorVersion === 3 ? require_v3_engine.resolveTailwindV3SourceFromPatcher(patcher) : require_v3_engine.resolveTailwindV4SourceFromPatcher(patcher);
62
+ }
63
+ async function createWeappTailwindcssGeneratorFromPatcher(patcher) {
64
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromPatcher(patcher));
65
+ }
66
+ //#endregion
67
+ Object.defineProperty(exports, "createWeappTailwindcssGenerator", {
68
+ enumerable: true,
69
+ get: function() {
70
+ return createWeappTailwindcssGenerator;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, "createWeappTailwindcssGeneratorFromPatcher", {
74
+ enumerable: true,
75
+ get: function() {
76
+ return createWeappTailwindcssGeneratorFromPatcher;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, "normalizeWeappTailwindcssGeneratorOptions", {
80
+ enumerable: true,
81
+ get: function() {
82
+ return normalizeWeappTailwindcssGeneratorOptions;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, "resolveTailwindSourceFromPatcher", {
86
+ enumerable: true,
87
+ get: function() {
88
+ return resolveTailwindSourceFromPatcher;
89
+ }
90
+ });