weapp-tailwindcss 5.0.0-next.1 → 5.0.0-next.11

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 (215) hide show
  1. package/README.md +4 -5
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/bundle-state-BRkhpjio.js +448 -0
  4. package/dist/bundle-state-BrtFgX-A.mjs +369 -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 +4 -0
  9. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  10. package/dist/bundlers/shared/css-cleanup.d.ts +1 -2
  11. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  12. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  13. package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
  14. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  15. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  16. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  17. package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
  18. package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
  19. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
  20. package/dist/bundlers/shared/generator-css.d.ts +12 -20
  21. package/dist/bundlers/shared/hmr-timing.d.ts +5 -0
  22. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  23. package/dist/bundlers/vite/css-finalizer.d.ts +4 -1
  24. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  25. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
  26. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
  27. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  28. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  29. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  30. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  31. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  32. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  33. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  34. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  35. package/dist/bundlers/vite/generate-bundle.d.ts +16 -2
  36. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +4 -1
  37. package/dist/bundlers/vite/index.d.ts +1 -1
  38. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  39. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  40. package/dist/bundlers/vite/rewrite-css-imports.d.ts +5 -3
  41. package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
  42. package/dist/bundlers/vite/source-candidates.d.ts +18 -0
  43. package/dist/bundlers/vite/source-scan.d.ts +9 -0
  44. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  45. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
  46. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -2
  47. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -3
  48. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
  49. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -1
  50. package/dist/cache/index.d.ts +6 -6
  51. package/dist/cache-B_9E7FxF.js +517 -0
  52. package/dist/cache-DEDxBMIw.mjs +443 -0
  53. package/dist/cli/context.d.ts +1 -14
  54. package/dist/cli/doctor/types.d.ts +11 -11
  55. package/dist/cli/helpers.d.ts +1 -2
  56. package/dist/cli/mount-options.d.ts +2 -0
  57. package/dist/cli/types.d.ts +0 -2
  58. package/dist/cli/vscode-entry.d.ts +3 -3
  59. package/dist/cli.js +126 -602
  60. package/dist/cli.mjs +135 -610
  61. package/dist/constants.d.ts +1 -2
  62. package/dist/core.js +13 -20
  63. package/dist/core.mjs +8 -14
  64. package/dist/css-macro/postcss.js +3 -2
  65. package/dist/css-macro/postcss.mjs +3 -2
  66. package/dist/css-macro.d.ts +1 -0
  67. package/dist/css-macro.js +2 -2
  68. package/dist/css-macro.mjs +2 -2
  69. package/dist/defaults.d.ts +15 -1
  70. package/dist/defaults.js +33 -14
  71. package/dist/defaults.mjs +30 -15
  72. package/dist/escape.js +10 -2
  73. package/dist/escape.mjs +10 -2
  74. package/dist/generator/index.d.ts +1 -1
  75. package/dist/generator/options.d.ts +10 -7
  76. package/dist/generator/types.d.ts +3 -2
  77. package/dist/generator-CahkD2vq.mjs +1469 -0
  78. package/dist/generator-Ck1Dd1V0.js +1568 -0
  79. package/dist/generator.js +1 -1
  80. package/dist/generator.mjs +1 -1
  81. package/dist/gulp.js +149 -47
  82. package/dist/gulp.mjs +144 -42
  83. package/dist/incremental-runtime-class-set-CBMefNHQ.js +1744 -0
  84. package/dist/incremental-runtime-class-set-DaS2yw5c.mjs +1687 -0
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +6 -6
  87. package/dist/index.mjs +5 -5
  88. package/dist/js/index.d.ts +1 -0
  89. package/dist/js/literal-transform.d.ts +2 -0
  90. package/dist/js/precheck.d.ts +2 -2
  91. package/dist/lightningcss/style-handler/selector-transform.d.ts +1 -1
  92. package/dist/lightningcss/style-handler.d.ts +3 -3
  93. package/dist/logger-CZUxvJJD.mjs +2 -0
  94. package/dist/logger-EVNB9z7i.js +1 -0
  95. package/dist/postcss/config-directive.d.ts +1 -0
  96. package/dist/postcss/context.d.ts +9 -0
  97. package/dist/postcss/source-files.d.ts +8 -0
  98. package/dist/postcss/tailwind-version.d.ts +3 -0
  99. package/dist/postcss-BdcRlSpp.js +243 -0
  100. package/dist/postcss-Bs-RbNzK.js +5477 -0
  101. package/dist/postcss-xZDiTRII.mjs +234 -0
  102. package/dist/postcss.d.ts +2 -2
  103. package/dist/postcss.js +3 -274
  104. package/dist/postcss.mjs +1 -267
  105. package/dist/{recorder-rn_2v_nd.js → precheck-D5eEdqeH.js} +168 -304
  106. package/dist/{recorder-B_XyZ576.mjs → precheck-DtBGFS-n.mjs} +134 -269
  107. package/dist/presets.js +13 -11
  108. package/dist/presets.mjs +11 -9
  109. package/dist/reset.d.ts +1 -0
  110. package/dist/runtime-patch-CqB-A4zA.js +85 -0
  111. package/dist/runtime-patch-DGKsVkiG.mjs +71 -0
  112. package/dist/shared/mpx.d.ts +1 -0
  113. package/dist/source-scan-CIVTa3Cj.js +297 -0
  114. package/dist/source-scan-CJ0y0XBj.mjs +258 -0
  115. package/dist/tailwindcss/miniprogram.d.ts +5 -1
  116. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  117. package/dist/tailwindcss/patcher.d.ts +1 -2
  118. package/dist/tailwindcss/runtime/cache.d.ts +3 -3
  119. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  120. package/dist/tailwindcss/runtime.d.ts +11 -12
  121. package/dist/tailwindcss/source-scan.d.ts +25 -0
  122. package/dist/tailwindcss/targets.d.ts +1 -5
  123. package/dist/tailwindcss/v3-engine/types.d.ts +14 -14
  124. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  125. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  126. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  127. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  128. package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
  129. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +1 -0
  130. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
  131. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
  132. package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
  133. package/dist/tailwindcss/v4-engine/types.d.ts +6 -3
  134. package/dist/tailwindcss/version.d.ts +4 -0
  135. package/dist/tailwindcss-B78nj6n7.js +644 -0
  136. package/dist/tailwindcss-DGM8lHUj.mjs +593 -0
  137. package/dist/typedoc.export.d.ts +0 -2
  138. package/dist/types/index.d.ts +45 -48
  139. package/dist/types/shared.d.ts +3 -0
  140. package/dist/types/user-defined-options/general.d.ts +21 -23
  141. package/dist/types/user-defined-options/important.d.ts +31 -28
  142. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  143. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  144. package/dist/uni-app-x/vite.d.ts +1 -1
  145. package/dist/utils/disabled.d.ts +2 -3
  146. package/dist/utils/object.d.ts +9 -0
  147. package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
  148. package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
  149. package/dist/{vite-BHpAqldo.js → vite-BEj9JOOA.js} +1245 -876
  150. package/dist/{vite-C8JlHiyR.mjs → vite-C8S1wfyQ.mjs} +1208 -842
  151. package/dist/vite.d.ts +1 -2
  152. package/dist/vite.js +3 -4
  153. package/dist/vite.mjs +2 -2
  154. package/dist/weapp-tw-css-import-rewrite-loader.js +129 -15
  155. package/dist/weapp-tw-runtime-classset-loader.js +44 -6
  156. package/dist/webpack-Dm1IXTIh.js +778 -0
  157. package/dist/webpack-ZGIKKpFf.mjs +768 -0
  158. package/dist/webpack.js +1 -1
  159. package/dist/webpack.mjs +1 -1
  160. package/package.json +26 -39
  161. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  162. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  163. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  164. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  165. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  166. package/dist/cli/config.d.ts +0 -5
  167. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  168. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  169. package/dist/cli/patch-options.d.ts +0 -6
  170. package/dist/cli/tokens.d.ts +0 -4
  171. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  172. package/dist/cli/workspace/patch-package.d.ts +0 -3
  173. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  174. package/dist/cli/workspace/types.d.ts +0 -11
  175. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  176. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  177. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  178. package/dist/cli/workspace.d.ts +0 -2
  179. package/dist/css-imports-BbrbluP9.js +0 -177
  180. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  181. package/dist/experimental/index.d.ts +0 -2
  182. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  183. package/dist/experimental/oxc/index.d.ts +0 -2
  184. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  185. package/dist/experimental/shared/cache.d.ts +0 -3
  186. package/dist/experimental/shared/transform.d.ts +0 -3
  187. package/dist/experimental/shared.d.ts +0 -8
  188. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  189. package/dist/experimental/swc/index.d.ts +0 -2
  190. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  191. package/dist/generator-CZ-JXw6T.js +0 -492
  192. package/dist/generator-Dwxgra97.mjs +0 -399
  193. package/dist/generator-css-CnYjiMrD.js +0 -1084
  194. package/dist/generator-css-DhPFjSzK.mjs +0 -1057
  195. package/dist/js/syntax.d.ts +0 -10
  196. package/dist/loader-anchors-DvwgIYdA.mjs +0 -205
  197. package/dist/loader-anchors-cprm4Klq.js +0 -273
  198. package/dist/logger-BZ45DZJT.js +0 -1003
  199. package/dist/logger-BoVx1Dbt.mjs +0 -935
  200. package/dist/patcher-options-6gJN2EXy.js +0 -115
  201. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  202. package/dist/tailwindcss/recorder.d.ts +0 -13
  203. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  204. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  205. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  206. package/dist/tailwindcss/targets/types.d.ts +0 -35
  207. package/dist/types/disabled-options.d.ts +0 -4
  208. package/dist/webpack-CABjKGGQ.mjs +0 -441
  209. package/dist/webpack-DNIJ0ysE.js +0 -456
  210. package/dist/webpack4.d.ts +0 -4
  211. package/dist/webpack4.js +0 -387
  212. package/dist/webpack4.mjs +0 -379
  213. package/scripts/postinstall.mjs +0 -59
  214. /package/dist/{constants-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
  215. /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
package/dist/generator.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./chunk-8l464Juk.js");
3
- const require_generator = require("./generator-CZ-JXw6T.js");
3
+ const require_generator = require("./generator-Ck1Dd1V0.js");
4
4
  let tailwindcss_patch = require("tailwindcss-patch");
5
5
  exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
6
6
  exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
@@ -1,2 +1,2 @@
1
- import { a as resolveTailwindV4Source, c as resolveTailwindV4SourceOptionsFromPatcher, f as resolveTailwindV3Source, g as transformTailwindV3CssToWeapp, h as transformTailwindV3CssByTarget, i as normalizeWeappTailwindcssGeneratorOptions, l as transformTailwindV4CssByTarget, m as resolveTailwindV3SourceOptionsFromPatcher, n as createWeappTailwindcssGeneratorFromPatcher, o as resolveTailwindV4SourceFromPatchOptions, p as resolveTailwindV3SourceFromPatcher, r as resolveTailwindSourceFromPatcher, s as resolveTailwindV4SourceFromPatcher, t as createWeappTailwindcssGenerator, u as transformTailwindV4CssToWeapp } from "./generator-Dwxgra97.mjs";
1
+ import { _ as transformTailwindV3CssToWeapp, a as resolveTailwindV4Source, c as resolveTailwindV4SourceOptionsFromPatcher, g as transformTailwindV3CssByTarget, h as resolveTailwindV3SourceOptionsFromPatcher, i as normalizeWeappTailwindcssGeneratorOptions, l as transformTailwindV4CssByTarget, m as resolveTailwindV3SourceFromPatcher, n as createWeappTailwindcssGeneratorFromPatcher, o as resolveTailwindV4SourceFromPatchOptions, p as resolveTailwindV3Source, r as resolveTailwindSourceFromPatcher, s as resolveTailwindV4SourceFromPatcher, t as createWeappTailwindcssGenerator, u as transformTailwindV4CssToWeapp } from "./generator-CahkD2vq.mjs";
2
2
  export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
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-rn_2v_nd.js");
4
- const require_generator_css = require("./generator-css-CnYjiMrD.js");
3
+ const require_cache = require("./cache-B_9E7FxF.js");
4
+ const require_runtime_patch = require("./runtime-patch-CqB-A4zA.js");
5
+ const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CBMefNHQ.js");
6
+ const require_precheck = require("./precheck-D5eEdqeH.js");
7
+ const require_tailwindcss = require("./tailwindcss-B78nj6n7.js");
5
8
  let node_path = require("node:path");
6
9
  node_path = require_chunk.__toESM(node_path);
7
10
  let node_process = require("node:process");
8
11
  node_process = require_chunk.__toESM(node_process);
9
- let node_buffer = require("node:buffer");
10
12
  let node_fs = require("node:fs");
11
13
  node_fs = require_chunk.__toESM(node_fs);
14
+ let node_buffer = require("node:buffer");
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_runtime_patch.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,111 @@ 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
+ const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? require_incremental_runtime_class_set.createBundleRuntimeClassSetManager();
56
+ async function refreshRuntimeSet(options = false) {
57
+ const normalizedOptions = typeof options === "boolean" ? {
58
+ forceRefresh: options,
59
+ forceCollect: options,
60
+ clearCache: options
61
+ } : options;
62
+ const forceRefresh = normalizedOptions.forceRefresh === true;
63
+ const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
64
+ const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
65
+ if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
66
+ runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
67
+ forceRefresh,
68
+ forceCollect: shouldForceCollect,
69
+ clearCache,
59
70
  allowEmpty: false
60
71
  });
61
72
  runtimeSetInitialized = true;
73
+ runtimeSetDirty = false;
62
74
  return runtimeSet;
63
75
  }
76
+ function createRuntimeSnapshot(changedFiles) {
77
+ const runtimeAffectingChangedByType = {
78
+ html: /* @__PURE__ */ new Set(),
79
+ js: /* @__PURE__ */ new Set(),
80
+ css: /* @__PURE__ */ new Set(),
81
+ other: /* @__PURE__ */ new Set()
82
+ };
83
+ for (const file of changedFiles) {
84
+ const entry = runtimeSourcesByFile.get(file);
85
+ if (entry) runtimeAffectingChangedByType[entry.type].add(file);
86
+ }
87
+ return {
88
+ entries: [...runtimeSourcesByFile.entries()].map(([file, entry]) => ({
89
+ file,
90
+ output: {
91
+ fileName: file,
92
+ source: entry.source,
93
+ type: "asset"
94
+ },
95
+ source: entry.source,
96
+ type: entry.type
97
+ })),
98
+ jsEntries: /* @__PURE__ */ new Map(),
99
+ sourceHashByFile: /* @__PURE__ */ new Map(),
100
+ runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
101
+ runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
102
+ changedByType: {
103
+ html: /* @__PURE__ */ new Set(),
104
+ js: /* @__PURE__ */ new Set(),
105
+ css: /* @__PURE__ */ new Set(),
106
+ other: /* @__PURE__ */ new Set()
107
+ },
108
+ runtimeAffectingChangedByType,
109
+ processFiles: {
110
+ html: /* @__PURE__ */ new Set(),
111
+ js: /* @__PURE__ */ new Set(),
112
+ css: /* @__PURE__ */ new Set()
113
+ },
114
+ linkedImpactsByEntry: /* @__PURE__ */ new Map()
115
+ };
116
+ }
117
+ async function refreshRuntimeSetForSource(file, rawSource, type) {
118
+ const filename = node_path.default.resolve(file.path);
119
+ const hash = cache.computeHash(rawSource);
120
+ const changed = runtimeSourceHashByFile.get(filename) !== hash;
121
+ runtimeSourceHashByFile.set(filename, hash);
122
+ runtimeSourcesByFile.set(filename, {
123
+ source: rawSource,
124
+ type
125
+ });
126
+ if (!changed && runtimeSetInitialized) return runtimeSet;
127
+ if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
128
+ runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createRuntimeSnapshot([filename]));
129
+ runtimeSetInitialized = true;
130
+ return runtimeSet;
131
+ } catch (error) {
132
+ debug("gulp incremental runtime set sync failed, fallback to collect: %O", error);
133
+ await bundleRuntimeClassSetManager.reset();
134
+ }
135
+ return refreshRuntimeSet({ forceCollect: true });
136
+ }
137
+ function createRuntimeSetHash(rawSource, nextRuntimeSet) {
138
+ return cache.computeHash([
139
+ rawSource,
140
+ require_cache.getRuntimeClassSetSignature(runtimeState.twPatcher),
141
+ [...nextRuntimeSet].sort().join("\n")
142
+ ].join("\n\n"));
143
+ }
144
+ async function registerAutoCssSource(file, rawSource) {
145
+ if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !require_incremental_runtime_class_set.hasTailwindRootDirectives(rawSource)) return false;
146
+ const sourceCss = require_incremental_runtime_class_set.normalizeTailwindSourceForGenerator(rawSource, { importFallback: true });
147
+ if (!require_tailwindcss.upsertTailwindV4CssSource(opts, {
148
+ file: node_path.default.resolve(file.path),
149
+ css: sourceCss
150
+ })) return false;
151
+ runtimeSetInitialized = false;
152
+ runtimeSetDirty = true;
153
+ await bundleRuntimeClassSetManager.reset();
154
+ debug("detected tailwindcss v4 css source from gulp css file: %s", file.path);
155
+ return true;
156
+ }
64
157
  function resolveWithExtensions(base) {
65
158
  for (const ext of MODULE_EXTENSIONS) {
66
159
  const candidate = `${base}${ext}`;
@@ -107,12 +200,14 @@ function createPlugins(options = {}) {
107
200
  if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
108
201
  return cachedDefaultModuleGraphOptions;
109
202
  }
110
- function createVinylTransform(handler) {
203
+ function createVinylTransform(phase, handler) {
111
204
  return new Transform({
112
205
  objectMode: true,
113
206
  async transform(file, _encoding, callback) {
207
+ const hmrTimingStartedAt = performance.now();
114
208
  try {
115
209
  await handler(file);
210
+ require_incremental_runtime_class_set.emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, { file: file.relative || node_path.default.basename(file.path) });
116
211
  callback(null, file);
117
212
  } catch (error) {
118
213
  callback(error, file);
@@ -125,12 +220,12 @@ function createPlugins(options = {}) {
125
220
  if (!options || Object.keys(options).length === 0) {
126
221
  let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
127
222
  if (!cached) {
128
- cached = { majorVersion: runtimeState.twPatcher.majorVersion };
223
+ cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
129
224
  defaultStyleHandlerOptionsCache.set(majorVersion, cached);
130
225
  }
131
226
  return cached;
132
227
  }
133
- return {
228
+ return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
134
229
  majorVersion: runtimeState.twPatcher.majorVersion,
135
230
  ...options
136
231
  };
@@ -165,15 +260,19 @@ function createPlugins(options = {}) {
165
260
  ...options
166
261
  };
167
262
  }
168
- const transformWxss = (options = {}) => createVinylTransform(async (file) => {
263
+ const transformWxss = (options = {}) => createVinylTransform("css", async (file) => {
169
264
  if (!file.contents) return;
170
- await refreshRuntimeState(true);
171
- await runtimeState.patchPromise;
172
265
  const rawSource = file.contents.toString();
173
- await require_generator_css.processCachedTask({
266
+ const cssSourceChanged = await registerAutoCssSource(file, rawSource);
267
+ const nextRuntimeSet = await refreshRuntimeSet({
268
+ forceRefresh: cssSourceChanged,
269
+ forceCollect: cssSourceChanged || opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType),
270
+ clearCache: cssSourceChanged
271
+ });
272
+ await require_incremental_runtime_class_set.processCachedTask({
174
273
  cache,
175
274
  cacheKey: file.path,
176
- rawSource,
275
+ hash: createRuntimeSetHash(rawSource, nextRuntimeSet),
177
276
  applyResult(source) {
178
277
  file.contents = node_buffer.Buffer.from(source);
179
278
  },
@@ -181,42 +280,42 @@ function createPlugins(options = {}) {
181
280
  debug("css cache hit: %s", file.path);
182
281
  },
183
282
  async transform() {
184
- await runtimeState.patchPromise;
283
+ await runtimeState.readyPromise;
185
284
  const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
186
- const css = (hasExplicitGeneratorOptions ? await require_generator_css.generateCssByGenerator({
285
+ const css = (await require_incremental_runtime_class_set.generateCssByGenerator({
187
286
  opts,
188
287
  runtimeState,
189
- runtime: await refreshRuntimeSet(false),
288
+ runtime: nextRuntimeSet,
190
289
  rawSource,
191
290
  file: file.path,
192
291
  cssHandlerOptions,
193
292
  cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
194
293
  styleHandler,
195
294
  debug
196
- }) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
295
+ }))?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
197
296
  debug("css handle: %s", file.path);
198
297
  return { result: css };
199
298
  }
200
299
  });
201
300
  });
202
- const transformJs = (options = {}) => createVinylTransform(async (file) => {
301
+ const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
203
302
  if (!file.contents) return;
204
- await refreshRuntimeSet(false);
205
- await runtimeState.patchPromise;
206
303
  const filename = node_path.default.resolve(file.path);
304
+ const rawSource = file.contents.toString();
305
+ await refreshRuntimeSetForSource(file, rawSource, "js");
306
+ await runtimeState.readyPromise;
207
307
  const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
208
308
  const handlerOptions = {
209
309
  ...options,
210
310
  filename,
211
311
  moduleGraph,
212
- tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
213
312
  babelParserOptions: {
214
313
  ...options?.babelParserOptions ?? {},
215
314
  sourceFilename: filename
216
315
  }
217
316
  };
218
- const rawSource = file.contents.toString();
219
- await require_generator_css.processCachedTask({
317
+ if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
318
+ await require_incremental_runtime_class_set.processCachedTask({
220
319
  cache,
221
320
  cacheKey: file.path,
222
321
  rawSource,
@@ -227,21 +326,24 @@ function createPlugins(options = {}) {
227
326
  debug("js cache hit: %s", file.path);
228
327
  },
229
328
  async transform() {
230
- await runtimeState.patchPromise;
329
+ await runtimeState.readyPromise;
231
330
  const currentSource = file.contents?.toString() ?? rawSource;
232
- if (require_recorder.shouldSkipJsTransform(currentSource, handlerOptions)) return { result: currentSource };
331
+ if (require_precheck.shouldSkipJsTransform(currentSource, {
332
+ ...handlerOptions,
333
+ classNameSet: runtimeSet
334
+ })) return { result: currentSource };
233
335
  const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
234
336
  debug("js handle: %s", file.path);
235
337
  return { result: code };
236
338
  }
237
339
  });
238
340
  });
239
- const transformWxml = (options = {}) => createVinylTransform(async (file) => {
341
+ const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
240
342
  if (!file.contents) return;
241
- await refreshRuntimeSet(false);
242
- await runtimeState.patchPromise;
243
343
  const rawSource = file.contents.toString();
244
- await require_generator_css.processCachedTask({
344
+ await refreshRuntimeSetForSource(file, rawSource, "html");
345
+ await runtimeState.readyPromise;
346
+ await require_incremental_runtime_class_set.processCachedTask({
245
347
  cache,
246
348
  cacheKey: file.path,
247
349
  rawSource,
@@ -252,7 +354,7 @@ function createPlugins(options = {}) {
252
354
  debug("html cache hit: %s", file.path);
253
355
  },
254
356
  async transform() {
255
- await runtimeState.patchPromise;
357
+ await runtimeState.readyPromise;
256
358
  const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
257
359
  debug("html handle: %s", file.path);
258
360
  return { result: code };
package/dist/gulp.mjs CHANGED
@@ -1,9 +1,12 @@
1
- import { _ as refreshTailwindRuntimeState, g as ensureRuntimeClassSet, n as shouldSkipJsTransform, r as getCompilerContext, t as setupPatchRecorder, v as createDebug } from "./recorder-B_XyZ576.mjs";
2
- import { i as processCachedTask, t as generateCssByGenerator } from "./generator-css-DhPFjSzK.mjs";
1
+ import { n as getRuntimeClassSetSignature } from "./cache-DEDxBMIw.mjs";
2
+ import { n as createDebug } from "./runtime-patch-DGKsVkiG.mjs";
3
+ import { a as processCachedTask, c as normalizeTailwindSourceForGenerator, n as emitHmrTiming, o as hasTailwindRootDirectives, r as generateCssByGenerator, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-DaS2yw5c.mjs";
4
+ import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-DtBGFS-n.mjs";
5
+ import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-DGM8lHUj.mjs";
3
6
  import path from "node:path";
4
7
  import process from "node:process";
5
- import { Buffer } from "node:buffer";
6
8
  import fs from "node:fs";
9
+ import { Buffer } from "node:buffer";
7
10
  import stream from "node:stream";
8
11
  //#region src/bundlers/gulp/index.ts
9
12
  const debug = createDebug();
@@ -14,19 +17,18 @@ const Transform = stream.Transform;
14
17
  * @link https://tw.icebreaker.top/docs/quick-start/frameworks/native
15
18
  */
16
19
  function createPlugins(options = {}) {
17
- const opts = getCompilerContext(options);
18
- const hasExplicitGeneratorOptions = options.generator !== void 0;
19
- const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
20
- const patchRecorderState = setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
21
- source: "runtime",
22
- cwd: opts.tailwindcssBasedir ?? process.cwd()
20
+ const hasInitialTailwindCssRoots = hasConfiguredTailwindV4CssRoots(options);
21
+ const opts = getCompilerContext({
22
+ ...options,
23
+ __internalDeferMissingCssEntriesWarning: true
23
24
  });
25
+ const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
26
+ const readyPromise = createTailwindRuntimeReadyPromise(initialTwPatcher);
24
27
  let runtimeSet = /* @__PURE__ */ new Set();
25
28
  const runtimeState = {
26
29
  twPatcher: initialTwPatcher,
27
- patchPromise: patchRecorderState.patchPromise,
28
- refreshTailwindcssPatcher,
29
- onPatchCompleted: patchRecorderState.onPatchCompleted
30
+ readyPromise,
31
+ refreshTailwindcssPatcher
30
32
  };
31
33
  const defaultStyleHandlerOptionsCache = /* @__PURE__ */ new Map();
32
34
  let cachedDefaultTemplateHandlerOptions;
@@ -41,20 +43,111 @@ function createPlugins(options = {}) {
41
43
  ".jsx"
42
44
  ];
43
45
  let runtimeSetInitialized = false;
44
- async function refreshRuntimeState(force) {
45
- await refreshTailwindRuntimeState(runtimeState, force);
46
- }
47
- async function refreshRuntimeSet(force = false) {
48
- if (!force && runtimeSetInitialized) return runtimeSet;
46
+ let runtimeSetDirty = false;
47
+ const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
48
+ const runtimeSourcesByFile = /* @__PURE__ */ new Map();
49
+ const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? createBundleRuntimeClassSetManager();
50
+ async function refreshRuntimeSet(options = false) {
51
+ const normalizedOptions = typeof options === "boolean" ? {
52
+ forceRefresh: options,
53
+ forceCollect: options,
54
+ clearCache: options
55
+ } : options;
56
+ const forceRefresh = normalizedOptions.forceRefresh === true;
57
+ const shouldForceCollect = normalizedOptions.forceCollect === true || runtimeSetDirty;
58
+ const clearCache = normalizedOptions.clearCache === true || runtimeSetDirty;
59
+ if (!forceRefresh && !shouldForceCollect && runtimeSetInitialized) return runtimeSet;
49
60
  runtimeSet = await ensureRuntimeClassSet(runtimeState, {
50
- forceRefresh: force,
51
- forceCollect: force,
52
- clearCache: force,
61
+ forceRefresh,
62
+ forceCollect: shouldForceCollect,
63
+ clearCache,
53
64
  allowEmpty: false
54
65
  });
55
66
  runtimeSetInitialized = true;
67
+ runtimeSetDirty = false;
56
68
  return runtimeSet;
57
69
  }
70
+ function createRuntimeSnapshot(changedFiles) {
71
+ const runtimeAffectingChangedByType = {
72
+ html: /* @__PURE__ */ new Set(),
73
+ js: /* @__PURE__ */ new Set(),
74
+ css: /* @__PURE__ */ new Set(),
75
+ other: /* @__PURE__ */ new Set()
76
+ };
77
+ for (const file of changedFiles) {
78
+ const entry = runtimeSourcesByFile.get(file);
79
+ if (entry) runtimeAffectingChangedByType[entry.type].add(file);
80
+ }
81
+ return {
82
+ entries: [...runtimeSourcesByFile.entries()].map(([file, entry]) => ({
83
+ file,
84
+ output: {
85
+ fileName: file,
86
+ source: entry.source,
87
+ type: "asset"
88
+ },
89
+ source: entry.source,
90
+ type: entry.type
91
+ })),
92
+ jsEntries: /* @__PURE__ */ new Map(),
93
+ sourceHashByFile: /* @__PURE__ */ new Map(),
94
+ runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
95
+ runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
96
+ changedByType: {
97
+ html: /* @__PURE__ */ new Set(),
98
+ js: /* @__PURE__ */ new Set(),
99
+ css: /* @__PURE__ */ new Set(),
100
+ other: /* @__PURE__ */ new Set()
101
+ },
102
+ runtimeAffectingChangedByType,
103
+ processFiles: {
104
+ html: /* @__PURE__ */ new Set(),
105
+ js: /* @__PURE__ */ new Set(),
106
+ css: /* @__PURE__ */ new Set()
107
+ },
108
+ linkedImpactsByEntry: /* @__PURE__ */ new Map()
109
+ };
110
+ }
111
+ async function refreshRuntimeSetForSource(file, rawSource, type) {
112
+ const filename = path.resolve(file.path);
113
+ const hash = cache.computeHash(rawSource);
114
+ const changed = runtimeSourceHashByFile.get(filename) !== hash;
115
+ runtimeSourceHashByFile.set(filename, hash);
116
+ runtimeSourcesByFile.set(filename, {
117
+ source: rawSource,
118
+ type
119
+ });
120
+ if (!changed && runtimeSetInitialized) return runtimeSet;
121
+ if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
122
+ runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createRuntimeSnapshot([filename]));
123
+ runtimeSetInitialized = true;
124
+ return runtimeSet;
125
+ } catch (error) {
126
+ debug("gulp incremental runtime set sync failed, fallback to collect: %O", error);
127
+ await bundleRuntimeClassSetManager.reset();
128
+ }
129
+ return refreshRuntimeSet({ forceCollect: true });
130
+ }
131
+ function createRuntimeSetHash(rawSource, nextRuntimeSet) {
132
+ return cache.computeHash([
133
+ rawSource,
134
+ getRuntimeClassSetSignature(runtimeState.twPatcher),
135
+ [...nextRuntimeSet].sort().join("\n")
136
+ ].join("\n\n"));
137
+ }
138
+ async function registerAutoCssSource(file, rawSource) {
139
+ if (hasInitialTailwindCssRoots || (runtimeState.twPatcher.majorVersion ?? 0) < 4 || !file.path || !hasTailwindRootDirectives(rawSource)) return false;
140
+ const sourceCss = normalizeTailwindSourceForGenerator(rawSource, { importFallback: true });
141
+ if (!upsertTailwindV4CssSource(opts, {
142
+ file: path.resolve(file.path),
143
+ css: sourceCss
144
+ })) return false;
145
+ runtimeSetInitialized = false;
146
+ runtimeSetDirty = true;
147
+ await bundleRuntimeClassSetManager.reset();
148
+ debug("detected tailwindcss v4 css source from gulp css file: %s", file.path);
149
+ return true;
150
+ }
58
151
  function resolveWithExtensions(base) {
59
152
  for (const ext of MODULE_EXTENSIONS) {
60
153
  const candidate = `${base}${ext}`;
@@ -101,12 +194,14 @@ function createPlugins(options = {}) {
101
194
  if (!cachedDefaultModuleGraphOptions) cachedDefaultModuleGraphOptions = createModuleGraphOptionsFor();
102
195
  return cachedDefaultModuleGraphOptions;
103
196
  }
104
- function createVinylTransform(handler) {
197
+ function createVinylTransform(phase, handler) {
105
198
  return new Transform({
106
199
  objectMode: true,
107
200
  async transform(file, _encoding, callback) {
201
+ const hmrTimingStartedAt = performance.now();
108
202
  try {
109
203
  await handler(file);
204
+ emitHmrTiming("gulp", phase, performance.now() - hmrTimingStartedAt, { file: file.relative || path.basename(file.path) });
110
205
  callback(null, file);
111
206
  } catch (error) {
112
207
  callback(error, file);
@@ -119,12 +214,12 @@ function createPlugins(options = {}) {
119
214
  if (!options || Object.keys(options).length === 0) {
120
215
  let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
121
216
  if (!cached) {
122
- cached = { majorVersion: runtimeState.twPatcher.majorVersion };
217
+ cached = runtimeState.twPatcher.majorVersion === void 0 ? {} : { majorVersion: runtimeState.twPatcher.majorVersion };
123
218
  defaultStyleHandlerOptionsCache.set(majorVersion, cached);
124
219
  }
125
220
  return cached;
126
221
  }
127
- return {
222
+ return runtimeState.twPatcher.majorVersion === void 0 ? { ...options } : {
128
223
  majorVersion: runtimeState.twPatcher.majorVersion,
129
224
  ...options
130
225
  };
@@ -159,15 +254,19 @@ function createPlugins(options = {}) {
159
254
  ...options
160
255
  };
161
256
  }
162
- const transformWxss = (options = {}) => createVinylTransform(async (file) => {
257
+ const transformWxss = (options = {}) => createVinylTransform("css", async (file) => {
163
258
  if (!file.contents) return;
164
- await refreshRuntimeState(true);
165
- await runtimeState.patchPromise;
166
259
  const rawSource = file.contents.toString();
260
+ const cssSourceChanged = await registerAutoCssSource(file, rawSource);
261
+ const nextRuntimeSet = await refreshRuntimeSet({
262
+ forceRefresh: cssSourceChanged,
263
+ forceCollect: cssSourceChanged || opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType),
264
+ clearCache: cssSourceChanged
265
+ });
167
266
  await processCachedTask({
168
267
  cache,
169
268
  cacheKey: file.path,
170
- rawSource,
269
+ hash: createRuntimeSetHash(rawSource, nextRuntimeSet),
171
270
  applyResult(source) {
172
271
  file.contents = Buffer.from(source);
173
272
  },
@@ -175,41 +274,41 @@ function createPlugins(options = {}) {
175
274
  debug("css cache hit: %s", file.path);
176
275
  },
177
276
  async transform() {
178
- await runtimeState.patchPromise;
277
+ await runtimeState.readyPromise;
179
278
  const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
180
- const css = (hasExplicitGeneratorOptions ? await generateCssByGenerator({
279
+ const css = (await generateCssByGenerator({
181
280
  opts,
182
281
  runtimeState,
183
- runtime: await refreshRuntimeSet(false),
282
+ runtime: nextRuntimeSet,
184
283
  rawSource,
185
284
  file: file.path,
186
285
  cssHandlerOptions,
187
286
  cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
188
287
  styleHandler,
189
288
  debug
190
- }) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
289
+ }))?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css;
191
290
  debug("css handle: %s", file.path);
192
291
  return { result: css };
193
292
  }
194
293
  });
195
294
  });
196
- const transformJs = (options = {}) => createVinylTransform(async (file) => {
295
+ const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
197
296
  if (!file.contents) return;
198
- await refreshRuntimeSet(false);
199
- await runtimeState.patchPromise;
200
297
  const filename = path.resolve(file.path);
298
+ const rawSource = file.contents.toString();
299
+ await refreshRuntimeSetForSource(file, rawSource, "js");
300
+ await runtimeState.readyPromise;
201
301
  const moduleGraph = resolveModuleGraphOptions(options.moduleGraph);
202
302
  const handlerOptions = {
203
303
  ...options,
204
304
  filename,
205
305
  moduleGraph,
206
- tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
207
306
  babelParserOptions: {
208
307
  ...options?.babelParserOptions ?? {},
209
308
  sourceFilename: filename
210
309
  }
211
310
  };
212
- const rawSource = file.contents.toString();
311
+ if (runtimeState.twPatcher.majorVersion !== void 0) handlerOptions.tailwindcssMajorVersion = runtimeState.twPatcher.majorVersion;
213
312
  await processCachedTask({
214
313
  cache,
215
314
  cacheKey: file.path,
@@ -221,20 +320,23 @@ function createPlugins(options = {}) {
221
320
  debug("js cache hit: %s", file.path);
222
321
  },
223
322
  async transform() {
224
- await runtimeState.patchPromise;
323
+ await runtimeState.readyPromise;
225
324
  const currentSource = file.contents?.toString() ?? rawSource;
226
- if (shouldSkipJsTransform(currentSource, handlerOptions)) return { result: currentSource };
325
+ if (shouldSkipJsTransform(currentSource, {
326
+ ...handlerOptions,
327
+ classNameSet: runtimeSet
328
+ })) return { result: currentSource };
227
329
  const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
228
330
  debug("js handle: %s", file.path);
229
331
  return { result: code };
230
332
  }
231
333
  });
232
334
  });
233
- const transformWxml = (options = {}) => createVinylTransform(async (file) => {
335
+ const transformWxml = (options = {}) => createVinylTransform("html", async (file) => {
234
336
  if (!file.contents) return;
235
- await refreshRuntimeSet(false);
236
- await runtimeState.patchPromise;
237
337
  const rawSource = file.contents.toString();
338
+ await refreshRuntimeSetForSource(file, rawSource, "html");
339
+ await runtimeState.readyPromise;
238
340
  await processCachedTask({
239
341
  cache,
240
342
  cacheKey: file.path,
@@ -246,7 +348,7 @@ function createPlugins(options = {}) {
246
348
  debug("html cache hit: %s", file.path);
247
349
  },
248
350
  async transform() {
249
- await runtimeState.patchPromise;
351
+ await runtimeState.readyPromise;
250
352
  const code = await templateHandler(rawSource, resolveWxmlHandlerOptions(options));
251
353
  debug("html handle: %s", file.path);
252
354
  return { result: code };