weapp-tailwindcss 5.0.12 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/auto-Ba6hDrse.mjs +13 -0
  4. package/dist/auto-DtU6f3X6.js +18 -0
  5. package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
  6. package/dist/bundlers/shared/generator-css/directives.d.ts +2 -1
  7. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +27 -10
  8. package/dist/bundlers/shared/generator-css/local-imports.d.ts +3 -0
  9. package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -0
  10. package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +6 -0
  11. package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +7 -0
  12. package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +3 -0
  13. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +15 -0
  14. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +12 -0
  15. package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +22 -0
  16. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +6 -23
  17. package/dist/bundlers/shared/generator-css/types.d.ts +15 -1
  18. package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -1
  19. package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
  20. package/dist/bundlers/shared/run-tasks.d.ts +1 -0
  21. package/dist/bundlers/shared/v4-generation-core.d.ts +11 -0
  22. package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
  23. package/dist/bundlers/vite/css-memory.d.ts +37 -0
  24. package/dist/bundlers/vite/generate-bundle/bundle-file-names.d.ts +2 -0
  25. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +0 -1
  26. package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +8 -0
  27. package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +4 -0
  28. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -0
  29. package/dist/bundlers/vite/generate-bundle/css-output.d.ts +9 -7
  30. package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +6 -0
  31. package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +12 -0
  32. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +63 -0
  33. package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +31 -0
  34. package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +80 -0
  35. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +53 -0
  36. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
  37. package/dist/bundlers/vite/generate-bundle/runtime-linked-css.d.ts +4 -0
  38. package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +21 -0
  39. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +5 -2
  40. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +30 -0
  41. package/dist/bundlers/vite/generate-bundle/timing.d.ts +1 -0
  42. package/dist/bundlers/vite/generate-bundle/types.d.ts +3 -1
  43. package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +20 -0
  44. package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +6 -0
  45. package/dist/bundlers/vite/generate-bundle.d.ts +4 -1
  46. package/dist/bundlers/vite/hot-css-modules.d.ts +5 -0
  47. package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +1 -0
  48. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +3 -3
  49. package/dist/bundlers/vite/map-cache.d.ts +2 -0
  50. package/dist/bundlers/vite/processed-css-assets.d.ts +16 -0
  51. package/dist/bundlers/vite/resolve-app-type.d.ts +1 -2
  52. package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
  53. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -5
  54. package/dist/bundlers/vite/source-candidate-scan-signature.d.ts +13 -0
  55. package/dist/bundlers/vite/source-candidates/script.d.ts +1 -7
  56. package/dist/bundlers/vite/source-candidates.d.ts +12 -2
  57. package/dist/bundlers/vite/source-scan/css-entries.d.ts +3 -6
  58. package/dist/bundlers/vite/source-scan.d.ts +3 -3
  59. package/dist/bundlers/vite/uni-app-x-css-options.d.ts +1 -1
  60. package/dist/bundlers/vite/utils.d.ts +1 -0
  61. package/dist/bundlers/vite/weapp-vite-config.d.ts +3 -1
  62. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +24 -0
  63. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -10
  64. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-cache.d.ts +28 -0
  65. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +5 -1
  66. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +15 -1
  67. package/dist/bundlers/webpack/shared/css-loader-runtime.d.ts +1 -0
  68. package/dist/cache/index.d.ts +1 -0
  69. package/dist/cli/mount-options.d.ts +2 -2
  70. package/dist/cli.js +126 -439
  71. package/dist/cli.mjs +121 -434
  72. package/dist/context/index.d.ts +3 -3
  73. package/dist/context/style-options.d.ts +4 -1
  74. package/dist/context/tailwindcss.d.ts +1 -1
  75. package/dist/{precheck-30zNPRlI.js → context-BHxLe743.js} +484 -175
  76. package/dist/{precheck-CsFr1q2l.mjs → context-Mbzkek1q.mjs} +461 -159
  77. package/dist/core.js +15 -12
  78. package/dist/core.mjs +10 -7
  79. package/dist/css-macro.js +2 -2
  80. package/dist/css-macro.mjs +2 -2
  81. package/dist/{defaults-Boc26eel.js → defaults-CVcKbXBG.js} +6 -50
  82. package/dist/{defaults-DH0ZQRhy.mjs → defaults-ZElj1zKc.mjs} +7 -45
  83. package/dist/defaults.d.ts +1 -7
  84. package/dist/defaults.js +1 -2
  85. package/dist/defaults.mjs +2 -2
  86. package/dist/framework/index.d.ts +59 -0
  87. package/dist/framework.d.ts +1 -0
  88. package/dist/framework.js +198 -0
  89. package/dist/framework.mjs +180 -0
  90. package/dist/generator/index.d.ts +6 -7
  91. package/dist/generator/options.d.ts +3 -3
  92. package/dist/generator/types.d.ts +9 -10
  93. package/dist/generator-9rUz4Hcb.js +170 -0
  94. package/dist/generator-Dc4qaPmT.mjs +123 -0
  95. package/dist/generator.js +10 -16
  96. package/dist/generator.mjs +3 -3
  97. package/dist/{gulp-CxGZU0-v.js → gulp-B_sdP6dx.js} +80 -92
  98. package/dist/{gulp-BfZpaYSQ.mjs → gulp-uM36oIJs.mjs} +73 -85
  99. package/dist/gulp.js +1 -1
  100. package/dist/gulp.mjs +1 -1
  101. package/dist/{hmr-timing-DNjF8bWA.mjs → hmr-timing-BXMLsF4b.mjs} +1289 -909
  102. package/dist/{hmr-timing-DFR51wgo.js → hmr-timing-CogqkFaF.js} +1397 -939
  103. package/dist/index.d.ts +1 -0
  104. package/dist/index.js +20 -4
  105. package/dist/index.mjs +6 -5
  106. package/dist/js/fast-path/oxc.d.ts +4 -0
  107. package/dist/js/precheck.d.ts +1 -0
  108. package/dist/postcss.js +3 -4
  109. package/dist/postcss.mjs +2 -3
  110. package/dist/presets.js +10 -20
  111. package/dist/presets.mjs +9 -19
  112. package/dist/runtime-branch/create-branch.d.ts +2 -0
  113. package/dist/runtime-branch/generator-target-env.d.ts +4 -0
  114. package/dist/runtime-branch/index.d.ts +6 -0
  115. package/dist/runtime-branch/mini-program.d.ts +2 -0
  116. package/dist/runtime-branch/native-app.d.ts +2 -0
  117. package/dist/runtime-branch/platform.d.ts +6 -0
  118. package/dist/runtime-branch/tailwind-version.d.ts +2 -0
  119. package/dist/runtime-branch/types.d.ts +37 -0
  120. package/dist/runtime-branch/web.d.ts +2 -0
  121. package/dist/runtime-branch.d.ts +1 -0
  122. package/dist/{bundle-state-DU2ATDhw.js → source-candidate-scan-signature-2ybpptAK.js} +262 -20
  123. package/dist/{bundle-state-BxMNKjBV.mjs → source-candidate-scan-signature-Cvb5z1ha.mjs} +187 -17
  124. package/dist/tailwindcss/candidates.d.ts +7 -0
  125. package/dist/tailwindcss/index.d.ts +2 -2
  126. package/dist/tailwindcss/runtime/cache.d.ts +6 -6
  127. package/dist/tailwindcss/runtime-factory.d.ts +12 -0
  128. package/dist/tailwindcss/runtime-options.d.ts +8 -0
  129. package/dist/tailwindcss/runtime-types.d.ts +86 -0
  130. package/dist/tailwindcss/runtime.d.ts +6 -6
  131. package/dist/tailwindcss/source-scan.d.ts +1 -1
  132. package/dist/tailwindcss/targets.d.ts +2 -2
  133. package/dist/tailwindcss/v4/config.d.ts +3 -3
  134. package/dist/tailwindcss/v4/css-entries.d.ts +1 -0
  135. package/dist/tailwindcss/v4/css-sources.d.ts +4 -2
  136. package/dist/tailwindcss/v4/index.d.ts +1 -1
  137. package/dist/tailwindcss/v4/multi-runtime.d.ts +2 -0
  138. package/dist/tailwindcss/v4/runtime-factory.d.ts +15 -0
  139. package/dist/tailwindcss/v4/runtime-options.d.ts +2 -0
  140. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -1
  141. package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +1 -1
  142. package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +3 -3
  143. package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +1 -1
  144. package/dist/tailwindcss/v4-engine/generator.d.ts +10 -3
  145. package/dist/tailwindcss/v4-engine/index.d.ts +1 -1
  146. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +7 -1
  147. package/dist/tailwindcss/v4-engine/source.d.ts +23 -6
  148. package/dist/tailwindcss/v4-engine/types.d.ts +8 -9
  149. package/dist/tailwindcss/version.d.ts +1 -1
  150. package/dist/tailwindcss-DHIYcqXT.js +1523 -0
  151. package/dist/tailwindcss-wyUHrfil.mjs +1418 -0
  152. package/dist/{transform-CaVEBOuR.js → transform-CQVOgmzM.js} +45 -37
  153. package/dist/{transform-Cju08-aJ.mjs → transform-tExdt40m.mjs} +30 -22
  154. package/dist/typedoc.export.d.ts +1 -1
  155. package/dist/types/index.d.ts +16 -17
  156. package/dist/types/shared.d.ts +1 -1
  157. package/dist/types/{typedoc-tailwindcss-patch.d.ts → typedoc-tailwindcss-runtime.d.ts} +4 -10
  158. package/dist/types/user-defined-options/general.d.ts +8 -4
  159. package/dist/types/user-defined-options/important.d.ts +2 -2
  160. package/dist/uni-app-x/style-asset.d.ts +1 -0
  161. package/dist/{utils-Dolmt8EO.js → utils-BCa37Wqj.js} +2 -17
  162. package/dist/{utils-DsaS975I.mjs → utils-DodxWHGz.mjs} +2 -17
  163. package/dist/v4-engine-CF9zt4Cw.mjs +2396 -0
  164. package/dist/v4-engine-D4ubP7N5.js +2778 -0
  165. package/dist/{vite-BBGOjh9e.js → vite-CP0ylSxZ.js} +2887 -1683
  166. package/dist/{vite-CS5DE-HD.mjs → vite-CPO83EhA.mjs} +2753 -1548
  167. package/dist/vite.js +1 -1
  168. package/dist/vite.mjs +1 -1
  169. package/dist/weapp-tw-css-import-rewrite-loader.js +5741 -4396
  170. package/dist/weapp-tw-runtime-classset-loader.js +36 -0
  171. package/dist/webpack-Bsek8VhR.js +2094 -0
  172. package/dist/webpack-BzqhJ8yK.mjs +2082 -0
  173. package/dist/webpack.js +1 -1
  174. package/dist/webpack.mjs +1 -1
  175. package/package.json +11 -7
  176. package/dist/auto-CTp6wE5a.js +0 -33
  177. package/dist/auto-Cl8_hsG6.mjs +0 -22
  178. package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +0 -13
  179. package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +0 -1
  180. package/dist/context/tailwindcss/rax.d.ts +0 -2
  181. package/dist/generator-Cb1Zp3Al.js +0 -92
  182. package/dist/generator-mvNFUvns.mjs +0 -67
  183. package/dist/tailwindcss/patcher-options.d.ts +0 -8
  184. package/dist/tailwindcss/patcher.d.ts +0 -12
  185. package/dist/tailwindcss/runtime-patch.d.ts +0 -5
  186. package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +0 -3
  187. package/dist/tailwindcss/v3-engine/generator/content.d.ts +0 -10
  188. package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +0 -2
  189. package/dist/tailwindcss/v3-engine/generator.d.ts +0 -19
  190. package/dist/tailwindcss/v3-engine/index.d.ts +0 -4
  191. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +0 -4
  192. package/dist/tailwindcss/v3-engine/source.d.ts +0 -5
  193. package/dist/tailwindcss/v3-engine/types.d.ts +0 -61
  194. package/dist/tailwindcss/v4/multi-patcher.d.ts +0 -2
  195. package/dist/tailwindcss/v4/patcher-options.d.ts +0 -2
  196. package/dist/tailwindcss/v4/patcher.d.ts +0 -15
  197. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +0 -1
  198. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +0 -1
  199. package/dist/tailwindcss-CK84uGBp.mjs +0 -556
  200. package/dist/tailwindcss-Clpkz1oR.js +0 -613
  201. package/dist/v3-engine-CQE5JJNZ.js +0 -4639
  202. package/dist/v3-engine-DKBaKWGL.mjs +0 -4231
  203. package/dist/webpack-DIWrcpRo.js +0 -1066
  204. package/dist/webpack-SPcri_D8.mjs +0 -1054
  205. /package/dist/tailwindcss/{patcher-resolve.d.ts → runtime-resolve.d.ts} +0 -0
@@ -1,4 +1,6 @@
1
- import { h as traverse, m as babelParse, o as Parser } from "./precheck-CsFr1q2l.mjs";
1
+ import { a as Parser, h as traverse, m as babelParse } from "./context-Mbzkek1q.mjs";
2
+ import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-wyUHrfil.mjs";
3
+ import { u as generateCssByGenerator } from "./hmr-timing-BXMLsF4b.mjs";
2
4
  import { createRequire } from "node:module";
3
5
  import path from "node:path";
4
6
  import process from "node:process";
@@ -77,10 +79,14 @@ function slash(p) {
77
79
  return ensurePosix(p);
78
80
  }
79
81
  const isWindows = process.platform === "win32";
80
- const cssLangRE = new RegExp(`\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`);
82
+ const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
83
+ const htmlLangRE = /\.html?(?:$|\?)/;
81
84
  function isCSSRequest(request) {
82
85
  return cssLangRE.test(request) || isSourceStyleRequest(request);
83
86
  }
87
+ function isHTMLRequest(request) {
88
+ return htmlLangRE.test(request);
89
+ }
84
90
  function normalizePath(id) {
85
91
  return path.posix.normalize(isWindows ? ensurePosix(id) : id);
86
92
  }
@@ -116,9 +122,9 @@ function resolvePackageDir(name) {
116
122
  }
117
123
  //#endregion
118
124
  //#region src/bundlers/shared/generated-css-marker.ts
119
- const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/i;
120
- const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/gi;
121
- const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!\s*weapp-tailwindcss (vite|webpack)-generated-css(?::([^\s*]+))?\s*\*\/\s*/gi;
125
+ const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
126
+ const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
127
+ const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
122
128
  function createBundlerGeneratedCssMarker(bundler, file) {
123
129
  return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
124
130
  }
@@ -147,6 +153,25 @@ function parseBundlerGeneratedCssMarkerBlocks(source) {
147
153
  return blocks;
148
154
  }
149
155
  //#endregion
156
+ //#region src/bundlers/shared/v4-generation-core.ts
157
+ async function generateTailwindV4Css(options) {
158
+ const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
159
+ if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
160
+ const generated = await generateCssByGenerator(options);
161
+ if (!generated) return;
162
+ return {
163
+ ...generated,
164
+ classSet: generated.classSet,
165
+ dependencies: generated.dependencies,
166
+ metadata: {
167
+ file: options.file,
168
+ majorVersion,
169
+ outputFile: options.outputFile,
170
+ ...generated.metadata ?? {}
171
+ }
172
+ };
173
+ }
174
+ //#endregion
150
175
  //#region src/bundlers/vite/bundle-entries.ts
151
176
  function readOutputEntry(entry) {
152
177
  if (entry.output.type === "chunk") return entry.output.code;
@@ -200,6 +225,8 @@ const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
200
225
  const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
201
226
  const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
202
227
  const CSS_WHITESPACE_RE = /\s+/g;
228
+ const JS_RUNTIME_AFFECTING_TEXT_HINT_RE = /["'`/]/;
229
+ const JS_INCOMPLETE_TRAILING_OPERATOR_RE = /(?:=>|[=+\-*%&|^!~?:,.({[\]])\s*$/;
203
230
  function createHtmlRuntimeAffectingSignature(source) {
204
231
  try {
205
232
  const parts = [];
@@ -223,9 +250,10 @@ function createHtmlRuntimeAffectingSignature(source) {
223
250
  }
224
251
  }
225
252
  function createJsRuntimeAffectingSignature(source) {
253
+ if (!JS_RUNTIME_AFFECTING_TEXT_HINT_RE.test(source) && !JS_INCOMPLETE_TRAILING_OPERATOR_RE.test(source)) return "";
226
254
  try {
227
255
  const ast = babelParse(source, {
228
- cache: true,
256
+ cache: false,
229
257
  cacheKey: "vite-runtime-affecting:unambiguous",
230
258
  plugins: ["jsx", "typescript"],
231
259
  sourceType: "unambiguous"
@@ -295,8 +323,8 @@ function readEntrySource(output) {
295
323
  return output.source.toString();
296
324
  }
297
325
  function classifyBundleEntry(file, opts) {
326
+ if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
298
327
  if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
299
- if (opts.htmlMatcher(file)) return "html";
300
328
  if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
301
329
  return "other";
302
330
  }
@@ -331,12 +359,12 @@ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false, opti
331
359
  sourceHashByFile.set(file, hash);
332
360
  const previousHash = state.sourceHashByFile.get(file);
333
361
  const changed = previousHash == null || previousHash !== hash;
334
- const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
335
362
  const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
336
- const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
337
- const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
338
- const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
339
- runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
363
+ const runtimeAffectingHash = !changed && previousRuntimeAffectingHash != null ? previousRuntimeAffectingHash : (() => {
364
+ const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
365
+ runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
366
+ return opts.cache.computeHash(runtimeAffectingSignature);
367
+ })();
340
368
  runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
341
369
  if (changed) changedByType[type].add(file);
342
370
  if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
@@ -389,14 +417,156 @@ function invertLinkedByEntry(linkedByEntry) {
389
417
  }
390
418
  return dependentsByLinkedFile;
391
419
  }
420
+ function replaceMapEntries(target, source) {
421
+ target.clear();
422
+ for (const [key, value] of source) target.set(key, value);
423
+ return target;
424
+ }
425
+ function mergeMapEntries(target, source) {
426
+ for (const [key, value] of source) target.set(key, value);
427
+ return target;
428
+ }
392
429
  function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
393
430
  const incremental = options.incremental === true;
394
431
  state.iteration += 1;
395
- state.sourceHashByFile = incremental ? new Map([...state.sourceHashByFile, ...snapshot.sourceHashByFile]) : snapshot.sourceHashByFile;
396
- state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
397
- state.runtimeAffectingHashByFile = incremental ? new Map([...state.runtimeAffectingHashByFile, ...snapshot.runtimeAffectingHashByFile]) : snapshot.runtimeAffectingHashByFile;
398
- state.linkedByEntry = incremental ? new Map([...state.linkedByEntry, ...linkedByEntry]) : linkedByEntry;
432
+ state.sourceHashByFile = incremental ? mergeMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile) : replaceMapEntries(state.sourceHashByFile, snapshot.sourceHashByFile);
433
+ state.runtimeAffectingSignatureByFile.clear();
434
+ state.runtimeAffectingHashByFile = incremental ? mergeMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile) : replaceMapEntries(state.runtimeAffectingHashByFile, snapshot.runtimeAffectingHashByFile);
435
+ state.linkedByEntry = incremental ? mergeMapEntries(state.linkedByEntry, linkedByEntry) : replaceMapEntries(state.linkedByEntry, linkedByEntry);
399
436
  state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
400
437
  }
401
438
  //#endregion
402
- export { toAbsoluteOutputPath as S, slash as _, applyLinkedResults as a, normalizeOutputPathKey as b, hasBundlerGeneratedCssMarker as c, resolvePackageDir as d, resolvePluginDisabledState as f, normalizePath as g, isCSSRequest as h, createRuntimeAffectingSourceSignature as i, parseBundlerGeneratedCssMarkerBlocks as l, formatPostcssSourceMap as m, createBundleBuildState as n, createBundleModuleGraphOptions as o, cleanUrl as p, updateBundleBuildState as r, createBundlerGeneratedCssMarker as s, buildBundleSnapshot as t, stripBundlerGeneratedCssMarkers as u, isSourceStyleRequest as v, resolveOutputSpecifier as x, stripRequestQuery as y };
439
+ //#region src/bundlers/vite/generate-bundle/signatures.ts
440
+ function summarizeStringDiff(previous, next) {
441
+ if (previous === next) return "same";
442
+ const previousLength = previous.length;
443
+ const nextLength = next.length;
444
+ const minLength = Math.min(previousLength, nextLength);
445
+ let prefixLength = 0;
446
+ while (prefixLength < minLength && previous.charCodeAt(prefixLength) === next.charCodeAt(prefixLength)) prefixLength += 1;
447
+ let previousSuffixCursor = previousLength - 1;
448
+ let nextSuffixCursor = nextLength - 1;
449
+ while (previousSuffixCursor >= prefixLength && nextSuffixCursor >= prefixLength && previous.charCodeAt(previousSuffixCursor) === next.charCodeAt(nextSuffixCursor)) {
450
+ previousSuffixCursor -= 1;
451
+ nextSuffixCursor -= 1;
452
+ }
453
+ const previousChangedLength = previousSuffixCursor >= prefixLength ? previousSuffixCursor - prefixLength + 1 : 0;
454
+ const nextChangedLength = nextSuffixCursor >= prefixLength ? nextSuffixCursor - prefixLength + 1 : 0;
455
+ return `changed@${prefixLength} old=${previousChangedLength} new=${nextChangedLength} len=${previousLength}->${nextLength}`;
456
+ }
457
+ function createLinkedImpactSignature(entry, linkedImpactsByEntry, sourceHashByFile) {
458
+ const changedLinkedFiles = linkedImpactsByEntry.get(entry);
459
+ if (!changedLinkedFiles || changedLinkedFiles.size === 0) return;
460
+ return [...changedLinkedFiles].sort().map((file) => {
461
+ return `${file}:${sourceHashByFile.get(file) ?? "missing"}`;
462
+ }).join(",");
463
+ }
464
+ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
465
+ if (!linkedImpactSignature) return runtimeSignature;
466
+ return `${runtimeSignature}:linked:${linkedImpactSignature}`;
467
+ }
468
+ function createStableTextSignature(input) {
469
+ let hash = 2166136261;
470
+ for (let i = 0; i < input.length; i++) {
471
+ hash ^= input.charCodeAt(i);
472
+ hash = Math.imul(hash, 16777619);
473
+ }
474
+ return (hash >>> 0).toString(36);
475
+ }
476
+ function createCandidateSignature(candidates) {
477
+ if (candidates.size === 0) return "empty";
478
+ return createStableTextSignature([...candidates].sort().join("\n"));
479
+ }
480
+ function getSnapshotHash(snapshotMap, file, fallback) {
481
+ return snapshotMap.get(file) ?? fallback;
482
+ }
483
+ function hasRuntimeAffectingSourceChanges(changedByType) {
484
+ return changedByType.html.size > 0 || changedByType.js.size > 0;
485
+ }
486
+ //#endregion
487
+ //#region src/bundlers/vite/generate-bundle/scoped-generator.ts
488
+ function hasOwnSourceDirectives(rawSource) {
489
+ return rawSource.includes("@source") || rawSource.includes("@config");
490
+ }
491
+ function createLocalSourceEntries(sourceFile) {
492
+ return [{
493
+ base: path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, ""))),
494
+ negated: false,
495
+ pattern: "**/*"
496
+ }];
497
+ }
498
+ function intersectCandidates(first, second) {
499
+ const scoped = /* @__PURE__ */ new Set();
500
+ const [small, large] = first.size <= second.size ? [first, second] : [second, first];
501
+ for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
502
+ return scoped;
503
+ }
504
+ function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
505
+ if (!hasOwnSourceDirectives(rawSource)) return {
506
+ entries: resolvedEntries,
507
+ localEntries: void 0
508
+ };
509
+ const localEntries = createLocalSourceEntries(sourceFile);
510
+ if (!resolvedEntries || resolvedEntries.length === 0) return {
511
+ entries: localEntries,
512
+ localEntries: void 0
513
+ };
514
+ return {
515
+ entries: resolvedEntries,
516
+ localEntries
517
+ };
518
+ }
519
+ async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
520
+ if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
521
+ const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
522
+ if (entries === void 0) return fallbackSignature;
523
+ const scopedCandidates = getSourceCandidatesForEntries(entries);
524
+ const scopedSignature = createCandidateSignature(localEntries ? intersectCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries)) : scopedCandidates);
525
+ return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
526
+ }
527
+ async function createScopedGeneratorRuntime(options) {
528
+ const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
529
+ if (getSourceCandidatesForEntries && rawSource && sourceFile) {
530
+ const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
531
+ if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
532
+ const scopedCandidates = scopedSourceCandidateGetter?.(entries) ?? getSourceCandidatesForEntries(entries);
533
+ if (!localEntries) return scopedCandidates;
534
+ return intersectCandidates(scopedCandidates, scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries));
535
+ }
536
+ }
537
+ const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
538
+ if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return scopedCandidates;
539
+ if (!shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions)) return fallbackRuntime;
540
+ return fallbackRuntime;
541
+ }
542
+ //#endregion
543
+ //#region src/bundlers/vite/source-candidate-scan-signature.ts
544
+ function normalizeSignaturePath(value) {
545
+ return slash(path.resolve(value));
546
+ }
547
+ function serializeInlineCandidates(inlineCandidates) {
548
+ return {
549
+ excluded: [...inlineCandidates?.excluded ?? []].sort(),
550
+ included: [...inlineCandidates?.included ?? []].sort()
551
+ };
552
+ }
553
+ function serializeSourceEntries(entries) {
554
+ return (entries ?? []).map((entry) => ({
555
+ base: normalizeSignaturePath(entry.base),
556
+ negated: entry.negated,
557
+ pattern: entry.pattern
558
+ })).sort((a, b) => `${a.base}\0${a.pattern}\0${a.negated}`.localeCompare(`${b.base}\0${b.pattern}\0${b.negated}`));
559
+ }
560
+ function createSourceCandidateScanSignature(input) {
561
+ return JSON.stringify({
562
+ inlineCandidates: serializeInlineCandidates(input.inlineCandidates),
563
+ outDir: input.outDir ? normalizeSignaturePath(input.outDir) : void 0,
564
+ roots: input.roots.map((root) => ({
565
+ entries: serializeSourceEntries(root.entries),
566
+ root: normalizeSignaturePath(root.root)
567
+ })),
568
+ scanAllSources: input.scanAllSources ?? false
569
+ });
570
+ }
571
+ //#endregion
572
+ export { isSourceStyleRequest as A, resolvePluginDisabledState as C, isHTMLRequest as D, isCSSRequest as E, normalizeOutputPathKey as M, resolveOutputSpecifier as N, normalizePath as O, toAbsoluteOutputPath as P, resolvePackageDir as S, formatPostcssSourceMap as T, generateTailwindV4Css as _, createJsHashSalt as a, parseBundlerGeneratedCssMarkerBlocks as b, hasRuntimeAffectingSourceChanges as c, classifyBundleEntry as d, createBundleBuildState as f, createBundleModuleGraphOptions as g, applyLinkedResults as h, createCandidateSignature as i, stripRequestQuery as j, slash as k, summarizeStringDiff as l, createRuntimeAffectingSourceSignature as m, createScopedGeneratorCandidateSignature as n, createLinkedImpactSignature as o, updateBundleBuildState as p, createScopedGeneratorRuntime as r, getSnapshotHash as s, createSourceCandidateScanSignature as t, buildBundleSnapshot as u, createBundlerGeneratedCssMarker as v, cleanUrl as w, stripBundlerGeneratedCssMarkers as x, hasBundlerGeneratedCssMarker as y };
@@ -0,0 +1,7 @@
1
+ import type { IArbitraryValues } from '../types/shared';
2
+ export interface SourceCandidateExtractionOptions {
3
+ bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
4
+ extractor?: ((source: string, extension: string) => Promise<Iterable<string>> | Iterable<string>) | undefined;
5
+ }
6
+ export declare function extractCandidatesFromSource(source: string, extension: string, options?: SourceCandidateExtractionOptions): Promise<Set<string>>;
7
+ export declare function extractScriptStringCandidates(source: string, extension: string, options: SourceCandidateExtractionOptions): Promise<never[] | Set<string>>;
@@ -1,6 +1,6 @@
1
1
  import type { PackageResolvingOptions } from 'local-pkg';
2
2
  import type { PackageJson } from 'pkg-types';
3
- import { createTailwindcssPatcher } from './patcher';
3
+ import { createTailwindcssRuntime } from './runtime-factory';
4
4
  declare function getTailwindcssPackageInfo(options?: PackageResolvingOptions): {
5
5
  name: string;
6
6
  version: string | undefined;
@@ -8,4 +8,4 @@ declare function getTailwindcssPackageInfo(options?: PackageResolvingOptions): {
8
8
  packageJsonPath: string;
9
9
  packageJson: PackageJson;
10
10
  } | undefined;
11
- export { createTailwindcssPatcher, getTailwindcssPackageInfo, };
11
+ export { createTailwindcssRuntime, getTailwindcssPackageInfo, };
@@ -1,12 +1,12 @@
1
- import type { TailwindcssPatcherLike } from '../../types';
1
+ import type { TailwindcssRuntimeLike } from '../../types';
2
2
  interface RuntimeClassSetCacheEntry {
3
3
  value?: Set<string> | undefined;
4
4
  promise?: Promise<Set<string>> | undefined;
5
5
  signature?: string | undefined;
6
6
  }
7
- export declare const runtimeSignaturePatchersSymbol: unique symbol;
8
- export declare function invalidateRuntimeClassSet(twPatcher?: TailwindcssPatcherLike): void;
9
- export declare function getRuntimeClassSetCacheEntry(twPatcher: TailwindcssPatcherLike): RuntimeClassSetCacheEntry;
10
- export declare function getRuntimeClassSetSignature(twPatcher: TailwindcssPatcherLike): string;
11
- export declare function getRuntimeClassSetSignatureWithSources(twPatcher: TailwindcssPatcherLike): Promise<string>;
7
+ export declare const runtimeSignatureRuntimesSymbol: unique symbol;
8
+ export declare function invalidateRuntimeClassSet(tailwindRuntime?: TailwindcssRuntimeLike): void;
9
+ export declare function getRuntimeClassSetCacheEntry(tailwindRuntime: TailwindcssRuntimeLike): RuntimeClassSetCacheEntry;
10
+ export declare function getRuntimeClassSetSignature(tailwindRuntime: TailwindcssRuntimeLike): string;
11
+ export declare function getRuntimeClassSetSignatureWithSources(tailwindRuntime: TailwindcssRuntimeLike): Promise<string>;
12
12
  export {};
@@ -0,0 +1,12 @@
1
+ import type { LengthUnitsRuntimeOptions, TailwindCssRuntimeOptions } from './runtime-types';
2
+ import type { TailwindcssRuntimeLike } from '../types';
3
+ type TailwindUserOptions = NonNullable<TailwindCssRuntimeOptions['tailwindcss']>;
4
+ export interface CreateTailwindcssRuntimeOptions {
5
+ basedir?: string;
6
+ cacheDir?: string;
7
+ supportCustomLengthUnits?: boolean | LengthUnitsRuntimeOptions;
8
+ tailwindcss?: TailwindUserOptions;
9
+ tailwindcssRuntimeOptions?: TailwindCssRuntimeOptions;
10
+ }
11
+ export declare function createTailwindcssRuntime(options?: CreateTailwindcssRuntimeOptions): TailwindcssRuntimeLike;
12
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { LengthUnitsRuntimeOptions, TailwindCssRuntimeOptions } from './runtime-types';
2
+ type TailwindUserOptions = NonNullable<TailwindCssRuntimeOptions['tailwindcss']>;
3
+ type TailwindApplyOptions = NonNullable<TailwindCssRuntimeOptions['apply']>;
4
+ type TailwindExtendLengthUnitsOption = TailwindApplyOptions['extendLengthUnits'];
5
+ export declare function resolveTailwindcssOptions(options?: TailwindCssRuntimeOptions): TailwindUserOptions | undefined;
6
+ export declare function normalizeExtendLengthUnits(value: boolean | LengthUnitsRuntimeOptions | undefined): TailwindExtendLengthUnitsOption | undefined;
7
+ export declare function normalizeTailwindcssRuntimeOptions(options?: TailwindCssRuntimeOptions): TailwindCssRuntimeOptions | undefined;
8
+ export {};
@@ -0,0 +1,86 @@
1
+ import type { PackageResolvingOptions } from 'local-pkg';
2
+ import type { TailwindSourceEntry } from './source-scan';
3
+ import type { TailwindV4SourceOptions } from './v4-engine';
4
+ type TailwindV4CssSource = NonNullable<TailwindV4SourceOptions['cssSources']>[number];
5
+ export interface LengthUnitsRuntimeOptions {
6
+ units?: string[] | undefined;
7
+ rem2rpx?: boolean | undefined;
8
+ [key: string]: unknown;
9
+ }
10
+ export interface ExtendLengthUnitsOptions extends Partial<LengthUnitsRuntimeOptions> {
11
+ enabled?: boolean | undefined;
12
+ }
13
+ export type CacheStrategy = 'merge' | 'overwrite';
14
+ export type CacheDriver = 'file' | 'memory' | 'noop';
15
+ export interface CacheOptions {
16
+ enabled?: boolean | undefined;
17
+ cwd?: string | undefined;
18
+ dir?: string | undefined;
19
+ file?: string | undefined;
20
+ strategy?: CacheStrategy | undefined;
21
+ driver?: CacheDriver | undefined;
22
+ }
23
+ export interface ExtractOptions {
24
+ write?: boolean | undefined;
25
+ file?: string | undefined;
26
+ format?: 'json' | 'lines' | undefined;
27
+ pretty?: number | boolean | undefined;
28
+ removeUniversalSelector?: boolean | undefined;
29
+ }
30
+ export interface ExposeContextOptions {
31
+ refProperty?: string | undefined;
32
+ }
33
+ export interface ApplyOptions {
34
+ overwrite?: boolean | undefined;
35
+ exposeContext?: boolean | ExposeContextOptions | undefined;
36
+ extendLengthUnits?: false | ExtendLengthUnitsOptions | undefined;
37
+ }
38
+ export interface TailwindRuntimeOptionsBase {
39
+ config?: string | undefined;
40
+ cwd?: string | undefined;
41
+ postcssPlugin?: string | undefined;
42
+ }
43
+ export interface TailwindV4Options {
44
+ base?: string | undefined;
45
+ css?: string | undefined;
46
+ cssSources?: TailwindV4CssSource[] | undefined;
47
+ cssEntries?: string[] | undefined;
48
+ sources?: TailwindSourceEntry[] | undefined;
49
+ bareArbitraryValues?: boolean | {
50
+ units?: string[] | undefined;
51
+ } | undefined;
52
+ }
53
+ export interface TailwindCssOptions extends TailwindRuntimeOptionsBase {
54
+ version?: 4 | undefined;
55
+ packageName?: string | undefined;
56
+ resolve?: PackageResolvingOptions | undefined;
57
+ v4?: TailwindV4Options | undefined;
58
+ }
59
+ export interface TailwindCssRuntimeOptions {
60
+ projectRoot?: string | undefined;
61
+ tailwindcss?: TailwindCssOptions | undefined;
62
+ apply?: ApplyOptions | undefined;
63
+ extract?: ExtractOptions | undefined;
64
+ filter?: ((className: string) => boolean) | undefined;
65
+ cache?: boolean | CacheOptions | undefined;
66
+ }
67
+ export interface TailwindPackageInfo {
68
+ name: string;
69
+ version: string | undefined;
70
+ rootPath: string;
71
+ packageJsonPath: string;
72
+ packageJson: Record<string, unknown>;
73
+ }
74
+ export interface TailwindcssExtractOptions extends ExtractOptions {
75
+ }
76
+ export interface TailwindcssExtractResult {
77
+ classList: string[];
78
+ classSet: Set<string>;
79
+ }
80
+ export interface TailwindContentTokenReport {
81
+ entries: unknown[];
82
+ filesScanned: number;
83
+ sources: unknown[];
84
+ skippedFiles: unknown[];
85
+ }
86
+ export {};
@@ -1,6 +1,6 @@
1
- import type { RefreshTailwindcssPatcherOptions, TailwindcssPatcherLike } from '../types';
1
+ import type { RefreshTailwindcssRuntimeOptions, TailwindcssRuntimeLike } from '../types';
2
2
  import { invalidateRuntimeClassSet } from './runtime/cache';
3
- export declare const refreshTailwindcssPatcherSymbol: unique symbol;
3
+ export declare const refreshTailwindcssRuntimeSymbol: unique symbol;
4
4
  export interface CollectRuntimeClassSetOptions {
5
5
  force?: boolean | undefined;
6
6
  skipRefresh?: boolean | undefined;
@@ -10,11 +10,11 @@ export interface RefreshTailwindRuntimeStateOptions {
10
10
  force: boolean;
11
11
  clearCache?: boolean | undefined;
12
12
  }
13
- export declare function createTailwindRuntimeReadyPromise(twPatcher: TailwindcssPatcherLike): Promise<void>;
13
+ export declare function createTailwindRuntimeReadyPromise(tailwindRuntime: TailwindcssRuntimeLike): Promise<void>;
14
14
  export interface TailwindRuntimeState {
15
- twPatcher: TailwindcssPatcherLike;
15
+ tailwindRuntime: TailwindcssRuntimeLike;
16
16
  readyPromise: Promise<void>;
17
- refreshTailwindcssPatcher?: ((options?: RefreshTailwindcssPatcherOptions) => Promise<TailwindcssPatcherLike>) | undefined;
17
+ refreshTailwindcssRuntime?: ((options?: RefreshTailwindcssRuntimeOptions) => Promise<TailwindcssRuntimeLike>) | undefined;
18
18
  }
19
19
  export declare function refreshTailwindRuntimeState(state: TailwindRuntimeState, forceOrOptions: boolean | RefreshTailwindRuntimeStateOptions): Promise<boolean>;
20
20
  export interface EnsureRuntimeClassSetOptions {
@@ -24,5 +24,5 @@ export interface EnsureRuntimeClassSetOptions {
24
24
  allowEmpty?: boolean | undefined;
25
25
  }
26
26
  export declare function ensureRuntimeClassSet(state: TailwindRuntimeState, options?: EnsureRuntimeClassSetOptions): Promise<Set<string>>;
27
- declare function collectRuntimeClassSet(twPatcher: TailwindcssPatcherLike, options?: CollectRuntimeClassSetOptions): Promise<Set<string>>;
27
+ declare function collectRuntimeClassSet(tailwindRuntime: TailwindcssRuntimeLike, options?: CollectRuntimeClassSetOptions): Promise<Set<string>>;
28
28
  export { collectRuntimeClassSet, invalidateRuntimeClassSet };
@@ -1,5 +1,5 @@
1
+ import type { TailwindV4CssSource } from '@tailwindcss-mangle/engine';
1
2
  import type { Root } from '@weapp-tailwindcss/postcss';
2
- import type { TailwindV4CssSource } from 'tailwindcss-patch';
3
3
  export interface TailwindSourceEntry {
4
4
  base: string;
5
5
  pattern: string;
@@ -1,2 +1,2 @@
1
- import type { TailwindcssPatcherLike } from '../types';
2
- export declare function logTailwindcssTarget(patcher: TailwindcssPatcherLike | undefined, baseDir?: string): void;
1
+ import type { TailwindcssRuntimeLike } from '../types';
2
+ export declare function logTailwindcssTarget(tailwindRuntime: TailwindcssRuntimeLike | undefined, baseDir?: string): void;
@@ -1,5 +1,5 @@
1
- import type { InternalUserDefinedOptions, TailwindcssPatcherLike } from '../../types';
1
+ import type { InternalUserDefinedOptions, TailwindcssRuntimeLike } from '../../types';
2
2
  export declare const DEFAULT_CSS_CALC_CUSTOM_PROPERTIES: (string | RegExp)[];
3
3
  export declare function normalizeCssEntriesConfig(entries: unknown): string[] | undefined;
4
- export declare function warnMissingCssEntries(ctx: InternalUserDefinedOptions, patcher: TailwindcssPatcherLike | undefined): void;
5
- export declare function applyV4CssCalcDefaults(cssCalc: InternalUserDefinedOptions['cssCalc'], patcher: TailwindcssPatcherLike | undefined): InternalUserDefinedOptions['cssCalc'];
4
+ export declare function warnMissingCssEntries(ctx: InternalUserDefinedOptions, tailwindRuntime: TailwindcssRuntimeLike | undefined): void;
5
+ export declare function applyV4CssCalcDefaults(cssCalc: InternalUserDefinedOptions['cssCalc'], tailwindRuntime: TailwindcssRuntimeLike | undefined): InternalUserDefinedOptions['cssCalc'];
@@ -1,3 +1,4 @@
1
+ export declare function isTailwindV4CssEntry(entry: string | undefined): entry is string;
1
2
  export declare function guessBasedirFromEntries(entries?: string[]): string | undefined;
2
3
  export declare function normalizeCssEntries(entries: string[] | undefined, anchor: string): string[] | undefined;
3
4
  export interface GroupCssEntriesOptions {
@@ -1,5 +1,7 @@
1
- import type { TailwindV4CssSource } from 'tailwindcss-patch';
1
+ import type { TailwindV4CssSource } from '@tailwindcss-mangle/engine';
2
2
  import type { UserDefinedOptions } from '../../types';
3
3
  export declare function hasCssSourcesValue(value: unknown): boolean;
4
- export declare function hasConfiguredTailwindV4CssRoots(options: Pick<UserDefinedOptions, 'cssEntries' | 'tailwindcss' | 'tailwindcssPatcherOptions'>): boolean;
4
+ export declare function isTailwindV4CssSourceRoot(source: unknown): source is TailwindV4CssSource;
5
+ export declare function filterTailwindV4CssSourceRoots(sources: TailwindV4CssSource[] | undefined): TailwindV4CssSource[] | undefined;
6
+ export declare function hasConfiguredTailwindV4CssRoots(options: Pick<UserDefinedOptions, 'cssEntries' | 'tailwindcss' | 'tailwindcssRuntimeOptions'>): boolean;
5
7
  export declare function upsertTailwindV4CssSource(opts: UserDefinedOptions, source: TailwindV4CssSource): boolean;
@@ -1,2 +1,2 @@
1
1
  export * from './config';
2
- export * from './patcher';
2
+ export * from './runtime-factory';
@@ -0,0 +1,2 @@
1
+ import type { TailwindcssRuntimeLike } from '../../types';
2
+ export declare function createMultiTailwindcssRuntime(runtimes: TailwindcssRuntimeLike[]): TailwindcssRuntimeLike;
@@ -0,0 +1,15 @@
1
+ import type { TailwindCssRuntimeOptions } from '../runtime-types';
2
+ import type { CreateTailwindcssRuntimeOptions } from '../runtime-factory';
3
+ import type { InternalUserDefinedOptions, TailwindcssRuntimeLike } from '../../types';
4
+ export { groupCssEntriesByBase, guessBasedirFromEntries, normalizeCssEntries } from './css-entries';
5
+ export { createMultiTailwindcssRuntime } from './multi-runtime';
6
+ type TailwindUserOptions = NonNullable<TailwindCssRuntimeOptions['tailwindcss']>;
7
+ export interface TailwindcssRuntimeFactoryOptions {
8
+ tailwindcss?: TailwindUserOptions;
9
+ tailwindcssRuntimeOptions?: CreateTailwindcssRuntimeOptions['tailwindcssRuntimeOptions'];
10
+ supportCustomLengthUnits: InternalUserDefinedOptions['supportCustomLengthUnits'];
11
+ appType: InternalUserDefinedOptions['appType'];
12
+ bareArbitraryValues?: InternalUserDefinedOptions['arbitraryValues']['bareArbitraryValues'];
13
+ }
14
+ export declare function createTailwindcssRuntimeForBase(baseDir: string, cssEntries: string[] | undefined, options: TailwindcssRuntimeFactoryOptions): TailwindcssRuntimeLike;
15
+ export declare function tryCreateMultiTailwindcssRuntime(groups: Map<string, string[]>, options: TailwindcssRuntimeFactoryOptions): TailwindcssRuntimeLike | undefined;
@@ -0,0 +1,2 @@
1
+ import type { TailwindCssRuntimeOptions } from '../runtime-types';
2
+ export declare function overrideTailwindcssRuntimeOptionsForBase(options: TailwindCssRuntimeOptions | undefined, baseDir: string, cssEntries: string[]): TailwindCssRuntimeOptions | undefined;
@@ -1 +1 @@
1
- export { loadTailwindV4DesignSystem, resolveValidTailwindV4Candidates, } from 'tailwindcss-patch';
1
+ export { loadTailwindV4DesignSystem, resolveValidTailwindV4Candidates, } from '@tailwindcss-mangle/engine';
@@ -1,2 +1,2 @@
1
1
  import type { TailwindV4GenerateTarget, TailwindV4ResolvedSource } from '../types';
2
- export declare function createCompatibleSource(source: TailwindV4ResolvedSource, target: TailwindV4GenerateTarget, tailwindcssV3Compatibility: boolean | undefined): TailwindV4ResolvedSource;
2
+ export declare function createCompatibleSource(source: TailwindV4ResolvedSource, target: TailwindV4GenerateTarget): TailwindV4ResolvedSource;
@@ -1,6 +1,6 @@
1
- export declare function normalizeRpxTextCandidates(candidates: Iterable<string>): {
1
+ export declare function normalizeRpxLengthCandidates(candidates: Iterable<string>): {
2
2
  candidates: Set<string>;
3
3
  restoreCandidates: Map<string, string>;
4
4
  };
5
- export declare function restoreRpxTextCandidates(candidates: Iterable<string>, restoreCandidates: ReadonlyMap<string, string>): Set<string>;
6
- export declare function restoreRpxTextCssSelectors(css: string, restoreCandidates: ReadonlyMap<string, string>): string;
5
+ export declare function restoreRpxLengthCandidates(candidates: Iterable<string>, restoreCandidates: ReadonlyMap<string, string>): Set<string>;
6
+ export declare function restoreRpxLengthCssSelectors(css: string, restoreCandidates: ReadonlyMap<string, string>): string;
@@ -1,2 +1,2 @@
1
1
  import type { TailwindV4GenerateOptions, TailwindV4ResolvedSource } from '../types';
2
- export declare function resolveScanSources(source: TailwindV4ResolvedSource, scanSources: TailwindV4GenerateOptions['scanSources']): Promise<boolean | import("tailwindcss-patch").TailwindV4SourcePattern[] | undefined>;
2
+ export declare function resolveScanSources(source: TailwindV4ResolvedSource, scanSources: TailwindV4GenerateOptions['scanSources']): Promise<boolean | import("@tailwindcss-mangle/engine").TailwindV4SourcePattern[] | undefined>;
@@ -8,14 +8,21 @@ export declare function getTailwindV4IncrementalGenerateCacheStats(): {
8
8
  taskMax: number;
9
9
  taskSize: number;
10
10
  entries: {
11
- key: string;
12
11
  candidates: number;
13
12
  classSet: number;
14
13
  cssBytes: number;
15
14
  rawCssBytes: number;
15
+ keyHash: string;
16
+ keyBytes: number;
17
+ }[];
18
+ keys: {
19
+ keyHash: string;
20
+ keyBytes: number;
21
+ }[];
22
+ taskKeys: {
23
+ keyHash: string;
24
+ keyBytes: number;
16
25
  }[];
17
- keys: string[];
18
- taskKeys: string[];
19
26
  };
20
27
  export declare const getTailwindV4IncrementalGenerateCacheStatsForTest: typeof getTailwindV4IncrementalGenerateCacheStats;
21
28
  export declare function clearTailwindV4IncrementalGenerateCacheForTest(): void;
@@ -1,5 +1,5 @@
1
1
  export { loadTailwindV4DesignSystem, resolveValidTailwindV4Candidates, } from './design-system';
2
2
  export { clearTailwindV4IncrementalGenerateCacheForTest, createTailwindV4Engine, getTailwindV4IncrementalGenerateCacheStats, getTailwindV4IncrementalGenerateCacheStatsForTest, } from './generator';
3
3
  export { transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp } from './miniprogram';
4
- export { resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, } from './source';
4
+ export { resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, } from './source';
5
5
  export type { TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, } from './types';
@@ -1,5 +1,11 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  import type { TailwindV4GenerateTarget } from './types';
3
+ import type { AppType } from '../../types';
4
+ type TailwindV4TargetStyleOptions = Partial<IStyleHandlerOptions> & {
5
+ appType?: AppType | undefined;
6
+ };
3
7
  export declare function normalizeTailwindV4GeneratedUrlValues(css: string): string;
4
8
  export declare function transformTailwindV4CssToWeapp(css: string, options?: Partial<IStyleHandlerOptions>): Promise<string>;
5
- export declare function transformTailwindV4CssByTarget(css: string, target: TailwindV4GenerateTarget, options?: Partial<IStyleHandlerOptions>): Promise<string>;
9
+ export declare function transformTailwindV4WebRpxCss(css: string): string;
10
+ export declare function transformTailwindV4CssByTarget(css: string, target: TailwindV4GenerateTarget, options?: TailwindV4TargetStyleOptions): Promise<string>;
11
+ export {};