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,8 +1,8 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_v3_engine = require("./v3-engine-CQE5JJNZ.js");
3
- const require_precheck = require("./precheck-30zNPRlI.js");
4
- const require_tailwindcss = require("./tailwindcss-Clpkz1oR.js");
5
- const require_hmr_timing = require("./hmr-timing-DFR51wgo.js");
2
+ const require_v4_engine = require("./v4-engine-D4ubP7N5.js");
3
+ const require_context = require("./context-BHxLe743.js");
4
+ const require_tailwindcss = require("./tailwindcss-DHIYcqXT.js");
5
+ const require_hmr_timing = require("./hmr-timing-CogqkFaF.js");
6
6
  let node_fs = require("node:fs");
7
7
  node_fs = require_chunk.__toESM(node_fs);
8
8
  let node_path = require("node:path");
@@ -129,7 +129,7 @@ function createVinylTransform(phase, handler, getTimingDetails) {
129
129
  }
130
130
  //#endregion
131
131
  //#region src/bundlers/gulp/index.ts
132
- const debug = require_v3_engine.createDebug();
132
+ const debug = require_context.createDebug();
133
133
  const GULP_RUNTIME_SOURCE_CACHE_MAX = 256;
134
134
  const GULP_PROCESS_CACHE_MAX = 512;
135
135
  function toMb(bytes) {
@@ -187,10 +187,7 @@ function resolveGulpMemoryDebugStats(context) {
187
187
  maxCacheKeys: GULP_PROCESS_CACHE_MAX
188
188
  },
189
189
  gulpOptions: { defaultStyleHandlerOptions: context.defaultStyleHandlerOptionsCache.size },
190
- tailwind: {
191
- v3: require_v3_engine.getTailwindV3IncrementalGenerateCacheStats(),
192
- v4: require_v3_engine.getTailwindV4IncrementalGenerateCacheStats()
193
- }
190
+ tailwind: { v4: require_v4_engine.getTailwindV4IncrementalGenerateCacheStats() }
194
191
  };
195
192
  }
196
193
  /**
@@ -199,18 +196,20 @@ function resolveGulpMemoryDebugStats(context) {
199
196
  * @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
200
197
  */
201
198
  function createPlugins(options = {}) {
202
- const hasInitialTailwindCssRoots = require_tailwindcss.hasConfiguredTailwindV4CssRoots(options);
203
- const opts = require_precheck.getCompilerContext({
199
+ const hasInitialTailwindCssRoots = require_v4_engine.hasConfiguredTailwindV4CssRoots(options);
200
+ const opts = require_context.getCompilerContext({
204
201
  ...options,
205
202
  __internalDeferMissingCssEntriesWarning: true
206
203
  });
207
- const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
208
- const readyPromise = require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher);
204
+ const { templateHandler, styleHandler, jsHandler, cache } = opts;
205
+ const initialTailwindRuntime = opts.tailwindRuntime;
206
+ const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
207
+ const readyPromise = require_context.createTailwindRuntimeReadyPromise(initialTailwindRuntime);
209
208
  let runtimeSet = /* @__PURE__ */ new Set();
210
209
  const runtimeState = {
211
- twPatcher: initialTwPatcher,
210
+ tailwindRuntime: initialTailwindRuntime,
212
211
  readyPromise,
213
- refreshTailwindcssPatcher
212
+ refreshTailwindcssRuntime
214
213
  };
215
214
  const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
216
215
  let cachedDefaultTemplateHandlerOptions;
@@ -222,13 +221,10 @@ function createPlugins(options = {}) {
222
221
  let runtimeSetDirty = false;
223
222
  const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
224
223
  const runtimeSourcesByFile = /* @__PURE__ */ new Map();
225
- let cachedGulpSourceCandidates;
226
224
  let cachedGulpSourceCandidateSignature;
227
225
  const gulpProcessCacheKeys = /* @__PURE__ */ new Set();
228
- const sourceCandidateExtractor = initialTwPatcher.majorVersion === 3 ? require_hmr_timing.createTailwindV3DefaultExtractor() : void 0;
229
226
  const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? require_hmr_timing.createBundleRuntimeClassSetManager();
230
227
  function invalidateGulpSourceCandidates() {
231
- cachedGulpSourceCandidates = void 0;
232
228
  cachedGulpSourceCandidateSignature = void 0;
233
229
  cachedGulpSourceCandidateGetter = void 0;
234
230
  cachedGulpSourceCandidateSourceGetter = void 0;
@@ -243,7 +239,7 @@ function createPlugins(options = {}) {
243
239
  const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
244
240
  const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
245
241
  if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
246
- runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
242
+ runtimeSet = await require_context.ensureRuntimeClassSet(runtimeState, {
247
243
  forceRefresh,
248
244
  forceCollect: shouldForceCollect,
249
245
  clearCache,
@@ -264,10 +260,10 @@ function createPlugins(options = {}) {
264
260
  type
265
261
  });
266
262
  pruneGulpRuntimeSourceCaches(runtimeSourceHashByFile, runtimeSourcesByFile);
267
- if (changed && runtimeState.twPatcher.majorVersion === 4) invalidateGulpSourceCandidates();
263
+ if (changed) invalidateGulpSourceCandidates();
268
264
  if (!changed && runtimeSetInitialized) return runtimeSet;
269
- if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
270
- runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
265
+ if (!runtimeSetDirty) try {
266
+ runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.tailwindRuntime, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
271
267
  runtimeSetInitialized = true;
272
268
  return runtimeSet;
273
269
  } catch (error) {
@@ -276,44 +272,9 @@ function createPlugins(options = {}) {
276
272
  }
277
273
  return refreshRuntimeSet({ forceCollect: true });
278
274
  }
279
- async function refreshGulpSourceCandidates(forceRefresh = false) {
280
- if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
281
- const root = opts.tailwindcssBasedir ?? node_process.default.cwd();
282
- const sourceScan = await require_v3_engine.resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
283
- const nextSignature = cache.computeHash(JSON.stringify({
284
- root,
285
- entries: sourceScan?.entries,
286
- inlineCandidates: sourceScan?.inlineCandidates ? {
287
- included: [...sourceScan.inlineCandidates.included].sort(),
288
- excluded: [...sourceScan.inlineCandidates.excluded].sort()
289
- } : void 0,
290
- explicit: sourceScan?.explicit ?? false,
291
- dependencies: [...sourceScan?.dependencies ?? []].sort()
292
- }));
293
- if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
294
- const collector = require_hmr_timing.createSourceCandidateCollector({
295
- bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
296
- extractor: sourceCandidateExtractor
297
- });
298
- await collector.scanRoot({
299
- entries: sourceScan?.entries,
300
- root
301
- });
302
- collector.syncInline(sourceScan?.inlineCandidates);
303
- cachedGulpSourceCandidateSignature = nextSignature;
304
- cachedGulpSourceCandidateGetter = (entries) => collector.valuesForEntries(entries);
305
- cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
306
- cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
307
- return cachedGulpSourceCandidates;
308
- }
309
275
  async function refreshGulpV4SourceCandidates(forceRefresh = false) {
310
- if (runtimeState.twPatcher.majorVersion !== 4) {
311
- cachedGulpSourceCandidateGetter = void 0;
312
- cachedGulpSourceCandidateSourceGetter = void 0;
313
- return;
314
- }
315
276
  const root = opts.tailwindcssBasedir ?? node_process.default.cwd();
316
- const sourceScan = await require_v3_engine.resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
277
+ const sourceScan = await require_tailwindcss.resolveViteSourceScanEntries(opts, runtimeState.tailwindRuntime, { root });
317
278
  const nextSignature = cache.computeHash(JSON.stringify({
318
279
  root,
319
280
  entries: sourceScan?.entries,
@@ -337,22 +298,25 @@ function createPlugins(options = {}) {
337
298
  cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
338
299
  return cachedGulpSourceCandidateGetter;
339
300
  }
340
- function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature) {
301
+ function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature) {
341
302
  return cache.computeHash([
342
303
  rawSource,
343
- require_v3_engine.getRuntimeClassSetSignature(runtimeState.twPatcher),
304
+ require_tailwindcss.getRuntimeClassSetSignature(runtimeState.tailwindRuntime),
344
305
  [...nextRuntimeSet].sort().join("\n"),
345
- sourceTraceSignature ?? "css-source-trace:0"
306
+ sourceTraceSignature ?? "css-source-trace:0",
307
+ sourceCandidateSignature ?? "gulp-source-candidates:0",
308
+ outputSignature ?? "gulp-output:0"
346
309
  ].join("\n\n"));
347
310
  }
348
311
  async function registerAutoCssSource(file, rawSource) {
349
- if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !require_v3_engine.hasTailwindRootDirectives(rawSource)) return false;
312
+ if (hasInitialTailwindCssRoots || (runtimeState.tailwindRuntime.majorVersion ?? 0) < 4 || !file.path || !require_v4_engine.hasTailwindRootDirectives(rawSource)) return false;
350
313
  const sourceFile = node_path.default.resolve(file.path);
351
- const sourceCss = require_v3_engine.normalizeTailwindSourceForGenerator(require_v3_engine.normalizeTailwindConfigDirectives(rawSource, node_path.default.dirname(sourceFile)), { importFallback: true });
352
- if (!require_tailwindcss.upsertTailwindV4CssSource(opts, {
314
+ const sourceCss = require_v4_engine.normalizeTailwindSourceForGenerator(require_v4_engine.normalizeTailwindConfigDirectives(rawSource, node_path.default.dirname(sourceFile)), { importFallback: true });
315
+ const generatorSourceCss = require_hmr_timing.splitLocalCssImports(sourceCss)?.source ?? sourceCss;
316
+ if (!require_v4_engine.upsertTailwindV4CssSource(opts, {
353
317
  file: sourceFile,
354
318
  base: node_path.default.dirname(sourceFile),
355
- css: sourceCss
319
+ css: generatorSourceCss
356
320
  })) return false;
357
321
  runtimeSetInitialized = false;
358
322
  runtimeSetDirty = true;
@@ -366,29 +330,56 @@ function createPlugins(options = {}) {
366
330
  return cachedDefaultModuleGraphOptions;
367
331
  }
368
332
  function resolveWxssHandlerOptions(options) {
369
- const majorVersion = runtimeState.twPatcher.majorVersion ?? "unknown";
333
+ const majorVersion = runtimeState.tailwindRuntime.majorVersion ?? "unknown";
370
334
  if (!options || Object.keys(options).length === 0) {
371
335
  let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
372
336
  if (!cached) {
373
- cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
337
+ cached = runtimeState.tailwindRuntime.majorVersion === void 0 ? {} : { majorVersion: runtimeState.tailwindRuntime.majorVersion };
374
338
  defaultStyleHandlerOptionsCache.set(majorVersion, cached);
375
339
  }
376
340
  return cached;
377
341
  }
378
- return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
379
- majorVersion: runtimeState.twPatcher.majorVersion,
342
+ return runtimeState.tailwindRuntime.majorVersion === void 0 ? { ...options } : {
343
+ majorVersion: runtimeState.tailwindRuntime.majorVersion,
380
344
  ...options
381
345
  };
382
346
  }
347
+ function resolveGulpStyleOutputExtension(file) {
348
+ return typeof opts.cssMatcher === "function" && opts.cssMatcher(node_path.default.basename(file.path)) ? node_path.default.extname(file.path) : void 0;
349
+ }
383
350
  function resolveGulpMatcherName(file) {
384
351
  return (file.relative || node_path.default.basename(file.path)).replaceAll(node_path.default.sep, "/");
385
352
  }
386
- function resolveWxssFileHandlerOptions(file, options) {
353
+ function resolveWxssFileHandlerOptions(file, rawSource, options) {
387
354
  const resolved = resolveWxssHandlerOptions(options);
388
- if (resolved.isMainChunk !== void 0) return resolved;
355
+ const sourceFile = file.path ? node_path.default.resolve(file.path) : void 0;
356
+ const sourceOptions = sourceFile ? {
357
+ outputRoot: node_path.default.resolve(file.cwd ?? node_process.default.cwd()),
358
+ sourceCss: rawSource,
359
+ sourceFile
360
+ } : void 0;
361
+ if (resolved.isMainChunk !== void 0) return {
362
+ ...resolved,
363
+ postcssOptions: {
364
+ ...resolved.postcssOptions,
365
+ options: {
366
+ ...resolved.postcssOptions?.options,
367
+ ...sourceFile ? { from: sourceFile } : {}
368
+ }
369
+ },
370
+ ...sourceOptions ? { sourceOptions } : {}
371
+ };
389
372
  return {
390
373
  ...resolved,
391
- isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType)
374
+ isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType),
375
+ postcssOptions: {
376
+ ...resolved.postcssOptions,
377
+ options: {
378
+ ...resolved.postcssOptions?.options,
379
+ ...sourceFile ? { from: sourceFile } : {}
380
+ }
381
+ },
382
+ ...sourceOptions ? { sourceOptions } : {}
392
383
  };
393
384
  }
394
385
  function resolveWxssUserHandlerOptions(options) {
@@ -425,27 +416,23 @@ function createPlugins(options = {}) {
425
416
  if (!file.contents) return;
426
417
  const rawSource = file.contents.toString();
427
418
  const cssSourceChanged = await registerAutoCssSource(file, rawSource);
428
- const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
429
- const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || require_v3_engine.hasTailwindRootDirectives(rawSource);
430
- const gulpV4SourceCandidates = shouldUseGenerator && runtimeState.twPatcher.majorVersion === 4 ? await refreshGulpV4SourceCandidates(cssSourceChanged) : void 0;
431
- let nextRuntimeSet = await refreshRuntimeSet({
419
+ const shouldUseGenerator = runtimeState.tailwindRuntime.majorVersion === 4;
420
+ let gulpSourceCandidateGetter;
421
+ if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
422
+ const nextRuntimeSet = await refreshRuntimeSet({
432
423
  forceRefresh: cssSourceChanged,
433
- forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
424
+ forceCollect: cssSourceChanged,
434
425
  clearCache: cssSourceChanged
435
426
  });
436
- if (runtimeState.twPatcher.majorVersion === 3 && isMainChunk && shouldUseGenerator) {
437
- const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
438
- if (sourceCandidates.size > 0) {
439
- nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
440
- runtimeSet = nextRuntimeSet;
441
- }
442
- }
443
427
  const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? require_hmr_timing.createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
444
428
  const sourceTraceSignature = require_hmr_timing.createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
429
+ const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
430
+ const styleOutputExtension = resolveGulpStyleOutputExtension(file);
431
+ const outputSignature = styleOutputExtension ? `gulp-output:1:${styleOutputExtension}` : "gulp-output:0";
445
432
  await require_hmr_timing.processCachedTask({
446
433
  cache,
447
434
  cacheKey: file.path,
448
- hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature),
435
+ hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
449
436
  applyResult(source) {
450
437
  file.contents = node_buffer.Buffer.from(source);
451
438
  },
@@ -454,8 +441,8 @@ function createPlugins(options = {}) {
454
441
  },
455
442
  async transform() {
456
443
  await runtimeState.readyPromise;
457
- const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
458
- const css = require_hmr_timing.annotateCssSourceTrace((shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
444
+ const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
445
+ const outputCss = require_hmr_timing.rewriteLocalCssImportRequestsForOutput(require_hmr_timing.annotateCssSourceTrace((shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
459
446
  opts,
460
447
  runtimeState,
461
448
  runtime: nextRuntimeSet,
@@ -463,15 +450,15 @@ function createPlugins(options = {}) {
463
450
  file: file.path,
464
451
  cssHandlerOptions,
465
452
  cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
466
- getSourceCandidatesForEntries: gulpV4SourceCandidates,
453
+ getSourceCandidatesForEntries: gulpSourceCandidateGetter,
467
454
  styleHandler,
468
455
  debug
469
456
  }) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
470
457
  opts,
471
458
  tokenSources: sourceTraceTokenSources
472
- });
459
+ }), { styleOutputExtension });
473
460
  debug("css handle: %s", file.path);
474
- return { result: css };
461
+ return { result: outputCss };
475
462
  }
476
463
  });
477
464
  rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
@@ -486,6 +473,7 @@ function createPlugins(options = {}) {
486
473
  const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
487
474
  const handlerOptions = {
488
475
  ...options,
476
+ generateMap: false,
489
477
  filename,
490
478
  moduleGraph,
491
479
  babelParserOptions: {
@@ -493,7 +481,7 @@ function createPlugins(options = {}) {
493
481
  sourceFilename: filename
494
482
  }
495
483
  };
496
- if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
484
+ if (runtimeState.tailwindRuntime.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.tailwindRuntime.majorVersion;
497
485
  await require_hmr_timing.processCachedTask({
498
486
  cache,
499
487
  cacheKey: file.path,
@@ -507,7 +495,7 @@ function createPlugins(options = {}) {
507
495
  async transform() {
508
496
  await runtimeState.readyPromise;
509
497
  const currentSource = file.contents?.toString() ?? rawSource;
510
- if (require_precheck.shouldSkipJsTransform(currentSource, {
498
+ if (require_context.shouldSkipJsTransform(currentSource, {
511
499
  ...handlerOptions,
512
500
  classNameSet: runtimeSet
513
501
  })) return { result: currentSource };
@@ -1,7 +1,7 @@
1
- import { A as normalizeTailwindSourceForGenerator, E as hasTailwindRootDirectives, J as getTailwindV4IncrementalGenerateCacheStats, O as normalizeTailwindConfigDirectives, a as getTailwindV3IncrementalGenerateCacheStats, at as createDebug, h as resolveViteSourceScanEntries, u as getRuntimeClassSetSignature } from "./v3-engine-DKBaKWGL.mjs";
2
- import { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-CsFr1q2l.mjs";
3
- import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-CK84uGBp.mjs";
4
- import { _ as createCssSourceTraceCacheSignature, a as createTailwindV3DefaultExtractor, b as processCachedTask, g as annotateCssSourceTrace, n as emitHmrTiming, o as createBundleRuntimeClassSetManager, r as createSourceCandidateCollector, s as generateCssByGenerator, v as createCssTokenSourceMap } from "./hmr-timing-DNjF8bWA.mjs";
1
+ import { C as hasTailwindRootDirectives, E as normalizeTailwindConfigDirectives, K as getTailwindV4IncrementalGenerateCacheStats, O as normalizeTailwindSourceForGenerator, o as hasConfiguredTailwindV4CssRoots, s as upsertTailwindV4CssSource } from "./v4-engine-CF9zt4Cw.mjs";
2
+ import { c as shouldSkipJsTransform, t as getCompilerContext, v as createTailwindRuntimeReadyPromise, x as createDebug, y as ensureRuntimeClassSet } from "./context-Mbzkek1q.mjs";
3
+ import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-wyUHrfil.mjs";
4
+ import { F as processCachedTask, M as createCssSourceTraceCacheSignature, N as createCssTokenSourceMap, j as annotateCssSourceTrace, n as emitHmrTiming, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, u as generateCssByGenerator, v as rewriteLocalCssImportRequestsForOutput, y as splitLocalCssImports } from "./hmr-timing-BXMLsF4b.mjs";
5
5
  import fs from "node:fs";
6
6
  import path from "node:path";
7
7
  import process from "node:process";
@@ -182,10 +182,7 @@ function resolveGulpMemoryDebugStats(context) {
182
182
  maxCacheKeys: GULP_PROCESS_CACHE_MAX
183
183
  },
184
184
  gulpOptions: { defaultStyleHandlerOptions: context.defaultStyleHandlerOptionsCache.size },
185
- tailwind: {
186
- v3: getTailwindV3IncrementalGenerateCacheStats(),
187
- v4: getTailwindV4IncrementalGenerateCacheStats()
188
- }
185
+ tailwind: { v4: getTailwindV4IncrementalGenerateCacheStats() }
189
186
  };
190
187
  }
191
188
  /**
@@ -199,13 +196,15 @@ function createPlugins(options = {}) {
199
196
  ...options,
200
197
  __internalDeferMissingCssEntriesWarning: true
201
198
  });
202
- const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
203
- const readyPromise = createTailwindRuntimeReadyPromise(initialTwPatcher);
199
+ const { templateHandler, styleHandler, jsHandler, cache } = opts;
200
+ const initialTailwindRuntime = opts.tailwindRuntime;
201
+ const refreshTailwindcssRuntime = opts.refreshTailwindcssRuntime;
202
+ const readyPromise = createTailwindRuntimeReadyPromise(initialTailwindRuntime);
204
203
  let runtimeSet = /* @__PURE__ */ new Set();
205
204
  const runtimeState = {
206
- twPatcher: initialTwPatcher,
205
+ tailwindRuntime: initialTailwindRuntime,
207
206
  readyPromise,
208
- refreshTailwindcssPatcher
207
+ refreshTailwindcssRuntime
209
208
  };
210
209
  const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
211
210
  let cachedDefaultTemplateHandlerOptions;
@@ -217,13 +216,10 @@ function createPlugins(options = {}) {
217
216
  let runtimeSetDirty = false;
218
217
  const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
219
218
  const runtimeSourcesByFile = /* @__PURE__ */ new Map();
220
- let cachedGulpSourceCandidates;
221
219
  let cachedGulpSourceCandidateSignature;
222
220
  const gulpProcessCacheKeys = /* @__PURE__ */ new Set();
223
- const sourceCandidateExtractor = initialTwPatcher.majorVersion === 3 ? createTailwindV3DefaultExtractor() : void 0;
224
221
  const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? createBundleRuntimeClassSetManager();
225
222
  function invalidateGulpSourceCandidates() {
226
- cachedGulpSourceCandidates = void 0;
227
223
  cachedGulpSourceCandidateSignature = void 0;
228
224
  cachedGulpSourceCandidateGetter = void 0;
229
225
  cachedGulpSourceCandidateSourceGetter = void 0;
@@ -259,10 +255,10 @@ function createPlugins(options = {}) {
259
255
  type
260
256
  });
261
257
  pruneGulpRuntimeSourceCaches(runtimeSourceHashByFile, runtimeSourcesByFile);
262
- if (changed && runtimeState.twPatcher.majorVersion === 4) invalidateGulpSourceCandidates();
258
+ if (changed) invalidateGulpSourceCandidates();
263
259
  if (!changed && runtimeSetInitialized) return runtimeSet;
264
- if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
265
- runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
260
+ if (!runtimeSetDirty) try {
261
+ runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.tailwindRuntime, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
266
262
  runtimeSetInitialized = true;
267
263
  return runtimeSet;
268
264
  } catch (error) {
@@ -271,44 +267,9 @@ function createPlugins(options = {}) {
271
267
  }
272
268
  return refreshRuntimeSet({ forceCollect: true });
273
269
  }
274
- async function refreshGulpSourceCandidates(forceRefresh = false) {
275
- if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
276
- const root = opts.tailwindcssBasedir ?? process.cwd();
277
- const sourceScan = await resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
278
- const nextSignature = cache.computeHash(JSON.stringify({
279
- root,
280
- entries: sourceScan?.entries,
281
- inlineCandidates: sourceScan?.inlineCandidates ? {
282
- included: [...sourceScan.inlineCandidates.included].sort(),
283
- excluded: [...sourceScan.inlineCandidates.excluded].sort()
284
- } : void 0,
285
- explicit: sourceScan?.explicit ?? false,
286
- dependencies: [...sourceScan?.dependencies ?? []].sort()
287
- }));
288
- if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
289
- const collector = createSourceCandidateCollector({
290
- bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
291
- extractor: sourceCandidateExtractor
292
- });
293
- await collector.scanRoot({
294
- entries: sourceScan?.entries,
295
- root
296
- });
297
- collector.syncInline(sourceScan?.inlineCandidates);
298
- cachedGulpSourceCandidateSignature = nextSignature;
299
- cachedGulpSourceCandidateGetter = (entries) => collector.valuesForEntries(entries);
300
- cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
301
- cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
302
- return cachedGulpSourceCandidates;
303
- }
304
270
  async function refreshGulpV4SourceCandidates(forceRefresh = false) {
305
- if (runtimeState.twPatcher.majorVersion !== 4) {
306
- cachedGulpSourceCandidateGetter = void 0;
307
- cachedGulpSourceCandidateSourceGetter = void 0;
308
- return;
309
- }
310
271
  const root = opts.tailwindcssBasedir ?? process.cwd();
311
- const sourceScan = await resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
272
+ const sourceScan = await resolveViteSourceScanEntries(opts, runtimeState.tailwindRuntime, { root });
312
273
  const nextSignature = cache.computeHash(JSON.stringify({
313
274
  root,
314
275
  entries: sourceScan?.entries,
@@ -332,22 +293,25 @@ function createPlugins(options = {}) {
332
293
  cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
333
294
  return cachedGulpSourceCandidateGetter;
334
295
  }
335
- function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature) {
296
+ function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature) {
336
297
  return cache.computeHash([
337
298
  rawSource,
338
- getRuntimeClassSetSignature(runtimeState.twPatcher),
299
+ getRuntimeClassSetSignature(runtimeState.tailwindRuntime),
339
300
  [...nextRuntimeSet].sort().join("\n"),
340
- sourceTraceSignature ?? "css-source-trace:0"
301
+ sourceTraceSignature ?? "css-source-trace:0",
302
+ sourceCandidateSignature ?? "gulp-source-candidates:0",
303
+ outputSignature ?? "gulp-output:0"
341
304
  ].join("\n\n"));
342
305
  }
343
306
  async function registerAutoCssSource(file, rawSource) {
344
- if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !hasTailwindRootDirectives(rawSource)) return false;
307
+ if (hasInitialTailwindCssRoots || (runtimeState.tailwindRuntime.majorVersion ?? 0) < 4 || !file.path || !hasTailwindRootDirectives(rawSource)) return false;
345
308
  const sourceFile = path.resolve(file.path);
346
309
  const sourceCss = normalizeTailwindSourceForGenerator(normalizeTailwindConfigDirectives(rawSource, path.dirname(sourceFile)), { importFallback: true });
310
+ const generatorSourceCss = splitLocalCssImports(sourceCss)?.source ?? sourceCss;
347
311
  if (!upsertTailwindV4CssSource(opts, {
348
312
  file: sourceFile,
349
313
  base: path.dirname(sourceFile),
350
- css: sourceCss
314
+ css: generatorSourceCss
351
315
  })) return false;
352
316
  runtimeSetInitialized = false;
353
317
  runtimeSetDirty = true;
@@ -361,29 +325,56 @@ function createPlugins(options = {}) {
361
325
  return cachedDefaultModuleGraphOptions;
362
326
  }
363
327
  function resolveWxssHandlerOptions(options) {
364
- const majorVersion = runtimeState.twPatcher.majorVersion ?? "unknown";
328
+ const majorVersion = runtimeState.tailwindRuntime.majorVersion ?? "unknown";
365
329
  if (!options || Object.keys(options).length === 0) {
366
330
  let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
367
331
  if (!cached) {
368
- cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
332
+ cached = runtimeState.tailwindRuntime.majorVersion === void 0 ? {} : { majorVersion: runtimeState.tailwindRuntime.majorVersion };
369
333
  defaultStyleHandlerOptionsCache.set(majorVersion, cached);
370
334
  }
371
335
  return cached;
372
336
  }
373
- return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
374
- majorVersion: runtimeState.twPatcher.majorVersion,
337
+ return runtimeState.tailwindRuntime.majorVersion === void 0 ? { ...options } : {
338
+ majorVersion: runtimeState.tailwindRuntime.majorVersion,
375
339
  ...options
376
340
  };
377
341
  }
342
+ function resolveGulpStyleOutputExtension(file) {
343
+ return typeof opts.cssMatcher === "function" && opts.cssMatcher(path.basename(file.path)) ? path.extname(file.path) : void 0;
344
+ }
378
345
  function resolveGulpMatcherName(file) {
379
346
  return (file.relative || path.basename(file.path)).replaceAll(path.sep, "/");
380
347
  }
381
- function resolveWxssFileHandlerOptions(file, options) {
348
+ function resolveWxssFileHandlerOptions(file, rawSource, options) {
382
349
  const resolved = resolveWxssHandlerOptions(options);
383
- if (resolved.isMainChunk !== void 0) return resolved;
350
+ const sourceFile = file.path ? path.resolve(file.path) : void 0;
351
+ const sourceOptions = sourceFile ? {
352
+ outputRoot: path.resolve(file.cwd ?? process.cwd()),
353
+ sourceCss: rawSource,
354
+ sourceFile
355
+ } : void 0;
356
+ if (resolved.isMainChunk !== void 0) return {
357
+ ...resolved,
358
+ postcssOptions: {
359
+ ...resolved.postcssOptions,
360
+ options: {
361
+ ...resolved.postcssOptions?.options,
362
+ ...sourceFile ? { from: sourceFile } : {}
363
+ }
364
+ },
365
+ ...sourceOptions ? { sourceOptions } : {}
366
+ };
384
367
  return {
385
368
  ...resolved,
386
- isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType)
369
+ isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType),
370
+ postcssOptions: {
371
+ ...resolved.postcssOptions,
372
+ options: {
373
+ ...resolved.postcssOptions?.options,
374
+ ...sourceFile ? { from: sourceFile } : {}
375
+ }
376
+ },
377
+ ...sourceOptions ? { sourceOptions } : {}
387
378
  };
388
379
  }
389
380
  function resolveWxssUserHandlerOptions(options) {
@@ -420,27 +411,23 @@ function createPlugins(options = {}) {
420
411
  if (!file.contents) return;
421
412
  const rawSource = file.contents.toString();
422
413
  const cssSourceChanged = await registerAutoCssSource(file, rawSource);
423
- const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
424
- const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || hasTailwindRootDirectives(rawSource);
425
- const gulpV4SourceCandidates = shouldUseGenerator && runtimeState.twPatcher.majorVersion === 4 ? await refreshGulpV4SourceCandidates(cssSourceChanged) : void 0;
426
- let nextRuntimeSet = await refreshRuntimeSet({
414
+ const shouldUseGenerator = runtimeState.tailwindRuntime.majorVersion === 4;
415
+ let gulpSourceCandidateGetter;
416
+ if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
417
+ const nextRuntimeSet = await refreshRuntimeSet({
427
418
  forceRefresh: cssSourceChanged,
428
- forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
419
+ forceCollect: cssSourceChanged,
429
420
  clearCache: cssSourceChanged
430
421
  });
431
- if (runtimeState.twPatcher.majorVersion === 3 && isMainChunk && shouldUseGenerator) {
432
- const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
433
- if (sourceCandidates.size > 0) {
434
- nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
435
- runtimeSet = nextRuntimeSet;
436
- }
437
- }
438
422
  const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
439
423
  const sourceTraceSignature = createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
424
+ const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
425
+ const styleOutputExtension = resolveGulpStyleOutputExtension(file);
426
+ const outputSignature = styleOutputExtension ? `gulp-output:1:${styleOutputExtension}` : "gulp-output:0";
440
427
  await processCachedTask({
441
428
  cache,
442
429
  cacheKey: file.path,
443
- hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature),
430
+ hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
444
431
  applyResult(source) {
445
432
  file.contents = Buffer.from(source);
446
433
  },
@@ -449,8 +436,8 @@ function createPlugins(options = {}) {
449
436
  },
450
437
  async transform() {
451
438
  await runtimeState.readyPromise;
452
- const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
453
- const css = annotateCssSourceTrace((shouldUseGenerator ? await generateCssByGenerator({
439
+ const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
440
+ const outputCss = rewriteLocalCssImportRequestsForOutput(annotateCssSourceTrace((shouldUseGenerator ? await generateCssByGenerator({
454
441
  opts,
455
442
  runtimeState,
456
443
  runtime: nextRuntimeSet,
@@ -458,15 +445,15 @@ function createPlugins(options = {}) {
458
445
  file: file.path,
459
446
  cssHandlerOptions,
460
447
  cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
461
- getSourceCandidatesForEntries: gulpV4SourceCandidates,
448
+ getSourceCandidatesForEntries: gulpSourceCandidateGetter,
462
449
  styleHandler,
463
450
  debug
464
451
  }) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
465
452
  opts,
466
453
  tokenSources: sourceTraceTokenSources
467
- });
454
+ }), { styleOutputExtension });
468
455
  debug("css handle: %s", file.path);
469
- return { result: css };
456
+ return { result: outputCss };
470
457
  }
471
458
  });
472
459
  rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
@@ -481,6 +468,7 @@ function createPlugins(options = {}) {
481
468
  const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
482
469
  const handlerOptions = {
483
470
  ...options,
471
+ generateMap: false,
484
472
  filename,
485
473
  moduleGraph,
486
474
  babelParserOptions: {
@@ -488,7 +476,7 @@ function createPlugins(options = {}) {
488
476
  sourceFilename: filename
489
477
  }
490
478
  };
491
- if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
479
+ if (runtimeState.tailwindRuntime.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.tailwindRuntime.majorVersion;
492
480
  await processCachedTask({
493
481
  cache,
494
482
  cacheKey: file.path,
package/dist/gulp.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_gulp = require("./gulp-CxGZU0-v.js");
2
+ const require_gulp = require("./gulp-B_sdP6dx.js");
3
3
  exports.WeappTailwindcss = require_gulp.createPlugins;
4
4
  exports.createPlugins = require_gulp.createPlugins;
5
5
  exports.weappTailwindcss = require_gulp.createPlugins;
package/dist/gulp.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as createPlugins } from "./gulp-BfZpaYSQ.mjs";
1
+ import { t as createPlugins } from "./gulp-uM36oIJs.mjs";
2
2
  export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };