weapp-tailwindcss 5.0.12 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/auto-Ba6hDrse.mjs +13 -0
  4. package/dist/auto-DtU6f3X6.js +18 -0
  5. package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
  6. package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
  7. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +27 -10
  8. package/dist/bundlers/shared/generator-css/local-imports.d.ts +3 -0
  9. package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -0
  10. package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +6 -0
  11. package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +7 -0
  12. package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +3 -0
  13. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +15 -0
  14. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +12 -0
  15. package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +22 -0
  16. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +6 -23
  17. package/dist/bundlers/shared/generator-css/types.d.ts +15 -1
  18. package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -1
  19. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
  20. package/dist/bundlers/shared/run-tasks.d.ts +1 -0
  21. package/dist/bundlers/shared/v4-generation-core.d.ts +11 -0
  22. package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
  23. package/dist/bundlers/vite/css-memory.d.ts +37 -0
  24. package/dist/bundlers/vite/generate-bundle/bundle-file-names.d.ts +2 -0
  25. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +0 -1
  26. package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +8 -0
  27. package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +4 -0
  28. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -0
  29. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +9 -7
  30. package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +6 -0
  31. package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +12 -0
  32. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +63 -0
  33. package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +31 -0
  34. package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +80 -0
  35. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +53 -0
  36. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
  37. package/dist/bundlers/vite/generate-bundle/runtime-linked-css.d.ts +4 -0
  38. package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +21 -0
  39. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +5 -2
  40. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +30 -0
  41. package/dist/bundlers/vite/generate-bundle/timing.d.ts +1 -0
  42. package/dist/bundlers/vite/generate-bundle/types.d.ts +3 -1
  43. package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +20 -0
  44. package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +6 -0
  45. package/dist/bundlers/vite/generate-bundle.d.ts +4 -1
  46. package/dist/bundlers/vite/hot-css-modules.d.ts +5 -0
  47. package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -0
  48. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +3 -3
  49. package/dist/bundlers/vite/map-cache.d.ts +2 -0
  50. package/dist/bundlers/vite/processed-css-assets.d.ts +16 -0
  51. package/dist/bundlers/vite/resolve-app-type.d.ts +1 -2
  52. package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
  53. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -5
  54. package/dist/bundlers/vite/source-candidate-scan-signature.d.ts +13 -0
  55. package/dist/bundlers/vite/source-candidates/script.d.ts +1 -7
  56. package/dist/bundlers/vite/source-candidates.d.ts +12 -2
  57. package/dist/bundlers/vite/source-scan/css-entries.d.ts +3 -6
  58. package/dist/bundlers/vite/source-scan.d.ts +3 -3
  59. package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
  60. package/dist/bundlers/vite/utils.d.ts +1 -0
  61. package/dist/bundlers/vite/weapp-vite-config.d.ts +3 -1
  62. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +24 -0
  63. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -10
  64. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
  65. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +5 -1
  66. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +15 -1
  67. package/dist/bundlers/webpack/shared/css-loader-runtime.d.ts +1 -0
  68. package/dist/cache/index.d.ts +1 -0
  69. package/dist/cli/mount-options.d.ts +2 -2
  70. package/dist/cli.js +126 -439
  71. package/dist/cli.mjs +121 -434
  72. package/dist/context/index.d.ts +3 -3
  73. package/dist/context/style-options.d.ts +4 -1
  74. package/dist/context/tailwindcss.d.ts +1 -1
  75. package/dist/{precheck-30zNPRlI.js → context-BHxLe743.js} +484 -175
  76. package/dist/{precheck-CsFr1q2l.mjs → context-Mbzkek1q.mjs} +461 -159
  77. package/dist/core.js +15 -12
  78. package/dist/core.mjs +10 -7
  79. package/dist/css-macro.js +2 -2
  80. package/dist/css-macro.mjs +2 -2
  81. package/dist/{defaults-Boc26eel.js → defaults-CVcKbXBG.js} +6 -50
  82. package/dist/{defaults-DH0ZQRhy.mjs → defaults-ZElj1zKc.mjs} +7 -45
  83. package/dist/defaults.d.ts +1 -7
  84. package/dist/defaults.js +1 -2
  85. package/dist/defaults.mjs +2 -2
  86. package/dist/framework/index.d.ts +59 -0
  87. package/dist/framework.d.ts +1 -0
  88. package/dist/framework.js +198 -0
  89. package/dist/framework.mjs +180 -0
  90. package/dist/generator/index.d.ts +6 -7
  91. package/dist/generator/options.d.ts +3 -3
  92. package/dist/generator/types.d.ts +9 -10
  93. package/dist/generator-9rUz4Hcb.js +170 -0
  94. package/dist/generator-Dc4qaPmT.mjs +123 -0
  95. package/dist/generator.js +10 -16
  96. package/dist/generator.mjs +3 -3
  97. package/dist/{gulp-CxGZU0-v.js → gulp-B_sdP6dx.js} +80 -92
  98. package/dist/{gulp-BfZpaYSQ.mjs → gulp-uM36oIJs.mjs} +73 -85
  99. package/dist/gulp.js +1 -1
  100. package/dist/gulp.mjs +1 -1
  101. package/dist/{hmr-timing-DNjF8bWA.mjs → hmr-timing-BXMLsF4b.mjs} +1289 -909
  102. package/dist/{hmr-timing-DFR51wgo.js → hmr-timing-CogqkFaF.js} +1397 -939
  103. package/dist/index.d.ts +1 -0
  104. package/dist/index.js +20 -4
  105. package/dist/index.mjs +6 -5
  106. package/dist/js/fast-path/oxc.d.ts +4 -0
  107. package/dist/js/precheck.d.ts +1 -0
  108. package/dist/postcss.js +3 -4
  109. package/dist/postcss.mjs +2 -3
  110. package/dist/presets.js +10 -20
  111. package/dist/presets.mjs +9 -19
  112. package/dist/runtime-branch/create-branch.d.ts +2 -0
  113. package/dist/runtime-branch/generator-target-env.d.ts +4 -0
  114. package/dist/runtime-branch/index.d.ts +6 -0
  115. package/dist/runtime-branch/mini-program.d.ts +2 -0
  116. package/dist/runtime-branch/native-app.d.ts +2 -0
  117. package/dist/runtime-branch/platform.d.ts +6 -0
  118. package/dist/runtime-branch/tailwind-version.d.ts +2 -0
  119. package/dist/runtime-branch/types.d.ts +37 -0
  120. package/dist/runtime-branch/web.d.ts +2 -0
  121. package/dist/runtime-branch.d.ts +1 -0
  122. package/dist/{bundle-state-DU2ATDhw.js → source-candidate-scan-signature-2ybpptAK.js} +262 -20
  123. package/dist/{bundle-state-BxMNKjBV.mjs → source-candidate-scan-signature-Cvb5z1ha.mjs} +187 -17
  124. package/dist/tailwindcss/candidates.d.ts +7 -0
  125. package/dist/tailwindcss/index.d.ts +2 -2
  126. package/dist/tailwindcss/runtime/cache.d.ts +6 -6
  127. package/dist/tailwindcss/runtime-factory.d.ts +12 -0
  128. package/dist/tailwindcss/runtime-options.d.ts +8 -0
  129. package/dist/tailwindcss/runtime-types.d.ts +86 -0
  130. package/dist/tailwindcss/runtime.d.ts +6 -6
  131. package/dist/tailwindcss/source-scan.d.ts +1 -1
  132. package/dist/tailwindcss/targets.d.ts +2 -2
  133. package/dist/tailwindcss/v4/config.d.ts +3 -3
  134. package/dist/tailwindcss/v4/css-entries.d.ts +1 -0
  135. package/dist/tailwindcss/v4/css-sources.d.ts +4 -2
  136. package/dist/tailwindcss/v4/index.d.ts +1 -1
  137. package/dist/tailwindcss/v4/multi-runtime.d.ts +2 -0
  138. package/dist/tailwindcss/v4/runtime-factory.d.ts +15 -0
  139. package/dist/tailwindcss/v4/runtime-options.d.ts +2 -0
  140. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
  141. package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
  142. package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +3 -3
  143. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +1 -1
  144. package/dist/tailwindcss/v4-engine/generator.d.ts +10 -3
  145. package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
  146. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +7 -1
  147. package/dist/tailwindcss/v4-engine/source.d.ts +23 -6
  148. package/dist/tailwindcss/v4-engine/types.d.ts +8 -9
  149. package/dist/tailwindcss/version.d.ts +1 -1
  150. package/dist/tailwindcss-DHIYcqXT.js +1523 -0
  151. package/dist/tailwindcss-wyUHrfil.mjs +1418 -0
  152. package/dist/{transform-CaVEBOuR.js → transform-CQVOgmzM.js} +45 -37
  153. package/dist/{transform-Cju08-aJ.mjs → transform-tExdt40m.mjs} +30 -22
  154. package/dist/typedoc.export.d.ts +1 -1
  155. package/dist/types/index.d.ts +16 -17
  156. package/dist/types/shared.d.ts +1 -1
  157. package/dist/types/{typedoc-tailwindcss-patch.d.ts → typedoc-tailwindcss-runtime.d.ts} +4 -10
  158. package/dist/types/user-defined-options/general.d.ts +8 -4
  159. package/dist/types/user-defined-options/important.d.ts +2 -2
  160. package/dist/uni-app-x/style-asset.d.ts +1 -0
  161. package/dist/{utils-Dolmt8EO.js → utils-BCa37Wqj.js} +2 -17
  162. package/dist/{utils-DsaS975I.mjs → utils-DodxWHGz.mjs} +2 -17
  163. package/dist/v4-engine-CF9zt4Cw.mjs +2396 -0
  164. package/dist/v4-engine-D4ubP7N5.js +2778 -0
  165. package/dist/{vite-BBGOjh9e.js → vite-CP0ylSxZ.js} +2887 -1683
  166. package/dist/{vite-CS5DE-HD.mjs → vite-CPO83EhA.mjs} +2753 -1548
  167. package/dist/vite.js +1 -1
  168. package/dist/vite.mjs +1 -1
  169. package/dist/weapp-tw-css-import-rewrite-loader.js +5741 -4396
  170. package/dist/weapp-tw-runtime-classset-loader.js +36 -0
  171. package/dist/webpack-Bsek8VhR.js +2094 -0
  172. package/dist/webpack-BzqhJ8yK.mjs +2082 -0
  173. package/dist/webpack.js +1 -1
  174. package/dist/webpack.mjs +1 -1
  175. package/package.json +11 -7
  176. package/dist/auto-CTp6wE5a.js +0 -33
  177. package/dist/auto-Cl8_hsG6.mjs +0 -22
  178. package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +0 -13
  179. package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +0 -1
  180. package/dist/context/tailwindcss/rax.d.ts +0 -2
  181. package/dist/generator-Cb1Zp3Al.js +0 -92
  182. package/dist/generator-mvNFUvns.mjs +0 -67
  183. package/dist/tailwindcss/patcher-options.d.ts +0 -8
  184. package/dist/tailwindcss/patcher.d.ts +0 -12
  185. package/dist/tailwindcss/runtime-patch.d.ts +0 -5
  186. package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +0 -3
  187. package/dist/tailwindcss/v3-engine/generator/content.d.ts +0 -10
  188. package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +0 -2
  189. package/dist/tailwindcss/v3-engine/generator.d.ts +0 -19
  190. package/dist/tailwindcss/v3-engine/index.d.ts +0 -4
  191. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +0 -4
  192. package/dist/tailwindcss/v3-engine/source.d.ts +0 -5
  193. package/dist/tailwindcss/v3-engine/types.d.ts +0 -61
  194. package/dist/tailwindcss/v4/multi-patcher.d.ts +0 -2
  195. package/dist/tailwindcss/v4/patcher-options.d.ts +0 -2
  196. package/dist/tailwindcss/v4/patcher.d.ts +0 -15
  197. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +0 -1
  198. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +0 -1
  199. package/dist/tailwindcss-CK84uGBp.mjs +0 -556
  200. package/dist/tailwindcss-Clpkz1oR.js +0 -613
  201. package/dist/v3-engine-CQE5JJNZ.js +0 -4639
  202. package/dist/v3-engine-DKBaKWGL.mjs +0 -4231
  203. package/dist/webpack-DIWrcpRo.js +0 -1066
  204. package/dist/webpack-SPcri_D8.mjs +0 -1054
  205. /package/dist/tailwindcss/{patcher-resolve.d.ts → runtime-resolve.d.ts} +0 -0
@@ -0,0 +1,180 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import process from "node:process";
4
+ //#region src/framework/index.ts
5
+ const KNOWN_MAC_HBUILDERX_PLUGIN_DIRS = ["/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli-vite", "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli"];
6
+ const HBUILDERX_PLUGIN_CWD_RE = /[\\/]HBuilderX(?:\.[^\\/]*)?(?:[\\/]Contents[\\/]HBuilderX)?[\\/]plugins[\\/]uniapp-cli(?:-vite)?(?:[\\/]|$)/i;
7
+ const PACKAGE_JSON_FILE = "package.json";
8
+ const MANIFEST_JSON_FILE = "manifest.json";
9
+ const MPX_SCRIPT_RE = /\bmpx(?:-cli-service)?\b/u;
10
+ const TARO_SCRIPT_RE = /\btaro\b/u;
11
+ const WEAPP_VITE_SCRIPT_RE = /\bweapp-vite\b/u;
12
+ const UNI_APP_SCRIPT_RE = /\buni(?:\s|$)/u;
13
+ const UNI_APP_VITE_SCRIPT_RE = /\buni(?:\s|$)/u;
14
+ const MPX_MARKERS = [["src/app.mpx", "mpx"], ["app.mpx", "mpx"]];
15
+ function getProcessEnv() {
16
+ return {
17
+ MPX_CLI_MODE: process.env["MPX_CLI_MODE"],
18
+ MPX_CURRENT_TARGET_MODE: process.env["MPX_CURRENT_TARGET_MODE"],
19
+ NODE_PATH: process.env["NODE_PATH"],
20
+ TARO_ENV: process.env["TARO_ENV"],
21
+ UNI_PLATFORM: process.env["UNI_PLATFORM"],
22
+ UNI_UTS_PLATFORM: process.env["UNI_UTS_PLATFORM"],
23
+ WEAPP_TAILWINDCSS_TARGET: process.env["WEAPP_TAILWINDCSS_TARGET"],
24
+ WEAPP_TW_TARGET: process.env["WEAPP_TW_TARGET"]
25
+ };
26
+ }
27
+ function resolveDependencyNames(pkg) {
28
+ return new Set([
29
+ ...Object.keys(pkg.dependencies ?? {}),
30
+ ...Object.keys(pkg.devDependencies ?? {}),
31
+ ...Object.keys(pkg.peerDependencies ?? {}),
32
+ ...Object.keys(pkg.optionalDependencies ?? {})
33
+ ]);
34
+ }
35
+ function hasDependencyPrefix(dependencyNames, prefix) {
36
+ return [...dependencyNames].some((name) => name.startsWith(prefix));
37
+ }
38
+ function hasScriptMatch(pkg, pattern) {
39
+ return Object.values(pkg.scripts ?? {}).some((script) => pattern.test(script));
40
+ }
41
+ function normalizePlatform(value) {
42
+ return value?.trim().toLowerCase() || void 0;
43
+ }
44
+ function resolvePlatformInfo(value) {
45
+ const normalized = normalizePlatform(value);
46
+ const isAppAndroid = normalized === "app-android";
47
+ const isAppIos = normalized === "app-ios";
48
+ const isAppHarmony = normalized === "app-harmony";
49
+ return {
50
+ raw: value,
51
+ normalized,
52
+ isApp: normalized?.startsWith("app-") === true || normalized === "app" || normalized === "app-plus",
53
+ isAppAndroid,
54
+ isAppHarmony,
55
+ isAppIos,
56
+ isMp: normalized?.startsWith("mp-") === true,
57
+ isWeb: normalized?.startsWith("web") === true || normalized === "h5"
58
+ };
59
+ }
60
+ function hasKnownHBuilderXPluginPrefix(normalizedCwd) {
61
+ for (const dir of KNOWN_MAC_HBUILDERX_PLUGIN_DIRS) {
62
+ const normalizedDir = path.normalize(dir);
63
+ if (normalizedCwd === normalizedDir || normalizedCwd.startsWith(`${normalizedDir}${path.sep}`)) return true;
64
+ }
65
+ return false;
66
+ }
67
+ function matchesHBuilderXPluginCwd(cwd) {
68
+ const normalized = path.normalize(cwd);
69
+ if (hasKnownHBuilderXPluginPrefix(normalized)) return true;
70
+ return HBUILDERX_PLUGIN_CWD_RE.test(normalized);
71
+ }
72
+ function isRunningInHBuilderX(options = {}) {
73
+ const env = options.env ?? getProcessEnv();
74
+ const nodePath = "nodePath" in options ? options.nodePath : env.NODE_PATH;
75
+ if (!(nodePath == null || nodePath.trim().length === 0)) return false;
76
+ return matchesHBuilderXPluginCwd(options.cwd ?? process.cwd());
77
+ }
78
+ function resolveUniPlatform(value) {
79
+ return resolvePlatformInfo(value);
80
+ }
81
+ function resolveUniUtsPlatform(value) {
82
+ return resolvePlatformInfo(value);
83
+ }
84
+ function resolveUniPlatformsFromEnv(env = getProcessEnv()) {
85
+ return {
86
+ uniPlatform: resolveUniPlatform(env.UNI_PLATFORM),
87
+ uniUtsPlatform: resolveUniUtsPlatform(env.UNI_UTS_PLATFORM)
88
+ };
89
+ }
90
+ function detectAppTypeFromEnv(env = getProcessEnv(), options = {}) {
91
+ if (env.WEAPP_TW_TARGET === "weapp-vite" || env.WEAPP_TAILWINDCSS_TARGET === "weapp-vite") return "weapp-vite";
92
+ if (env.TARO_ENV) return "taro";
93
+ if (env.MPX_CLI_MODE || env.MPX_CURRENT_TARGET_MODE) return "mpx";
94
+ const { uniPlatform, uniUtsPlatform } = resolveUniPlatformsFromEnv(env);
95
+ if (uniUtsPlatform.normalized) return "uni-app-x";
96
+ if (uniPlatform.normalized) return "uni-app-vite";
97
+ if (isRunningInHBuilderX({
98
+ cwd: options.cwd,
99
+ env
100
+ })) return options.hbuilderxVite === false ? "uni-app" : "uni-app-vite";
101
+ }
102
+ function isWeappVitePackage(pkg) {
103
+ const dependencyNames = resolveDependencyNames(pkg);
104
+ return dependencyNames.has("weapp-vite") || hasDependencyPrefix(dependencyNames, "@weapp-vite/") || hasScriptMatch(pkg, WEAPP_VITE_SCRIPT_RE);
105
+ }
106
+ function isMpxPackage(pkg) {
107
+ return hasDependencyPrefix(resolveDependencyNames(pkg), "@mpxjs/") || hasScriptMatch(pkg, MPX_SCRIPT_RE);
108
+ }
109
+ function isTaroPackage(pkg) {
110
+ return hasDependencyPrefix(resolveDependencyNames(pkg), "@tarojs/") || hasScriptMatch(pkg, TARO_SCRIPT_RE);
111
+ }
112
+ function isUniAppVitePackage(pkg) {
113
+ return resolveDependencyNames(pkg).has("@dcloudio/vite-plugin-uni") || hasScriptMatch(pkg, UNI_APP_VITE_SCRIPT_RE);
114
+ }
115
+ function isUniAppXPackage(pkg) {
116
+ const dependencyNames = resolveDependencyNames(pkg);
117
+ return dependencyNames.has("@dcloudio/uni-uts-v1") || dependencyNames.has("@weapp-tailwindcss/debug-uni-app-x");
118
+ }
119
+ function isUniAppPackage(pkg) {
120
+ const dependencyNames = resolveDependencyNames(pkg);
121
+ return dependencyNames.has("@dcloudio/vue-cli-plugin-uni") || dependencyNames.has("@dcloudio/uni-app") || Object.hasOwn(pkg, "uni-app") || hasScriptMatch(pkg, UNI_APP_SCRIPT_RE);
122
+ }
123
+ function isUniAppXManifest(manifest) {
124
+ return Boolean(manifest && Object.hasOwn(manifest, "uni-app-x"));
125
+ }
126
+ function detectAppTypeFromPackageJson(pkg) {
127
+ if (isWeappVitePackage(pkg)) return "weapp-vite";
128
+ if (isMpxPackage(pkg)) return "mpx";
129
+ if (isTaroPackage(pkg)) return "taro";
130
+ if (isUniAppXPackage(pkg)) return "uni-app-x";
131
+ if (isUniAppVitePackage(pkg)) return "uni-app-vite";
132
+ if (isUniAppPackage(pkg)) return "uni-app";
133
+ }
134
+ function tryReadJson(file) {
135
+ if (!existsSync(file)) return;
136
+ try {
137
+ return JSON.parse(readFileSync(file, "utf8"));
138
+ } catch {}
139
+ }
140
+ function detectAppTypeFromMarkers(root) {
141
+ for (const [relativePath, appType] of MPX_MARKERS) if (existsSync(path.join(root, relativePath))) return appType;
142
+ }
143
+ function detectAppTypeFromRoot(root, searchUp = true) {
144
+ const resolvedRoot = path.resolve(root);
145
+ if (!existsSync(resolvedRoot)) return;
146
+ const markerDetected = detectAppTypeFromMarkers(resolvedRoot);
147
+ if (markerDetected) return markerDetected;
148
+ let current = resolvedRoot;
149
+ while (true) {
150
+ if (isUniAppXManifest(tryReadJson(path.join(current, MANIFEST_JSON_FILE)))) return "uni-app-x";
151
+ const pkg = tryReadJson(path.join(current, PACKAGE_JSON_FILE));
152
+ if (pkg) {
153
+ const detected = detectAppTypeFromPackageJson(pkg);
154
+ if (detected) return detected;
155
+ }
156
+ if (!searchUp) break;
157
+ const parent = path.dirname(current);
158
+ if (parent === current) break;
159
+ current = parent;
160
+ }
161
+ }
162
+ function detectAppType(options = {}) {
163
+ if (isUniAppXManifest(options.manifest)) return "uni-app-x";
164
+ if (options.packageJson) {
165
+ const detected = detectAppTypeFromPackageJson(options.packageJson);
166
+ if (detected) return detected;
167
+ }
168
+ if (options.root) {
169
+ const detected = detectAppTypeFromRoot(options.root, options.searchUp ?? true);
170
+ if (detected) return detected;
171
+ }
172
+ const env = options.env ?? (options.detectEnv ? getProcessEnv() : void 0);
173
+ if (env) return detectAppTypeFromEnv(env, {
174
+ cwd: options.cwd ?? options.root ?? (options.detectEnv ? process.cwd() : void 0),
175
+ hbuilderxVite: options.hbuilderxVite
176
+ });
177
+ }
178
+ const resolveImplicitAppTypeFromViteRoot = (root) => detectAppType({ root });
179
+ //#endregion
180
+ export { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform };
@@ -1,11 +1,10 @@
1
1
  import type { TailwindResolvedSource, WeappTailwindcssGenerator } from './types';
2
- import type { TailwindcssPatcherLike } from '../types';
3
- import { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp } from '../tailwindcss/v3-engine';
4
- import { resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp } from '../tailwindcss/v4-engine';
2
+ import type { TailwindcssRuntimeLike } from '../types';
3
+ import { resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp } from '../tailwindcss/v4-engine';
5
4
  export declare function createWeappTailwindcssGenerator(source: TailwindResolvedSource): WeappTailwindcssGenerator;
6
- export declare function resolveTailwindSourceFromPatcher(patcher: TailwindcssPatcherLike): Promise<TailwindResolvedSource>;
7
- export declare function createWeappTailwindcssGeneratorFromPatcher(patcher: TailwindcssPatcherLike): Promise<WeappTailwindcssGenerator>;
5
+ export declare function resolveTailwindSourceFromRuntime(tailwindRuntime: TailwindcssRuntimeLike): Promise<TailwindResolvedSource>;
6
+ export declare function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime: TailwindcssRuntimeLike): Promise<WeappTailwindcssGenerator>;
8
7
  export { normalizeWeappTailwindcssGeneratorOptions, } from './options';
9
- export { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
8
+ export { resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
10
9
  export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
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';
10
+ export type { TailwindCandidateSource, TailwindGeneratorVersion, TailwindResolvedSource, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, } from './types';
@@ -1,21 +1,21 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  import type { WeappTailwindcssGeneratorTarget } from './types';
3
+ import type { RuntimeBranch, RuntimeBranchContext } from '../runtime-branch';
3
4
  import type { IArbitraryValues } from '../types/shared';
4
5
  export interface WeappTailwindcssGeneratorOptions {
5
6
  target?: WeappTailwindcssGeneratorTarget | undefined;
6
7
  config?: string | undefined;
7
8
  styleOptions?: Partial<IStyleHandlerOptions> | undefined;
8
9
  importFallback?: boolean | undefined;
9
- tailwindcssV3Compatibility?: boolean | undefined;
10
10
  bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
11
11
  }
12
12
  export type WeappTailwindcssGeneratorUserOptions = WeappTailwindcssGeneratorOptions;
13
13
  export interface NormalizedWeappTailwindcssGeneratorOptions {
14
14
  target: WeappTailwindcssGeneratorTarget;
15
+ branch: RuntimeBranch;
15
16
  config?: string | undefined;
16
17
  styleOptions?: Partial<IStyleHandlerOptions> | undefined;
17
18
  importFallback: boolean;
18
- tailwindcssV3Compatibility: boolean;
19
19
  bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
20
20
  }
21
- export declare function normalizeWeappTailwindcssGeneratorOptions(options: WeappTailwindcssGeneratorUserOptions | undefined): NormalizedWeappTailwindcssGeneratorOptions;
21
+ export declare function normalizeWeappTailwindcssGeneratorOptions(options: WeappTailwindcssGeneratorUserOptions | undefined, context?: Omit<RuntimeBranchContext, 'generatorTarget'>): NormalizedWeappTailwindcssGeneratorOptions;
@@ -1,20 +1,19 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
- import type { TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions } from '../tailwindcss/v3-engine';
2
+ import type { WeappTailwindcssGeneratorTarget } from '../runtime-branch';
3
3
  import type { TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions } from '../tailwindcss/v4-engine';
4
- export type WeappTailwindcssGeneratorTarget = TailwindV3GenerateTarget | TailwindV4GenerateTarget;
5
- export type TailwindGeneratorVersion = 3 | 4;
6
- export type TailwindCandidateSource = TailwindV3CandidateSource | TailwindV4CandidateSource;
7
- export type TailwindResolvedSource = TailwindV3ResolvedSource | TailwindV4ResolvedSource;
8
- export interface WeappTailwindcssGenerateOptions extends Omit<TailwindV3GenerateOptions & TailwindV4GenerateOptions, 'target'> {
4
+ export type { WeappTailwindcssGeneratorTarget };
5
+ export type TailwindGeneratorVersion = 4;
6
+ export type TailwindCandidateSource = TailwindV4CandidateSource;
7
+ export type TailwindResolvedSource = TailwindV4ResolvedSource;
8
+ export interface WeappTailwindcssGenerateOptions extends Omit<TailwindV4GenerateOptions, 'target'> {
9
9
  target?: WeappTailwindcssGeneratorTarget | undefined;
10
10
  styleOptions?: Partial<IStyleHandlerOptions> | undefined;
11
- tailwindcssV3Compatibility?: boolean | undefined;
12
11
  }
13
- export type WeappTailwindcssGenerateResult = (TailwindV3GenerateResult | TailwindV4GenerateResult) & {
12
+ export type WeappTailwindcssGenerateResult = TailwindV4GenerateResult & {
14
13
  target: WeappTailwindcssGeneratorTarget;
15
14
  rawCss: string;
16
15
  };
17
- export interface WeappTailwindcssGenerator extends Omit<TailwindV3Engine | TailwindV4Engine, 'generate'> {
16
+ export interface WeappTailwindcssGenerator extends Omit<TailwindV4Engine, 'generate'> {
18
17
  generate: (options?: WeappTailwindcssGenerateOptions) => Promise<WeappTailwindcssGenerateResult>;
19
18
  }
20
- export type { TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, };
19
+ export type { TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, };
@@ -0,0 +1,170 @@
1
+ const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
2
+ const require_utils = require("./utils-BCa37Wqj.js");
3
+ //#region src/runtime-branch/create-branch.ts
4
+ function createRuntimeBranch(base, platformFamily, options) {
5
+ const { context, tailwindcssVersion } = base;
6
+ return {
7
+ tailwindcssVersion,
8
+ generatorTarget: context.generatorTarget,
9
+ platformFamily,
10
+ platform: options.platform,
11
+ nativeAppPlatform: options.nativeAppPlatform,
12
+ isTailwindV4: tailwindcssVersion === 4,
13
+ isWeb: platformFamily === "web",
14
+ isMiniProgram: platformFamily === "mini-program",
15
+ isNativeApp: platformFamily === "native-app"
16
+ };
17
+ }
18
+ //#endregion
19
+ //#region src/runtime-branch/mini-program.ts
20
+ function createMiniProgramRuntimeBranch(base) {
21
+ const { context, uniUtsPlatform } = base;
22
+ return createRuntimeBranch(base, "mini-program", { platform: typeof context.platform === "string" && context.platform.length > 0 ? context.platform : uniUtsPlatform.isMp ? uniUtsPlatform.normalized : context.platform });
23
+ }
24
+ //#endregion
25
+ //#region src/runtime-branch/platform.ts
26
+ function isRuntimeUniAppXEnabled(value) {
27
+ return value === true || typeof value === "object" && value?.enabled !== false;
28
+ }
29
+ function normalizeRuntimeUniUtsPlatform(value) {
30
+ return typeof value === "object" && value !== null ? value : require_utils.resolveUniUtsPlatform(value);
31
+ }
32
+ function resolveNativeAppPlatform(platform) {
33
+ if (platform.isAppAndroid) return "android";
34
+ if (platform.isAppIos) return "ios";
35
+ if (platform.isAppHarmony) return "harmony";
36
+ return "unknown";
37
+ }
38
+ function resolveExplicitOrEnvPlatform(context, uniUtsPlatform) {
39
+ if (typeof context.platform === "string" && context.platform.length > 0) return context.platform;
40
+ return uniUtsPlatform.normalized;
41
+ }
42
+ //#endregion
43
+ //#region src/runtime-branch/native-app.ts
44
+ function createNativeAppRuntimeBranch(base) {
45
+ return createRuntimeBranch(base, "native-app", {
46
+ platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform),
47
+ nativeAppPlatform: resolveNativeAppPlatform(base.uniUtsPlatform)
48
+ });
49
+ }
50
+ //#endregion
51
+ //#region src/runtime-branch/tailwind-version.ts
52
+ function resolveTailwindcssBranchVersion(_majorVersion) {
53
+ return 4;
54
+ }
55
+ //#endregion
56
+ //#region src/runtime-branch/web.ts
57
+ function createWebRuntimeBranch(base) {
58
+ return createRuntimeBranch(base, "web", { platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform) });
59
+ }
60
+ //#endregion
61
+ //#region src/runtime-branch/index.ts
62
+ function shouldUseNativeAppBranch(base, uniUtsPlatform) {
63
+ return base.appType === "uni-app-x" && isRuntimeUniAppXEnabled(base.uniAppX) && uniUtsPlatform.isApp;
64
+ }
65
+ function resolveRuntimeBranch(context) {
66
+ const uniUtsPlatform = normalizeRuntimeUniUtsPlatform(context.uniUtsPlatform);
67
+ const base = {
68
+ context,
69
+ tailwindcssVersion: resolveTailwindcssBranchVersion(context.tailwindcssMajorVersion),
70
+ uniUtsPlatform
71
+ };
72
+ if (context.generatorTarget === "web") return createWebRuntimeBranch(base);
73
+ if (shouldUseNativeAppBranch(context, uniUtsPlatform)) return createNativeAppRuntimeBranch(base);
74
+ return createMiniProgramRuntimeBranch(base);
75
+ }
76
+ function resolveGeneratorRuntimeBranch(options, context = {}) {
77
+ return options.branch ?? resolveRuntimeBranch({
78
+ ...context,
79
+ generatorTarget: options.target
80
+ });
81
+ }
82
+ function shouldUseMiniProgramCssBranch(branch) {
83
+ return branch.platformFamily === "mini-program" || branch.platformFamily === "native-app";
84
+ }
85
+ function shouldUseNativeAppCssBranch(branch) {
86
+ return branch.platformFamily === "native-app";
87
+ }
88
+ //#endregion
89
+ //#region src/generator/options.ts
90
+ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
91
+ const target = options?.target ?? require_v4_engine.inferGeneratorTargetFromEnv();
92
+ const branch = resolveRuntimeBranch({
93
+ ...context,
94
+ generatorTarget: target
95
+ });
96
+ if (options == null) return {
97
+ target,
98
+ branch,
99
+ importFallback: false,
100
+ bareArbitraryValues: void 0
101
+ };
102
+ return {
103
+ target,
104
+ branch,
105
+ config: options.config,
106
+ styleOptions: options.styleOptions,
107
+ importFallback: options.importFallback ?? false,
108
+ bareArbitraryValues: options.bareArbitraryValues
109
+ };
110
+ }
111
+ //#endregion
112
+ //#region src/generator/index.ts
113
+ function createWeappTailwindcssGenerator(source) {
114
+ return require_v4_engine.createTailwindV4Engine(source);
115
+ }
116
+ async function resolveTailwindSourceFromRuntime(tailwindRuntime) {
117
+ return require_v4_engine.resolveTailwindV4SourceFromRuntime(tailwindRuntime);
118
+ }
119
+ async function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime) {
120
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromRuntime(tailwindRuntime));
121
+ }
122
+ //#endregion
123
+ Object.defineProperty(exports, "createWeappTailwindcssGenerator", {
124
+ enumerable: true,
125
+ get: function() {
126
+ return createWeappTailwindcssGenerator;
127
+ }
128
+ });
129
+ Object.defineProperty(exports, "createWeappTailwindcssGeneratorFromRuntime", {
130
+ enumerable: true,
131
+ get: function() {
132
+ return createWeappTailwindcssGeneratorFromRuntime;
133
+ }
134
+ });
135
+ Object.defineProperty(exports, "normalizeWeappTailwindcssGeneratorOptions", {
136
+ enumerable: true,
137
+ get: function() {
138
+ return normalizeWeappTailwindcssGeneratorOptions;
139
+ }
140
+ });
141
+ Object.defineProperty(exports, "resolveGeneratorRuntimeBranch", {
142
+ enumerable: true,
143
+ get: function() {
144
+ return resolveGeneratorRuntimeBranch;
145
+ }
146
+ });
147
+ Object.defineProperty(exports, "resolveRuntimeBranch", {
148
+ enumerable: true,
149
+ get: function() {
150
+ return resolveRuntimeBranch;
151
+ }
152
+ });
153
+ Object.defineProperty(exports, "resolveTailwindSourceFromRuntime", {
154
+ enumerable: true,
155
+ get: function() {
156
+ return resolveTailwindSourceFromRuntime;
157
+ }
158
+ });
159
+ Object.defineProperty(exports, "shouldUseMiniProgramCssBranch", {
160
+ enumerable: true,
161
+ get: function() {
162
+ return shouldUseMiniProgramCssBranch;
163
+ }
164
+ });
165
+ Object.defineProperty(exports, "shouldUseNativeAppCssBranch", {
166
+ enumerable: true,
167
+ get: function() {
168
+ return shouldUseNativeAppCssBranch;
169
+ }
170
+ });
@@ -0,0 +1,123 @@
1
+ import { G as createTailwindV4Engine, lt as inferGeneratorTargetFromEnv, n as resolveTailwindV4SourceFromRuntime } from "./v4-engine-CF9zt4Cw.mjs";
2
+ import { o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
3
+ //#region src/runtime-branch/create-branch.ts
4
+ function createRuntimeBranch(base, platformFamily, options) {
5
+ const { context, tailwindcssVersion } = base;
6
+ return {
7
+ tailwindcssVersion,
8
+ generatorTarget: context.generatorTarget,
9
+ platformFamily,
10
+ platform: options.platform,
11
+ nativeAppPlatform: options.nativeAppPlatform,
12
+ isTailwindV4: tailwindcssVersion === 4,
13
+ isWeb: platformFamily === "web",
14
+ isMiniProgram: platformFamily === "mini-program",
15
+ isNativeApp: platformFamily === "native-app"
16
+ };
17
+ }
18
+ //#endregion
19
+ //#region src/runtime-branch/mini-program.ts
20
+ function createMiniProgramRuntimeBranch(base) {
21
+ const { context, uniUtsPlatform } = base;
22
+ return createRuntimeBranch(base, "mini-program", { platform: typeof context.platform === "string" && context.platform.length > 0 ? context.platform : uniUtsPlatform.isMp ? uniUtsPlatform.normalized : context.platform });
23
+ }
24
+ //#endregion
25
+ //#region src/runtime-branch/platform.ts
26
+ function isRuntimeUniAppXEnabled(value) {
27
+ return value === true || typeof value === "object" && value?.enabled !== false;
28
+ }
29
+ function normalizeRuntimeUniUtsPlatform(value) {
30
+ return typeof value === "object" && value !== null ? value : resolveUniUtsPlatform(value);
31
+ }
32
+ function resolveNativeAppPlatform(platform) {
33
+ if (platform.isAppAndroid) return "android";
34
+ if (platform.isAppIos) return "ios";
35
+ if (platform.isAppHarmony) return "harmony";
36
+ return "unknown";
37
+ }
38
+ function resolveExplicitOrEnvPlatform(context, uniUtsPlatform) {
39
+ if (typeof context.platform === "string" && context.platform.length > 0) return context.platform;
40
+ return uniUtsPlatform.normalized;
41
+ }
42
+ //#endregion
43
+ //#region src/runtime-branch/native-app.ts
44
+ function createNativeAppRuntimeBranch(base) {
45
+ return createRuntimeBranch(base, "native-app", {
46
+ platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform),
47
+ nativeAppPlatform: resolveNativeAppPlatform(base.uniUtsPlatform)
48
+ });
49
+ }
50
+ //#endregion
51
+ //#region src/runtime-branch/tailwind-version.ts
52
+ function resolveTailwindcssBranchVersion(_majorVersion) {
53
+ return 4;
54
+ }
55
+ //#endregion
56
+ //#region src/runtime-branch/web.ts
57
+ function createWebRuntimeBranch(base) {
58
+ return createRuntimeBranch(base, "web", { platform: resolveExplicitOrEnvPlatform(base.context, base.uniUtsPlatform) });
59
+ }
60
+ //#endregion
61
+ //#region src/runtime-branch/index.ts
62
+ function shouldUseNativeAppBranch(base, uniUtsPlatform) {
63
+ return base.appType === "uni-app-x" && isRuntimeUniAppXEnabled(base.uniAppX) && uniUtsPlatform.isApp;
64
+ }
65
+ function resolveRuntimeBranch(context) {
66
+ const uniUtsPlatform = normalizeRuntimeUniUtsPlatform(context.uniUtsPlatform);
67
+ const base = {
68
+ context,
69
+ tailwindcssVersion: resolveTailwindcssBranchVersion(context.tailwindcssMajorVersion),
70
+ uniUtsPlatform
71
+ };
72
+ if (context.generatorTarget === "web") return createWebRuntimeBranch(base);
73
+ if (shouldUseNativeAppBranch(context, uniUtsPlatform)) return createNativeAppRuntimeBranch(base);
74
+ return createMiniProgramRuntimeBranch(base);
75
+ }
76
+ function resolveGeneratorRuntimeBranch(options, context = {}) {
77
+ return options.branch ?? resolveRuntimeBranch({
78
+ ...context,
79
+ generatorTarget: options.target
80
+ });
81
+ }
82
+ function shouldUseMiniProgramCssBranch(branch) {
83
+ return branch.platformFamily === "mini-program" || branch.platformFamily === "native-app";
84
+ }
85
+ function shouldUseNativeAppCssBranch(branch) {
86
+ return branch.platformFamily === "native-app";
87
+ }
88
+ //#endregion
89
+ //#region src/generator/options.ts
90
+ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
91
+ const target = options?.target ?? inferGeneratorTargetFromEnv();
92
+ const branch = resolveRuntimeBranch({
93
+ ...context,
94
+ generatorTarget: target
95
+ });
96
+ if (options == null) return {
97
+ target,
98
+ branch,
99
+ importFallback: false,
100
+ bareArbitraryValues: void 0
101
+ };
102
+ return {
103
+ target,
104
+ branch,
105
+ config: options.config,
106
+ styleOptions: options.styleOptions,
107
+ importFallback: options.importFallback ?? false,
108
+ bareArbitraryValues: options.bareArbitraryValues
109
+ };
110
+ }
111
+ //#endregion
112
+ //#region src/generator/index.ts
113
+ function createWeappTailwindcssGenerator(source) {
114
+ return createTailwindV4Engine(source);
115
+ }
116
+ async function resolveTailwindSourceFromRuntime(tailwindRuntime) {
117
+ return resolveTailwindV4SourceFromRuntime(tailwindRuntime);
118
+ }
119
+ async function createWeappTailwindcssGeneratorFromRuntime(tailwindRuntime) {
120
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromRuntime(tailwindRuntime));
121
+ }
122
+ //#endregion
123
+ export { resolveGeneratorRuntimeBranch as a, shouldUseNativeAppCssBranch as c, normalizeWeappTailwindcssGeneratorOptions as i, createWeappTailwindcssGeneratorFromRuntime as n, resolveRuntimeBranch as o, resolveTailwindSourceFromRuntime as r, shouldUseMiniProgramCssBranch as s, createWeappTailwindcssGenerator as t };
package/dist/generator.js CHANGED
@@ -1,19 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_v3_engine = require("./v3-engine-CQE5JJNZ.js");
3
- const require_generator = require("./generator-Cb1Zp3Al.js");
4
- let tailwindcss_patch = require("tailwindcss-patch");
2
+ const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
3
+ const require_generator = require("./generator-9rUz4Hcb.js");
5
4
  exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
6
- exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
5
+ exports.createWeappTailwindcssGeneratorFromRuntime = require_generator.createWeappTailwindcssGeneratorFromRuntime;
7
6
  exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
8
- exports.resolveTailwindSourceFromPatcher = require_generator.resolveTailwindSourceFromPatcher;
9
- exports.resolveTailwindV3Source = require_v3_engine.resolveTailwindV3Source;
10
- exports.resolveTailwindV3SourceFromPatcher = require_v3_engine.resolveTailwindV3SourceFromPatcher;
11
- exports.resolveTailwindV3SourceOptionsFromPatcher = require_v3_engine.resolveTailwindV3SourceOptionsFromPatcher;
12
- exports.resolveTailwindV4Source = require_v3_engine.resolveTailwindV4Source;
13
- exports.resolveTailwindV4SourceFromPatchOptions = tailwindcss_patch.resolveTailwindV4SourceFromPatchOptions;
14
- exports.resolveTailwindV4SourceFromPatcher = require_v3_engine.resolveTailwindV4SourceFromPatcher;
15
- exports.resolveTailwindV4SourceOptionsFromPatcher = require_v3_engine.resolveTailwindV4SourceOptionsFromPatcher;
16
- exports.transformTailwindV3CssByTarget = require_v3_engine.transformTailwindV3CssByTarget;
17
- exports.transformTailwindV3CssToWeapp = require_v3_engine.transformTailwindV3CssToWeapp;
18
- exports.transformTailwindV4CssByTarget = require_v3_engine.transformTailwindV4CssByTarget;
19
- exports.transformTailwindV4CssToWeapp = require_v3_engine.transformTailwindV4CssToWeapp;
7
+ exports.resolveTailwindSourceFromRuntime = require_generator.resolveTailwindSourceFromRuntime;
8
+ exports.resolveTailwindV4Source = require_v4_engine.resolveTailwindV4Source;
9
+ exports.resolveTailwindV4SourceFromRuntime = require_v4_engine.resolveTailwindV4SourceFromRuntime;
10
+ exports.resolveTailwindV4SourceFromRuntimeOptions = require_v4_engine.resolveTailwindV4SourceFromRuntimeOptions;
11
+ exports.resolveTailwindV4SourceOptionsFromRuntime = require_v4_engine.resolveTailwindV4SourceOptionsFromRuntime;
12
+ exports.transformTailwindV4CssByTarget = require_v4_engine.transformTailwindV4CssByTarget;
13
+ exports.transformTailwindV4CssToWeapp = require_v4_engine.transformTailwindV4CssToWeapp;
@@ -1,3 +1,3 @@
1
- import { C as resolveTailwindV4SourceOptionsFromPatcher, S as resolveTailwindV4SourceFromPatcher, X as transformTailwindV4CssToWeapp, Y as transformTailwindV4CssByTarget, b as resolveTailwindV4Source, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssByTarget, r as resolveTailwindV3SourceOptionsFromPatcher, s as transformTailwindV3CssToWeapp, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatchOptions } from "./v3-engine-DKBaKWGL.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-mvNFUvns.mjs";
3
- export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
1
+ import { J as transformTailwindV4CssToWeapp, i as resolveTailwindV4SourceOptionsFromRuntime, n as resolveTailwindV4SourceFromRuntime, q as transformTailwindV4CssByTarget, r as resolveTailwindV4SourceFromRuntimeOptions, t as resolveTailwindV4Source } from "./v4-engine-CF9zt4Cw.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator } from "./generator-Dc4qaPmT.mjs";
3
+ export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromRuntime, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromRuntime, resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };