weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.20

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 (220) hide show
  1. package/README.md +6 -7
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/bundle-state-BlXvU4jl.js +530 -0
  4. package/dist/bundle-state-PO6MysTJ.mjs +414 -0
  5. package/dist/bundlers/shared/cache.d.ts +6 -6
  6. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
  7. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
  8. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +5 -0
  9. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  10. package/dist/bundlers/shared/css-cleanup.d.ts +7 -3
  11. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  12. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  13. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  14. package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
  15. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  16. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  17. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  18. package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
  19. package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
  20. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
  21. package/dist/bundlers/shared/generator-css.d.ts +16 -22
  22. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  23. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  24. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  25. package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
  26. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  27. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
  28. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
  29. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  30. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  31. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  32. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  33. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  34. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  35. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  36. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  37. package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
  38. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
  39. package/dist/bundlers/vite/index.d.ts +1 -1
  40. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  41. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  42. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  43. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
  44. package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
  45. package/dist/bundlers/vite/source-candidates.d.ts +16 -1
  46. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  47. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  48. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  49. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  50. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
  51. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
  52. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
  53. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  54. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
  55. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  56. package/dist/cache/index.d.ts +6 -6
  57. package/dist/cli/context.d.ts +1 -14
  58. package/dist/cli/doctor/types.d.ts +11 -11
  59. package/dist/cli/helpers.d.ts +1 -2
  60. package/dist/cli/mount-options.d.ts +2 -0
  61. package/dist/cli/types.d.ts +0 -2
  62. package/dist/cli/vscode-entry.d.ts +3 -3
  63. package/dist/cli.js +605 -611
  64. package/dist/cli.mjs +614 -620
  65. package/dist/constants.d.ts +1 -2
  66. package/dist/core.js +13 -20
  67. package/dist/core.mjs +8 -14
  68. package/dist/css-macro/postcss.js +3 -2
  69. package/dist/css-macro/postcss.mjs +3 -2
  70. package/dist/css-macro.d.ts +1 -0
  71. package/dist/css-macro.js +2 -2
  72. package/dist/css-macro.mjs +2 -2
  73. package/dist/defaults-B1igPF_e.mjs +150 -0
  74. package/dist/defaults-IHhYxNeU.js +193 -0
  75. package/dist/defaults.d.ts +15 -1
  76. package/dist/defaults.js +6 -131
  77. package/dist/defaults.mjs +2 -129
  78. package/dist/escape.js +10 -2
  79. package/dist/escape.mjs +10 -2
  80. package/dist/generator/index.d.ts +1 -1
  81. package/dist/generator/options.d.ts +9 -8
  82. package/dist/generator/types.d.ts +3 -3
  83. package/dist/generator-DIuglJub.mjs +32 -0
  84. package/dist/generator-N4jy1HCk.js +55 -0
  85. package/dist/generator.js +12 -11
  86. package/dist/generator.mjs +2 -1
  87. package/dist/gulp.js +185 -47
  88. package/dist/gulp.mjs +179 -41
  89. package/dist/incremental-runtime-class-set-CJ0Pnsw2.js +2348 -0
  90. package/dist/incremental-runtime-class-set-hF-uiw6W.mjs +2285 -0
  91. package/dist/index.d.ts +1 -1
  92. package/dist/index.js +6 -6
  93. package/dist/index.mjs +5 -5
  94. package/dist/js/babel/cache-options.d.ts +3 -0
  95. package/dist/js/babel/parse.d.ts +7 -4
  96. package/dist/js/index.d.ts +1 -0
  97. package/dist/js/literal-transform.d.ts +2 -0
  98. package/dist/js/precheck.d.ts +2 -2
  99. package/dist/lightningcss/style-handler/selector-transform.d.ts +1 -1
  100. package/dist/lightningcss/style-handler.d.ts +3 -3
  101. package/dist/logger-CZUxvJJD.mjs +2 -0
  102. package/dist/logger-EVNB9z7i.js +1 -0
  103. package/dist/postcss/config-directive.d.ts +1 -0
  104. package/dist/postcss/context.d.ts +9 -0
  105. package/dist/postcss/source-files.d.ts +8 -0
  106. package/dist/postcss/tailwind-version.d.ts +3 -0
  107. package/dist/postcss-D4UdbBQ6.mjs +228 -0
  108. package/dist/postcss-DlY-YRvA.js +237 -0
  109. package/dist/postcss.d.ts +2 -2
  110. package/dist/postcss.js +3 -276
  111. package/dist/postcss.mjs +1 -269
  112. package/dist/{recorder-gYSNLfOP.js → precheck-BjEbVEpX.js} +218 -314
  113. package/dist/{recorder-zsgatmkB.mjs → precheck-tbk626YL.mjs} +186 -281
  114. package/dist/presets.js +13 -11
  115. package/dist/presets.mjs +11 -9
  116. package/dist/reset.d.ts +1 -0
  117. package/dist/runtime-registry-D5qnaSpo.js +5516 -0
  118. package/dist/shared/mpx.d.ts +1 -0
  119. package/dist/source-candidates-BrvneDDd.mjs +209 -0
  120. package/dist/source-candidates-gxijpPI3.js +222 -0
  121. package/dist/tailwindcss/miniprogram.d.ts +5 -1
  122. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  123. package/dist/tailwindcss/patcher.d.ts +1 -2
  124. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  125. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  126. package/dist/tailwindcss/runtime.d.ts +11 -12
  127. package/dist/tailwindcss/source-scan.d.ts +35 -0
  128. package/dist/tailwindcss/targets.d.ts +1 -5
  129. package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
  130. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  131. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  132. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  133. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  134. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  135. package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
  136. package/dist/tailwindcss/version.d.ts +4 -0
  137. package/dist/tailwindcss-BhG7BtB-.js +651 -0
  138. package/dist/tailwindcss-c6ROlNNW.mjs +600 -0
  139. package/dist/typedoc.export.d.ts +0 -2
  140. package/dist/types/index.d.ts +51 -48
  141. package/dist/types/shared.d.ts +3 -0
  142. package/dist/types/user-defined-options/general.d.ts +23 -23
  143. package/dist/types/user-defined-options/important.d.ts +31 -28
  144. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  145. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  146. package/dist/uni-app-x/vite.d.ts +1 -1
  147. package/dist/utils/disabled.d.ts +2 -3
  148. package/dist/utils/object.d.ts +9 -0
  149. package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
  150. package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
  151. package/dist/v3-engine-5LoZUH-4.js +3695 -0
  152. package/dist/v3-engine-DIXDEDmL.mjs +3406 -0
  153. package/dist/{vite-CrlzCNqz.mjs → vite-B5faZcbE.mjs} +1256 -1088
  154. package/dist/vite-MyXBNux0.js +2368 -0
  155. package/dist/vite.d.ts +1 -2
  156. package/dist/vite.js +3 -4
  157. package/dist/vite.mjs +2 -2
  158. package/dist/weapp-tw-css-import-rewrite-loader.js +5157 -16
  159. package/dist/weapp-tw-runtime-classset-loader.js +32 -7
  160. package/dist/webpack-BnVyDmsD.mjs +836 -0
  161. package/dist/webpack-Mz1V0A9p.js +846 -0
  162. package/dist/webpack.js +1 -1
  163. package/dist/webpack.mjs +1 -1
  164. package/package.json +27 -37
  165. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  166. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  167. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  168. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  169. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  170. package/dist/cli/config.d.ts +0 -5
  171. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  172. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  173. package/dist/cli/patch-options.d.ts +0 -6
  174. package/dist/cli/tokens.d.ts +0 -4
  175. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  176. package/dist/cli/workspace/patch-package.d.ts +0 -3
  177. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  178. package/dist/cli/workspace/types.d.ts +0 -11
  179. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  180. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  181. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  182. package/dist/cli/workspace.d.ts +0 -2
  183. package/dist/css-imports-BbrbluP9.js +0 -177
  184. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  185. package/dist/experimental/index.d.ts +0 -2
  186. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  187. package/dist/experimental/oxc/index.d.ts +0 -2
  188. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  189. package/dist/experimental/shared/cache.d.ts +0 -3
  190. package/dist/experimental/shared/transform.d.ts +0 -3
  191. package/dist/experimental/shared.d.ts +0 -8
  192. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  193. package/dist/experimental/swc/index.d.ts +0 -2
  194. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  195. package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
  196. package/dist/generator-css-B5ejWUMv.mjs +0 -1098
  197. package/dist/generator-css-D3OdPRiS.js +0 -1125
  198. package/dist/generator-mmhXzZnv.js +0 -1276
  199. package/dist/js/syntax.d.ts +0 -10
  200. package/dist/loader-anchors-CNkWT8hx.js +0 -273
  201. package/dist/loader-anchors-TrU7EUr7.mjs +0 -205
  202. package/dist/logger-BZ45DZJT.js +0 -1003
  203. package/dist/logger-BoVx1Dbt.mjs +0 -935
  204. package/dist/patcher-options-6gJN2EXy.js +0 -115
  205. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  206. package/dist/tailwindcss/recorder.d.ts +0 -13
  207. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  208. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  209. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  210. package/dist/tailwindcss/targets/types.d.ts +0 -35
  211. package/dist/types/disabled-options.d.ts +0 -4
  212. package/dist/vite-BC9U7ahn.js +0 -2199
  213. package/dist/webpack-Bu6M-Hbw.mjs +0 -441
  214. package/dist/webpack-DD7A6V0u.js +0 -456
  215. package/dist/webpack4.d.ts +0 -4
  216. package/dist/webpack4.js +0 -387
  217. package/dist/webpack4.mjs +0 -379
  218. package/scripts/postinstall.mjs +0 -59
  219. /package/dist/{constants-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
  220. /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
package/dist/gulp.js CHANGED
@@ -1,18 +1,21 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-8l464Juk.js");
3
- const require_recorder = require("./recorder-gYSNLfOP.js");
4
- const require_generator_css = require("./generator-css-D3OdPRiS.js");
3
+ const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
4
+ const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CJ0Pnsw2.js");
5
+ const require_precheck = require("./precheck-BjEbVEpX.js");
6
+ const require_tailwindcss = require("./tailwindcss-BhG7BtB-.js");
7
+ const require_source_candidates = require("./source-candidates-gxijpPI3.js");
8
+ let node_fs = require("node:fs");
9
+ node_fs = require_chunk.__toESM(node_fs);
5
10
  let node_path = require("node:path");
6
11
  node_path = require_chunk.__toESM(node_path);
7
12
  let node_process = require("node:process");
8
13
  node_process = require_chunk.__toESM(node_process);
9
14
  let node_buffer = require("node:buffer");
10
- let node_fs = require("node:fs");
11
- node_fs = require_chunk.__toESM(node_fs);
12
15
  let node_stream = require("node:stream");
13
16
  node_stream = require_chunk.__toESM(node_stream);
14
17
  //#region src/bundlers/gulp/index.ts
15
- const debug = require_recorder.createDebug();
18
+ const debug = require_v3_engine.createDebug();
16
19
  const Transform = node_stream.default.Transform;
17
20
  /**
18
21
  * @name weapp-tw-gulp
@@ -20,19 +23,18 @@ const Transform = node_stream.default.Transform;
20
23
  * @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
21
24
  */
22
25
  function createPlugins(options = {}) {
23
- const opts = require_recorder.getCompilerContext(options);
24
- const hasExplicitGeneratorOptions = options.generator !== void 0;
25
- const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
26
- const patchRecorderState = require_recorder.setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
27
- source: "runtime",
28
- cwd: opts.tailwindcssBasedir ?? node_process.default.cwd()
26
+ const hasInitialTailwindCssRoots = require_tailwindcss.hasConfiguredTailwindV4CssRoots(options);
27
+ const opts = require_precheck.getCompilerContext({
28
+ ...options,
29
+ __internalDeferMissingCssEntriesWarning: true
29
30
  });
31
+ const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
32
+ const readyPromise = require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher);
30
33
  let runtimeSet = /* @__PURE__ */ new Set();
31
34
  const runtimeState = {
32
35
  twPatcher: initialTwPatcher,
33
- patchPromise: patchRecorderState.patchPromise,
34
- refreshTailwindcssPatcher,
35
- onPatchCompleted: patchRecorderState.onPatchCompleted
36
+ readyPromise,
37
+ refreshTailwindcssPatcher
36
38
  };
37
39
  const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
38
40
  let cachedDefaultTemplateHandlerOptions;
@@ -47,20 +49,138 @@ function createPlugins(options = {}) {
47
49
  ".jsx"
48
50
  ];
49
51
  let runtimeSetInitialized = false;
50
- async function refreshRuntimeState(force) {
51
- await require_recorder.refreshTailwindRuntimeState(runtimeState, force);
52
- }
53
- async function refreshRuntimeSet(force = false) {
54
- if (!force && runtimeSetInitialized) return runtimeSet;
55
- runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, {
56
- forceRefresh: force,
57
- forceCollect: force,
58
- clearCache: force,
52
+ let runtimeSetDirty = false;
53
+ const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
54
+ const runtimeSourcesByFile = /* @__PURE__ */ new Map();
55
+ let cachedGulpSourceCandidates;
56
+ let cachedGulpSourceCandidateSignature;
57
+ const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? require_incremental_runtime_class_set.createBundleRuntimeClassSetManager();
58
+ async function refreshRuntimeSet(options = false) {
59
+ const normalizedOptions = typeof options === "boolean" ? {
60
+ forceRefresh: options,
61
+ forceCollect: options,
62
+ clearCache: options
63
+ } : options;
64
+ const forceRefresh = normalizedOptions.forceRefresh === true;
65
+ const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
66
+ const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
67
+ if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
68
+ runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
69
+ forceRefresh,
70
+ forceCollect: shouldForceCollect,
71
+ clearCache,
59
72
  allowEmpty: false
60
73
  });
61
74
  runtimeSetInitialized = true;
75
+ runtimeSetDirty = false;
62
76
  return runtimeSet;
63
77
  }
78
+ function createRuntimeSnapshot(changedFiles) {
79
+ const runtimeAffectingChangedByType = {
80
+ html: /* @__PURE__ */ new Set(),
81
+ js: /* @__PURE__ */ new Set(),
82
+ css: /* @__PURE__ */ new Set(),
83
+ other: /* @__PURE__ */ new Set()
84
+ };
85
+ for (const file of changedFiles) {
86
+ const entry = runtimeSourcesByFile.get(file);
87
+ if (entry) runtimeAffectingChangedByType[entry.type].add(file);
88
+ }
89
+ return {
90
+ entries: [...runtimeSourcesByFile.entries()].map(([file, entry]) => ({
91
+ file,
92
+ output: {
93
+ fileName: file,
94
+ source: entry.source,
95
+ type: "asset"
96
+ },
97
+ source: entry.source,
98
+ type: entry.type
99
+ })),
100
+ jsEntries: /* @__PURE__ */ new Map(),
101
+ sourceHashByFile: /* @__PURE__ */ new Map(),
102
+ runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
103
+ runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
104
+ changedByType: {
105
+ html: /* @__PURE__ */ new Set(),
106
+ js: /* @__PURE__ */ new Set(),
107
+ css: /* @__PURE__ */ new Set(),
108
+ other: /* @__PURE__ */ new Set()
109
+ },
110
+ runtimeAffectingChangedByType,
111
+ processFiles: {
112
+ html: /* @__PURE__ */ new Set(),
113
+ js: /* @__PURE__ */ new Set(),
114
+ css: /* @__PURE__ */ new Set()
115
+ },
116
+ linkedImpactsByEntry: /* @__PURE__ */ new Map()
117
+ };
118
+ }
119
+ async function refreshRuntimeSetForSource(file, rawSource, type) {
120
+ const filename = node_path.default.resolve(file.path);
121
+ const hash = cache.computeHash(rawSource);
122
+ const changed = runtimeSourceHashByFile.get(filename) !== hash;
123
+ runtimeSourceHashByFile.set(filename, hash);
124
+ runtimeSourcesByFile.set(filename, {
125
+ source: rawSource,
126
+ type
127
+ });
128
+ if (!changed && runtimeSetInitialized) return runtimeSet;
129
+ if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
130
+ runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createRuntimeSnapshot([filename]));
131
+ runtimeSetInitialized = true;
132
+ return runtimeSet;
133
+ } catch (error) {
134
+ debug("gulp incremental runtime set sync failed, fallback to collect: %O", error);
135
+ await bundleRuntimeClassSetManager.reset();
136
+ }
137
+ return refreshRuntimeSet({ forceCollect: true });
138
+ }
139
+ async function refreshGulpSourceCandidates(forceRefresh = false) {
140
+ if (runtimeState.twPatcher.majorVersion !== 3) return /* @__PURE__ */ new Set();
141
+ const root = opts.tailwindcssBasedir ?? node_process.default.cwd();
142
+ const sourceScan = await require_v3_engine.resolveViteSourceScanEntries(opts, runtimeState.twPatcher, { root });
143
+ const nextSignature = cache.computeHash(JSON.stringify({
144
+ root,
145
+ entries: sourceScan?.entries,
146
+ inlineCandidates: sourceScan?.inlineCandidates ? {
147
+ included: [...sourceScan.inlineCandidates.included].sort(),
148
+ excluded: [...sourceScan.inlineCandidates.excluded].sort()
149
+ } : void 0,
150
+ explicit: sourceScan?.explicit ?? false,
151
+ dependencies: [...sourceScan?.dependencies ?? []].sort()
152
+ }));
153
+ if (!forceRefresh && cachedGulpSourceCandidateSignature === nextSignature && cachedGulpSourceCandidates) return cachedGulpSourceCandidates;
154
+ const collector = require_source_candidates.createSourceCandidateCollector();
155
+ await collector.scanRoot({
156
+ entries: sourceScan?.entries,
157
+ root
158
+ });
159
+ collector.syncInline(sourceScan?.inlineCandidates);
160
+ cachedGulpSourceCandidateSignature = nextSignature;
161
+ cachedGulpSourceCandidates = sourceScan?.entries ? collector.valuesForEntries(sourceScan.entries) : collector.values();
162
+ return cachedGulpSourceCandidates;
163
+ }
164
+ function createRuntimeSetHash(rawSource, nextRuntimeSet) {
165
+ return cache.computeHash([
166
+ rawSource,
167
+ require_v3_engine.getRuntimeClassSetSignature(runtimeState.twPatcher),
168
+ [...nextRuntimeSet].sort().join("\n")
169
+ ].join("\n\n"));
170
+ }
171
+ async function registerAutoCssSource(file, rawSource) {
172
+ if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !require_incremental_runtime_class_set.hasTailwindRootDirectives(rawSource)) return false;
173
+ const sourceCss = require_incremental_runtime_class_set.normalizeTailwindSourceForGenerator(rawSource, { importFallback: true });
174
+ if (!require_tailwindcss.upsertTailwindV4CssSource(opts, {
175
+ file: node_path.default.resolve(file.path),
176
+ css: sourceCss
177
+ })) return false;
178
+ runtimeSetInitialized = false;
179
+ runtimeSetDirty = true;
180
+ await bundleRuntimeClassSetManager.reset();
181
+ debug("detected tailwindcss v4 css source from gulp css file: %s", file.path);
182
+ return true;
183
+ }
64
184
  function resolveWithExtensions(base) {
65
185
  for (const ext of MODULE_EXTENSIONS) {
66
186
  const candidate = `${base}${ext}`;
@@ -107,12 +227,14 @@ function createPlugins(options = {}) {
107
227
  if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
108
228
  return cachedDefaultModuleGraphOptions;
109
229
  }
110
- function createVinylTransform(handler) {
230
+ function createVinylTransform(phase, handler) {
111
231
  return new Transform({
112
232
  objectMode: true,
113
233
  async transform(file, _encoding, callback) {
234
+ const hmrTimingStartedAt = performance.now();
114
235
  try {
115
236
  await handler(file);
237
+ require_incremental_runtime_class_set.emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, { file: file.relative || node_path.default.basename(file.path) });
116
238
  callback(null, file);
117
239
  } catch (error) {
118
240
  callback(error, file);
@@ -125,12 +247,12 @@ function createPlugins(options = {}) {
125
247
  if (!options || Object.keys(options).length === 0) {
126
248
  let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
127
249
  if (!cached) {
128
- cached = { majorVersion: runtimeState.twPatcher.majorVersion };
250
+ cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
129
251
  defaultStyleHandlerOptionsCache.set(majorVersion, cached);
130
252
  }
131
253
  return cached;
132
254
  }
133
- return {
255
+ return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
134
256
  majorVersion: runtimeState.twPatcher.majorVersion,
135
257
  ...options
136
258
  };
@@ -165,15 +287,28 @@ function createPlugins(options = {}) {
165
287
  ...options
166
288
  };
167
289
  }
168
- const transformWxss = (options = {}) => createVinylTransform(async (file) => {
290
+ const transformWxss = (options = {}) => createVinylTransform("css", async (file) => {
169
291
  if (!file.contents) return;
170
- await refreshRuntimeState(true);
171
- await runtimeState.patchPromise;
172
292
  const rawSource = file.contents.toString();
173
- await require_generator_css.processCachedTask({
293
+ const cssSourceChanged = await registerAutoCssSource(file, rawSource);
294
+ const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
295
+ const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || require_incremental_runtime_class_set.hasTailwindRootDirectives(rawSource);
296
+ let nextRuntimeSet = await refreshRuntimeSet({
297
+ forceRefresh: cssSourceChanged,
298
+ forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
299
+ clearCache: cssSourceChanged
300
+ });
301
+ if (runtimeState.twPatcher.majorVersion === 3 && isMainChunk && shouldUseGenerator) {
302
+ const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
303
+ if (sourceCandidates.size > 0) {
304
+ nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
305
+ runtimeSet = nextRuntimeSet;
306
+ }
307
+ }
308
+ await require_incremental_runtime_class_set.processCachedTask({
174
309
  cache,
175
310
  cacheKey: file.path,
176
- rawSource,
311
+ hash: createRuntimeSetHash(rawSource, nextRuntimeSet),
177
312
  applyResult(source) {
178
313
  file.contents = node_buffer.Buffer.from(source);
179
314
  },
@@ -181,12 +316,12 @@ function createPlugins(options = {}) {
181
316
  debug("css cache hit: %s", file.path);
182
317
  },
183
318
  async transform() {
184
- await runtimeState.patchPromise;
319
+ await runtimeState.readyPromise;
185
320
  const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
186
- const css = (hasExplicitGeneratorOptions ? await require_generator_css.generateCssByGenerator({
321
+ const css = (shouldUseGenerator ? await require_incremental_runtime_class_set.generateCssByGenerator({
187
322
  opts,
188
323
  runtimeState,
189
- runtime: await refreshRuntimeSet(false),
324
+ runtime: nextRuntimeSet,
190
325
  rawSource,
191
326
  file: file.path,
192
327
  cssHandlerOptions,
@@ -199,24 +334,24 @@ function createPlugins(options = {}) {
199
334
  }
200
335
  });
201
336
  });
202
- const transformJs = (options = {}) => createVinylTransform(async (file) => {
337
+ const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
203
338
  if (!file.contents) return;
204
- await refreshRuntimeSet(false);
205
- await runtimeState.patchPromise;
206
339
  const filename = node_path.default.resolve(file.path);
340
+ const rawSource = file.contents.toString();
341
+ await refreshRuntimeSetForSource(file, rawSource, "js");
342
+ await runtimeState.readyPromise;
207
343
  const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
208
344
  const handlerOptions = {
209
345
  ...options,
210
346
  filename,
211
347
  moduleGraph,
212
- tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
213
348
  babelParserOptions: {
214
349
  ...options?.babelParserOptions ?? {},
215
350
  sourceFilename: filename
216
351
  }
217
352
  };
218
- const rawSource = file.contents.toString();
219
- await require_generator_css.processCachedTask({
353
+ if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
354
+ await require_incremental_runtime_class_set.processCachedTask({
220
355
  cache,
221
356
  cacheKey: file.path,
222
357
  rawSource,
@@ -227,21 +362,24 @@ function createPlugins(options = {}) {
227
362
  debug("js cache hit: %s", file.path);
228
363
  },
229
364
  async transform() {
230
- await runtimeState.patchPromise;
365
+ await runtimeState.readyPromise;
231
366
  const currentSource = file.contents?.toString() ?? rawSource;
232
- if (require_recorder.shouldSkipJsTransform(currentSource, handlerOptions)) return { result: currentSource };
367
+ if (require_precheck.shouldSkipJsTransform(currentSource, {
368
+ ...handlerOptions,
369
+ classNameSet: runtimeSet
370
+ })) return { result: currentSource };
233
371
  const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
234
372
  debug("js handle: %s", file.path);
235
373
  return { result: code };
236
374
  }
237
375
  });
238
376
  });
239
- const transformWxml = (options = {}) => createVinylTransform(async (file) => {
377
+ const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
240
378
  if (!file.contents) return;
241
- await refreshRuntimeSet(false);
242
- await runtimeState.patchPromise;
243
379
  const rawSource = file.contents.toString();
244
- await require_generator_css.processCachedTask({
380
+ await refreshRuntimeSetForSource(file, rawSource, "html");
381
+ await runtimeState.readyPromise;
382
+ await require_incremental_runtime_class_set.processCachedTask({
245
383
  cache,
246
384
  cacheKey: file.path,
247
385
  rawSource,
@@ -252,7 +390,7 @@ function createPlugins(options = {}) {
252
390
  debug("html cache hit: %s", file.path);
253
391
  },
254
392
  async transform() {
255
- await runtimeState.patchPromise;
393
+ await runtimeState.readyPromise;
256
394
  const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
257
395
  debug("html handle: %s", file.path);
258
396
  return { result: code };