weapp-tailwindcss 4.7.0 → 4.7.2

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 (39) hide show
  1. package/dist/{chunk-Q5TPAJI4.js → chunk-2SI3KT2H.js} +7 -6
  2. package/dist/{chunk-IY2OKZE6.mjs → chunk-3ARXMTWC.mjs} +21 -8
  3. package/dist/{chunk-D7SF52F6.mjs → chunk-5BW6X6AJ.mjs} +42 -36
  4. package/dist/chunk-667CYXAH.mjs +133 -0
  5. package/dist/chunk-BUMQQPAO.js +133 -0
  6. package/dist/{chunk-W3JU6K3T.js → chunk-FPDJ3BCM.js} +260 -108
  7. package/dist/{chunk-BAXZHBSU.js → chunk-GNWJEIZZ.js} +92 -77
  8. package/dist/{chunk-7TKAJ3P6.mjs → chunk-JYCQWWYU.mjs} +257 -105
  9. package/dist/{chunk-NRG7N2Q7.mjs → chunk-KZJLIZIK.mjs} +0 -1
  10. package/dist/{chunk-34T2BFTJ.mjs → chunk-KZUIVLPP.mjs} +42 -1
  11. package/dist/{chunk-C3CG4UUY.js → chunk-OPTIAB5G.js} +21 -8
  12. package/dist/{chunk-BTOCLUJ4.mjs → chunk-Q6PLZCM6.mjs} +6 -5
  13. package/dist/{chunk-CCMDCC3N.js → chunk-QZRXYCOQ.js} +49 -43
  14. package/dist/{chunk-WVKK6TBL.js → chunk-W7BVY5S5.js} +42 -1
  15. package/dist/{chunk-LZ6L3UQO.js → chunk-WXBFAARR.js} +0 -1
  16. package/dist/{chunk-KSXOBEXQ.mjs → chunk-Z2H7M33Z.mjs} +83 -68
  17. package/dist/cli.js +6 -6
  18. package/dist/cli.mjs +3 -3
  19. package/dist/core.js +10 -9
  20. package/dist/core.mjs +10 -9
  21. package/dist/defaults.js +2 -2
  22. package/dist/defaults.mjs +1 -1
  23. package/dist/gulp.js +6 -6
  24. package/dist/gulp.mjs +5 -5
  25. package/dist/index.js +9 -9
  26. package/dist/index.mjs +8 -8
  27. package/dist/presets.js +2 -2
  28. package/dist/presets.mjs +1 -1
  29. package/dist/types.d.mts +2 -21
  30. package/dist/types.d.ts +2 -21
  31. package/dist/vite.js +7 -7
  32. package/dist/vite.mjs +6 -6
  33. package/dist/webpack.js +7 -7
  34. package/dist/webpack.mjs +6 -6
  35. package/dist/webpack4.js +51 -45
  36. package/dist/webpack4.mjs +44 -38
  37. package/package.json +4 -4
  38. package/dist/chunk-FB5P4TRH.js +0 -70
  39. package/dist/chunk-YPBRGP6K.mjs +0 -70
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-VSRDBMDB.mjs";
4
4
  import {
5
5
  createTailwindcssPatcherFromContext
6
- } from "./chunk-IY2OKZE6.mjs";
6
+ } from "./chunk-3ARXMTWC.mjs";
7
7
  import {
8
8
  getDefaultOptions
9
- } from "./chunk-NRG7N2Q7.mjs";
9
+ } from "./chunk-KZJLIZIK.mjs";
10
10
  import {
11
11
  defuOverrideArray,
12
12
  isMap
@@ -142,7 +142,6 @@ function toCustomAttributesEntities(customAttributes) {
142
142
  import { createStyleHandler } from "@weapp-tailwindcss/postcss";
143
143
 
144
144
  // src/js/babel.ts
145
- import { jsStringEscape as jsStringEscape2 } from "@ast-core/escape";
146
145
  import { LRUCache as LRUCache2 } from "lru-cache";
147
146
  import MagicString from "magic-string";
148
147
 
@@ -209,8 +208,86 @@ function createNameMatcher(list, { exact = false } = {}) {
209
208
  };
210
209
  }
211
210
 
212
- // src/js/handlers.ts
211
+ // src/js/evalTransforms.ts
213
212
  import { jsStringEscape } from "@ast-core/escape";
213
+ function isEvalPath(path) {
214
+ if (path.isCallExpression()) {
215
+ const calleePath = path.get("callee");
216
+ return calleePath.isIdentifier({ name: "eval" });
217
+ }
218
+ return false;
219
+ }
220
+ function createEvalReplacementToken(path, updated) {
221
+ const node = path.node;
222
+ let offset = 0;
223
+ let original;
224
+ if (path.isStringLiteral()) {
225
+ offset = 1;
226
+ original = path.node.value;
227
+ } else if (path.isTemplateElement()) {
228
+ original = path.node.value.raw;
229
+ } else {
230
+ original = "";
231
+ }
232
+ if (typeof node.start !== "number" || typeof node.end !== "number") {
233
+ return void 0;
234
+ }
235
+ const start = node.start + offset;
236
+ const end = node.end - offset;
237
+ if (start >= end) {
238
+ return void 0;
239
+ }
240
+ if (original === updated) {
241
+ return void 0;
242
+ }
243
+ const value = path.isStringLiteral() ? jsStringEscape(updated) : updated;
244
+ return {
245
+ start,
246
+ end,
247
+ value,
248
+ path
249
+ };
250
+ }
251
+ function handleEvalStringLiteral(path, options, updater, handler) {
252
+ const { code } = handler(path.node.value, {
253
+ ...options,
254
+ needEscaped: false,
255
+ generateMap: false
256
+ });
257
+ if (!code) {
258
+ return;
259
+ }
260
+ const token = createEvalReplacementToken(path, code);
261
+ if (token) {
262
+ updater.addToken(token);
263
+ }
264
+ }
265
+ function handleEvalTemplateElement(path, options, updater, handler) {
266
+ const { code } = handler(path.node.value.raw, {
267
+ ...options,
268
+ generateMap: false
269
+ });
270
+ if (!code) {
271
+ return;
272
+ }
273
+ const token = createEvalReplacementToken(path, code);
274
+ if (token) {
275
+ updater.addToken(token);
276
+ }
277
+ }
278
+ function walkEvalExpression(path, options, updater, handler) {
279
+ path.traverse({
280
+ StringLiteral(innerPath) {
281
+ handleEvalStringLiteral(innerPath, options, updater, handler);
282
+ },
283
+ TemplateElement(innerPath) {
284
+ handleEvalTemplateElement(innerPath, options, updater, handler);
285
+ }
286
+ });
287
+ }
288
+
289
+ // src/js/handlers.ts
290
+ import { jsStringEscape as jsStringEscape2 } from "@ast-core/escape";
214
291
  import { escapeStringRegexp as escapeStringRegexp2 } from "@weapp-core/regex";
215
292
  import { splitCode } from "@weapp-tailwindcss/shared/extractors";
216
293
 
@@ -355,7 +432,7 @@ function replaceHandleValue(path, options) {
355
432
  if (start >= end || transformed === original) {
356
433
  return void 0;
357
434
  }
358
- const value = needEscaped ? jsStringEscape(transformed) : transformed;
435
+ const value = needEscaped ? jsStringEscape2(transformed) : transformed;
359
436
  return {
360
437
  start,
361
438
  end,
@@ -842,71 +919,7 @@ var NodePathWalker = class {
842
919
  }
843
920
  };
844
921
 
845
- // src/js/babel.ts
846
- var parseCache = new LRUCache2(
847
- {
848
- max: 512
849
- }
850
- );
851
- function genCacheKey(source, options) {
852
- return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
853
- }
854
- function babelParse(code, { cache, ...options } = {}) {
855
- const cacheKey = genCacheKey(code, options);
856
- let result;
857
- if (cache) {
858
- result = parseCache.get(cacheKey);
859
- }
860
- if (!result) {
861
- result = parse(code, options);
862
- if (cache) {
863
- parseCache.set(cacheKey, result);
864
- }
865
- }
866
- return result;
867
- }
868
- function isEvalPath(p) {
869
- if (p.isCallExpression()) {
870
- const calleePath = p.get("callee");
871
- return calleePath.isIdentifier(
872
- {
873
- name: "eval"
874
- }
875
- );
876
- }
877
- return false;
878
- }
879
- function createEvalReplacementToken(path, updated) {
880
- const node = path.node;
881
- let offset = 0;
882
- let original;
883
- if (path.isStringLiteral()) {
884
- offset = 1;
885
- original = path.node.value;
886
- } else if (path.isTemplateElement()) {
887
- original = path.node.value.raw;
888
- } else {
889
- original = "";
890
- }
891
- if (typeof node.start !== "number" || typeof node.end !== "number") {
892
- return void 0;
893
- }
894
- const start = node.start + offset;
895
- const end = node.end - offset;
896
- if (start >= end) {
897
- return void 0;
898
- }
899
- if (original === updated) {
900
- return void 0;
901
- }
902
- const value = path.isStringLiteral() ? jsStringEscape2(updated) : updated;
903
- return {
904
- start,
905
- end,
906
- value,
907
- path
908
- };
909
- }
922
+ // src/js/sourceAnalysis.ts
910
923
  function createModuleSpecifierReplacementToken(path, replacement) {
911
924
  const node = path.node;
912
925
  if (node.value === replacement) {
@@ -964,42 +977,179 @@ function collectModuleSpecifierReplacementTokens(analysis, replacements) {
964
977
  }
965
978
  return tokens;
966
979
  }
967
- function handleEvalStringLiteral(path, options, updater, handler) {
968
- const { code } = handler(path.node.value, {
969
- ...options,
970
- needEscaped: false,
971
- generateMap: false
972
- });
973
- if (!code) {
974
- return;
975
- }
976
- const token = createEvalReplacementToken(path, code);
977
- if (token) {
978
- updater.addToken(token);
979
- }
980
+
981
+ // src/js/taggedTemplateIgnore.ts
982
+ function createTaggedTemplateIgnore({ matcher, names }) {
983
+ const bindingIgnoreCache = /* @__PURE__ */ new Map();
984
+ const taggedTemplateIgnoreCache = /* @__PURE__ */ new WeakMap();
985
+ const canonicalIgnoreNames = new Set(
986
+ (names ?? []).filter((item) => typeof item === "string")
987
+ );
988
+ const propertyMatches = (propertyPath) => {
989
+ if (!propertyPath) {
990
+ return false;
991
+ }
992
+ if (propertyPath.isIdentifier()) {
993
+ const { name } = propertyPath.node;
994
+ return canonicalIgnoreNames.has(name) || matcher(name);
995
+ }
996
+ if (propertyPath.isStringLiteral()) {
997
+ const { value } = propertyPath.node;
998
+ return canonicalIgnoreNames.has(value) || matcher(value);
999
+ }
1000
+ return false;
1001
+ };
1002
+ const resolvesMemberExpressionToIgnore = (path, seen) => {
1003
+ const propertyPath = path.get("property");
1004
+ if (propertyMatches(propertyPath)) {
1005
+ return true;
1006
+ }
1007
+ const objectPath = path.get("object");
1008
+ if (objectPath.isIdentifier()) {
1009
+ const binding = objectPath.scope.getBinding(objectPath.node.name);
1010
+ if (binding) {
1011
+ return resolvesToWeappTwIgnore(binding, seen);
1012
+ }
1013
+ }
1014
+ return false;
1015
+ };
1016
+ const resolvesToWeappTwIgnore = (binding, seen) => {
1017
+ const cached = bindingIgnoreCache.get(binding);
1018
+ if (cached !== void 0) {
1019
+ return cached;
1020
+ }
1021
+ if (seen.has(binding)) {
1022
+ return false;
1023
+ }
1024
+ seen.add(binding);
1025
+ let result = false;
1026
+ const bindingPath = binding.path;
1027
+ if (bindingPath.isImportSpecifier()) {
1028
+ const imported = bindingPath.node.imported;
1029
+ if (imported.type === "Identifier" && (canonicalIgnoreNames.has(imported.name) || matcher(imported.name))) {
1030
+ result = true;
1031
+ } else if (imported.type === "StringLiteral" && (canonicalIgnoreNames.has(imported.value) || matcher(imported.value))) {
1032
+ result = true;
1033
+ }
1034
+ } else if (bindingPath.isVariableDeclarator()) {
1035
+ const init = bindingPath.get("init");
1036
+ if (init && init.node) {
1037
+ if (init.isIdentifier()) {
1038
+ const target = binding.scope.getBinding(init.node.name);
1039
+ if (target) {
1040
+ result = resolvesToWeappTwIgnore(target, seen);
1041
+ }
1042
+ } else if (init.isMemberExpression()) {
1043
+ result = resolvesMemberExpressionToIgnore(init, seen);
1044
+ }
1045
+ }
1046
+ }
1047
+ bindingIgnoreCache.set(binding, result);
1048
+ seen.delete(binding);
1049
+ return result;
1050
+ };
1051
+ const getEffectiveTagPath = (tagPath) => {
1052
+ let current = tagPath;
1053
+ while (true) {
1054
+ if (current.isParenthesizedExpression?.() || current.node.type === "ParenthesizedExpression") {
1055
+ current = current.get("expression");
1056
+ continue;
1057
+ }
1058
+ if (current.isTSAsExpression() || current.isTSTypeAssertion()) {
1059
+ current = current.get("expression");
1060
+ continue;
1061
+ }
1062
+ if (current.isTSNonNullExpression()) {
1063
+ current = current.get("expression");
1064
+ continue;
1065
+ }
1066
+ if (current.isTypeCastExpression?.()) {
1067
+ current = current.get("expression");
1068
+ continue;
1069
+ }
1070
+ if (current.isSequenceExpression()) {
1071
+ const expressions = current.get("expressions");
1072
+ const last = expressions[expressions.length - 1];
1073
+ if (last) {
1074
+ current = last;
1075
+ continue;
1076
+ }
1077
+ }
1078
+ if (current.isCallExpression?.() || current.node.type === "CallExpression") {
1079
+ const callee = current.get("callee");
1080
+ current = callee;
1081
+ continue;
1082
+ }
1083
+ break;
1084
+ }
1085
+ return current;
1086
+ };
1087
+ const evaluateTagPath = (tagPath) => {
1088
+ if (tagPath.isCallExpression?.() || tagPath.node.type === "CallExpression") {
1089
+ const calleePath = tagPath.get("callee");
1090
+ return evaluateTagPath(calleePath);
1091
+ }
1092
+ if (tagPath.isIdentifier()) {
1093
+ if (matcher(tagPath.node.name)) {
1094
+ return true;
1095
+ }
1096
+ const binding = tagPath.scope.getBinding(tagPath.node.name);
1097
+ if (binding) {
1098
+ return resolvesToWeappTwIgnore(binding, /* @__PURE__ */ new Set());
1099
+ }
1100
+ return false;
1101
+ }
1102
+ if (tagPath.isMemberExpression()) {
1103
+ return resolvesMemberExpressionToIgnore(tagPath, /* @__PURE__ */ new Set());
1104
+ }
1105
+ return false;
1106
+ };
1107
+ const computeIgnore = (tagPath) => {
1108
+ const cached = taggedTemplateIgnoreCache.get(tagPath.node);
1109
+ if (cached !== void 0) {
1110
+ return cached;
1111
+ }
1112
+ const effectiveTagPath = getEffectiveTagPath(tagPath);
1113
+ const effectiveCached = taggedTemplateIgnoreCache.get(effectiveTagPath.node);
1114
+ if (effectiveCached !== void 0) {
1115
+ taggedTemplateIgnoreCache.set(tagPath.node, effectiveCached);
1116
+ return effectiveCached;
1117
+ }
1118
+ const result = evaluateTagPath(effectiveTagPath);
1119
+ taggedTemplateIgnoreCache.set(effectiveTagPath.node, result);
1120
+ taggedTemplateIgnoreCache.set(tagPath.node, result);
1121
+ return result;
1122
+ };
1123
+ return {
1124
+ shouldIgnore(tagPath) {
1125
+ return computeIgnore(tagPath);
1126
+ },
1127
+ getEffectiveTagPath
1128
+ };
980
1129
  }
981
- function handleEvalTemplateElement(path, options, updater, handler) {
982
- const { code } = handler(path.node.value.raw, {
983
- ...options,
984
- generateMap: false
985
- });
986
- if (!code) {
987
- return;
988
- }
989
- const token = createEvalReplacementToken(path, code);
990
- if (token) {
991
- updater.addToken(token);
1130
+
1131
+ // src/js/babel.ts
1132
+ var parseCache = new LRUCache2(
1133
+ {
1134
+ max: 512
992
1135
  }
1136
+ );
1137
+ function genCacheKey(source, options) {
1138
+ return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
993
1139
  }
994
- function walkEvalExpression(path, options, updater, handler) {
995
- path.traverse({
996
- StringLiteral(innerPath) {
997
- handleEvalStringLiteral(innerPath, options, updater, handler);
998
- },
999
- TemplateElement(innerPath) {
1000
- handleEvalTemplateElement(innerPath, options, updater, handler);
1140
+ function babelParse(code, { cache, ...options } = {}) {
1141
+ const cacheKey = genCacheKey(code, options);
1142
+ let result;
1143
+ if (cache) {
1144
+ result = parseCache.get(cacheKey);
1145
+ }
1146
+ if (!result) {
1147
+ result = parse(code, options);
1148
+ if (cache) {
1149
+ parseCache.set(cacheKey, result);
1001
1150
  }
1002
- });
1151
+ }
1152
+ return result;
1003
1153
  }
1004
1154
  function analyzeSource(ast, options, handler) {
1005
1155
  const jsTokenUpdater = new JsTokenUpdater();
@@ -1015,6 +1165,10 @@ function analyzeSource(ast, options, handler) {
1015
1165
  }
1016
1166
  );
1017
1167
  const isIgnoredTaggedTemplate = createNameMatcher(options.ignoreTaggedTemplateExpressionIdentifiers, { exact: true });
1168
+ const taggedTemplateIgnore = createTaggedTemplateIgnore({
1169
+ matcher: isIgnoredTaggedTemplate,
1170
+ names: options.ignoreTaggedTemplateExpressionIdentifiers
1171
+ });
1018
1172
  const targetPaths = [];
1019
1173
  const importDeclarations = /* @__PURE__ */ new Set();
1020
1174
  const exportDeclarations = /* @__PURE__ */ new Set();
@@ -1039,7 +1193,7 @@ function analyzeSource(ast, options, handler) {
1039
1193
  }
1040
1194
  if (ppp.isTaggedTemplateExpression()) {
1041
1195
  const tagPath = ppp.get("tag");
1042
- if (tagPath.isIdentifier() && isIgnoredTaggedTemplate(tagPath.node.name)) {
1196
+ if (taggedTemplateIgnore.shouldIgnore(tagPath)) {
1043
1197
  return;
1044
1198
  }
1045
1199
  }
@@ -1618,7 +1772,6 @@ function resolveRuntimePackageReplacements(option) {
1618
1772
  function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions) {
1619
1773
  const {
1620
1774
  cssPreflight,
1621
- customRuleCallback,
1622
1775
  cssPreflightRange,
1623
1776
  escapeMap,
1624
1777
  cssChildCombinatorReplaceValue,
@@ -1643,7 +1796,6 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
1643
1796
  const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
1644
1797
  const styleHandler = createStyleHandler({
1645
1798
  cssPreflight,
1646
- customRuleCallback,
1647
1799
  cssPreflightRange,
1648
1800
  escapeMap,
1649
1801
  cssChildCombinatorReplaceValue,
@@ -67,7 +67,6 @@ function getDefaultOptions() {
67
67
  "border-color": "currentColor"
68
68
  },
69
69
  disabled: false,
70
- customRuleCallback: noop,
71
70
  onLoad: noop,
72
71
  onStart: noop,
73
72
  onEnd: noop,
@@ -53,7 +53,48 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
53
53
  return matchWithExtensions(candidate, hasOutput);
54
54
  }
55
55
 
56
+ // src/bundlers/shared/run-tasks.ts
57
+ async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
58
+ if (factories.length === 0) {
59
+ return [];
60
+ }
61
+ const results = Array.from({ length: factories.length });
62
+ const executing = /* @__PURE__ */ new Set();
63
+ let cursor = 0;
64
+ const effectiveLimit = Math.max(1, limit);
65
+ const scheduleNext = () => {
66
+ if (cursor >= factories.length) {
67
+ return;
68
+ }
69
+ const currentIndex = cursor++;
70
+ const wrapped = Promise.resolve(factories[currentIndex]()).then((value) => {
71
+ results[currentIndex] = value;
72
+ }).finally(() => {
73
+ executing.delete(wrapped);
74
+ });
75
+ executing.add(wrapped);
76
+ };
77
+ while (cursor < factories.length && executing.size < effectiveLimit) {
78
+ scheduleNext();
79
+ }
80
+ while (cursor < factories.length) {
81
+ await Promise.race(executing);
82
+ scheduleNext();
83
+ }
84
+ await Promise.all(executing);
85
+ return results;
86
+ }
87
+ function pushConcurrentTaskFactories(queue, factories, limit) {
88
+ if (factories.length === 0) {
89
+ return;
90
+ }
91
+ queue.push(
92
+ runWithConcurrency(factories, limit).then(() => void 0)
93
+ );
94
+ }
95
+
56
96
  export {
57
97
  toAbsoluteOutputPath,
58
- resolveOutputSpecifier
98
+ resolveOutputSpecifier,
99
+ pushConcurrentTaskFactories
59
100
  };
@@ -246,25 +246,29 @@ function normalizeTailwindcssPatcherOptions(options) {
246
246
  function createTailwindcssPatcher(options) {
247
247
  const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss, tailwindcssPatcherOptions } = options || {};
248
248
  const cache = {};
249
+ const normalizedBasedir = basedir ? _path2.default.resolve(basedir) : void 0;
250
+ const cacheRoot = _nullishCoalesce(_nullishCoalesce(findNearestPackageRoot(normalizedBasedir), () => ( normalizedBasedir)), () => ( _process2.default.cwd()));
249
251
  if (cacheDir) {
250
252
  if (_path2.default.isAbsolute(cacheDir)) {
251
253
  cache.dir = cacheDir;
252
- } else if (basedir) {
253
- cache.dir = _path2.default.resolve(basedir, cacheDir);
254
+ } else if (normalizedBasedir) {
255
+ cache.dir = _path2.default.resolve(normalizedBasedir, cacheDir);
254
256
  } else {
255
257
  cache.dir = _path2.default.resolve(_process2.default.cwd(), cacheDir);
256
258
  }
259
+ } else {
260
+ cache.dir = _path2.default.join(cacheRoot, "node_modules", ".cache", "tailwindcss-patch");
257
261
  }
258
- if (basedir) {
259
- cache.cwd = basedir;
262
+ if (normalizedBasedir) {
263
+ cache.cwd = normalizedBasedir;
260
264
  }
261
- const resolvePaths = createDefaultResolvePaths(_nullishCoalesce(_nullishCoalesce(cache.cwd, () => ( basedir)), () => ( _process2.default.cwd())));
265
+ const resolvePaths = createDefaultResolvePaths(_nullishCoalesce(_nullishCoalesce(cache.cwd, () => ( normalizedBasedir)), () => ( _process2.default.cwd())));
262
266
  const normalizedUserOptions = normalizeTailwindcssPatcherOptions(tailwindcssPatcherOptions);
263
267
  const extendLengthUnits = normalizeExtendLengthUnits(supportCustomLengthUnitsPatch);
264
268
  const baseTailwindOptions = _shared.defuOverrideArray.call(void 0,
265
269
  _nullishCoalesce(tailwindcss, () => ( {})),
266
270
  {
267
- cwd: basedir,
271
+ cwd: normalizedBasedir,
268
272
  resolve: {
269
273
  paths: resolvePaths
270
274
  }
@@ -290,7 +294,7 @@ function createTailwindcssPatcher(options) {
290
294
  }
291
295
  }
292
296
  const baseOptions = {
293
- cwd: basedir,
297
+ cwd: normalizedBasedir,
294
298
  cache,
295
299
  tailwind: baseTailwindOptions,
296
300
  features: {
@@ -383,6 +387,12 @@ var ENV_BASEDIR_KEYS = [
383
387
  "PWD"
384
388
  ];
385
389
  var GENERIC_ENV_BASEDIR_KEYS = /* @__PURE__ */ new Set(["INIT_CWD", "PWD"]);
390
+ function isLegacyTailwindcssPatcherOptions(options) {
391
+ return typeof options === "object" && options !== null && "patch" in options;
392
+ }
393
+ function isModernTailwindcssPatchOptions(options) {
394
+ return typeof options === "object" && options !== null && !("patch" in options);
395
+ }
386
396
  function pickEnvBasedir() {
387
397
  for (const key of ENV_BASEDIR_KEYS) {
388
398
  const value = _process2.default.env[key];
@@ -541,7 +551,7 @@ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries)
541
551
  if (!options) {
542
552
  return options;
543
553
  }
544
- if ("patch" in options) {
554
+ if (isLegacyTailwindcssPatcherOptions(options)) {
545
555
  const patchOptions = options.patch;
546
556
  if (!patchOptions) {
547
557
  return options;
@@ -566,6 +576,9 @@ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries)
566
576
  patch: nextPatch
567
577
  };
568
578
  }
579
+ if (!isModernTailwindcssPatchOptions(options)) {
580
+ return options;
581
+ }
569
582
  if (!options.tailwind) {
570
583
  return options;
571
584
  }
@@ -3,11 +3,12 @@ import {
3
3
  } from "./chunk-RRHPTTCP.mjs";
4
4
  import {
5
5
  collectRuntimeClassSet,
6
- createDebug
7
- } from "./chunk-YPBRGP6K.mjs";
6
+ createDebug,
7
+ createTailwindPatchPromise
8
+ } from "./chunk-667CYXAH.mjs";
8
9
  import {
9
10
  getCompilerContext
10
- } from "./chunk-7TKAJ3P6.mjs";
11
+ } from "./chunk-JYCQWWYU.mjs";
11
12
 
12
13
  // src/bundlers/gulp/index.ts
13
14
  import { Buffer } from "buffer";
@@ -21,7 +22,7 @@ function createPlugins(options = {}) {
21
22
  const opts = getCompilerContext(options);
22
23
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher } = opts;
23
24
  let runtimeSet = /* @__PURE__ */ new Set();
24
- const patchPromise = Promise.resolve(twPatcher.patch());
25
+ const patchPromise = createTailwindPatchPromise(twPatcher);
25
26
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
26
27
  let runtimeSetInitialized = false;
27
28
  async function refreshRuntimeSet(force = false) {
@@ -29,7 +30,7 @@ function createPlugins(options = {}) {
29
30
  if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
30
31
  return runtimeSet;
31
32
  }
32
- runtimeSet = await collectRuntimeClassSet(twPatcher);
33
+ runtimeSet = await collectRuntimeClassSet(twPatcher, { force });
33
34
  runtimeSetInitialized = true;
34
35
  return runtimeSet;
35
36
  }