weapp-tailwindcss 5.1.16 → 5.2.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 (442) hide show
  1. package/README.en.md +6 -0
  2. package/README.md +6 -0
  3. package/bin/{weapp-tailwindcss.js → weapp-tailwindcss.cjs} +1 -1
  4. package/dist/bundlers/framework-selector.d.ts +2 -2
  5. package/dist/bundlers/gulp/asset-emission-plan.d.ts +10 -0
  6. package/dist/bundlers/gulp/frameworks/native/index.d.ts +10 -3
  7. package/dist/bundlers/gulp/index.d.ts +10 -3
  8. package/dist/bundlers/gulp/module-graph.d.ts +1 -1
  9. package/dist/bundlers/gulp/runtime-snapshot.d.ts +4 -2
  10. package/dist/bundlers/gulp/shared/create-native-framework-plugins/cache-state.d.ts +4 -4
  11. package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +5 -3
  12. package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +9 -2
  13. package/dist/bundlers/rspack/index.d.ts +2 -2
  14. package/dist/bundlers/shared/cache.d.ts +1 -1
  15. package/dist/bundlers/shared/css-imports.d.ts +1 -1
  16. package/dist/bundlers/shared/css-source-trace.d.ts +2 -2
  17. package/dist/bundlers/shared/framework-postcss.d.ts +9 -2
  18. package/dist/bundlers/shared/generator-css/candidates.d.ts +2 -0
  19. package/dist/bundlers/shared/generator-css/generation-helpers/preflight.d.ts +4 -3
  20. package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +3 -3
  21. package/dist/bundlers/shared/generator-css/generation-helpers/runtime-isolation.d.ts +4 -4
  22. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +4 -4
  23. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +2 -2
  24. package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +58 -0
  25. package/dist/bundlers/shared/generator-css/pipeline/deferred-output.d.ts +3 -14
  26. package/dist/bundlers/shared/generator-css/pipeline/execution.d.ts +3 -12
  27. package/dist/bundlers/shared/generator-css/pipeline/fallback-output.d.ts +3 -12
  28. package/dist/bundlers/shared/generator-css/pipeline/ordered-output.d.ts +3 -25
  29. package/dist/bundlers/shared/generator-css/pipeline.d.ts +1 -1
  30. package/dist/bundlers/shared/generator-css/result-helpers.d.ts +2 -2
  31. package/dist/bundlers/shared/generator-css/source-resolver/configuration.d.ts +3 -4
  32. package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +1 -1
  33. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +13 -5
  34. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +1 -1
  35. package/dist/bundlers/shared/generator-css/source-resolver/resolve-source.d.ts +3 -3
  36. package/dist/bundlers/shared/generator-css/source-resolver/resolve-sources.d.ts +4 -3
  37. package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +9 -9
  38. package/dist/bundlers/shared/generator-css/source-resolver/source-entries.d.ts +3 -3
  39. package/dist/bundlers/shared/generator-css/source-resolver/source-matching.d.ts +4 -4
  40. package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +4 -4
  41. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +7 -6
  42. package/dist/bundlers/shared/generator-css/types.d.ts +12 -3
  43. package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +1 -1
  44. package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -5
  45. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -1
  46. package/dist/bundlers/shared/generator-css.d.ts +9 -9
  47. package/dist/bundlers/shared/runtime-class-set/entries.d.ts +4 -0
  48. package/dist/bundlers/shared/runtime-class-set/escaped-candidates.d.ts +9 -0
  49. package/dist/bundlers/shared/runtime-class-set.d.ts +30 -0
  50. package/dist/bundlers/shared/runtime-entry-type.d.ts +8 -0
  51. package/dist/bundlers/shared/runtime-signatures.d.ts +8 -0
  52. package/dist/bundlers/shared/source-candidate-scan-signature.d.ts +13 -0
  53. package/dist/bundlers/{vite → shared}/source-candidates/collector.d.ts +1 -1
  54. package/dist/bundlers/shared/source-candidates/scan-root.d.ts +10 -0
  55. package/dist/bundlers/{vite → shared}/source-candidates/script.d.ts +1 -1
  56. package/dist/bundlers/{vite → shared}/source-candidates/store.d.ts +1 -1
  57. package/dist/bundlers/{vite → shared}/source-candidates/types-and-cache.d.ts +3 -3
  58. package/dist/bundlers/shared/source-candidates.d.ts +4 -0
  59. package/dist/bundlers/shared/source-scan/css-entries.d.ts +18 -0
  60. package/dist/bundlers/shared/source-scan.d.ts +16 -0
  61. package/dist/bundlers/shared/static-config-content.d.ts +5 -0
  62. package/dist/bundlers/shared/v4-generation-core.d.ts +8 -3
  63. package/dist/bundlers/vite/bundle-entries.d.ts +1 -1
  64. package/dist/bundlers/vite/bundle-state.d.ts +11 -38
  65. package/dist/bundlers/vite/css-asset-identity.d.ts +11 -0
  66. package/dist/bundlers/vite/css-finalizer/options.d.ts +3 -3
  67. package/dist/bundlers/vite/css-finalizer/plugin.d.ts +1 -1
  68. package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
  69. package/dist/bundlers/vite/css-memory.d.ts +1 -2
  70. package/dist/bundlers/vite/frameworks/generic/index.d.ts +2 -2
  71. package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -2
  72. package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +3 -3
  73. package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +3 -3
  74. package/dist/bundlers/vite/frameworks/weapp-vite/index.d.ts +2 -2
  75. package/dist/bundlers/vite/generate-bundle/asset-emission-plan.d.ts +8 -0
  76. package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +4 -4
  77. package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +1 -1
  78. package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
  79. package/dist/bundlers/vite/generate-bundle/css-cache-task.d.ts +34 -0
  80. package/dist/bundlers/vite/generate-bundle/css-composition-plan.d.ts +58 -0
  81. package/dist/bundlers/vite/generate-bundle/css-config-directives.d.ts +1 -1
  82. package/dist/bundlers/vite/generate-bundle/css-entry-processing.d.ts +1 -0
  83. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
  84. package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +21 -2
  85. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +1 -1
  86. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -1
  87. package/dist/bundlers/vite/generate-bundle/css-source-plan.d.ts +19 -0
  88. package/dist/bundlers/vite/generate-bundle/css-transform-decision-plan.d.ts +61 -0
  89. package/dist/bundlers/vite/generate-bundle/css-transform-result.d.ts +23 -0
  90. package/dist/bundlers/vite/generate-bundle/css-transform-task.d.ts +42 -0
  91. package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +3 -2
  92. package/dist/bundlers/vite/generate-bundle/finalize/bundle.d.ts +1 -1
  93. package/dist/bundlers/vite/generate-bundle/finalize/root-import-shell.d.ts +5 -5
  94. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +2 -2
  95. package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +2 -2
  96. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +1 -1
  97. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +2 -1
  98. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +2 -2
  99. package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +6 -5
  100. package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +1 -1
  101. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +1 -1
  102. package/dist/bundlers/vite/generate-bundle/remembered-css-plan.d.ts +35 -0
  103. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +5 -6
  104. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +2 -2
  105. package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +20 -0
  106. package/dist/bundlers/vite/generate-bundle/runtime-configured-css.d.ts +54 -0
  107. package/dist/bundlers/vite/generate-bundle/runtime-linked-css.d.ts +1 -1
  108. package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +3 -3
  109. package/dist/bundlers/vite/{generate-bundle-runtime.d.ts → generate-bundle/runtime.d.ts} +4 -4
  110. package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +2 -2
  111. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -2
  112. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +1 -8
  113. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +3 -3
  114. package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +5 -0
  115. package/dist/bundlers/vite/generate-bundle/subpackages.d.ts +2 -2
  116. package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +14 -1
  117. package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +1 -1
  118. package/dist/bundlers/vite/generate-bundle/transform-scheduling.d.ts +1 -0
  119. package/dist/bundlers/vite/generate-bundle/types.d.ts +8 -7
  120. package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +3 -2
  121. package/dist/bundlers/vite/generate-bundle/validate-runtime-candidates.d.ts +22 -0
  122. package/dist/bundlers/vite/generate-bundle.d.ts +6 -6
  123. package/dist/bundlers/vite/incremental-runtime-class-set/entries.d.ts +1 -4
  124. package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -3
  125. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +2 -30
  126. package/dist/bundlers/vite/index.d.ts +3 -3
  127. package/dist/bundlers/vite/js-precheck.d.ts +1 -1
  128. package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +2 -1
  129. package/dist/bundlers/vite/processed-css-assets/collector.d.ts +1 -1
  130. package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +1 -1
  131. package/dist/bundlers/vite/processed-css-assets/empty-at-rule.d.ts +1 -0
  132. package/dist/bundlers/vite/processed-css-assets/injection-plan.d.ts +4 -4
  133. package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +5 -5
  134. package/dist/bundlers/vite/processed-css-assets.d.ts +4 -4
  135. package/dist/bundlers/vite/resolve-app-type.d.ts +1 -1
  136. package/dist/bundlers/vite/rewrite-css-imports.d.ts +3 -2
  137. package/dist/bundlers/vite/runtime-affecting-signature.d.ts +1 -2
  138. package/dist/bundlers/vite/runtime-candidate-entry.d.ts +9 -0
  139. package/dist/bundlers/vite/runtime-class-set.d.ts +4 -4
  140. package/dist/bundlers/vite/serve-css-generation.d.ts +2 -1
  141. package/dist/bundlers/vite/serve-js-transform.d.ts +1 -1
  142. package/dist/bundlers/vite/serve-root-import-shell.d.ts +1 -1
  143. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +7 -7
  144. package/dist/bundlers/vite/shared/framework-hmr-candidate-state.d.ts +45 -0
  145. package/dist/bundlers/vite/shared/framework-post-plugin.d.ts +2 -0
  146. package/dist/bundlers/vite/shared/framework-processed-css-registry.d.ts +22 -0
  147. package/dist/bundlers/vite/shared/framework-runtime-options.d.ts +1 -0
  148. package/dist/bundlers/vite/shared/framework-source-candidates-plugin.d.ts +2 -0
  149. package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +38 -0
  150. package/dist/bundlers/vite/shared/framework-strategy.d.ts +4 -4
  151. package/dist/bundlers/vite/source-candidate-scan-signature.d.ts +2 -13
  152. package/dist/bundlers/vite/source-candidates/scan-root.d.ts +1 -10
  153. package/dist/bundlers/vite/source-candidates.d.ts +1 -4
  154. package/dist/bundlers/vite/source-output-relations.d.ts +24 -0
  155. package/dist/bundlers/vite/source-scan/css-entries.d.ts +2 -18
  156. package/dist/bundlers/vite/source-scan.d.ts +2 -16
  157. package/dist/bundlers/vite/static-config-content.d.ts +1 -5
  158. package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
  159. package/dist/bundlers/vite/web-css-compat.d.ts +1 -1
  160. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/asset-emission-plan.d.ts +18 -0
  161. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +2 -2
  162. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/finalize-assets.d.ts +1 -1
  163. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/generated-css-task.d.ts +1 -1
  164. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +11 -41
  165. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/html-js-tasks.d.ts +1 -1
  166. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +4 -10
  167. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/finalize.d.ts +4 -4
  168. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/memory-trace.d.ts +3 -3
  169. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/preflight-runtime.d.ts +6 -6
  170. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/resources.d.ts +2 -2
  171. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/sources.d.ts +4 -4
  172. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css.d.ts +1 -1
  173. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +9 -9
  174. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +3 -3
  175. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +3 -3
  176. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +2 -2
  177. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -4
  178. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +2 -2
  179. package/dist/bundlers/webpack/frameworks/generic/index.d.ts +2 -2
  180. package/dist/bundlers/webpack/frameworks/index.d.ts +7 -7
  181. package/dist/bundlers/webpack/frameworks/mpx/index.d.ts +2 -2
  182. package/dist/bundlers/webpack/frameworks/taro/index.d.ts +2 -2
  183. package/dist/bundlers/webpack/frameworks/uni-app/index.d.ts +2 -2
  184. package/dist/bundlers/webpack/frameworks/weapp-vite/index.d.ts +2 -2
  185. package/dist/bundlers/webpack/index.d.ts +1 -1
  186. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +2 -2
  187. package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +1 -1
  188. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +1 -1
  189. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +1 -1
  190. package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +4 -4
  191. package/dist/bundlers/webpack/shared/create-framework-plugin.d.ts +3 -3
  192. package/dist/cli/context.d.ts +2 -2
  193. package/dist/cli/doctor.d.ts +1 -1
  194. package/dist/cli/helpers/options.d.ts +3 -3
  195. package/dist/cli/helpers.d.ts +1 -1
  196. package/dist/cli.cjs +37012 -0
  197. package/dist/cli.js +141 -168
  198. package/dist/compiler/artifact.d.ts +14 -0
  199. package/dist/compiler/candidate-index.d.ts +10 -0
  200. package/dist/compiler/compilation-change-coordinator.d.ts +28 -0
  201. package/dist/compiler/compilation-dependency-state.d.ts +16 -0
  202. package/dist/compiler/compilation-scope-graph.d.ts +31 -0
  203. package/dist/compiler/compilation-session-pool.d.ts +54 -0
  204. package/dist/compiler/compiler-owner-state.d.ts +3 -0
  205. package/dist/compiler/composition.d.ts +8 -0
  206. package/dist/compiler/emission-plan.d.ts +26 -0
  207. package/dist/compiler/index.d.ts +23 -0
  208. package/dist/compiler/invalidation.d.ts +3 -0
  209. package/dist/compiler/mode.d.ts +3 -0
  210. package/dist/compiler/owner-lifecycle.d.ts +1 -0
  211. package/dist/compiler/platform-adapter.d.ts +9 -0
  212. package/dist/compiler/runtime-affecting-signature.d.ts +2 -0
  213. package/dist/compiler/runtime-build-state.d.ts +6 -0
  214. package/dist/compiler/runtime-snapshot.d.ts +53 -0
  215. package/dist/compiler/scope-planner.d.ts +6 -0
  216. package/dist/compiler/semantic-css.d.ts +66 -0
  217. package/dist/compiler/session.d.ts +13 -0
  218. package/dist/compiler/shadow-gate.d.ts +26 -0
  219. package/dist/compiler/shadow-report-session.d.ts +37 -0
  220. package/dist/compiler/shadow-report.d.ts +15 -0
  221. package/dist/compiler/source-graph.d.ts +32 -0
  222. package/dist/compiler/tailwind-generation-session-pool.d.ts +22 -0
  223. package/dist/compiler/types.d.ts +95 -0
  224. package/dist/constants.d.ts +2 -2
  225. package/dist/context/compiler-context-cache.d.ts +1 -1
  226. package/dist/context/custom-attributes.d.ts +1 -1
  227. package/dist/context/handlers.d.ts +3 -3
  228. package/dist/context/index.d.ts +1 -1
  229. package/dist/context/runtime-package-replacements.d.ts +1 -1
  230. package/dist/context/style-options.d.ts +1 -1
  231. package/dist/context/tailwindcss.d.ts +3 -3
  232. package/dist/{context-BtLIID4m.js → context-PZXBqrAJ.cjs} +31 -93
  233. package/dist/{context-JzwzSX36.mjs → context-oTkxC5aZ.js} +22 -11
  234. package/dist/{core.mjs → core.cjs} +13 -12
  235. package/dist/core.d.ts +2 -2
  236. package/dist/core.js +12 -13
  237. package/dist/css-imports-DfNC3e6a.cjs +43 -0
  238. package/dist/css-loader-runtime-CSv0lKqV.cjs +11 -0
  239. package/dist/css-macro/postcss.cjs +19 -0
  240. package/dist/css-macro/postcss.js +2 -19
  241. package/dist/{css-macro.mjs → css-macro.cjs} +11 -8
  242. package/dist/css-macro.d.ts +2 -2
  243. package/dist/css-macro.js +8 -11
  244. package/dist/{defaults.mjs → defaults.cjs} +16 -11
  245. package/dist/defaults.d.ts +1 -1
  246. package/dist/defaults.js +11 -16
  247. package/dist/{escape.mjs → escape.cjs} +18 -4
  248. package/dist/escape.js +4 -18
  249. package/dist/framework/platform.d.ts +1 -1
  250. package/dist/{framework.mjs → framework.cjs} +47 -25
  251. package/dist/framework.d.ts +1 -1
  252. package/dist/framework.js +25 -47
  253. package/dist/generator/index.d.ts +6 -6
  254. package/dist/generator/options.d.ts +3 -3
  255. package/dist/generator/types.d.ts +2 -2
  256. package/dist/{generator-B91GhUJQ.js → generator-C8D5cnbe.cjs} +164 -33
  257. package/dist/{generator-Bv7myuhY.mjs → generator-CDdzqf1S.js} +155 -30
  258. package/dist/generator.cjs +12 -0
  259. package/dist/generator.d.ts +1 -1
  260. package/dist/generator.js +2 -12
  261. package/dist/{gulp-Q1wITegn.js → gulp-Cjcss8T_.cjs} +157 -103
  262. package/dist/{gulp-CKSklPlH.mjs → gulp-DNXQvDUw.js} +141 -90
  263. package/dist/gulp.cjs +5 -0
  264. package/dist/gulp.d.ts +4 -4
  265. package/dist/gulp.js +2 -5
  266. package/dist/{hmr-timing-BXg7nI8N.mjs → hmr-timing-CuJwQzDc.js} +3824 -1988
  267. package/dist/hmr-timing-DMLfNfGG.cjs +555 -0
  268. package/dist/index.cjs +45 -0
  269. package/dist/index.d.ts +9 -9
  270. package/dist/index.js +9 -45
  271. package/dist/js/JsTokenUpdater.d.ts +1 -1
  272. package/dist/js/ModuleGraph.d.ts +3 -3
  273. package/dist/js/NodePathWalker.d.ts +2 -2
  274. package/dist/js/babel/process.d.ts +2 -2
  275. package/dist/js/babel.d.ts +8 -8
  276. package/dist/js/evalTransforms.d.ts +2 -2
  277. package/dist/js/fast-path/oxc.d.ts +1 -1
  278. package/dist/js/handlers.d.ts +2 -2
  279. package/dist/js/index.d.ts +3 -3
  280. package/dist/js/literal-transform.d.ts +1 -1
  281. package/dist/js/module-graph/ignored-exports.d.ts +4 -4
  282. package/dist/js/module-graph/types.d.ts +2 -2
  283. package/dist/js/node-path-walker/export-handlers.d.ts +1 -1
  284. package/dist/js/precheck.d.ts +1 -1
  285. package/dist/js/replacement-cache.d.ts +1 -1
  286. package/dist/js/sourceAnalysis.d.ts +3 -3
  287. package/dist/js/taggedTemplateIgnore.d.ts +1 -1
  288. package/dist/object-Bvy6-w9r.js +47 -0
  289. package/dist/object-C_Vr6_S5.cjs +58 -0
  290. package/dist/options-DlvhQwWB.cjs +775 -0
  291. package/dist/pipeline-helpers-XtUmUlci.cjs +955 -0
  292. package/dist/postcss-html-transform.cjs +7 -0
  293. package/dist/postcss-html-transform.js +3 -5
  294. package/dist/postcss.cjs +15 -0
  295. package/dist/postcss.js +7 -11
  296. package/dist/presets/hbuilderx.d.ts +2 -2
  297. package/dist/presets/index.d.ts +4 -4
  298. package/dist/presets/shared.d.ts +1 -1
  299. package/dist/presets/taro.d.ts +2 -2
  300. package/dist/presets/uni-app-x.d.ts +1 -1
  301. package/dist/presets/uni-app.d.ts +2 -2
  302. package/dist/{presets.mjs → presets.cjs} +37 -24
  303. package/dist/presets.d.ts +1 -1
  304. package/dist/presets.js +24 -36
  305. package/dist/reset.cjs +19 -0
  306. package/dist/reset.d.ts +2 -2
  307. package/dist/reset.js +2 -19
  308. package/dist/{rolldown-runtime-emK7D4bc.js → rolldown-runtime-CVvi-lCc.cjs} +15 -0
  309. package/dist/{rspack.mjs → rspack.cjs} +10 -4
  310. package/dist/rspack.d.ts +3 -3
  311. package/dist/rspack.js +4 -10
  312. package/dist/runtime-branch/create-branch.d.ts +1 -1
  313. package/dist/runtime-branch/generator-target-env.d.ts +1 -1
  314. package/dist/runtime-branch/index.d.ts +2 -2
  315. package/dist/runtime-branch/mini-program.d.ts +1 -1
  316. package/dist/runtime-branch/native-app.d.ts +1 -1
  317. package/dist/runtime-branch/platform.d.ts +2 -2
  318. package/dist/runtime-branch/tailwind-version.d.ts +1 -1
  319. package/dist/runtime-branch/types.d.ts +2 -2
  320. package/dist/runtime-branch/web.d.ts +1 -1
  321. package/dist/runtime-branch.d.ts +1 -1
  322. package/dist/runtime-registry-Y7NrD2WH.cjs +31 -0
  323. package/dist/shared/classname-transform.d.ts +1 -1
  324. package/dist/shared/mpx.d.ts +1 -1
  325. package/dist/source-candidate-scan-signature-B0S7f5P7.js +421 -0
  326. package/dist/source-candidate-scan-signature-BmSuoxR9.cjs +555 -0
  327. package/dist/style-injector/internal.d.ts +6 -6
  328. package/dist/style-options-CEfXwZzX.cjs +75 -0
  329. package/dist/tailwindcss/candidates.d.ts +2 -2
  330. package/dist/tailwindcss/index.d.ts +1 -1
  331. package/dist/tailwindcss/runtime/cache.d.ts +1 -1
  332. package/dist/tailwindcss/runtime-factory.d.ts +2 -2
  333. package/dist/tailwindcss/runtime-options.d.ts +1 -1
  334. package/dist/tailwindcss/runtime-types.d.ts +2 -2
  335. package/dist/tailwindcss/runtime.d.ts +2 -2
  336. package/dist/tailwindcss/source-scan.d.ts +2 -2
  337. package/dist/tailwindcss/targets.d.ts +1 -1
  338. package/dist/tailwindcss/v4/config.d.ts +1 -1
  339. package/dist/tailwindcss/v4/css-sources.d.ts +2 -1
  340. package/dist/tailwindcss/v4/index.d.ts +2 -2
  341. package/dist/tailwindcss/v4/multi-runtime.d.ts +1 -1
  342. package/dist/tailwindcss/v4/runtime-factory.d.ts +5 -5
  343. package/dist/tailwindcss/v4/runtime-options.d.ts +1 -1
  344. package/dist/tailwindcss/v4-engine/css-macro-source.d.ts +1 -1
  345. package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
  346. package/dist/tailwindcss/v4-engine/generator/engine.d.ts +1 -1
  347. package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +4 -5
  348. package/dist/tailwindcss/v4-engine/generator/native-session.d.ts +17 -0
  349. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +2 -1
  350. package/dist/tailwindcss/v4-engine/generator.d.ts +2 -2
  351. package/dist/tailwindcss/v4-engine/index.d.ts +5 -5
  352. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +2 -2
  353. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  354. package/dist/tailwindcss/v4-engine/types.d.ts +1 -0
  355. package/dist/{tailwindcss-B4phC0kB.js → tailwindcss-Cs94gJgf.cjs} +9 -769
  356. package/dist/{tailwindcss-BTcXX8Ka.mjs → tailwindcss-D7TGiZR2.js} +22 -22
  357. package/dist/transform-BUEyOCT7.cjs +341 -0
  358. package/dist/transform-BbaPIji9.js +342 -0
  359. package/dist/typedoc.export.d.ts +4 -4
  360. package/dist/types/index.d.ts +7 -7
  361. package/dist/types/shared.d.ts +1 -1
  362. package/dist/types/typedoc-tailwindcss-runtime.d.ts +3 -3
  363. package/dist/types/user-defined-options/general.d.ts +5 -5
  364. package/dist/types/user-defined-options/important.d.ts +2 -2
  365. package/dist/types/user-defined-options/index.d.ts +9 -9
  366. package/dist/types/user-defined-options/matcher.d.ts +2 -2
  367. package/dist/types.cjs +0 -0
  368. package/dist/types.d.ts +1 -1
  369. package/dist/types.js +1 -0
  370. package/dist/uni-app-x/harmony.d.ts +1 -0
  371. package/dist/uni-app-x/index.d.ts +2 -2
  372. package/dist/uni-app-x/options.d.ts +1 -1
  373. package/dist/uni-app-x/style-asset/harmony-apply.d.ts +1 -0
  374. package/dist/uni-app-x/style-asset/style-value.d.ts +3 -0
  375. package/dist/uni-app-x/style-asset.d.ts +5 -4
  376. package/dist/uni-app-x/transform.d.ts +1 -1
  377. package/dist/uni-app-x/vite/harmony-apply.d.ts +19 -0
  378. package/dist/uni-app-x/vite/native-target.d.ts +2 -0
  379. package/dist/uni-app-x/vite.d.ts +5 -2
  380. package/dist/unocss/index.d.ts +1 -1
  381. package/dist/utils/disabled.d.ts +1 -1
  382. package/dist/utils/index.d.ts +3 -3
  383. package/dist/{hmr-timing-CMPaWn9P.js → v4-generation-core-D7MuR5ZF.cjs} +3468 -2059
  384. package/dist/{vite-BwQWl9ft.mjs → vite-BI1TeUPO.js} +5968 -4456
  385. package/dist/{vite-DhVnXvAQ.js → vite-CBzmUTu-.cjs} +6159 -4672
  386. package/dist/vite.cjs +4 -0
  387. package/dist/vite.d.ts +3 -3
  388. package/dist/vite.js +2 -4
  389. package/dist/watch-dependencies-BZGubvuJ.cjs +40 -0
  390. package/dist/{weapp-tw-css-generation-loader.js → weapp-tw-css-generation-loader.cjs} +3 -2
  391. package/dist/weapp-tw-css-import-rewrite-loader.cjs +201 -0
  392. package/dist/{weapp-tw-runtime-classset-loader.js → weapp-tw-runtime-classset-loader.cjs} +9 -11
  393. package/dist/{webpack-kh78iMSS.js → webpack-Dao6bWEj.cjs} +208 -954
  394. package/dist/{webpack-Bo1QrFPf.mjs → webpack-dAY9h8r8.js} +105 -101
  395. package/dist/webpack.cjs +5 -0
  396. package/dist/webpack.d.ts +2 -2
  397. package/dist/webpack.js +2 -5
  398. package/dist/wxml/Tokenizer.d.ts +2 -2
  399. package/dist/wxml/custom-attributes.d.ts +1 -1
  400. package/dist/wxml/index.d.ts +2 -2
  401. package/dist/wxml/shared.d.ts +1 -1
  402. package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +1 -1
  403. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -2
  404. package/dist/wxml/utils/codegen.d.ts +1 -1
  405. package/dist/wxml/utils/custom-template.d.ts +2 -2
  406. package/dist/wxml/utils/fragment-helpers.d.ts +2 -2
  407. package/dist/wxml/utils/fragment-updater.d.ts +2 -2
  408. package/dist/wxml/utils/template-fragments.d.ts +2 -2
  409. package/dist/wxml/utils.d.ts +5 -5
  410. package/dist/wxml-DSMNuUaP.cjs +38609 -0
  411. package/dist/{cli.mjs → wxml-IBzZSaQC.js} +237 -714
  412. package/package.json +56 -53
  413. package/dist/css-macro/postcss.mjs +0 -2
  414. package/dist/generator.mjs +0 -2
  415. package/dist/gulp.mjs +0 -2
  416. package/dist/index.mjs +0 -9
  417. package/dist/object-BJSWl-E5.mjs +0 -9
  418. package/dist/object-COs_Mw6p.js +0 -14
  419. package/dist/postcss-html-transform.mjs +0 -5
  420. package/dist/postcss.mjs +0 -11
  421. package/dist/reset.mjs +0 -2
  422. package/dist/source-candidate-scan-signature-BKZZk_e6.js +0 -1078
  423. package/dist/source-candidate-scan-signature-CtK-mB_C.mjs +0 -854
  424. package/dist/transform-B_KM9sLX.mjs +0 -14930
  425. package/dist/transform-CcYptivi.js +0 -14927
  426. package/dist/types.mjs +0 -1
  427. package/dist/vite.mjs +0 -2
  428. package/dist/watch-dependencies-bpG6kmAf.js +0 -80
  429. package/dist/weapp-tw-css-import-rewrite-loader-B0tVkJLH.js +0 -10524
  430. package/dist/weapp-tw-css-import-rewrite-loader.js +0 -10
  431. package/dist/webpack.mjs +0 -2
  432. package/dist/wxml-Ce10eREX.js +0 -3979
  433. package/dist/wxml-DdGdeqaH.mjs +0 -3861
  434. /package/dist/{auto-2dg_uhEJ.mjs → auto-2dg_uhEJ.js} +0 -0
  435. /package/dist/{auto-DtU6f3X6.js → auto-DtU6f3X6.cjs} +0 -0
  436. /package/dist/bundlers/{vite → shared}/source-scan/dependencies.d.ts +0 -0
  437. /package/dist/{cache-options-DavPxrhC.js → cache-options-DavPxrhC.cjs} +0 -0
  438. /package/dist/{cache-options-DwBtLwQe.mjs → cache-options-DwBtLwQe.js} +0 -0
  439. /package/dist/{logger-BNzxZbZj.mjs → logger-BNzxZbZj.js} +0 -0
  440. /package/dist/{logger-TlKT3xmR.js → logger-TlKT3xmR.cjs} +0 -0
  441. /package/dist/{utils-CuKLf1Zv.js → utils-CuKLf1Zv.cjs} +0 -0
  442. /package/dist/{utils-MVwpU07P.mjs → utils-MVwpU07P.js} +0 -0
@@ -1,1078 +0,0 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
- const require_framework = require("./framework.js");
3
- const require_generator = require("./generator-B91GhUJQ.js");
4
- require("./auto-DtU6f3X6.js");
5
- const require_tailwindcss = require("./tailwindcss-B4phC0kB.js");
6
- const require_wxml = require("./wxml-Ce10eREX.js");
7
- const require_hmr_timing = require("./hmr-timing-CMPaWn9P.js");
8
- let node_path = require("node:path");
9
- node_path = require_rolldown_runtime.__toESM(node_path);
10
- let node_process = require("node:process");
11
- node_process = require_rolldown_runtime.__toESM(node_process);
12
- let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
13
- let node_module = require("node:module");
14
- let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
15
- let node_buffer = require("node:buffer");
16
- let weapp_style_injector_vite = require("weapp-style-injector/vite");
17
- let weapp_style_injector_vite_taro = require("weapp-style-injector/vite/taro");
18
- let weapp_style_injector_vite_uni_app = require("weapp-style-injector/vite/uni-app");
19
- let weapp_style_injector_webpack = require("weapp-style-injector/webpack");
20
- let weapp_style_injector_webpack_mpx = require("weapp-style-injector/webpack/mpx");
21
- let weapp_style_injector_webpack_taro = require("weapp-style-injector/webpack/taro");
22
- let weapp_style_injector_webpack_uni_app = require("weapp-style-injector/webpack/uni-app");
23
- //#region src/bundlers/framework-selector.ts
24
- function resolveBundlerAppType(options) {
25
- if (options.appType) return options.appType;
26
- return require_framework.detectAppType({
27
- cwd: options.cwd,
28
- detectEnv: options.detectEnv,
29
- env: options.env,
30
- manifest: options.manifest,
31
- packageJson: options.packageJson,
32
- root: options.root,
33
- searchUp: options.searchUp
34
- });
35
- }
36
- function isUniAppXFramework(appType, uniAppX) {
37
- return appType === "uni-app-x" || require_tailwindcss.resolveUniAppXOptions(uniAppX).enabled;
38
- }
39
- function resolveViteFrameworkProfile(options) {
40
- const appType = resolveBundlerAppType(options);
41
- if (isUniAppXFramework(appType, options.uniAppX)) return {
42
- appType,
43
- frameworkName: "uni-app-x"
44
- };
45
- if (appType === "uni-app" || appType === "uni-app-vite") return {
46
- appType,
47
- frameworkName: "uni-app"
48
- };
49
- if (appType === "taro") return {
50
- appType,
51
- frameworkName: "taro"
52
- };
53
- if (appType === "weapp-vite") return {
54
- appType,
55
- frameworkName: "weapp-vite"
56
- };
57
- return {
58
- appType,
59
- frameworkName: "generic"
60
- };
61
- }
62
- function resolveWebpackFrameworkProfile(options) {
63
- const appType = resolveBundlerAppType(options);
64
- if (appType === "mpx") return {
65
- appType,
66
- frameworkName: "mpx"
67
- };
68
- if (appType === "taro") return {
69
- appType,
70
- frameworkName: "taro"
71
- };
72
- if (appType === "uni-app" || appType === "uni-app-vite" || isUniAppXFramework(appType, options.uniAppX)) return {
73
- appType,
74
- frameworkName: "uni-app"
75
- };
76
- if (appType === "weapp-vite") return {
77
- appType,
78
- frameworkName: "weapp-vite"
79
- };
80
- return {
81
- appType,
82
- frameworkName: "generic"
83
- };
84
- }
85
- //#endregion
86
- //#region src/style-injector/options.ts
87
- function normalizeStyleInjectorOptions(options) {
88
- if (options === true) return {};
89
- if (!options) return;
90
- return options;
91
- }
92
- //#endregion
93
- //#region src/style-injector/internal.ts
94
- function toPluginArray(pluginOrPlugins) {
95
- return Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
96
- }
97
- function normalizeWebpackStyleInjectorOptions(options) {
98
- const normalized = normalizeStyleInjectorOptions(options);
99
- if (!normalized) return;
100
- const { generateSubpackageStyle, loadSubpackageTargetStyle, ...rest } = normalized;
101
- const webpackOptions = { ...rest };
102
- if (generateSubpackageStyle) webpackOptions.generateSubpackageStyle = (context) => {
103
- const generated = generateSubpackageStyle(context);
104
- if (generated && typeof generated.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage style generators must return synchronously.");
105
- return generated;
106
- };
107
- if (loadSubpackageTargetStyle) webpackOptions.loadSubpackageTargetStyle = (fileName, sourceAbsolutePath) => {
108
- const loaded = loadSubpackageTargetStyle(fileName, sourceAbsolutePath);
109
- if (loaded && typeof loaded.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage target style loaders must return synchronously.");
110
- return loaded;
111
- };
112
- return webpackOptions;
113
- }
114
- function getTransformHandler(hook) {
115
- if (typeof hook === "function") return hook;
116
- if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
117
- }
118
- function getGenerateBundleHandler(hook) {
119
- if (typeof hook === "function") return hook;
120
- if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
121
- }
122
- const viteStyleInjectorDelegates = {
123
- generic: ((options) => [(0, weapp_style_injector_vite.weappStyleInjector)(options)]),
124
- taro: ((options) => toPluginArray((0, weapp_style_injector_vite_taro.StyleInjector)(options))),
125
- uniApp: ((options) => toPluginArray((0, weapp_style_injector_vite_uni_app.StyleInjector)(options)))
126
- };
127
- const webpackStyleInjectorDelegates = {
128
- generic: ((options) => (0, weapp_style_injector_webpack.weappStyleInjectorWebpack)(options)),
129
- mpx: ((options) => (0, weapp_style_injector_webpack_mpx.StyleInjector)(options)),
130
- taro: ((options) => (0, weapp_style_injector_webpack_taro.StyleInjector)(options)),
131
- uniApp: ((options) => (0, weapp_style_injector_webpack_uni_app.StyleInjector)(options))
132
- };
133
- function createBuiltinViteStyleInjectorPlugins(options, getDelegateFactory) {
134
- const normalized = normalizeStyleInjectorOptions(options);
135
- if (!normalized) return [];
136
- let config;
137
- let delegates;
138
- let delegatesConfigured = false;
139
- let delegatesBuildStarted = false;
140
- const resolveDelegates = () => {
141
- if (delegates) return delegates;
142
- delegates = getDelegateFactory()(normalized);
143
- return delegates;
144
- };
145
- const configureDelegates = async () => {
146
- if (delegatesConfigured || !config) return;
147
- delegatesConfigured = true;
148
- for (const plugin of resolveDelegates()) if (typeof plugin.configResolved === "function") await plugin.configResolved(config);
149
- };
150
- const startDelegates = async (context) => {
151
- if (delegatesBuildStarted) return;
152
- await configureDelegates();
153
- delegatesBuildStarted = true;
154
- for (const plugin of resolveDelegates()) if (typeof plugin.buildStart === "function") await plugin.buildStart.call(context, {});
155
- };
156
- return [{
157
- name: "weapp-tailwindcss:style-injector-pre",
158
- apply: "build",
159
- enforce: "pre",
160
- configResolved(resolvedConfig) {
161
- config = resolvedConfig;
162
- },
163
- async buildStart() {
164
- await startDelegates(this);
165
- },
166
- async load(id, options) {
167
- await configureDelegates();
168
- for (const plugin of resolveDelegates()) {
169
- if (typeof plugin.load !== "function") continue;
170
- const result = await plugin.load.call(this, id, options);
171
- if (result != null) return result;
172
- }
173
- },
174
- async transform(code, id, options) {
175
- await configureDelegates();
176
- let currentCode = code;
177
- let changed = false;
178
- for (const plugin of resolveDelegates()) {
179
- const handler = getTransformHandler(plugin.transform);
180
- if (!handler) continue;
181
- const result = await handler.call(this, currentCode, id, options);
182
- if (!result) continue;
183
- if (typeof result === "string") {
184
- currentCode = result;
185
- changed = true;
186
- } else if (typeof result === "object" && typeof result.code === "string") {
187
- currentCode = result.code;
188
- changed = true;
189
- }
190
- }
191
- if (changed) return {
192
- code: currentCode,
193
- map: null
194
- };
195
- }
196
- }, {
197
- name: "weapp-tailwindcss:style-injector",
198
- apply: "build",
199
- enforce: "post",
200
- configResolved(resolvedConfig) {
201
- config = resolvedConfig;
202
- },
203
- async generateBundle(outputOptions, bundle, isWrite) {
204
- await configureDelegates();
205
- for (const plugin of resolveDelegates()) {
206
- const handler = getGenerateBundleHandler(plugin.generateBundle);
207
- if (!handler) continue;
208
- await handler.call(this, outputOptions, bundle, isWrite);
209
- }
210
- }
211
- }];
212
- }
213
- function createBuiltinWebpackStyleInjectorPlugin(options, delegateFactory) {
214
- const normalized = normalizeWebpackStyleInjectorOptions(options);
215
- if (!normalized) return;
216
- return delegateFactory(normalized);
217
- }
218
- //#endregion
219
- //#region src/utils/disabled.ts
220
- function resolvePluginDisabledState(disabled) {
221
- if (disabled === true) return { plugin: true };
222
- if (disabled === false || disabled == null) return { plugin: false };
223
- return { plugin: disabled.plugin ?? false };
224
- }
225
- //#endregion
226
- //#region src/utils/resolve-package.ts
227
- const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
228
- function resolvePackageDir(name) {
229
- const pkgPath = require$1.resolve(`${name}/package.json`);
230
- return node_path.default.dirname(pkgPath);
231
- }
232
- //#endregion
233
- //#region src/bundlers/shared/framework-postcss.ts
234
- const FRAMEWORK_POSTCSS_REGISTRY = Symbol.for("weapp-tailwindcss.framework-postcss-options");
235
- const registryHost = globalThis;
236
- const frameworkPostcssOptions = registryHost[FRAMEWORK_POSTCSS_REGISTRY] ?? (registryHost[FRAMEWORK_POSTCSS_REGISTRY] = /* @__PURE__ */ new WeakMap());
237
- function isObject(value) {
238
- return typeof value === "object" && value !== null;
239
- }
240
- function normalizePlugins(plugins) {
241
- const entries = Array.isArray(plugins) ? plugins : isObject(plugins) ? Object.values(plugins) : [];
242
- const resolved = [...new Set(entries.filter(Boolean))];
243
- (0, _weapp_tailwindcss_postcss.removeTailwindPostcssPlugins)(resolved);
244
- return resolved;
245
- }
246
- function resolveFrameworkPostcssOptions(value) {
247
- if (!isObject(value)) return;
248
- const plugins = normalizePlugins(value["plugins"]);
249
- const options = Object.fromEntries(Object.entries(value).filter(([key]) => key !== "plugins" && key !== "config"));
250
- if (plugins.length === 0 && Object.keys(options).length === 0) return;
251
- return {
252
- plugins,
253
- options
254
- };
255
- }
256
- function mergeFrameworkPostcssOptions(left, right) {
257
- if (!left) return right;
258
- if (!right) return left;
259
- return {
260
- plugins: [.../* @__PURE__ */ new Set([...normalizePlugins(left.plugins), ...normalizePlugins(right.plugins)])],
261
- options: {
262
- ...left.options ?? {},
263
- ...right.options ?? {}
264
- }
265
- };
266
- }
267
- function collectFrameworkPostcssOptionsFromLoaderEntries(entries, loaderContext) {
268
- let resolved;
269
- const visit = (value) => {
270
- if (Array.isArray(value)) {
271
- value.forEach(visit);
272
- return;
273
- }
274
- if (!isObject(value)) return;
275
- const loader = value["loader"];
276
- if (typeof loader === "string" && loader.includes("postcss-loader")) {
277
- const loaderOptions = value["options"];
278
- const rawOptions = isObject(loaderOptions) ? loaderOptions["postcssOptions"] : void 0;
279
- const options = typeof rawOptions === "function" ? rawOptions(loaderContext) : rawOptions;
280
- resolved = mergeFrameworkPostcssOptions(resolved, resolveFrameworkPostcssOptions(options));
281
- return;
282
- }
283
- visit(value["rules"]);
284
- visit(value["oneOf"]);
285
- visit(value["use"]);
286
- };
287
- entries.forEach(visit);
288
- return resolved;
289
- }
290
- function captureFrameworkPostcssOptions(owner, options) {
291
- const resolved = resolveFrameworkPostcssOptions(options);
292
- if (!resolved) {
293
- frameworkPostcssOptions.delete(owner);
294
- return;
295
- }
296
- frameworkPostcssOptions.set(owner, resolved);
297
- return resolved;
298
- }
299
- function captureResolvedFrameworkPostcssOptions(owner, options) {
300
- if (!options) {
301
- frameworkPostcssOptions.delete(owner);
302
- return;
303
- }
304
- frameworkPostcssOptions.set(owner, options);
305
- return options;
306
- }
307
- function hasFrameworkPostcssOptions(owner) {
308
- return frameworkPostcssOptions.has(owner);
309
- }
310
- function createGeneratedCssHandlerOptions(owner, options, from) {
311
- const frameworkOptions = frameworkPostcssOptions.get(owner);
312
- const merged = mergeFrameworkPostcssOptions(options.postcssOptions, frameworkOptions);
313
- return {
314
- ...options,
315
- postcssOptions: {
316
- ...merged ?? {},
317
- options: {
318
- ...merged?.options ?? {},
319
- from
320
- }
321
- }
322
- };
323
- }
324
- async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options) {
325
- const handled = await options.styleHandler(generated.css, createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file));
326
- const preflightMode = generated.metadata?.preflightMode;
327
- const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
328
- const preservePreflight = preflightMode?.preserve ?? options.cssHandlerOptions.isMainChunk;
329
- return require_hmr_timing.finalizeMiniProgramGeneratorCss(handled.css, generated.target, options.majorVersion, owner.cssPreflight, {
330
- ...injectPreflight === void 0 ? {} : { injectPreflight },
331
- ...preservePreflight === void 0 ? {} : { preservePreflight },
332
- styleOptions: options.cssHandlerOptions
333
- });
334
- }
335
- //#endregion
336
- //#region src/bundlers/shared/module-graph.ts
337
- const QUERY_HASH_RE = /[?#].*$/u;
338
- const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
339
- const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
340
- const VIRTUAL_PREFIX = "\0";
341
- const JS_EXTENSIONS = [
342
- ".js",
343
- ".mjs",
344
- ".cjs"
345
- ];
346
- function normalizeOutputPathKey(value) {
347
- return node_path.default.normalize(value).replace(/\\/g, "/");
348
- }
349
- function stripQueryAndHash(specifier) {
350
- return specifier.replace(QUERY_HASH_RE, "");
351
- }
352
- function isResolvableSpecifier(specifier) {
353
- if (!specifier) return false;
354
- const normalized = stripQueryAndHash(specifier);
355
- if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
356
- if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
357
- return !PROTOCOL_RE.test(normalized);
358
- }
359
- function toAbsoluteOutputPath(fileName, outDir) {
360
- if (node_path.default.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return node_path.default.normalize(fileName);
361
- return node_path.default.resolve(outDir, fileName);
362
- }
363
- function matchWithExtensions(candidate, hasOutput) {
364
- if (hasOutput(candidate)) return candidate;
365
- if (!node_path.default.extname(candidate)) for (const ext of JS_EXTENSIONS) {
366
- const extended = `${candidate}${ext}`;
367
- if (hasOutput(extended)) return extended;
368
- }
369
- }
370
- function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
371
- if (!isResolvableSpecifier(specifier)) return;
372
- const normalized = stripQueryAndHash(specifier);
373
- let candidate;
374
- if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = node_path.default.normalize(normalized);
375
- else if (normalized.startsWith("/")) candidate = node_path.default.resolve(outDir, normalized.slice(1));
376
- else candidate = node_path.default.resolve(node_path.default.dirname(importer), normalized);
377
- return matchWithExtensions(candidate, hasOutput);
378
- }
379
- //#endregion
380
- //#region src/bundlers/shared/v4-generation-core.ts
381
- async function generateTailwindV4Css(options) {
382
- const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
383
- if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
384
- const frameworkPostcssOwner = options.frameworkPostcssOwner ?? options.opts;
385
- const shouldReplayFrameworkPostcss = options.frameworkPostcssStage === "complete" && hasFrameworkPostcssOptions(frameworkPostcssOwner) && require_generator.normalizeWeappTailwindcssGeneratorOptions(options.opts.generator, {
386
- appType: options.opts.appType,
387
- platform: options.generatorPlatform ?? options.opts.cssOptions?.platform ?? options.opts.platform,
388
- tailwindcssMajorVersion: majorVersion,
389
- uniAppX: options.opts.uniAppX
390
- }).target === "weapp";
391
- const generated = await require_hmr_timing.generateCssByGenerator(shouldReplayFrameworkPostcss ? {
392
- ...options,
393
- deferCssAdaptation: true
394
- } : options);
395
- if (!generated) return;
396
- const adaptedCss = shouldReplayFrameworkPostcss ? await adaptGeneratedCssWithFrameworkPipeline(frameworkPostcssOwner, generated, {
397
- cssHandlerOptions: options.cssHandlerOptions,
398
- file: options.file,
399
- majorVersion,
400
- styleHandler: options.styleHandler
401
- }) : generated.css;
402
- const css = require_hmr_timing.isVueScopedStyleRequest(require_hmr_timing.resolvePostcssRequestOption(options.cssHandlerOptions)) ? require_generator.preferScopedGeneratedCssRules(adaptedCss) : adaptedCss;
403
- return {
404
- ...generated,
405
- css,
406
- classSet: generated.classSet,
407
- dependencies: generated.dependencies,
408
- metadata: {
409
- file: options.file,
410
- majorVersion,
411
- outputFile: options.outputFile,
412
- ...generated.metadata ?? {}
413
- }
414
- };
415
- }
416
- //#endregion
417
- //#region src/bundlers/vite/bundle-entries.ts
418
- function readOutputEntry(entry) {
419
- if (entry.output.type === "chunk") return entry.output.code;
420
- const source = entry.output.source;
421
- if (typeof source === "string") return source;
422
- if (source instanceof Uint8Array) return node_buffer.Buffer.from(source).toString();
423
- const fallbackSource = source;
424
- if (fallbackSource == null) return;
425
- if (typeof fallbackSource.toString === "function") return fallbackSource.toString();
426
- }
427
- function isJavaScriptEntry(entry) {
428
- if (entry.output.type === "chunk") return true;
429
- return entry.fileName.endsWith(".js");
430
- }
431
- function createBundleModuleGraphOptions(outputDir, entries) {
432
- const normalizedEntries = /* @__PURE__ */ new Map();
433
- for (const [id, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(id), entry);
434
- const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
435
- return {
436
- resolve(specifier, importer) {
437
- return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
438
- },
439
- load(id) {
440
- const entry = getEntry(id);
441
- if (!entry) return;
442
- return readOutputEntry(entry);
443
- },
444
- filter(id) {
445
- return Boolean(getEntry(id));
446
- }
447
- };
448
- }
449
- function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
450
- if (!linked) return;
451
- const normalizedEntries = /* @__PURE__ */ new Map();
452
- for (const [entryId, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
453
- for (const [id, { code }] of Object.entries(linked)) {
454
- const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
455
- if (!entry) continue;
456
- const previous = readOutputEntry(entry);
457
- if (previous == null || previous === code) continue;
458
- if (entry.output.type === "chunk") entry.output.code = code;
459
- else entry.output.source = code;
460
- onApplied?.(entry, code);
461
- onLinkedUpdate(entry.fileName, previous, code);
462
- }
463
- }
464
- //#endregion
465
- //#region src/bundlers/vite/runtime-affecting-signature.ts
466
- const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
467
- const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
468
- const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
469
- const CSS_WHITESPACE_RE = /\s+/g;
470
- const JS_RUNTIME_AFFECTING_TEXT_HINT_RE = /["'`/]/;
471
- const JS_INCOMPLETE_TRAILING_OPERATOR_RE = /(?:=>|[=+\-*%&|^!~?:,.({[\]])\s*$/;
472
- function createHtmlRuntimeAffectingSignature(source) {
473
- try {
474
- const parts = [];
475
- const parser = new require_wxml.Parser({
476
- onattribute(name, value) {
477
- parts.push(`a:${name}=${value}`);
478
- },
479
- oncomment(data) {
480
- parts.push(`c:${data}`);
481
- },
482
- ontext(data) {
483
- const value = data.trim();
484
- if (value.length > 0) parts.push(`t:${value}`);
485
- }
486
- }, { xmlMode: true });
487
- parser.write(source);
488
- parser.end();
489
- return parts.join("\n");
490
- } catch {
491
- return source;
492
- }
493
- }
494
- function createJsRuntimeAffectingSignature(source) {
495
- if (!JS_RUNTIME_AFFECTING_TEXT_HINT_RE.test(source) && !JS_INCOMPLETE_TRAILING_OPERATOR_RE.test(source)) return "";
496
- try {
497
- const ast = require_wxml.babelParse(source, {
498
- cache: false,
499
- cacheKey: "vite-runtime-affecting:unambiguous",
500
- plugins: ["jsx", "typescript"],
501
- sourceType: "unambiguous"
502
- });
503
- const parts = [];
504
- require_wxml.traverse(ast, {
505
- noScope: true,
506
- StringLiteral(path) {
507
- parts.push(`s:${path.node.value}`);
508
- },
509
- TemplateElement(path) {
510
- parts.push(`t:${path.node.value.raw}`);
511
- },
512
- JSXText(path) {
513
- const value = path.node.value.trim();
514
- if (value.length > 0) parts.push(`x:${value}`);
515
- }
516
- });
517
- const comments = ast.comments;
518
- if (Array.isArray(comments)) {
519
- for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
520
- }
521
- return parts.join("\n");
522
- } catch {
523
- return source;
524
- }
525
- }
526
- function createCssRuntimeAffectingSignature(source) {
527
- return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
528
- }
529
- function createRuntimeAffectingSourceSignature(source, type) {
530
- if (type === "html") return createHtmlRuntimeAffectingSignature(source);
531
- if (type === "js") return createJsRuntimeAffectingSignature(source);
532
- if (type === "css") return createCssRuntimeAffectingSignature(source);
533
- return source;
534
- }
535
- //#endregion
536
- //#region src/bundlers/vite/utils.ts
537
- function slash(p) {
538
- return (0, _weapp_tailwindcss_shared.ensurePosix)(p);
539
- }
540
- const isWindows = node_process.default.platform === "win32";
541
- const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
542
- const htmlLangRE = /\.html?(?:$|\?)/;
543
- function isCSSRequest(request) {
544
- return cssLangRE.test(request) || require_hmr_timing.isSourceStyleRequest(request);
545
- }
546
- function isHTMLRequest(request) {
547
- return htmlLangRE.test(request);
548
- }
549
- function normalizePath(id) {
550
- return node_path.default.posix.normalize(isWindows ? (0, _weapp_tailwindcss_shared.ensurePosix)(id) : id);
551
- }
552
- async function formatPostcssSourceMap(rawMap, file) {
553
- const inputFileDir = node_path.default.dirname(file);
554
- const sources = rawMap.sources.map((source) => {
555
- const cleanSource = (0, _weapp_tailwindcss_shared.cleanUrl)(decodeURIComponent(source));
556
- if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
557
- return normalizePath(node_path.default.resolve(inputFileDir, cleanSource));
558
- });
559
- return {
560
- file,
561
- mappings: rawMap.mappings,
562
- names: rawMap.names,
563
- sources,
564
- sourcesContent: rawMap.sourcesContent,
565
- version: rawMap.version
566
- };
567
- }
568
- //#endregion
569
- //#region src/bundlers/vite/bundle-state.ts
570
- function createBundleBuildState() {
571
- return {
572
- iteration: 0,
573
- sourceHashByFile: /* @__PURE__ */ new Map(),
574
- runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
575
- runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
576
- linkedByEntry: /* @__PURE__ */ new Map(),
577
- dependentsByLinkedFile: /* @__PURE__ */ new Map(),
578
- bundleMarkupCandidatesByFile: /* @__PURE__ */ new Map(),
579
- generatorCandidateSignature: void 0
580
- };
581
- }
582
- function createChangedByType() {
583
- return {
584
- html: /* @__PURE__ */ new Set(),
585
- js: /* @__PURE__ */ new Set(),
586
- css: /* @__PURE__ */ new Set(),
587
- other: /* @__PURE__ */ new Set()
588
- };
589
- }
590
- function createProcessFiles() {
591
- return {
592
- html: /* @__PURE__ */ new Set(),
593
- js: /* @__PURE__ */ new Set(),
594
- css: /* @__PURE__ */ new Set()
595
- };
596
- }
597
- function readEntrySource(output) {
598
- if (output.type === "chunk") return output.code;
599
- return typeof output.source === "string" ? output.source : node_buffer.Buffer.from(output.source).toString();
600
- }
601
- function classifyBundleEntry(file, opts) {
602
- if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
603
- if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
604
- if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
605
- return "other";
606
- }
607
- function collectJsEntries(fileName, output, outDir, store) {
608
- const entry = {
609
- fileName,
610
- output
611
- };
612
- if (!isJavaScriptEntry(entry)) return;
613
- const absolute = toAbsoluteOutputPath(fileName, outDir);
614
- store.set(absolute, entry);
615
- }
616
- function markProcessFile(type, file, processFiles) {
617
- if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
618
- }
619
- function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false, options = {}) {
620
- const sourceHashByFile = /* @__PURE__ */ new Map();
621
- const runtimeAffectingSignatureByFile = /* @__PURE__ */ new Map();
622
- const runtimeAffectingHashByFile = /* @__PURE__ */ new Map();
623
- const changedByType = createChangedByType();
624
- const runtimeAffectingChangedByType = createChangedByType();
625
- const processFiles = createProcessFiles();
626
- const linkedImpactsByEntry = /* @__PURE__ */ new Map();
627
- const jsEntries = /* @__PURE__ */ new Map();
628
- const entries = [];
629
- const firstRun = state.iteration === 0 && state.sourceHashByFile.size === 0;
630
- const hasOmittedKnownFiles = options.hasOmittedKnownFiles === true;
631
- for (const [file, output] of Object.entries(bundle)) {
632
- const type = classifyBundleEntry(file, opts);
633
- const source = readEntrySource(output);
634
- const hash = opts.cache.computeHash(source);
635
- sourceHashByFile.set(file, hash);
636
- const previousHash = state.sourceHashByFile.get(file);
637
- const changed = previousHash == null || previousHash !== hash;
638
- const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
639
- const runtimeAffectingHash = !changed && previousRuntimeAffectingHash != null ? previousRuntimeAffectingHash : (() => {
640
- const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
641
- runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
642
- return opts.cache.computeHash(runtimeAffectingSignature);
643
- })();
644
- runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
645
- if (changed) changedByType[type].add(file);
646
- if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
647
- if (forceAll || firstRun) markProcessFile(type, file, processFiles);
648
- else if (type === "html") processFiles.html.add(file);
649
- else if (changed && (type === "js" || type === "css")) processFiles[type].add(file);
650
- collectJsEntries(file, output, outDir, jsEntries);
651
- entries.push({
652
- file,
653
- output,
654
- source,
655
- type
656
- });
657
- }
658
- if (!forceAll && !firstRun) for (const changedFile of changedByType.js) {
659
- const dependents = state.dependentsByLinkedFile.get(changedFile);
660
- if (!dependents) continue;
661
- for (const entryFile of dependents) {
662
- processFiles.js.add(entryFile);
663
- let impacts = linkedImpactsByEntry.get(entryFile);
664
- if (!impacts) {
665
- impacts = /* @__PURE__ */ new Set();
666
- linkedImpactsByEntry.set(entryFile, impacts);
667
- }
668
- impacts.add(changedFile);
669
- }
670
- }
671
- return {
672
- entries,
673
- jsEntries,
674
- sourceHashByFile,
675
- runtimeAffectingSignatureByFile,
676
- runtimeAffectingHashByFile,
677
- hasOmittedKnownFiles,
678
- changedByType,
679
- runtimeAffectingChangedByType,
680
- processFiles,
681
- linkedImpactsByEntry
682
- };
683
- }
684
- function invertLinkedByEntry(linkedByEntry) {
685
- const dependentsByLinkedFile = /* @__PURE__ */ new Map();
686
- for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
687
- let dependents = dependentsByLinkedFile.get(linkedFile);
688
- if (!dependents) {
689
- dependents = /* @__PURE__ */ new Set();
690
- dependentsByLinkedFile.set(linkedFile, dependents);
691
- }
692
- dependents.add(entryFile);
693
- }
694
- return dependentsByLinkedFile;
695
- }
696
- function replaceMapEntries(target, source) {
697
- target.clear();
698
- for (const [key, value] of source) target.set(key, value);
699
- return target;
700
- }
701
- function mergeMapEntries(target, source) {
702
- for (const [key, value] of source) target.set(key, value);
703
- return target;
704
- }
705
- function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
706
- const incremental = options.incremental === true;
707
- state.iteration += 1;
708
- state.sourceHashByFile = incremental ? mergeMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile) : replaceMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile);
709
- state.runtimeAffectingSignatureByFile.clear();
710
- state.runtimeAffectingHashByFile = incremental ? mergeMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile) : replaceMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile);
711
- state.linkedByEntry = incremental ? mergeMapEntries(state.linkedByEntry, linkedByEntry) : replaceMapEntries(state.linkedByEntry, linkedByEntry);
712
- state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
713
- }
714
- //#endregion
715
- //#region src/bundlers/vite/generate-bundle/signatures.ts
716
- function summarizeStringDiff(previous, next) {
717
- if (previous === next) return "same";
718
- const previousLength = previous.length;
719
- const nextLength = next.length;
720
- const minLength = Math.min(previousLength, nextLength);
721
- let prefixLength = 0;
722
- while (prefixLength < minLength && previous.charCodeAt(prefixLength) === next.charCodeAt(prefixLength)) prefixLength += 1;
723
- let previousSuffixCursor = previousLength - 1;
724
- let nextSuffixCursor = nextLength - 1;
725
- while (previousSuffixCursor >= prefixLength && nextSuffixCursor >= prefixLength && previous.charCodeAt(previousSuffixCursor) === next.charCodeAt(nextSuffixCursor)) {
726
- previousSuffixCursor -= 1;
727
- nextSuffixCursor -= 1;
728
- }
729
- const previousChangedLength = previousSuffixCursor >= prefixLength ? previousSuffixCursor - prefixLength + 1 : 0;
730
- const nextChangedLength = nextSuffixCursor >= prefixLength ? nextSuffixCursor - prefixLength + 1 : 0;
731
- return `changed@${prefixLength} old=${previousChangedLength} new=${nextChangedLength} len=${previousLength}->${nextLength}`;
732
- }
733
- function createLinkedImpactSignature(entry, linkedImpactsByEntry, sourceHashByFile) {
734
- const changedLinkedFiles = linkedImpactsByEntry.get(entry);
735
- if (!changedLinkedFiles || changedLinkedFiles.size === 0) return;
736
- return [...changedLinkedFiles].sort().map((file) => {
737
- return `${file}:${sourceHashByFile.get(file) ?? "missing"}`;
738
- }).join(",");
739
- }
740
- function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
741
- if (!linkedImpactSignature) return runtimeSignature;
742
- return `${runtimeSignature}:linked:${linkedImpactSignature}`;
743
- }
744
- function createStableTextSignature(input) {
745
- let hash = 2166136261;
746
- for (let i = 0; i < input.length; i++) {
747
- hash ^= input.charCodeAt(i);
748
- hash = Math.imul(hash, 16777619);
749
- }
750
- return (hash >>> 0).toString(36);
751
- }
752
- function createCandidateSignature(candidates) {
753
- if (candidates.size === 0) return "empty";
754
- return createStableTextSignature([...candidates].sort().join("\n"));
755
- }
756
- function getSnapshotHash(snapshotMap, file, fallback) {
757
- return snapshotMap.get(file) ?? fallback;
758
- }
759
- function hasRuntimeAffectingSourceChanges(changedByType) {
760
- return changedByType.html.size > 0 || changedByType.js.size > 0;
761
- }
762
- //#endregion
763
- //#region src/bundlers/vite/generate-bundle/scoped-generator.ts
764
- function hasOwnSourceDirectives(rawSource) {
765
- return rawSource.includes("@source") || rawSource.includes("@config");
766
- }
767
- function createLocalSourceEntries(sourceFile) {
768
- return [{
769
- base: node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, ""))),
770
- negated: false,
771
- pattern: "**/*"
772
- }];
773
- }
774
- function intersectCandidates(first, second) {
775
- if (first.size === 0 || second.size === 0) return /* @__PURE__ */ new Set();
776
- const [small, large] = first.size <= second.size ? [first, second] : [second, first];
777
- const scoped = /* @__PURE__ */ new Set();
778
- for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
779
- return scoped;
780
- }
781
- function mergeCandidates(first, second) {
782
- return /* @__PURE__ */ new Set([...first, ...second]);
783
- }
784
- function canFallbackToOutputCandidates(rawSource, entries) {
785
- return rawSource.includes("@source") && entries.length > 0 && entries.every((entry) => !entry.negated);
786
- }
787
- function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
788
- if (!hasOwnSourceDirectives(rawSource)) return {
789
- entries: resolvedEntries,
790
- localEntries: void 0
791
- };
792
- if (resolvedEntries !== void 0) return { entries: resolvedEntries };
793
- return { entries: createLocalSourceEntries(sourceFile) };
794
- }
795
- async function resolveScopedGeneratorSourceEntries(rawSource, sourceFile) {
796
- return resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
797
- }
798
- async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
799
- if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
800
- const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
801
- if (entries === void 0) return fallbackSignature;
802
- const scopedSignature = createCandidateSignature(getSourceCandidatesForEntries(entries));
803
- return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
804
- }
805
- async function createScopedGeneratorSourceTraceMap(rawSource, sourceFile, getSourceCandidateSourcesForEntries) {
806
- if (!getSourceCandidateSourcesForEntries || !hasOwnSourceDirectives(rawSource)) return getSourceCandidateSourcesForEntries?.(void 0);
807
- const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
808
- if (entries === void 0) return getSourceCandidateSourcesForEntries(void 0);
809
- return getSourceCandidateSourcesForEntries(entries);
810
- }
811
- async function createScopedGeneratorRuntime(options) {
812
- const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
813
- if (getSourceCandidatesForEntries && rawSource && sourceFile) {
814
- const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
815
- if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
816
- const explicitCandidates = getSourceCandidatesForEntries(entries);
817
- const outputCandidates = scopedSourceCandidateGetter?.(void 0);
818
- const scopedCandidates = outputCandidates ? explicitCandidates.size === 0 && canFallbackToOutputCandidates(rawSource, entries) ? outputCandidates : intersectCandidates(explicitCandidates, outputCandidates) : explicitCandidates;
819
- return (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4CustomVariantConditionalComments)(rawSource) ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
820
- }
821
- }
822
- const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
823
- if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions) ? scopedCandidates : mergeCandidates(scopedCandidates, fallbackRuntime);
824
- if (!shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions)) return fallbackRuntime;
825
- return fallbackRuntime;
826
- }
827
- //#endregion
828
- //#region src/bundlers/vite/source-candidate-scan-signature.ts
829
- function normalizeSignaturePath(value) {
830
- return slash(node_path.default.resolve(value));
831
- }
832
- function serializeInlineCandidates(inlineCandidates) {
833
- return {
834
- excluded: [...inlineCandidates?.excluded ?? []].sort(),
835
- included: [...inlineCandidates?.included ?? []].sort()
836
- };
837
- }
838
- function serializeSourceEntries(entries) {
839
- return (entries ?? []).map((entry) => ({
840
- base: normalizeSignaturePath(entry.base),
841
- negated: entry.negated,
842
- pattern: entry.pattern
843
- })).sort((a, b) => `${a.base}\0${a.pattern}\0${a.negated}`.localeCompare(`${b.base}\0${b.pattern}\0${b.negated}`));
844
- }
845
- function createSourceCandidateScanSignature(input) {
846
- return JSON.stringify({
847
- inlineCandidates: serializeInlineCandidates(input.inlineCandidates),
848
- outDir: input.outDir ? normalizeSignaturePath(input.outDir) : void 0,
849
- roots: input.roots.map((root) => ({
850
- entries: serializeSourceEntries(root.entries),
851
- root: normalizeSignaturePath(root.root)
852
- })),
853
- scanAllSources: input.scanAllSources ?? false
854
- });
855
- }
856
- //#endregion
857
- Object.defineProperty(exports, "applyLinkedResults", {
858
- enumerable: true,
859
- get: function() {
860
- return applyLinkedResults;
861
- }
862
- });
863
- Object.defineProperty(exports, "buildBundleSnapshot", {
864
- enumerable: true,
865
- get: function() {
866
- return buildBundleSnapshot;
867
- }
868
- });
869
- Object.defineProperty(exports, "captureFrameworkPostcssOptions", {
870
- enumerable: true,
871
- get: function() {
872
- return captureFrameworkPostcssOptions;
873
- }
874
- });
875
- Object.defineProperty(exports, "captureResolvedFrameworkPostcssOptions", {
876
- enumerable: true,
877
- get: function() {
878
- return captureResolvedFrameworkPostcssOptions;
879
- }
880
- });
881
- Object.defineProperty(exports, "classifyBundleEntry", {
882
- enumerable: true,
883
- get: function() {
884
- return classifyBundleEntry;
885
- }
886
- });
887
- Object.defineProperty(exports, "collectFrameworkPostcssOptionsFromLoaderEntries", {
888
- enumerable: true,
889
- get: function() {
890
- return collectFrameworkPostcssOptionsFromLoaderEntries;
891
- }
892
- });
893
- Object.defineProperty(exports, "createBuiltinViteStyleInjectorPlugins", {
894
- enumerable: true,
895
- get: function() {
896
- return createBuiltinViteStyleInjectorPlugins;
897
- }
898
- });
899
- Object.defineProperty(exports, "createBuiltinWebpackStyleInjectorPlugin", {
900
- enumerable: true,
901
- get: function() {
902
- return createBuiltinWebpackStyleInjectorPlugin;
903
- }
904
- });
905
- Object.defineProperty(exports, "createBundleBuildState", {
906
- enumerable: true,
907
- get: function() {
908
- return createBundleBuildState;
909
- }
910
- });
911
- Object.defineProperty(exports, "createBundleModuleGraphOptions", {
912
- enumerable: true,
913
- get: function() {
914
- return createBundleModuleGraphOptions;
915
- }
916
- });
917
- Object.defineProperty(exports, "createCandidateSignature", {
918
- enumerable: true,
919
- get: function() {
920
- return createCandidateSignature;
921
- }
922
- });
923
- Object.defineProperty(exports, "createJsHashSalt", {
924
- enumerable: true,
925
- get: function() {
926
- return createJsHashSalt;
927
- }
928
- });
929
- Object.defineProperty(exports, "createLinkedImpactSignature", {
930
- enumerable: true,
931
- get: function() {
932
- return createLinkedImpactSignature;
933
- }
934
- });
935
- Object.defineProperty(exports, "createRuntimeAffectingSourceSignature", {
936
- enumerable: true,
937
- get: function() {
938
- return createRuntimeAffectingSourceSignature;
939
- }
940
- });
941
- Object.defineProperty(exports, "createScopedGeneratorCandidateSignature", {
942
- enumerable: true,
943
- get: function() {
944
- return createScopedGeneratorCandidateSignature;
945
- }
946
- });
947
- Object.defineProperty(exports, "createScopedGeneratorRuntime", {
948
- enumerable: true,
949
- get: function() {
950
- return createScopedGeneratorRuntime;
951
- }
952
- });
953
- Object.defineProperty(exports, "createScopedGeneratorSourceTraceMap", {
954
- enumerable: true,
955
- get: function() {
956
- return createScopedGeneratorSourceTraceMap;
957
- }
958
- });
959
- Object.defineProperty(exports, "createSourceCandidateScanSignature", {
960
- enumerable: true,
961
- get: function() {
962
- return createSourceCandidateScanSignature;
963
- }
964
- });
965
- Object.defineProperty(exports, "formatPostcssSourceMap", {
966
- enumerable: true,
967
- get: function() {
968
- return formatPostcssSourceMap;
969
- }
970
- });
971
- Object.defineProperty(exports, "generateTailwindV4Css", {
972
- enumerable: true,
973
- get: function() {
974
- return generateTailwindV4Css;
975
- }
976
- });
977
- Object.defineProperty(exports, "getSnapshotHash", {
978
- enumerable: true,
979
- get: function() {
980
- return getSnapshotHash;
981
- }
982
- });
983
- Object.defineProperty(exports, "hasRuntimeAffectingSourceChanges", {
984
- enumerable: true,
985
- get: function() {
986
- return hasRuntimeAffectingSourceChanges;
987
- }
988
- });
989
- Object.defineProperty(exports, "isCSSRequest", {
990
- enumerable: true,
991
- get: function() {
992
- return isCSSRequest;
993
- }
994
- });
995
- Object.defineProperty(exports, "isHTMLRequest", {
996
- enumerable: true,
997
- get: function() {
998
- return isHTMLRequest;
999
- }
1000
- });
1001
- Object.defineProperty(exports, "normalizeOutputPathKey", {
1002
- enumerable: true,
1003
- get: function() {
1004
- return normalizeOutputPathKey;
1005
- }
1006
- });
1007
- Object.defineProperty(exports, "normalizePath", {
1008
- enumerable: true,
1009
- get: function() {
1010
- return normalizePath;
1011
- }
1012
- });
1013
- Object.defineProperty(exports, "resolveOutputSpecifier", {
1014
- enumerable: true,
1015
- get: function() {
1016
- return resolveOutputSpecifier;
1017
- }
1018
- });
1019
- Object.defineProperty(exports, "resolvePackageDir", {
1020
- enumerable: true,
1021
- get: function() {
1022
- return resolvePackageDir;
1023
- }
1024
- });
1025
- Object.defineProperty(exports, "resolvePluginDisabledState", {
1026
- enumerable: true,
1027
- get: function() {
1028
- return resolvePluginDisabledState;
1029
- }
1030
- });
1031
- Object.defineProperty(exports, "resolveViteFrameworkProfile", {
1032
- enumerable: true,
1033
- get: function() {
1034
- return resolveViteFrameworkProfile;
1035
- }
1036
- });
1037
- Object.defineProperty(exports, "resolveWebpackFrameworkProfile", {
1038
- enumerable: true,
1039
- get: function() {
1040
- return resolveWebpackFrameworkProfile;
1041
- }
1042
- });
1043
- Object.defineProperty(exports, "slash", {
1044
- enumerable: true,
1045
- get: function() {
1046
- return slash;
1047
- }
1048
- });
1049
- Object.defineProperty(exports, "summarizeStringDiff", {
1050
- enumerable: true,
1051
- get: function() {
1052
- return summarizeStringDiff;
1053
- }
1054
- });
1055
- Object.defineProperty(exports, "toAbsoluteOutputPath", {
1056
- enumerable: true,
1057
- get: function() {
1058
- return toAbsoluteOutputPath;
1059
- }
1060
- });
1061
- Object.defineProperty(exports, "updateBundleBuildState", {
1062
- enumerable: true,
1063
- get: function() {
1064
- return updateBundleBuildState;
1065
- }
1066
- });
1067
- Object.defineProperty(exports, "viteStyleInjectorDelegates", {
1068
- enumerable: true,
1069
- get: function() {
1070
- return viteStyleInjectorDelegates;
1071
- }
1072
- });
1073
- Object.defineProperty(exports, "webpackStyleInjectorDelegates", {
1074
- enumerable: true,
1075
- get: function() {
1076
- return webpackStyleInjectorDelegates;
1077
- }
1078
- });