weapp-tailwindcss 5.0.0-next.9 → 5.0.1

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 (167) hide show
  1. package/README.md +2 -2
  2. package/dist/auto-DEHRmEAx.mjs +200 -0
  3. package/dist/auto-dPpsm6FB.js +238 -0
  4. package/dist/bundle-state-CBF5YX1m.js +529 -0
  5. package/dist/bundle-state-CQmxxx0R.mjs +413 -0
  6. package/dist/bundlers/shared/cache.d.ts +9 -7
  7. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
  8. package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
  9. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  10. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  11. package/dist/bundlers/shared/generator-css/directives.d.ts +11 -3
  12. package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
  13. package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
  14. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
  15. package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +6 -2
  17. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  18. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  19. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  20. package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
  21. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
  22. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
  23. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
  24. package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
  25. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
  26. package/dist/bundlers/vite/index.d.ts +5 -2
  27. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  28. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
  29. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
  30. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  31. package/dist/bundlers/vite/source-candidates.d.ts +24 -2
  32. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  33. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  34. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
  35. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
  36. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
  37. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  38. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  39. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
  40. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  41. package/dist/cache/index.d.ts +6 -6
  42. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  43. package/dist/cli/context.d.ts +1 -11
  44. package/dist/cli/doctor/types.d.ts +11 -11
  45. package/dist/cli/vscode-entry.d.ts +3 -3
  46. package/dist/cli.js +684 -41
  47. package/dist/cli.mjs +682 -40
  48. package/dist/context/runtime-package-replacements.d.ts +2 -0
  49. package/dist/context/style-options.d.ts +3 -0
  50. package/dist/context/tailwindcss.d.ts +1 -1
  51. package/dist/core.js +1 -2
  52. package/dist/core.mjs +1 -1
  53. package/dist/css-macro/auto.d.ts +11 -0
  54. package/dist/css-macro/constants.d.ts +5 -2
  55. package/dist/css-macro/postcss.d.ts +1 -0
  56. package/dist/css-macro/postcss.js +7 -46
  57. package/dist/css-macro/postcss.mjs +2 -46
  58. package/dist/css-macro.js +16 -7
  59. package/dist/css-macro.mjs +15 -6
  60. package/dist/defaults-8xrgzxFY.mjs +151 -0
  61. package/dist/defaults-zKUH2mDe.js +193 -0
  62. package/dist/defaults.js +6 -150
  63. package/dist/defaults.mjs +1 -143
  64. package/dist/escape.js +10 -2
  65. package/dist/escape.mjs +10 -2
  66. package/dist/generator/options.d.ts +11 -6
  67. package/dist/generator/types.d.ts +3 -3
  68. package/dist/generator-CvmsIQFI.js +92 -0
  69. package/dist/generator-DDtsUvkH.mjs +67 -0
  70. package/dist/generator.js +12 -12
  71. package/dist/generator.mjs +2 -1
  72. package/dist/gulp.js +163 -40
  73. package/dist/gulp.mjs +155 -32
  74. package/dist/incremental-runtime-class-set-BffodqHh.js +2366 -0
  75. package/dist/incremental-runtime-class-set-DArodvWs.mjs +2291 -0
  76. package/dist/index.d.ts +2 -1
  77. package/dist/index.js +17 -5
  78. package/dist/index.mjs +6 -5
  79. package/dist/js/babel/cache-options.d.ts +3 -0
  80. package/dist/js/babel/parse.d.ts +7 -4
  81. package/dist/js/precheck.d.ts +2 -2
  82. package/dist/js/replacement-cache.d.ts +5 -0
  83. package/dist/{postcss-w48mGIhe.mjs → postcss-BzNYQUOH.mjs} +54 -114
  84. package/dist/postcss-C7BMYpEF.mjs +169 -0
  85. package/dist/postcss-CiYLsqZn.js +192 -0
  86. package/dist/{postcss-QIXwT40c.js → postcss-DE0TOtV9.js} +60 -121
  87. package/dist/postcss-html-transform.js +1 -1
  88. package/dist/postcss.js +1 -1
  89. package/dist/postcss.mjs +1 -1
  90. package/dist/precheck-BzYPm-EG.js +4842 -0
  91. package/dist/precheck-jZvTVXXG.mjs +4716 -0
  92. package/dist/presets/index.d.ts +1 -0
  93. package/dist/presets/uni-app-x.d.ts +1 -0
  94. package/dist/presets.js +27 -13
  95. package/dist/presets.mjs +25 -13
  96. package/dist/reset.js +1 -1
  97. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  98. package/dist/shared/mpx.d.ts +1 -0
  99. package/dist/source-candidates-BuTlMabx.mjs +322 -0
  100. package/dist/source-candidates-CxoIaS88.js +335 -0
  101. package/dist/tailwindcss/miniprogram.d.ts +1 -5
  102. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  103. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  104. package/dist/tailwindcss/runtime.d.ts +9 -9
  105. package/dist/tailwindcss/source-scan.d.ts +35 -0
  106. package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
  107. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  108. package/dist/tailwindcss/v4/patcher.d.ts +1 -1
  109. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  110. package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
  111. package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-CCZcu0lr.mjs} +75 -98
  112. package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-DZckITp1.js} +83 -106
  113. package/dist/typedoc.export.d.ts +1 -1
  114. package/dist/types/index.d.ts +51 -41
  115. package/dist/types/shared.d.ts +3 -0
  116. package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
  117. package/dist/types/user-defined-options/general.d.ts +25 -22
  118. package/dist/types/user-defined-options/important.d.ts +32 -27
  119. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  120. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  121. package/dist/unocss/index.d.ts +2 -0
  122. package/dist/utils/object.d.ts +9 -0
  123. package/dist/utils/options.d.ts +2 -0
  124. package/dist/utils/regex.d.ts +1 -0
  125. package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
  126. package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
  127. package/dist/v3-engine-DGBhUnjn.mjs +3419 -0
  128. package/dist/v3-engine-M6Aqru5T.js +3714 -0
  129. package/dist/vite-BBcQIJpD.mjs +24493 -0
  130. package/dist/vite-DgRkWVPG.js +24507 -0
  131. package/dist/vite.js +1 -1
  132. package/dist/vite.mjs +1 -1
  133. package/dist/weapp-tw-css-import-rewrite-loader.js +5456 -22
  134. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  135. package/dist/{webpack-BzN2ly34.js → webpack-D-gb4ZvO.js} +341 -96
  136. package/dist/{webpack-DJazm5sT.mjs → webpack-D43aMQzO.mjs} +323 -79
  137. package/dist/webpack.d.ts +1 -3
  138. package/dist/webpack.js +3 -4
  139. package/dist/webpack.mjs +2 -2
  140. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
  141. package/package.json +22 -20
  142. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
  143. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
  144. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
  145. package/dist/cache-BVAiJV3J.js +0 -502
  146. package/dist/cache-CHs4DXui.mjs +0 -434
  147. package/dist/constants-BoB_6lFw.js +0 -73
  148. package/dist/constants-E_loJC49.mjs +0 -44
  149. package/dist/generator-DKkhJbOg.js +0 -1531
  150. package/dist/generator-UBmfduYg.mjs +0 -1432
  151. package/dist/generator-css-Bwp3nbrl.js +0 -1381
  152. package/dist/generator-css-DeLLmp2N.mjs +0 -1342
  153. package/dist/lightningcss/index.d.ts +0 -8
  154. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  155. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  156. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  157. package/dist/lightningcss/style-handler.d.ts +0 -17
  158. package/dist/precheck-B32p-gLI.js +0 -2736
  159. package/dist/precheck-B4RH6ZNN.mjs +0 -2622
  160. package/dist/run-tasks-B50A3pxt.js +0 -128
  161. package/dist/run-tasks-DdNi-hkk.mjs +0 -91
  162. package/dist/runtime-patch-CwN5ya72.mjs +0 -71
  163. package/dist/runtime-patch-D6mBo_KB.js +0 -85
  164. package/dist/vite-By5KQi9s.js +0 -2419
  165. package/dist/vite-Cyp42bBf.mjs +0 -2406
  166. /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
  167. /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
@@ -1,13 +1,13 @@
1
- const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_cache = require("./cache-BVAiJV3J.js");
3
- require("./utils-BiShvil9.js");
1
+ const require_chunk = require("./chunk-C5U5_Hdc.js");
2
+ const require_v3_engine = require("./v3-engine-M6Aqru5T.js");
3
+ require("./utils-D7Ygohep.js");
4
+ let node_fs = require("node:fs");
4
5
  let node_module = require("node:module");
5
- let node_path = require("node:path");
6
- node_path = require_chunk.__toESM(node_path);
7
6
  let node_process = require("node:process");
8
7
  node_process = require_chunk.__toESM(node_process);
8
+ let node_path = require("node:path");
9
+ node_path = require_chunk.__toESM(node_path);
9
10
  let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
10
- let node_fs = require("node:fs");
11
11
  let node_url = require("node:url");
12
12
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
13
13
  //#region src/tailwindcss/v4/css-sources.ts
@@ -27,18 +27,23 @@ function normalizeCssSourceFile(file) {
27
27
  if (!file) return;
28
28
  return node_path.default.isAbsolute(file) ? node_path.default.normalize(file) : file;
29
29
  }
30
+ function normalizeCssSourceBase(base) {
31
+ if (!base) return;
32
+ return node_path.default.resolve(base);
33
+ }
30
34
  function normalizeDependencies(dependencies) {
31
35
  return dependencies?.map(normalizeCssSourceFile).filter((dependency) => typeof dependency === "string" && dependency.length > 0);
32
36
  }
33
37
  function isSameCssSource(a, b) {
34
- return a.css === b.css && a.base === b.base && normalizeCssSourceFile(a.file) === normalizeCssSourceFile(b.file) && JSON.stringify(normalizeDependencies(a.dependencies)) === JSON.stringify(normalizeDependencies(b.dependencies));
38
+ return a.css === b.css && normalizeCssSourceBase(a.base) === normalizeCssSourceBase(b.base) && normalizeCssSourceFile(a.file) === normalizeCssSourceFile(b.file) && JSON.stringify(normalizeDependencies(a.dependencies)) === JSON.stringify(normalizeDependencies(b.dependencies));
35
39
  }
36
40
  function upsertTailwindV4CssSource(opts, source) {
37
- const normalizedSource = {
41
+ const normalizedSource = require_v3_engine.omitUndefined({
38
42
  ...source,
43
+ ...source.base === void 0 ? {} : { base: normalizeCssSourceBase(source.base) },
39
44
  ...source.file === void 0 ? {} : { file: normalizeCssSourceFile(source.file) },
40
45
  ...source.dependencies === void 0 ? {} : { dependencies: normalizeDependencies(source.dependencies) }
41
- };
46
+ });
42
47
  const tailwindcss = opts.tailwindcss ?? {};
43
48
  const v4 = tailwindcss.v4 ?? {};
44
49
  const cssSources = [...v4.cssSources ?? []];
@@ -46,6 +51,10 @@ function upsertTailwindV4CssSource(opts, source) {
46
51
  const existingIndex = cssSources.findIndex((candidate) => normalizeCssSourceFile(candidate.file) === sourceFile);
47
52
  if (existingIndex >= 0) {
48
53
  const existing = cssSources[existingIndex];
54
+ if (!existing) {
55
+ cssSources[existingIndex] = normalizedSource;
56
+ return true;
57
+ }
49
58
  const nextSource = {
50
59
  ...existing,
51
60
  ...normalizedSource
@@ -102,14 +111,7 @@ function ensureDefaultsIncluded(value) {
102
111
  return value;
103
112
  }
104
113
  function normalizeCssEntriesConfig(entries) {
105
- if (!entries) return;
106
- if (typeof entries === "string") {
107
- const trimmed = entries.trim();
108
- return trimmed ? [trimmed] : void 0;
109
- }
110
- if (!Array.isArray(entries)) return;
111
- const normalized = entries.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
112
- return normalized.length > 0 ? normalized : void 0;
114
+ return require_v3_engine.normalizeStringListOption(entries);
113
115
  }
114
116
  function hasConfiguredCssEntries(ctx) {
115
117
  if (normalizeCssEntriesConfig(ctx.cssEntries)) return true;
@@ -136,7 +138,11 @@ function applyV4CssCalcDefaults(cssCalc, patcher) {
136
138
  //#endregion
137
139
  //#region src/tailwindcss/v4/multi-patcher.ts
138
140
  function createMultiTailwindcssPatcher(patchers) {
139
- if (patchers.length <= 1) return patchers[0];
141
+ if (patchers.length <= 1) {
142
+ const [patcher] = patchers;
143
+ if (!patcher) throw new Error("createMultiTailwindcssPatcher requires at least one patcher.");
144
+ return patcher;
145
+ }
140
146
  const first = patchers[0];
141
147
  const firstWithoutPatch = { ...first };
142
148
  delete firstWithoutPatch.patch;
@@ -167,11 +173,11 @@ function createMultiTailwindcssPatcher(patchers) {
167
173
  }
168
174
  if (result.classSet) for (const className of result.classSet) aggregatedSet.add(className);
169
175
  }
170
- return {
176
+ return require_v3_engine.omitUndefined({
171
177
  classList: aggregatedList,
172
178
  classSet: aggregatedSet,
173
179
  filename
174
- };
180
+ });
175
181
  }
176
182
  };
177
183
  if (patchers.every((patcher) => typeof patcher.getClassSetSync === "function")) multiPatcher.getClassSetSync = () => {
@@ -183,7 +189,7 @@ function createMultiTailwindcssPatcher(patchers) {
183
189
  }
184
190
  return aggregated;
185
191
  };
186
- Object.defineProperty(multiPatcher, require_cache.runtimeSignaturePatchersSymbol, {
192
+ Object.defineProperty(multiPatcher, require_v3_engine.runtimeSignaturePatchersSymbol, {
187
193
  value: [...patchers],
188
194
  configurable: true
189
195
  });
@@ -217,7 +223,7 @@ function guessBasedirFromEntries(entries) {
217
223
  const trimmed = entry.trim();
218
224
  if (!trimmed || !node_path.default.isAbsolute(trimmed)) continue;
219
225
  const entryDir = node_path.default.dirname(trimmed);
220
- const resolved = require_cache.findNearestPackageRoot(entryDir) ?? entryDir;
226
+ const resolved = require_v3_engine.findNearestPackageRoot(entryDir) ?? entryDir;
221
227
  if (resolved) return resolved;
222
228
  }
223
229
  }
@@ -243,7 +249,7 @@ function resolveCssEntryBase(entryDir, options) {
243
249
  const { preferredBaseDir, workspaceRoot } = options;
244
250
  if (preferredBaseDir && isSubPath(preferredBaseDir, normalizedDir)) return preferredBaseDir;
245
251
  if (workspaceRoot && isSubPath(workspaceRoot, normalizedDir)) return workspaceRoot;
246
- const packageRoot = require_cache.findNearestPackageRoot(normalizedDir);
252
+ const packageRoot = require_v3_engine.findNearestPackageRoot(normalizedDir);
247
253
  if (packageRoot) return node_path.default.normalize(packageRoot);
248
254
  return normalizedDir;
249
255
  }
@@ -263,34 +269,26 @@ function groupCssEntriesByBase(entries, options = {}) {
263
269
  }
264
270
  //#endregion
265
271
  //#region src/tailwindcss/v4/patcher.ts
266
- const CONFIGURED_TAILWIND_VERSION_RE = /Configured tailwindcss\.version=\d+/u;
267
- const RESOLVED_TAILWIND_VERSION_RE = /resolved package ".+" is version /u;
268
272
  function isTailwindcss4Package(packageName) {
269
273
  return Boolean(packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4")));
270
274
  }
271
275
  function resolveExplicitTailwindVersion(configuredVersion, configuredPackageName) {
272
276
  if (typeof configuredVersion === "number") return configuredVersion;
273
- if (configuredPackageName === "tailwindcss") return 3;
274
277
  if (isTailwindcss4Package(configuredPackageName)) return 4;
275
278
  }
276
- function hasOwnV4Signal(value) {
277
- return typeof value === "object" && value !== null && "v4" in value;
278
- }
279
- function isTailwindVersionMismatchError(error) {
280
- return error instanceof Error && CONFIGURED_TAILWIND_VERSION_RE.test(error.message) && RESOLVED_TAILWIND_VERSION_RE.test(error.message);
281
- }
282
279
  function createPatcherForBase(baseDir, cssEntries, options) {
283
280
  const { tailwindcss, tailwindcssPatcherOptions, supportCustomLengthUnitsPatch, bareArbitraryValues } = options;
284
281
  const hasCssEntries = Boolean(cssEntries?.length);
285
- const mergedTailwindOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(tailwindcss ?? {}, {
282
+ const defaultTailwindcssConfig = {
286
283
  cwd: baseDir,
287
284
  v2: { cwd: baseDir },
288
285
  v3: { cwd: baseDir },
289
- v4: hasCssEntries ? { cssEntries } : {
286
+ v4: hasCssEntries ? require_v3_engine.omitUndefined({ cssEntries }) : require_v3_engine.omitUndefined({
290
287
  base: baseDir,
291
288
  cssEntries
292
- }
293
- });
289
+ })
290
+ };
291
+ const mergedTailwindOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(tailwindcss ?? {}, defaultTailwindcssConfig);
294
292
  if (!mergedTailwindOptions.v4) mergedTailwindOptions.v4 = hasCssEntries ? { cssEntries: cssEntries ?? [] } : {
295
293
  base: baseDir,
296
294
  cssEntries: cssEntries ?? []
@@ -306,69 +304,48 @@ function createPatcherForBase(baseDir, cssEntries, options) {
306
304
  const patchedOptions = overrideTailwindcssPatcherOptionsForBase(tailwindcssPatcherOptions, baseDir, cssEntries ?? []);
307
305
  const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName;
308
306
  const explicitTailwindVersion = resolveExplicitTailwindVersion(tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || mergedTailwindOptions.version, configuredPackageName);
309
- const hasExplicitV4Signals = hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
310
- const packageNameForVersionDetection = configuredPackageName ?? mergedTailwindOptions.packageName ?? "tailwindcss";
311
- const installedTailwindVersion = require_cache.readInstalledPackageMajorVersion(packageNameForVersionDetection, baseDir);
312
- const resolvedTailwindVersion = installedTailwindVersion ?? explicitTailwindVersion;
313
- const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
314
- const packageCandidates = /* @__PURE__ */ new Set();
315
- if (shouldPatchV4PostcssPackage) packageCandidates.add("@tailwindcss/postcss");
316
- packageCandidates.add(mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss");
317
- const patchers = [];
318
- const packageCandidateList = [...packageCandidates];
319
- let firstVersionMismatchError;
320
- for (const packageName of packageCandidateList) {
321
- const tailwindOptionsForPackage = {
322
- ...mergedTailwindOptions,
323
- packageName
324
- };
325
- if (resolvedTailwindVersion) tailwindOptionsForPackage.version = resolvedTailwindVersion;
326
- try {
327
- patchers.push(require_cache.createTailwindcssPatcher({
328
- basedir: baseDir,
329
- supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
330
- tailwindcss: tailwindOptionsForPackage,
331
- tailwindcssPatcherOptions: patchedOptions
332
- }));
333
- } catch (error) {
334
- if (packageCandidateList.length > 1 && isTailwindVersionMismatchError(error)) {
335
- firstVersionMismatchError ?? (firstVersionMismatchError = error);
336
- _weapp_tailwindcss_logger.logger.warn("skip incompatible Tailwind package candidate \"%s\" for v4 patcher: %s", packageName, error.message);
337
- continue;
338
- }
339
- throw error;
340
- }
341
- }
342
- if (patchers.length === 0 && firstVersionMismatchError) throw firstVersionMismatchError;
343
- return patchers.length === 1 ? patchers[0] : createMultiTailwindcssPatcher(patchers);
307
+ const resolvedTailwindVersion = require_v3_engine.readInstalledPackageMajorVersion(configuredPackageName ?? mergedTailwindOptions.packageName ?? "tailwindcss", baseDir) ?? explicitTailwindVersion;
308
+ const supportedResolvedTailwindVersion = resolvedTailwindVersion === 2 || resolvedTailwindVersion === 3 || resolvedTailwindVersion === 4 ? resolvedTailwindVersion : void 0;
309
+ const tailwindOptionsForPackage = {
310
+ ...mergedTailwindOptions,
311
+ packageName: mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss"
312
+ };
313
+ if (supportedResolvedTailwindVersion) tailwindOptionsForPackage.version = supportedResolvedTailwindVersion;
314
+ return require_v3_engine.createTailwindcssPatcher(require_v3_engine.omitUndefined({
315
+ basedir: baseDir,
316
+ supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
317
+ tailwindcss: tailwindOptionsForPackage,
318
+ tailwindcssPatcherOptions: patchedOptions
319
+ }));
344
320
  }
345
321
  function tryCreateMultiTailwindcssPatcher(groups, options) {
346
322
  if (groups.size <= 1) return;
347
323
  _weapp_tailwindcss_logger.logger.debug("detected multiple Tailwind CSS entry bases: %O", [...groups.keys()]);
348
324
  const patchers = [];
349
- for (const [baseDir, entries] of groups) patchers.push(createPatcherForBase(baseDir, entries, options));
325
+ for (const [baseDir, entries] of groups) {
326
+ const patcher = createPatcherForBase(baseDir, entries, options);
327
+ if (patcher) patchers.push(patcher);
328
+ }
350
329
  return createMultiTailwindcssPatcher(patchers);
351
330
  }
352
331
  //#endregion
353
332
  //#region src/uni-app-x/options.ts
333
+ const DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS = {
334
+ enabled: true,
335
+ onlyWhenStyleIsolationVersion2: true
336
+ };
337
+ const DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS = {
338
+ enabled: false,
339
+ onlyWhenStyleIsolationVersion2: true
340
+ };
341
+ function isBooleanUniAppXShortcut(option) {
342
+ return option === true || option === false || option === void 0;
343
+ }
354
344
  function resolveComponentLocalStyles(option) {
355
- if (option === false) return {
356
- enabled: false,
357
- onlyWhenStyleIsolationVersion2: true
358
- };
359
- if (option === true || option === void 0) return {
360
- enabled: false,
361
- onlyWhenStyleIsolationVersion2: true
362
- };
345
+ if (isBooleanUniAppXShortcut(option)) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
363
346
  const componentLocalStyles = option.componentLocalStyles;
364
- if (componentLocalStyles === false) return {
365
- enabled: false,
366
- onlyWhenStyleIsolationVersion2: true
367
- };
368
- if (componentLocalStyles === true || componentLocalStyles === void 0) return {
369
- enabled: true,
370
- onlyWhenStyleIsolationVersion2: true
371
- };
347
+ if (componentLocalStyles === false) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
348
+ if (componentLocalStyles === true || componentLocalStyles === void 0) return DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS;
372
349
  return {
373
350
  enabled: componentLocalStyles.enabled !== false,
374
351
  onlyWhenStyleIsolationVersion2: componentLocalStyles.onlyWhenStyleIsolationVersion2 !== false
@@ -414,12 +391,12 @@ function pickEnvBasedir() {
414
391
  }
415
392
  }
416
393
  function pickPackageEnvBasedir() {
417
- const packageJsonPath = node_process.default.env.npm_package_json;
394
+ const packageJsonPath = node_process.default.env["npm_package_json"];
418
395
  if (packageJsonPath) {
419
396
  const packageDir = node_path.default.dirname(packageJsonPath);
420
397
  if (packageDir && node_path.default.isAbsolute(packageDir)) return packageDir;
421
398
  }
422
- const localPrefix = node_process.default.env.npm_config_local_prefix;
399
+ const localPrefix = node_process.default.env["npm_config_local_prefix"];
423
400
  if (localPrefix && node_path.default.isAbsolute(localPrefix)) return localPrefix;
424
401
  }
425
402
  const STACK_PAREN_RE = /\(([^)]+)\)/u;
@@ -427,7 +404,7 @@ const STACK_AT_RE = /at\s+(\S.*)$/u;
427
404
  function detectCallerBasedir() {
428
405
  const stack = (/* @__PURE__ */ new Error("resolveTailwindcssBasedir stack probe")).stack;
429
406
  if (!stack) return;
430
- if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("caller stack: %s", stack);
407
+ if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("caller stack: %s", stack);
431
408
  const lines = stack.split("\n");
432
409
  for (const line of lines) {
433
410
  const location = (line.match(STACK_PAREN_RE) ?? line.match(STACK_AT_RE))?.[1];
@@ -438,7 +415,7 @@ function detectCallerBasedir() {
438
415
  } catch {
439
416
  continue;
440
417
  }
441
- const [candidate] = filePath.split(":");
418
+ const [candidate = ""] = filePath.split(":");
442
419
  const resolvedPath = node_path.default.isAbsolute(filePath) ? filePath : candidate;
443
420
  if (!node_path.default.isAbsolute(resolvedPath)) continue;
444
421
  if (resolvedPath.includes("node_modules") && resolvedPath.includes("weapp-tailwindcss")) continue;
@@ -459,7 +436,7 @@ function resolveTailwindcssBasedir(basedir, fallback) {
459
436
  const cwd = node_process.default.cwd();
460
437
  const anchor = envBasedir ?? packageEnvBasedir ?? fallback ?? callerBasedir ?? cwd;
461
438
  const resolveRelative = (value) => node_path.default.isAbsolute(value) ? node_path.default.normalize(value) : node_path.default.normalize(node_path.default.resolve(anchor, value));
462
- if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("resolveTailwindcssBasedir anchor %O", {
439
+ if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("resolveTailwindcssBasedir anchor %O", {
463
440
  basedir,
464
441
  envBasedir,
465
442
  envBasedirKey,
@@ -467,7 +444,7 @@ function resolveTailwindcssBasedir(basedir, fallback) {
467
444
  packageEnvBasedir,
468
445
  fallback,
469
446
  callerBasedir,
470
- npm_package_json: node_process.default.env.npm_package_json,
447
+ npm_package_json: node_process.default.env["npm_package_json"],
471
448
  cwd,
472
449
  anchor
473
450
  });
@@ -480,16 +457,16 @@ function resolveTailwindcssBasedir(basedir, fallback) {
480
457
  const librarySegment = `${node_path.default.sep}weapp-tailwindcss${node_path.default.sep}`;
481
458
  if (!normalizedCaller.includes(librarySegment)) return normalizedCaller;
482
459
  }
483
- const packageName = node_process.default.env.PNPM_PACKAGE_NAME;
460
+ const packageName = node_process.default.env["PNPM_PACKAGE_NAME"];
484
461
  if (packageName) try {
485
462
  const packageJsonPath = (0, node_module.createRequire)(node_path.default.join(anchor, "__resolve_tailwindcss_basedir__.cjs")).resolve(`${packageName}/package.json`);
486
- if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
463
+ if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
487
464
  return node_path.default.normalize(node_path.default.dirname(packageJsonPath));
488
465
  } catch {
489
- if (node_process.default.env.WEAPP_TW_DEBUG_STACK === "1") _weapp_tailwindcss_logger.logger.debug("failed to resolve package json for %s", packageName);
490
- const workspaceRoot = require_cache.findWorkspaceRoot(anchor);
466
+ if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("failed to resolve package json for %s", packageName);
467
+ const workspaceRoot = require_v3_engine.findWorkspaceRoot(anchor);
491
468
  if (workspaceRoot) {
492
- const packageDir = require_cache.findWorkspacePackageDir(workspaceRoot, packageName);
469
+ const packageDir = require_v3_engine.findWorkspacePackageDir(workspaceRoot, packageName);
493
470
  if (packageDir) return packageDir;
494
471
  }
495
472
  }
@@ -505,8 +482,8 @@ function isRaxWorkspace(appType, baseDir) {
505
482
  if (!(0, node_fs.existsSync)(pkgPath)) return false;
506
483
  const pkg = JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf8"));
507
484
  const deps = {
508
- ...pkg.dependencies ?? {},
509
- ...pkg.devDependencies ?? {}
485
+ ...pkg["dependencies"] ?? {},
486
+ ...pkg["devDependencies"] ?? {}
510
487
  };
511
488
  if (deps["rax-app"] || deps.rax) return true;
512
489
  } catch {
@@ -535,8 +512,8 @@ function detectImplicitCssEntries(appType, baseDir) {
535
512
  baseCandidates.add(node_path.default.normalize(baseDir));
536
513
  const envCandidates = [
537
514
  node_process.default.cwd(),
538
- node_process.default.env.INIT_CWD,
539
- node_process.default.env.PWD
515
+ node_process.default.env["INIT_CWD"],
516
+ node_process.default.env["PWD"]
540
517
  ];
541
518
  for (const candidate of envCandidates) if (candidate) baseCandidates.add(node_path.default.normalize(candidate));
542
519
  for (const candidateBase of baseCandidates) {
@@ -563,11 +540,11 @@ function createTailwindcssPatcherFromContext(ctx) {
563
540
  appType,
564
541
  bareArbitraryValues: arbitraryValues?.bareArbitraryValues
565
542
  };
566
- const workspaceRoot = require_cache.findWorkspaceRoot(resolvedTailwindcssBasedir) ?? (absoluteCssEntryBasedir ? require_cache.findWorkspaceRoot(absoluteCssEntryBasedir) : void 0);
567
- const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, {
543
+ const workspaceRoot = require_v3_engine.findWorkspaceRoot(resolvedTailwindcssBasedir) ?? (absoluteCssEntryBasedir ? require_v3_engine.findWorkspaceRoot(absoluteCssEntryBasedir) : void 0);
544
+ const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, require_v3_engine.omitUndefined({
568
545
  preferredBaseDir: resolvedTailwindcssBasedir,
569
546
  workspaceRoot
570
- }) : void 0;
547
+ })) : void 0;
571
548
  const multiPatcher = groupedCssEntries ? tryCreateMultiTailwindcssPatcher(groupedCssEntries, patcherOptions) : void 0;
572
549
  if (multiPatcher) return multiPatcher;
573
550
  if (groupedCssEntries?.size === 1) {
@@ -1,3 +1,3 @@
1
1
  export type { WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, WeappTailwindcssPostcssPluginOptions, } from './index';
2
+ export type { ApplyOptions, CacheOptions, ExtractOptions, TailwindCssOptions, TailwindCssPatchOptions, TailwindV2Options, TailwindV3Options, TailwindV4Options, } from './types/typedoc-tailwindcss-patch';
2
3
  export type { UserDefinedOptions } from './types/user-defined-options';
3
- export type { ApplyOptions, CacheOptions, ExtractOptions, TailwindCssOptions, TailwindCssPatchOptions, TailwindV2Options, TailwindV3Options, TailwindV4Options, } from 'tailwindcss-patch';
@@ -10,7 +10,11 @@ import type { UniAppXComponentLocalStylesOptions, UniAppXOptions as UniAppXUserD
10
10
  type AsyncableMethod<T> = T extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> | Awaited<R> : never;
11
11
  export type { UniAppXComponentLocalStylesOptions, UniAppXUserDefinedOptions, UserDefinedOptions, };
12
12
  export type { CssPreflightOptions, IStyleHandlerOptions, ItemOrItemArray };
13
- export type { AppType, IArbitraryValues, ICustomAttributes, ICustomAttributesEntities } from './shared';
13
+ export type { AppType, IArbitraryValues, ICustomAttributes, ICustomAttributesEntities, IUnocssCompatibilityOptions } from './shared';
14
+ export type RequiredDefined<T> = {
15
+ [K in keyof T]-?: Exclude<T[K], undefined>;
16
+ };
17
+ type InternalUserDefinedOptionsBase = RequiredDefined<Omit<UserDefinedOptions, 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary' | 'cache' | 'twPatcher' | 'refreshTailwindcssPatcher' | 'templateHandler' | 'styleHandler' | 'jsHandler'>>;
14
18
  export interface LinkedJsModuleResult {
15
19
  code: string;
16
20
  }
@@ -22,56 +26,62 @@ export interface JsHandlerResult {
22
26
  }
23
27
  export interface TailwindcssPatcherLike {
24
28
  packageInfo: TailwindcssPatcher['packageInfo'];
25
- majorVersion?: TailwindcssPatcher['majorVersion'];
26
- patch?: TailwindcssPatcher['patch'];
29
+ majorVersion?: TailwindcssPatcher['majorVersion'] | undefined;
30
+ patch?: TailwindcssPatcher['patch'] | undefined;
27
31
  getClassSet: AsyncableMethod<TailwindcssPatcher['getClassSet']>;
28
- getClassSetSync?: TailwindcssPatcher['getClassSetSync'];
32
+ getClassSetSync?: TailwindcssPatcher['getClassSetSync'] | undefined;
29
33
  extract: TailwindcssPatcher['extract'];
30
- collectContentTokens?: TailwindcssPatcher['collectContentTokens'];
31
- options?: TailwindcssPatcher['options'];
34
+ collectContentTokens?: TailwindcssPatcher['collectContentTokens'] | undefined;
35
+ options?: TailwindcssPatcher['options'] | undefined;
32
36
  }
37
+ export type BabelParserOptions = ParserOptions & {
38
+ cache?: boolean | undefined;
39
+ cacheKey?: string | undefined;
40
+ cacheMaxEntries?: number | undefined;
41
+ cacheMaxSourceLength?: number | undefined;
42
+ };
33
43
  export interface RefreshTailwindcssPatcherOptions {
34
- clearCache?: boolean;
44
+ clearCache?: boolean | undefined;
35
45
  }
36
46
  export interface IJsHandlerOptions {
37
- escapeMap?: Record<string, string>;
38
- classNameSet?: Set<string>;
39
- jsArbitraryValueFallback?: boolean | 'auto';
40
- tailwindcssMajorVersion?: number;
41
- arbitraryValues?: IArbitraryValues;
42
- jsPreserveClass?: (keyword: string) => boolean | undefined;
43
- needEscaped?: boolean;
44
- generateMap?: boolean;
45
- alwaysEscape?: boolean;
46
- unescapeUnicode?: boolean;
47
- babelParserOptions?: ParserOptions;
48
- ignoreTaggedTemplateExpressionIdentifiers?: (string | RegExp)[];
49
- ignoreCallExpressionIdentifiers?: (string | RegExp)[];
50
- uniAppX?: boolean;
51
- moduleSpecifierReplacements?: Record<string, string>;
52
- wrapExpression?: boolean;
53
- filename?: string;
54
- moduleGraph?: JsModuleGraphOptions;
47
+ escapeMap?: Record<string, string> | undefined;
48
+ classNameSet?: Set<string> | undefined;
49
+ jsArbitraryValueFallback?: boolean | 'auto' | undefined;
50
+ tailwindcssMajorVersion?: number | undefined;
51
+ arbitraryValues?: IArbitraryValues | undefined;
52
+ jsPreserveClass?: ((keyword: string) => boolean | undefined) | undefined;
53
+ needEscaped?: boolean | undefined;
54
+ generateMap?: boolean | undefined;
55
+ alwaysEscape?: boolean | undefined;
56
+ unescapeUnicode?: boolean | undefined;
57
+ babelParserOptions?: BabelParserOptions | undefined;
58
+ ignoreTaggedTemplateExpressionIdentifiers?: (string | RegExp)[] | undefined;
59
+ ignoreCallExpressionIdentifiers?: (string | RegExp)[] | undefined;
60
+ uniAppX?: boolean | undefined;
61
+ moduleSpecifierReplacements?: Record<string, string> | undefined;
62
+ wrapExpression?: boolean | undefined;
63
+ filename?: string | undefined;
64
+ moduleGraph?: JsModuleGraphOptions | undefined;
55
65
  }
56
66
  export interface JsHandler {
57
67
  (rawSource: string, set?: Set<string>, options?: CreateJsHandlerOptions): JsHandlerResult;
58
68
  }
59
69
  export interface ICommonReplaceOptions {
60
- keepEOL?: boolean;
61
- escapeMap?: Record<string, string>;
70
+ keepEOL?: boolean | undefined;
71
+ escapeMap?: Record<string, string> | undefined;
62
72
  }
63
73
  export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
64
- customAttributesEntities?: ICustomAttributesEntities;
65
- escapeMap?: Record<string, string>;
66
- inlineWxs?: boolean;
67
- jsHandler?: JsHandler;
68
- runtimeSet?: Set<string>;
69
- disabledDefaultTemplateHandler?: boolean;
70
- quote?: string | null;
71
- ignoreHead?: boolean;
72
- wrapExpression?: boolean;
74
+ customAttributesEntities?: ICustomAttributesEntities | undefined;
75
+ escapeMap?: Record<string, string> | undefined;
76
+ inlineWxs?: boolean | undefined;
77
+ jsHandler?: JsHandler | undefined;
78
+ runtimeSet?: Set<string> | undefined;
79
+ disabledDefaultTemplateHandler?: boolean | undefined;
80
+ quote?: string | null | undefined;
81
+ ignoreHead?: boolean | undefined;
82
+ wrapExpression?: boolean | undefined;
73
83
  }
74
- export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary' | 'cache'> & {
84
+ export interface InternalUserDefinedOptions extends InternalUserDefinedOptionsBase {
75
85
  supportCustomLengthUnitsPatch: ILengthUnitsPatchOptions | boolean;
76
86
  templateHandler: (rawSource: string, options?: ITemplateHandlerOptions) => Promise<string>;
77
87
  styleHandler: (rawSource: string, options?: IStyleHandlerOptions) => Promise<PostcssResult<Root | Document>>;
@@ -81,17 +91,17 @@ export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supp
81
91
  cache: ICreateCacheReturnType;
82
92
  twPatcher: TailwindcssPatcherLike;
83
93
  refreshTailwindcssPatcher: (options?: RefreshTailwindcssPatcherOptions) => Promise<TailwindcssPatcherLike>;
84
- }>;
94
+ }
85
95
  export type InternalPostcssOptions = Pick<UserDefinedOptions, 'cssMatcher' | 'mainCssChunkMatcher' | 'cssPreflight' | 'cssPreflightRange' | 'disabled'>;
86
96
  export interface IBaseWebpackPlugin {
87
97
  options: InternalUserDefinedOptions;
88
- appType?: AppType;
98
+ appType?: AppType | undefined;
89
99
  apply: (compiler: any) => void;
90
100
  }
91
101
  export type CreateJsHandlerOptions = Omit<IJsHandlerOptions, 'classNameSet'>;
92
102
  export interface JsModuleGraphOptions {
93
103
  resolve: (specifier: string, importer: string) => string | undefined;
94
104
  load: (id: string) => string | undefined;
95
- filter?: (id: string, specifier: string, importer: string) => boolean;
96
- maxDepth?: number;
105
+ filter?: ((id: string, specifier: string, importer: string) => boolean) | undefined;
106
+ maxDepth?: number | undefined;
97
107
  }
@@ -8,3 +8,6 @@ export interface IArbitraryValues {
8
8
  units?: string[];
9
9
  };
10
10
  }
11
+ export interface IUnocssCompatibilityOptions {
12
+ bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'];
13
+ }
@@ -0,0 +1,67 @@
1
+ import type { SourceEntry } from '@tailwindcss/oxide';
2
+ import type { PackageResolvingOptions } from 'local-pkg';
3
+ import type { ILengthUnitsPatchOptions } from 'tailwindcss-patch';
4
+ import type { TailwindV4CssSource } from '../tailwindcss/v4-engine';
5
+ export type CacheStrategy = 'merge' | 'overwrite';
6
+ export type CacheDriver = 'file' | 'memory' | 'noop';
7
+ export interface CacheOptions {
8
+ enabled?: boolean;
9
+ cwd?: string;
10
+ dir?: string;
11
+ file?: string;
12
+ strategy?: CacheStrategy;
13
+ driver?: CacheDriver;
14
+ }
15
+ export interface ExtractOptions {
16
+ write?: boolean;
17
+ file?: string;
18
+ format?: 'json' | 'lines';
19
+ pretty?: number | boolean;
20
+ removeUniversalSelector?: boolean;
21
+ }
22
+ export interface ExposeContextOptions {
23
+ refProperty?: string;
24
+ }
25
+ export interface ExtendLengthUnitsOptions extends Partial<ILengthUnitsPatchOptions> {
26
+ enabled?: boolean;
27
+ }
28
+ export interface ApplyOptions {
29
+ overwrite?: boolean;
30
+ exposeContext?: boolean | ExposeContextOptions;
31
+ extendLengthUnits?: false | ExtendLengthUnitsOptions;
32
+ }
33
+ export interface TailwindRuntimeOptionsBase {
34
+ config?: string;
35
+ cwd?: string;
36
+ postcssPlugin?: string;
37
+ }
38
+ export interface TailwindV2Options extends TailwindRuntimeOptionsBase {
39
+ }
40
+ export interface TailwindV3Options extends TailwindRuntimeOptionsBase {
41
+ }
42
+ export interface TailwindV4Options {
43
+ base?: string;
44
+ css?: string;
45
+ cssSources?: TailwindV4CssSource[];
46
+ cssEntries?: string[];
47
+ sources?: SourceEntry[];
48
+ bareArbitraryValues?: boolean | {
49
+ units?: string[];
50
+ } | undefined;
51
+ }
52
+ export interface TailwindCssOptions extends TailwindRuntimeOptionsBase {
53
+ version?: 2 | 3 | 4;
54
+ packageName?: string;
55
+ resolve?: PackageResolvingOptions;
56
+ v2?: TailwindV2Options;
57
+ v3?: TailwindV3Options;
58
+ v4?: TailwindV4Options;
59
+ }
60
+ export interface TailwindCssPatchOptions {
61
+ projectRoot?: string;
62
+ tailwindcss?: TailwindCssOptions;
63
+ apply?: ApplyOptions;
64
+ extract?: ExtractOptions;
65
+ filter?: (className: string) => boolean;
66
+ cache?: boolean | CacheOptions;
67
+ }
@@ -3,27 +3,30 @@ import type { LoadedPostcssOptions } from '@weapp-tailwindcss/postcss/types';
3
3
  import type { ILengthUnitsPatchOptions, TailwindCssPatchOptions } from 'tailwindcss-patch';
4
4
  import type { ICreateCacheReturnType } from '../../cache';
5
5
  import type { WeappTailwindcssGeneratorUserOptions } from '../../generator';
6
- import type { AppType, IArbitraryValues } from '../shared';
6
+ import type { AppType, IArbitraryValues, IUnocssCompatibilityOptions } from '../shared';
7
7
  export interface UserDefinedOptionsGeneralPart {
8
- supportCustomLengthUnitsPatch?: ILengthUnitsPatchOptions | boolean;
9
- appType?: AppType;
10
- arbitraryValues?: IArbitraryValues;
11
- jsPreserveClass?: (keyword: string) => boolean | undefined;
12
- jsArbitraryValueFallback?: boolean | 'auto';
13
- replaceRuntimePackages?: boolean | Record<string, string>;
14
- generator?: WeappTailwindcssGeneratorUserOptions;
15
- disabledDefaultTemplateHandler?: boolean;
16
- runtimeLoaderPath?: string;
17
- tailwindcssBasedir?: string;
18
- cache?: boolean | ICreateCacheReturnType;
19
- babelParserOptions?: ParserOptions & {
20
- cache?: boolean;
21
- cacheKey?: string;
22
- };
23
- cssChildCombinatorReplaceValue?: string | string[];
24
- postcssOptions?: LoadedPostcssOptions;
25
- cssRemoveHoverPseudoClass?: boolean;
26
- cssRemoveProperty?: boolean;
27
- tailwindcssPatcherOptions?: TailwindCssPatchOptions;
28
- logLevel?: 'info' | 'warn' | 'error' | 'silent';
8
+ supportCustomLengthUnitsPatch?: ILengthUnitsPatchOptions | boolean | undefined;
9
+ appType?: AppType | undefined;
10
+ arbitraryValues?: IArbitraryValues | undefined;
11
+ unocss?: boolean | IUnocssCompatibilityOptions | undefined;
12
+ jsPreserveClass?: ((keyword: string) => boolean | undefined) | undefined;
13
+ jsArbitraryValueFallback?: boolean | 'auto' | undefined;
14
+ replaceRuntimePackages?: boolean | Record<string, string> | undefined;
15
+ generator?: WeappTailwindcssGeneratorUserOptions | undefined;
16
+ disabledDefaultTemplateHandler?: boolean | undefined;
17
+ runtimeLoaderPath?: string | undefined;
18
+ tailwindcssBasedir?: string | undefined;
19
+ cache?: boolean | ICreateCacheReturnType | undefined;
20
+ babelParserOptions?: (ParserOptions & {
21
+ cache?: boolean | undefined;
22
+ cacheKey?: string | undefined;
23
+ cacheMaxEntries?: number | undefined;
24
+ cacheMaxSourceLength?: number | undefined;
25
+ }) | undefined;
26
+ cssChildCombinatorReplaceValue?: string | string[] | undefined;
27
+ postcssOptions?: LoadedPostcssOptions | undefined;
28
+ cssRemoveHoverPseudoClass?: boolean | undefined;
29
+ cssRemoveProperty?: boolean | undefined;
30
+ tailwindcssPatcherOptions?: TailwindCssPatchOptions | undefined;
31
+ logLevel?: 'info' | 'warn' | 'error' | 'silent' | undefined;
29
32
  }