weapp-tailwindcss 4.12.0 → 5.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) 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 +41 -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 +19 -0
  13. package/dist/bundlers/vite/generate-bundle.d.ts +20 -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/utils.d.ts +9 -0
  22. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +20 -0
  23. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +14 -0
  24. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +15 -0
  25. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +9 -0
  26. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +17 -0
  27. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +19 -0
  28. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +9 -0
  29. package/dist/bundlers/webpack/index.d.ts +1 -0
  30. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +12 -0
  31. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
  32. package/dist/bundlers/webpack/shared/css-imports.d.ts +6 -0
  33. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
  34. package/dist/cache/index.d.ts +38 -0
  35. package/dist/cache/md5.d.ts +1 -0
  36. package/dist/chunk-8l464Juk.js +28 -0
  37. package/dist/cli/config.d.ts +5 -0
  38. package/dist/cli/context.d.ts +16 -0
  39. package/dist/cli/doctor/constants.d.ts +7 -0
  40. package/dist/cli/doctor/types.d.ts +31 -0
  41. package/dist/cli/doctor.d.ts +4 -0
  42. package/dist/cli/helpers/options/format.d.ts +2 -0
  43. package/dist/cli/helpers/options/parse.d.ts +3 -0
  44. package/dist/cli/helpers/options/resolve.d.ts +1 -0
  45. package/dist/cli/helpers/options.d.ts +3 -0
  46. package/dist/cli/helpers/patch-cwd.d.ts +1 -0
  47. package/dist/cli/helpers.d.ts +5 -0
  48. package/dist/cli/mount-options/patch-status.d.ts +2 -0
  49. package/dist/cli/mount-options.d.ts +2 -0
  50. package/dist/cli/patch-options.d.ts +6 -0
  51. package/dist/cli/tokens.d.ts +4 -0
  52. package/dist/cli/types.d.ts +17 -0
  53. package/dist/cli/vscode-entry.d.ts +14 -0
  54. package/dist/cli/workspace/package-dirs.d.ts +3 -0
  55. package/dist/cli/workspace/patch-package.d.ts +3 -0
  56. package/dist/cli/workspace/patch-utils.d.ts +3 -0
  57. package/dist/cli/workspace/types.d.ts +11 -0
  58. package/dist/cli/workspace/workspace-globs.d.ts +2 -0
  59. package/dist/cli/workspace/workspace-io.d.ts +1 -0
  60. package/dist/cli/workspace/workspace-lock.d.ts +1 -0
  61. package/dist/cli/workspace.d.ts +2 -0
  62. package/dist/cli.d.ts +1 -2
  63. package/dist/cli.js +2425 -3524
  64. package/dist/cli.mjs +2402 -3505
  65. package/dist/constants-B-_T5UnW.mjs +44 -0
  66. package/dist/constants-p1dyh1x1.js +73 -0
  67. package/dist/constants.d.ts +13 -0
  68. package/dist/context/compiler-context-cache.d.ts +3 -0
  69. package/dist/context/custom-attributes.d.ts +2 -0
  70. package/dist/context/handlers.d.ts +6 -0
  71. package/dist/context/index.d.ts +7 -0
  72. package/dist/context/logger.d.ts +4 -0
  73. package/dist/context/tailwindcss/basedir.d.ts +1 -0
  74. package/dist/context/tailwindcss/rax.d.ts +2 -0
  75. package/dist/context/tailwindcss.d.ts +4 -0
  76. package/dist/context/workspace.d.ts +3 -0
  77. package/dist/core.d.ts +5 -21
  78. package/dist/core.js +138 -180
  79. package/dist/core.mjs +135 -180
  80. package/dist/css-imports-BbrbluP9.js +177 -0
  81. package/dist/css-imports-CSdPq_Sc.mjs +128 -0
  82. package/dist/css-macro/constants.d.ts +14 -0
  83. package/dist/css-macro/index.d.ts +15 -0
  84. package/dist/css-macro/postcss.d.ts +3 -7
  85. package/dist/css-macro/postcss.js +44 -58
  86. package/dist/css-macro/postcss.mjs +44 -56
  87. package/dist/css-macro.d.ts +1 -20
  88. package/dist/css-macro.js +37 -50
  89. package/dist/css-macro.mjs +33 -47
  90. package/dist/debug/index.d.ts +5 -0
  91. package/dist/defaults.d.ts +2 -11
  92. package/dist/defaults.js +132 -8
  93. package/dist/defaults.mjs +128 -7
  94. package/dist/escape.js +31 -54
  95. package/dist/escape.mjs +18 -25
  96. package/dist/experimental/index.d.ts +2 -0
  97. package/dist/experimental/oxc/ast-utils.d.ts +30 -0
  98. package/dist/experimental/oxc/index.d.ts +2 -0
  99. package/dist/experimental/oxc/module-specifiers.d.ts +2 -0
  100. package/dist/experimental/shared/cache.d.ts +3 -0
  101. package/dist/experimental/shared/transform.d.ts +3 -0
  102. package/dist/experimental/shared.d.ts +8 -0
  103. package/dist/experimental/swc/ast-utils.d.ts +30 -0
  104. package/dist/experimental/swc/index.d.ts +2 -0
  105. package/dist/experimental/swc/module-specifiers.d.ts +2 -0
  106. package/dist/generator/index.d.ts +11 -0
  107. package/dist/generator/options.d.ts +15 -0
  108. package/dist/generator/types.d.ts +19 -0
  109. package/dist/generator-CZ-JXw6T.js +492 -0
  110. package/dist/generator-Dwxgra97.mjs +399 -0
  111. package/dist/generator-css-CnYjiMrD.js +1084 -0
  112. package/dist/generator-css-DhPFjSzK.mjs +1057 -0
  113. package/dist/generator.d.ts +1 -0
  114. package/dist/generator.js +19 -0
  115. package/dist/generator.mjs +2 -0
  116. package/dist/gulp.d.ts +4 -24
  117. package/dist/gulp.js +271 -13
  118. package/dist/gulp.mjs +263 -13
  119. package/dist/index.d.ts +8 -15
  120. package/dist/index.js +12 -24
  121. package/dist/index.mjs +6 -24
  122. package/dist/js/JsTokenUpdater.d.ts +14 -0
  123. package/dist/js/ModuleGraph.d.ts +18 -0
  124. package/dist/js/NodePathWalker.d.ts +33 -0
  125. package/dist/js/babel/parse.d.ts +9 -0
  126. package/dist/js/babel/process.d.ts +4 -0
  127. package/dist/js/babel.d.ts +13 -0
  128. package/dist/js/class-context.d.ts +3 -0
  129. package/dist/js/evalTransforms.d.ts +7 -0
  130. package/dist/js/handlers.d.ts +5 -0
  131. package/dist/js/index.d.ts +4 -0
  132. package/dist/js/module-graph/ignored-exports.d.ts +18 -0
  133. package/dist/js/module-graph/types.d.ts +17 -0
  134. package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
  135. package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
  136. package/dist/js/precheck.d.ts +2 -0
  137. package/dist/js/sourceAnalysis.d.ts +17 -0
  138. package/dist/js/syntax.d.ts +10 -0
  139. package/dist/js/taggedTemplateIgnore.d.ts +13 -0
  140. package/dist/js/types.d.ts +11 -0
  141. package/dist/lightningcss/index.d.ts +8 -0
  142. package/dist/lightningcss/style-handler/options.d.ts +3 -0
  143. package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
  144. package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
  145. package/dist/lightningcss/style-handler.d.ts +17 -0
  146. package/dist/loader-anchors-DvwgIYdA.mjs +205 -0
  147. package/dist/loader-anchors-cprm4Klq.js +273 -0
  148. package/dist/logger/index.d.ts +2 -0
  149. package/dist/logger-BZ45DZJT.js +1003 -0
  150. package/dist/logger-BoVx1Dbt.mjs +935 -0
  151. package/dist/patcher-options-6gJN2EXy.js +115 -0
  152. package/dist/patcher-options-DQfR5xxT.mjs +92 -0
  153. package/dist/postcss-html-transform.d.ts +3 -3
  154. package/dist/postcss-html-transform.js +7 -10
  155. package/dist/postcss-html-transform.mjs +3 -6
  156. package/dist/postcss.d.ts +15 -0
  157. package/dist/postcss.js +278 -0
  158. package/dist/postcss.mjs +268 -0
  159. package/dist/presets/hbuilderx.d.ts +4 -0
  160. package/dist/presets/index.d.ts +3 -0
  161. package/dist/presets/shared.d.ts +10 -0
  162. package/dist/presets/taro.d.ts +4 -0
  163. package/dist/presets/uni-app-x.d.ts +16 -0
  164. package/dist/presets/uni-app.d.ts +4 -0
  165. package/dist/presets.d.ts +1 -76
  166. package/dist/presets.js +115 -163
  167. package/dist/presets.mjs +107 -163
  168. package/dist/recorder-B_XyZ576.mjs +2763 -0
  169. package/dist/recorder-rn_2v_nd.js +2878 -0
  170. package/dist/reset/index.d.ts +2 -0
  171. package/dist/reset.d.ts +1 -4
  172. package/dist/reset.js +19 -8
  173. package/dist/reset.mjs +2 -8
  174. package/dist/shared/classname-transform.d.ts +14 -0
  175. package/dist/shared/mpx.d.ts +7 -0
  176. package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
  177. package/dist/tailwindcss/index.d.ts +11 -0
  178. package/dist/tailwindcss/miniprogram.d.ts +1 -0
  179. package/dist/tailwindcss/patcher-options.d.ts +56 -0
  180. package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
  181. package/dist/tailwindcss/patcher.d.ts +13 -0
  182. package/dist/tailwindcss/recorder.d.ts +13 -0
  183. package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
  184. package/dist/tailwindcss/runtime/cache.d.ts +11 -0
  185. package/dist/tailwindcss/runtime-logs.d.ts +3 -0
  186. package/dist/tailwindcss/runtime.d.ts +29 -0
  187. package/dist/tailwindcss/targets/paths.d.ts +13 -0
  188. package/dist/tailwindcss/targets/record-io.d.ts +5 -0
  189. package/dist/tailwindcss/targets/recorder.d.ts +3 -0
  190. package/dist/tailwindcss/targets/types.d.ts +35 -0
  191. package/dist/tailwindcss/targets.d.ts +6 -0
  192. package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
  193. package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
  194. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
  195. package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
  196. package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
  197. package/dist/tailwindcss/v4/config.d.ts +5 -0
  198. package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
  199. package/dist/tailwindcss/v4/index.d.ts +2 -0
  200. package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
  201. package/dist/tailwindcss/v4/patcher-options.d.ts +24 -0
  202. package/dist/tailwindcss/v4/patcher.d.ts +14 -0
  203. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
  204. package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
  205. package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
  206. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +4 -0
  207. package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
  208. package/dist/tailwindcss/v4-engine/types.d.ts +17 -0
  209. package/dist/typedoc.export.d.ts +5 -0
  210. package/dist/types/base.d.ts +1 -0
  211. package/dist/types/disabled-options.d.ts +4 -0
  212. package/dist/types/index.d.ts +104 -0
  213. package/dist/types/shared.d.ts +7 -0
  214. package/dist/types/user-defined-options/general.d.ts +31 -0
  215. package/dist/types/user-defined-options/important.d.ts +37 -0
  216. package/dist/types/user-defined-options/index.d.ts +11 -0
  217. package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
  218. package/dist/types/user-defined-options/matcher.d.ts +9 -0
  219. package/dist/types.d.ts +1 -150
  220. package/dist/types.js +0 -1
  221. package/dist/types.mjs +1 -1
  222. package/dist/uni-app-x/component-local-style.d.ts +19 -0
  223. package/dist/uni-app-x/index.d.ts +2 -0
  224. package/dist/uni-app-x/options.d.ts +12 -0
  225. package/dist/uni-app-x/style-isolation.d.ts +2 -0
  226. package/dist/uni-app-x/transform.d.ts +9 -0
  227. package/dist/uni-app-x/vite.d.ts +36 -0
  228. package/dist/utils/decode.d.ts +2 -0
  229. package/dist/utils/disabled.d.ts +6 -0
  230. package/dist/utils/hbuilderx.d.ts +5 -0
  231. package/dist/utils/index.d.ts +7 -0
  232. package/dist/utils/nameMatcher.d.ts +4 -0
  233. package/dist/utils/resolve-package.d.ts +1 -0
  234. package/dist/utils/uni-platform.d.ts +11 -0
  235. package/dist/utils-7DUGTFED.mjs +48 -0
  236. package/dist/utils-DmC9_In3.js +61 -0
  237. package/dist/vite-BHpAqldo.js +1952 -0
  238. package/dist/vite-C8JlHiyR.mjs +1940 -0
  239. package/dist/vite.d.ts +4 -17
  240. package/dist/vite.js +5 -14
  241. package/dist/vite.mjs +2 -14
  242. package/dist/weapp-tw-css-import-rewrite-loader.js +59 -92
  243. package/dist/weapp-tw-runtime-classset-loader.js +31 -50
  244. package/dist/webpack-CABjKGGQ.mjs +441 -0
  245. package/dist/webpack-DNIJ0ysE.js +456 -0
  246. package/dist/webpack.d.ts +4 -25
  247. package/dist/webpack.js +6 -17
  248. package/dist/webpack.mjs +2 -17
  249. package/dist/webpack4.d.ts +4 -26
  250. package/dist/webpack4.js +375 -481
  251. package/dist/webpack4.mjs +366 -482
  252. package/dist/wxml/Tokenizer.d.ts +15 -0
  253. package/dist/wxml/custom-attributes.d.ts +4 -0
  254. package/dist/wxml/index.d.ts +2 -0
  255. package/dist/wxml/shared.d.ts +2 -0
  256. package/dist/wxml/tokenizer/types.d.ts +18 -0
  257. package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
  258. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
  259. package/dist/wxml/utils/codegen.d.ts +2 -0
  260. package/dist/wxml/utils/custom-template.d.ts +3 -0
  261. package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
  262. package/dist/wxml/utils/fragment-updater.d.ts +4 -0
  263. package/dist/wxml/utils/template-fragments.d.ts +3 -0
  264. package/dist/wxml/utils.d.ts +8 -0
  265. package/dist/wxml/whitespace.d.ts +2 -0
  266. package/generator-placeholder.css +1 -0
  267. package/package.json +19 -5
  268. package/dist/chunk-24AGZQVR.js +0 -183
  269. package/dist/chunk-3VQKDHGP.mjs +0 -179
  270. package/dist/chunk-4AFQP74Z.js +0 -24
  271. package/dist/chunk-57SOQCAU.mjs +0 -582
  272. package/dist/chunk-5ZYHNDEK.mjs +0 -2439
  273. package/dist/chunk-76S2EME4.mjs +0 -34
  274. package/dist/chunk-A5PB4KZT.js +0 -138
  275. package/dist/chunk-DUHYLR2R.js +0 -276
  276. package/dist/chunk-DYLQ6UOI.js +0 -71
  277. package/dist/chunk-E7I5TW5K.js +0 -52
  278. package/dist/chunk-FS2NOOEB.js +0 -292
  279. package/dist/chunk-HVNGIKLS.js +0 -3930
  280. package/dist/chunk-JZQBZHN5.js +0 -579
  281. package/dist/chunk-KGTVD4EP.mjs +0 -3930
  282. package/dist/chunk-NNOQDMUP.mjs +0 -10
  283. package/dist/chunk-OF6MFURR.js +0 -34
  284. package/dist/chunk-OFB2KBRP.js +0 -2442
  285. package/dist/chunk-OOHJLO5M.mjs +0 -71
  286. package/dist/chunk-PCDYXXSK.mjs +0 -1515
  287. package/dist/chunk-RKISS72P.js +0 -7
  288. package/dist/chunk-RRQZL7FQ.mjs +0 -292
  289. package/dist/chunk-XAKAD2CR.mjs +0 -138
  290. package/dist/chunk-XZP3MREK.mjs +0 -276
  291. package/dist/chunk-ZAA5ZG3D.js +0 -1518
  292. package/dist/chunk-ZCH4YINE.mjs +0 -52
  293. package/dist/cli.d.mts +0 -2
  294. package/dist/core.d.mts +0 -26
  295. package/dist/css-macro/postcss.d.mts +0 -7
  296. package/dist/css-macro.d.mts +0 -18
  297. package/dist/defaults.d.mts +0 -11
  298. package/dist/gulp.d.mts +0 -24
  299. package/dist/index-BXrmQelt.d.mts +0 -672
  300. package/dist/index-BXrmQelt.d.ts +0 -672
  301. package/dist/index.d.mts +0 -15
  302. package/dist/postcss-html-transform.d.mts +0 -2
  303. package/dist/presets.d.mts +0 -76
  304. package/dist/reset.d.mts +0 -1
  305. package/dist/types.d.mts +0 -150
  306. package/dist/vite.d.mts +0 -17
  307. package/dist/webpack.d.mts +0 -25
  308. package/dist/webpack4.d.mts +0 -26
package/dist/core.mjs CHANGED
@@ -1,185 +1,140 @@
1
- import {
2
- ensureRuntimeClassSet,
3
- getCompilerContext,
4
- setupPatchRecorder,
5
- shouldSkipJsTransform
6
- } from "./chunk-KGTVD4EP.mjs";
7
- import "./chunk-PCDYXXSK.mjs";
8
- import "./chunk-XAKAD2CR.mjs";
9
- import "./chunk-OOHJLO5M.mjs";
10
- import "./chunk-NNOQDMUP.mjs";
11
-
12
- // src/core.ts
13
- import process from "process";
1
+ import { g as ensureRuntimeClassSet, n as shouldSkipJsTransform, r as getCompilerContext, t as setupPatchRecorder } from "./recorder-B_XyZ576.mjs";
2
+ import process from "node:process";
14
3
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
15
- var DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({
16
- isMainChunk: true
17
- });
4
+ //#region src/core.ts
5
+ const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
18
6
  function resolveTransformWxssOptions(options) {
19
- if (!options) {
20
- return DEFAULT_MAIN_CHUNK_STYLE_OPTIONS;
21
- }
22
- if (options.isMainChunk === true) {
23
- return options;
24
- }
25
- return defuOverrideArray(options, DEFAULT_MAIN_CHUNK_STYLE_OPTIONS);
7
+ if (!options) return DEFAULT_MAIN_CHUNK_STYLE_OPTIONS;
8
+ if (options.isMainChunk === true) return options;
9
+ return defuOverrideArray(options, DEFAULT_MAIN_CHUNK_STYLE_OPTIONS);
26
10
  }
11
+ /**
12
+ * 创建一个上下文对象,用于处理小程序的模板、样式和脚本转换。
13
+ * @param options - 用户定义的选项对象
14
+ * @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
15
+ */
27
16
  function createContext(options = {}) {
28
- const opts = getCompilerContext(options);
29
- const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
30
- const patchRecorderState = setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
31
- source: "runtime",
32
- cwd: opts.tailwindcssBasedir ?? process.cwd()
33
- });
34
- let runtimeSet = /* @__PURE__ */ new Set();
35
- const runtimeState = {
36
- twPatcher: initialTwPatcher,
37
- patchPromise: patchRecorderState.patchPromise,
38
- refreshTailwindcssPatcher,
39
- onPatchCompleted: patchRecorderState.onPatchCompleted
40
- };
41
- const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
42
- function getDefaultJsHandlerOptions(majorVersion = runtimeState.twPatcher.majorVersion) {
43
- if (typeof majorVersion !== "number") {
44
- return void 0;
45
- }
46
- let cached = defaultJsHandlerOptionsCache.get(majorVersion);
47
- if (!cached) {
48
- cached = {
49
- tailwindcssMajorVersion: majorVersion
50
- };
51
- defaultJsHandlerOptionsCache.set(majorVersion, cached);
52
- }
53
- return cached;
54
- }
55
- function withRuntimeTailwindMajorVersion(options2) {
56
- if (!options2) {
57
- return getDefaultJsHandlerOptions();
58
- }
59
- if (typeof options2.tailwindcssMajorVersion === "number") {
60
- return options2;
61
- }
62
- const majorVersion = runtimeState.twPatcher.majorVersion;
63
- if (typeof majorVersion !== "number") {
64
- return options2;
65
- }
66
- return {
67
- ...options2,
68
- tailwindcssMajorVersion: majorVersion
69
- };
70
- }
71
- function resolveTransformJsOptions(options2) {
72
- if (!options2) {
73
- return getDefaultJsHandlerOptions();
74
- }
75
- let hasHandlerOption = false;
76
- let runtimeSetProvided = false;
77
- for (const key in options2) {
78
- if (key === "runtimeSet") {
79
- runtimeSetProvided = true;
80
- continue;
81
- }
82
- hasHandlerOption = true;
83
- break;
84
- }
85
- if (!hasHandlerOption) {
86
- return getDefaultJsHandlerOptions();
87
- }
88
- if (!runtimeSetProvided && typeof options2.tailwindcssMajorVersion === "number") {
89
- return options2;
90
- }
91
- if (runtimeSetProvided) {
92
- const { runtimeSet: _runtimeSet, ...handlerOptions } = options2;
93
- return withRuntimeTailwindMajorVersion(handlerOptions);
94
- }
95
- return withRuntimeTailwindMajorVersion(options2);
96
- }
97
- const runtimeAwareTemplateJsHandler = (source, runtime, handlerOptions) => {
98
- return jsHandler(source, runtime, withRuntimeTailwindMajorVersion(handlerOptions));
99
- };
100
- let cachedDefaultTemplateHandlerOptions;
101
- let cachedDefaultTemplateRuntimeSet;
102
- let cachedRuntimeOnlyTemplateHandlerOptions;
103
- let cachedRuntimeOnlyTemplateRuntimeSet;
104
- function getDefaultTemplateHandlerOptions() {
105
- if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
106
- cachedDefaultTemplateRuntimeSet = runtimeSet;
107
- cachedDefaultTemplateHandlerOptions = {
108
- runtimeSet,
109
- jsHandler: runtimeAwareTemplateJsHandler
110
- };
111
- }
112
- return cachedDefaultTemplateHandlerOptions;
113
- }
114
- function resolveTransformWxmlOptions(options2) {
115
- if (!options2) {
116
- return getDefaultTemplateHandlerOptions();
117
- }
118
- let hasOverride = false;
119
- for (const key in options2) {
120
- if (key !== "runtimeSet") {
121
- hasOverride = true;
122
- break;
123
- }
124
- }
125
- if (!hasOverride) {
126
- const runtimeOverride = options2.runtimeSet;
127
- if (runtimeOverride === void 0 || runtimeOverride === runtimeSet) {
128
- return getDefaultTemplateHandlerOptions();
129
- }
130
- if (cachedRuntimeOnlyTemplateRuntimeSet !== runtimeOverride || !cachedRuntimeOnlyTemplateHandlerOptions) {
131
- cachedRuntimeOnlyTemplateRuntimeSet = runtimeOverride;
132
- cachedRuntimeOnlyTemplateHandlerOptions = {
133
- runtimeSet: runtimeOverride,
134
- jsHandler: runtimeAwareTemplateJsHandler
135
- };
136
- }
137
- return cachedRuntimeOnlyTemplateHandlerOptions;
138
- }
139
- return defuOverrideArray(options2, {
140
- runtimeSet,
141
- jsHandler: runtimeAwareTemplateJsHandler
142
- });
143
- }
144
- async function transformWxss(rawCss, options2) {
145
- await runtimeState.patchPromise;
146
- const result = await styleHandler(rawCss, resolveTransformWxssOptions(options2));
147
- runtimeSet = await ensureRuntimeClassSet(runtimeState, {
148
- forceRefresh: true,
149
- forceCollect: true
150
- });
151
- return result;
152
- }
153
- async function transformJs(rawJs, options2) {
154
- await runtimeState.patchPromise;
155
- if (options2?.runtimeSet) {
156
- runtimeSet = options2.runtimeSet;
157
- } else if (runtimeSet.size === 0) {
158
- runtimeSet = await ensureRuntimeClassSet(runtimeState, {
159
- forceCollect: true
160
- });
161
- }
162
- const resolvedOptions = resolveTransformJsOptions(options2);
163
- if (shouldSkipJsTransform(rawJs, resolvedOptions)) {
164
- return { code: rawJs };
165
- }
166
- return await jsHandler(rawJs, runtimeSet, resolvedOptions);
167
- }
168
- async function transformWxml(rawWxml, options2) {
169
- await runtimeState.patchPromise;
170
- if (!options2?.runtimeSet && runtimeSet.size === 0) {
171
- runtimeSet = await ensureRuntimeClassSet(runtimeState, {
172
- forceCollect: true
173
- });
174
- }
175
- return templateHandler(rawWxml, resolveTransformWxmlOptions(options2));
176
- }
177
- return {
178
- transformWxss,
179
- transformWxml,
180
- transformJs
181
- };
17
+ const opts = getCompilerContext(options);
18
+ const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
19
+ const patchRecorderState = setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
20
+ source: "runtime",
21
+ cwd: opts.tailwindcssBasedir ?? process.cwd()
22
+ });
23
+ let runtimeSet = /* @__PURE__ */ new Set();
24
+ const runtimeState = {
25
+ twPatcher: initialTwPatcher,
26
+ patchPromise: patchRecorderState.patchPromise,
27
+ refreshTailwindcssPatcher,
28
+ onPatchCompleted: patchRecorderState.onPatchCompleted
29
+ };
30
+ const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
31
+ function getDefaultJsHandlerOptions(majorVersion = runtimeState.twPatcher.majorVersion) {
32
+ if (typeof majorVersion !== "number") return;
33
+ let cached = defaultJsHandlerOptionsCache.get(majorVersion);
34
+ if (!cached) {
35
+ cached = { tailwindcssMajorVersion: majorVersion };
36
+ defaultJsHandlerOptionsCache.set(majorVersion, cached);
37
+ }
38
+ return cached;
39
+ }
40
+ function withRuntimeTailwindMajorVersion(options) {
41
+ if (!options) return getDefaultJsHandlerOptions();
42
+ if (typeof options.tailwindcssMajorVersion === "number") return options;
43
+ const majorVersion = runtimeState.twPatcher.majorVersion;
44
+ if (typeof majorVersion !== "number") return options;
45
+ return {
46
+ ...options,
47
+ tailwindcssMajorVersion: majorVersion
48
+ };
49
+ }
50
+ function resolveTransformJsOptions(options) {
51
+ if (!options) return getDefaultJsHandlerOptions();
52
+ let hasHandlerOption = false;
53
+ let runtimeSetProvided = false;
54
+ for (const key in options) {
55
+ if (key === "runtimeSet") {
56
+ runtimeSetProvided = true;
57
+ continue;
58
+ }
59
+ hasHandlerOption = true;
60
+ break;
61
+ }
62
+ if (!hasHandlerOption) return getDefaultJsHandlerOptions();
63
+ if (!runtimeSetProvided && typeof options.tailwindcssMajorVersion === "number") return options;
64
+ if (runtimeSetProvided) {
65
+ const { runtimeSet: _runtimeSet, ...handlerOptions } = options;
66
+ return withRuntimeTailwindMajorVersion(handlerOptions);
67
+ }
68
+ return withRuntimeTailwindMajorVersion(options);
69
+ }
70
+ const runtimeAwareTemplateJsHandler = (source, runtime, handlerOptions) => {
71
+ return jsHandler(source, runtime, withRuntimeTailwindMajorVersion(handlerOptions));
72
+ };
73
+ let cachedDefaultTemplateHandlerOptions;
74
+ let cachedDefaultTemplateRuntimeSet;
75
+ let cachedRuntimeOnlyTemplateHandlerOptions;
76
+ let cachedRuntimeOnlyTemplateRuntimeSet;
77
+ function getDefaultTemplateHandlerOptions() {
78
+ if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
79
+ cachedDefaultTemplateRuntimeSet = runtimeSet;
80
+ cachedDefaultTemplateHandlerOptions = {
81
+ runtimeSet,
82
+ jsHandler: runtimeAwareTemplateJsHandler
83
+ };
84
+ }
85
+ return cachedDefaultTemplateHandlerOptions;
86
+ }
87
+ function resolveTransformWxmlOptions(options) {
88
+ if (!options) return getDefaultTemplateHandlerOptions();
89
+ let hasOverride = false;
90
+ for (const key in options) if (key !== "runtimeSet") {
91
+ hasOverride = true;
92
+ break;
93
+ }
94
+ if (!hasOverride) {
95
+ const runtimeOverride = options.runtimeSet;
96
+ if (runtimeOverride === void 0 || runtimeOverride === runtimeSet) return getDefaultTemplateHandlerOptions();
97
+ if (cachedRuntimeOnlyTemplateRuntimeSet !== runtimeOverride || !cachedRuntimeOnlyTemplateHandlerOptions) {
98
+ cachedRuntimeOnlyTemplateRuntimeSet = runtimeOverride;
99
+ cachedRuntimeOnlyTemplateHandlerOptions = {
100
+ runtimeSet: runtimeOverride,
101
+ jsHandler: runtimeAwareTemplateJsHandler
102
+ };
103
+ }
104
+ return cachedRuntimeOnlyTemplateHandlerOptions;
105
+ }
106
+ return defuOverrideArray(options, {
107
+ runtimeSet,
108
+ jsHandler: runtimeAwareTemplateJsHandler
109
+ });
110
+ }
111
+ async function transformWxss(rawCss, options) {
112
+ await runtimeState.patchPromise;
113
+ const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
114
+ runtimeSet = await ensureRuntimeClassSet(runtimeState, {
115
+ forceRefresh: true,
116
+ forceCollect: true
117
+ });
118
+ return result;
119
+ }
120
+ async function transformJs(rawJs, options) {
121
+ await runtimeState.patchPromise;
122
+ if (options?.runtimeSet) runtimeSet = options.runtimeSet;
123
+ else if (runtimeSet.size === 0) runtimeSet = await ensureRuntimeClassSet(runtimeState, { forceCollect: true });
124
+ const resolvedOptions = resolveTransformJsOptions(options);
125
+ if (shouldSkipJsTransform(rawJs, resolvedOptions)) return { code: rawJs };
126
+ return await jsHandler(rawJs, runtimeSet, resolvedOptions);
127
+ }
128
+ async function transformWxml(rawWxml, options) {
129
+ await runtimeState.patchPromise;
130
+ if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await ensureRuntimeClassSet(runtimeState, { forceCollect: true });
131
+ return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
132
+ }
133
+ return {
134
+ transformWxss,
135
+ transformWxml,
136
+ transformJs
137
+ };
182
138
  }
183
- export {
184
- createContext
185
- };
139
+ //#endregion
140
+ export { createContext };
@@ -0,0 +1,177 @@
1
+ const require_chunk = require("./chunk-8l464Juk.js");
2
+ let node_module = require("node:module");
3
+ let node_path = require("node:path");
4
+ node_path = require_chunk.__toESM(node_path);
5
+ //#region src/bundlers/shared/module-graph.ts
6
+ const QUERY_HASH_RE = /[?#].*$/u;
7
+ const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
8
+ const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
9
+ const VIRTUAL_PREFIX = "\0";
10
+ const JS_EXTENSIONS = [
11
+ ".js",
12
+ ".mjs",
13
+ ".cjs"
14
+ ];
15
+ function normalizeOutputPathKey(value) {
16
+ return node_path.default.normalize(value).replace(/\\/g, "/");
17
+ }
18
+ function stripQueryAndHash(specifier) {
19
+ return specifier.replace(QUERY_HASH_RE, "");
20
+ }
21
+ function isResolvableSpecifier(specifier) {
22
+ if (!specifier) return false;
23
+ const normalized = stripQueryAndHash(specifier);
24
+ if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
25
+ if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
26
+ return !PROTOCOL_RE.test(normalized);
27
+ }
28
+ function toAbsoluteOutputPath(fileName, outDir) {
29
+ if (node_path.default.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return node_path.default.normalize(fileName);
30
+ return node_path.default.resolve(outDir, fileName);
31
+ }
32
+ function matchWithExtensions(candidate, hasOutput) {
33
+ if (hasOutput(candidate)) return candidate;
34
+ if (!node_path.default.extname(candidate)) for (const ext of JS_EXTENSIONS) {
35
+ const extended = `${candidate}${ext}`;
36
+ if (hasOutput(extended)) return extended;
37
+ }
38
+ }
39
+ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
40
+ if (!isResolvableSpecifier(specifier)) return;
41
+ const normalized = stripQueryAndHash(specifier);
42
+ let candidate;
43
+ if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = node_path.default.normalize(normalized);
44
+ else if (normalized.startsWith("/")) candidate = node_path.default.resolve(outDir, normalized.slice(1));
45
+ else candidate = node_path.default.resolve(node_path.default.dirname(importer), normalized);
46
+ return matchWithExtensions(candidate, hasOutput);
47
+ }
48
+ //#endregion
49
+ //#region src/utils/disabled.ts
50
+ function resolveDisabledOptions(disabled) {
51
+ if (disabled === true) return {
52
+ plugin: true,
53
+ rewriteCssImports: false
54
+ };
55
+ if (disabled === false || disabled == null) return {
56
+ plugin: false,
57
+ rewriteCssImports: false
58
+ };
59
+ return {
60
+ plugin: disabled.plugin ?? false,
61
+ rewriteCssImports: disabled.rewriteCssImports ?? false
62
+ };
63
+ }
64
+ //#endregion
65
+ //#region src/utils/resolve-package.ts
66
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
67
+ function resolvePackageDir(name) {
68
+ const pkgPath = require$1.resolve(`${name}/package.json`);
69
+ return node_path.default.dirname(pkgPath);
70
+ }
71
+ //#endregion
72
+ //#region src/bundlers/shared/run-tasks.ts
73
+ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
74
+ if (factories.length === 0) return [];
75
+ const results = Array.from({ length: factories.length });
76
+ const executing = /* @__PURE__ */ new Set();
77
+ let cursor = 0;
78
+ const effectiveLimit = Math.max(1, limit);
79
+ const scheduleNext = () => {
80
+ if (cursor >= factories.length) return;
81
+ const currentIndex = cursor++;
82
+ const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
83
+ results[currentIndex] = value;
84
+ }).finally(() => {
85
+ executing.delete(wrapped);
86
+ });
87
+ executing.add(wrapped);
88
+ };
89
+ while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
90
+ while (cursor < factories.length) {
91
+ await Promise.race(executing);
92
+ scheduleNext();
93
+ }
94
+ await Promise.all(executing);
95
+ return results;
96
+ }
97
+ function pushConcurrentTaskFactories(queue, factories, limit) {
98
+ if (factories.length === 0) return;
99
+ queue.push(runWithConcurrency(factories, limit).then(() => void 0));
100
+ }
101
+ //#endregion
102
+ //#region src/bundlers/shared/css-imports.ts
103
+ const tailwindcssImportRE = /^tailwindcss(?:\/.*)?$/;
104
+ const tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])(tailwindcss(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
105
+ function normalizeTailwindcssSpecifier(specifier) {
106
+ if (specifier === "tailwindcss$") return "tailwindcss";
107
+ return specifier;
108
+ }
109
+ function getTailwindcssSubpath(specifier) {
110
+ if (specifier === "tailwindcss") return "index.css";
111
+ return specifier.slice(12);
112
+ }
113
+ function resolveTailwindcssImport(specifier, pkgDir, options) {
114
+ const normalized = normalizeTailwindcssSpecifier(specifier);
115
+ if (!tailwindcssImportRE.test(normalized)) return null;
116
+ if (normalized === "tailwindcss") return options?.rootImport ?? "weapp-tailwindcss/index.css";
117
+ return (options?.join ?? node_path.default.join)(pkgDir, getTailwindcssSubpath(normalized));
118
+ }
119
+ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
120
+ let hasReplacements = false;
121
+ const rewritten = code.replace(tailwindcssCssImportStatementRE, (full, prefix, quote, specifier, suffix) => {
122
+ const replacement = resolveTailwindcssImport(specifier, pkgDir, options);
123
+ if (!replacement) return full;
124
+ hasReplacements = true;
125
+ return `${prefix}${quote}${replacement}${suffix}`;
126
+ });
127
+ return hasReplacements ? rewritten : void 0;
128
+ }
129
+ //#endregion
130
+ Object.defineProperty(exports, "normalizeOutputPathKey", {
131
+ enumerable: true,
132
+ get: function() {
133
+ return normalizeOutputPathKey;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, "pushConcurrentTaskFactories", {
137
+ enumerable: true,
138
+ get: function() {
139
+ return pushConcurrentTaskFactories;
140
+ }
141
+ });
142
+ Object.defineProperty(exports, "resolveDisabledOptions", {
143
+ enumerable: true,
144
+ get: function() {
145
+ return resolveDisabledOptions;
146
+ }
147
+ });
148
+ Object.defineProperty(exports, "resolveOutputSpecifier", {
149
+ enumerable: true,
150
+ get: function() {
151
+ return resolveOutputSpecifier;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, "resolvePackageDir", {
155
+ enumerable: true,
156
+ get: function() {
157
+ return resolvePackageDir;
158
+ }
159
+ });
160
+ Object.defineProperty(exports, "resolveTailwindcssImport", {
161
+ enumerable: true,
162
+ get: function() {
163
+ return resolveTailwindcssImport;
164
+ }
165
+ });
166
+ Object.defineProperty(exports, "rewriteTailwindcssImportsInCode", {
167
+ enumerable: true,
168
+ get: function() {
169
+ return rewriteTailwindcssImportsInCode;
170
+ }
171
+ });
172
+ Object.defineProperty(exports, "toAbsoluteOutputPath", {
173
+ enumerable: true,
174
+ get: function() {
175
+ return toAbsoluteOutputPath;
176
+ }
177
+ });
@@ -0,0 +1,128 @@
1
+ import { createRequire } from "node:module";
2
+ import path from "node:path";
3
+ //#region src/bundlers/shared/module-graph.ts
4
+ const QUERY_HASH_RE = /[?#].*$/u;
5
+ const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
6
+ const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
7
+ const VIRTUAL_PREFIX = "\0";
8
+ const JS_EXTENSIONS = [
9
+ ".js",
10
+ ".mjs",
11
+ ".cjs"
12
+ ];
13
+ function normalizeOutputPathKey(value) {
14
+ return path.normalize(value).replace(/\\/g, "/");
15
+ }
16
+ function stripQueryAndHash(specifier) {
17
+ return specifier.replace(QUERY_HASH_RE, "");
18
+ }
19
+ function isResolvableSpecifier(specifier) {
20
+ if (!specifier) return false;
21
+ const normalized = stripQueryAndHash(specifier);
22
+ if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
23
+ if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
24
+ return !PROTOCOL_RE.test(normalized);
25
+ }
26
+ function toAbsoluteOutputPath(fileName, outDir) {
27
+ if (path.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return path.normalize(fileName);
28
+ return path.resolve(outDir, fileName);
29
+ }
30
+ function matchWithExtensions(candidate, hasOutput) {
31
+ if (hasOutput(candidate)) return candidate;
32
+ if (!path.extname(candidate)) for (const ext of JS_EXTENSIONS) {
33
+ const extended = `${candidate}${ext}`;
34
+ if (hasOutput(extended)) return extended;
35
+ }
36
+ }
37
+ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
38
+ if (!isResolvableSpecifier(specifier)) return;
39
+ const normalized = stripQueryAndHash(specifier);
40
+ let candidate;
41
+ if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = path.normalize(normalized);
42
+ else if (normalized.startsWith("/")) candidate = path.resolve(outDir, normalized.slice(1));
43
+ else candidate = path.resolve(path.dirname(importer), normalized);
44
+ return matchWithExtensions(candidate, hasOutput);
45
+ }
46
+ //#endregion
47
+ //#region src/utils/disabled.ts
48
+ function resolveDisabledOptions(disabled) {
49
+ if (disabled === true) return {
50
+ plugin: true,
51
+ rewriteCssImports: false
52
+ };
53
+ if (disabled === false || disabled == null) return {
54
+ plugin: false,
55
+ rewriteCssImports: false
56
+ };
57
+ return {
58
+ plugin: disabled.plugin ?? false,
59
+ rewriteCssImports: disabled.rewriteCssImports ?? false
60
+ };
61
+ }
62
+ //#endregion
63
+ //#region src/utils/resolve-package.ts
64
+ const require = createRequire(import.meta.url);
65
+ function resolvePackageDir(name) {
66
+ const pkgPath = require.resolve(`${name}/package.json`);
67
+ return path.dirname(pkgPath);
68
+ }
69
+ //#endregion
70
+ //#region src/bundlers/shared/run-tasks.ts
71
+ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
72
+ if (factories.length === 0) return [];
73
+ const results = Array.from({ length: factories.length });
74
+ const executing = /* @__PURE__ */ new Set();
75
+ let cursor = 0;
76
+ const effectiveLimit = Math.max(1, limit);
77
+ const scheduleNext = () => {
78
+ if (cursor >= factories.length) return;
79
+ const currentIndex = cursor++;
80
+ const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
81
+ results[currentIndex] = value;
82
+ }).finally(() => {
83
+ executing.delete(wrapped);
84
+ });
85
+ executing.add(wrapped);
86
+ };
87
+ while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
88
+ while (cursor < factories.length) {
89
+ await Promise.race(executing);
90
+ scheduleNext();
91
+ }
92
+ await Promise.all(executing);
93
+ return results;
94
+ }
95
+ function pushConcurrentTaskFactories(queue, factories, limit) {
96
+ if (factories.length === 0) return;
97
+ queue.push(runWithConcurrency(factories, limit).then(() => void 0));
98
+ }
99
+ //#endregion
100
+ //#region src/bundlers/shared/css-imports.ts
101
+ const tailwindcssImportRE = /^tailwindcss(?:\/.*)?$/;
102
+ const tailwindcssCssImportStatementRE = /(@import\s+(?:url\(\s*)?)(["'])(tailwindcss(?:\/[^"']*)?\$?)(\2\s*\)?)/gi;
103
+ function normalizeTailwindcssSpecifier(specifier) {
104
+ if (specifier === "tailwindcss$") return "tailwindcss";
105
+ return specifier;
106
+ }
107
+ function getTailwindcssSubpath(specifier) {
108
+ if (specifier === "tailwindcss") return "index.css";
109
+ return specifier.slice(12);
110
+ }
111
+ function resolveTailwindcssImport(specifier, pkgDir, options) {
112
+ const normalized = normalizeTailwindcssSpecifier(specifier);
113
+ if (!tailwindcssImportRE.test(normalized)) return null;
114
+ if (normalized === "tailwindcss") return options?.rootImport ?? "weapp-tailwindcss/index.css";
115
+ return (options?.join ?? path.join)(pkgDir, getTailwindcssSubpath(normalized));
116
+ }
117
+ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
118
+ let hasReplacements = false;
119
+ const rewritten = code.replace(tailwindcssCssImportStatementRE, (full, prefix, quote, specifier, suffix) => {
120
+ const replacement = resolveTailwindcssImport(specifier, pkgDir, options);
121
+ if (!replacement) return full;
122
+ hasReplacements = true;
123
+ return `${prefix}${quote}${replacement}${suffix}`;
124
+ });
125
+ return hasReplacements ? rewritten : void 0;
126
+ }
127
+ //#endregion
128
+ export { resolveDisabledOptions as a, toAbsoluteOutputPath as c, resolvePackageDir as i, rewriteTailwindcssImportsInCode as n, normalizeOutputPathKey as o, pushConcurrentTaskFactories as r, resolveOutputSpecifier as s, resolveTailwindcssImport as t };
@@ -0,0 +1,14 @@
1
+ export declare const uniAppPlatform: string[];
2
+ export declare const queryKey = "weapp-tw-platform";
3
+ export declare function createMediaQuery(value: string): string;
4
+ export declare function createNegativeMediaQuery(value: string): string;
5
+ export declare function normalComment(text: string): string;
6
+ export declare function ifdef(text: string): {
7
+ start: string;
8
+ end: string;
9
+ };
10
+ export declare function ifndef(text: string): {
11
+ start: string;
12
+ end: string;
13
+ };
14
+ export declare function matchCustomPropertyFromValue(str: string, cb: (arr: RegExpExecArray, index: number) => void): void;
@@ -0,0 +1,15 @@
1
+ export interface Options {
2
+ variantsMap?: Record<string, string | {
3
+ value: string;
4
+ negative?: boolean;
5
+ }>;
6
+ dynamic?: boolean;
7
+ }
8
+ declare const cssMacro: {
9
+ (options: Options | undefined): {
10
+ handler: import("tailwindcss/types/config").PluginCreator;
11
+ config?: Partial<import("tailwindcss/types/config").Config>;
12
+ };
13
+ __isOptionsFunction: true;
14
+ };
15
+ export default cssMacro;
@@ -1,9 +1,5 @@
1
- import { PluginCreator } from 'postcss';
2
-
3
- interface Options {
1
+ import type { PluginCreator } from 'postcss';
2
+ export interface Options {
4
3
  }
5
4
  declare const creator: PluginCreator<Options>;
6
-
7
- // @ts-ignore
8
- export = creator;
9
- export type { Options };
5
+ export default creator;