weapp-tailwindcss 4.11.2 → 4.12.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +38 -0
  2. package/dist/{chunk-WJIRXC26.js → chunk-5ONE75V7.js} +117 -119
  3. package/dist/{chunk-OMARW5NC.mjs → chunk-AYJ4HLWZ.mjs} +4 -2
  4. package/dist/{chunk-VGPAKLMZ.mjs → chunk-F5XJWJYO.mjs} +12 -7
  5. package/dist/{chunk-SUKOZ6OG.js → chunk-FMK6SFQQ.js} +10 -6
  6. package/dist/{chunk-TT5WHNGS.js → chunk-GC7WXUOW.js} +136 -77
  7. package/dist/{chunk-W3DXDWYC.mjs → chunk-GD4SQMVF.mjs} +49 -51
  8. package/dist/{chunk-7LKMJZD2.js → chunk-GMKSBLNY.js} +2 -2
  9. package/dist/{chunk-EFBQ4SQR.mjs → chunk-HL3US2OT.mjs} +1 -1
  10. package/dist/{chunk-3QHYEMEW.js → chunk-LVSUBDJC.js} +45 -40
  11. package/dist/{chunk-QK6VNNNL.js → chunk-NIS74SI6.js} +8 -6
  12. package/dist/{chunk-CRDOWYG4.js → chunk-ONLKZIRQ.js} +1 -1
  13. package/dist/{chunk-AB2RGZQO.mjs → chunk-QNRJCEZN.mjs} +131 -72
  14. package/dist/{chunk-ZZ36BKM5.mjs → chunk-UUJWDME4.mjs} +6 -2
  15. package/dist/{chunk-AV3XB6EQ.js → chunk-WSS26HZS.js} +5 -5
  16. package/dist/{chunk-JIERVBTX.mjs → chunk-ZR3KN3FG.mjs} +1 -1
  17. package/dist/cli.js +8 -1
  18. package/dist/cli.mjs +8 -1
  19. package/dist/core.d.mts +1 -1
  20. package/dist/core.d.ts +1 -1
  21. package/dist/core.js +14 -9
  22. package/dist/core.mjs +10 -5
  23. package/dist/css-macro/postcss.js +1 -1
  24. package/dist/css-macro/postcss.mjs +1 -1
  25. package/dist/css-macro.js +1 -1
  26. package/dist/css-macro.mjs +1 -1
  27. package/dist/defaults.d.mts +1 -1
  28. package/dist/defaults.d.ts +1 -1
  29. package/dist/defaults.js +1 -1
  30. package/dist/defaults.mjs +1 -1
  31. package/dist/gulp.d.mts +1 -1
  32. package/dist/gulp.d.ts +1 -1
  33. package/dist/gulp.js +5 -5
  34. package/dist/gulp.mjs +4 -4
  35. package/dist/{index-CoXntW_P.d.mts → index-BXrmQelt.d.mts} +29 -1
  36. package/dist/{index-CoXntW_P.d.ts → index-BXrmQelt.d.ts} +29 -1
  37. package/dist/index.d.mts +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.js +9 -9
  40. package/dist/index.mjs +7 -7
  41. package/dist/postcss-html-transform.js +1 -1
  42. package/dist/postcss-html-transform.mjs +1 -1
  43. package/dist/presets.d.mts +8 -1
  44. package/dist/presets.d.ts +8 -1
  45. package/dist/presets.js +7 -6
  46. package/dist/presets.mjs +3 -2
  47. package/dist/reset.d.mts +1 -31
  48. package/dist/reset.d.ts +3 -32
  49. package/dist/reset.js +3 -160
  50. package/dist/reset.mjs +3 -160
  51. package/dist/types.d.mts +2 -2
  52. package/dist/types.d.ts +2 -2
  53. package/dist/types.js +1 -1
  54. package/dist/types.mjs +1 -1
  55. package/dist/vite.d.mts +1 -1
  56. package/dist/vite.d.ts +1 -1
  57. package/dist/vite.js +6 -6
  58. package/dist/vite.mjs +4 -4
  59. package/dist/webpack.d.mts +1 -1
  60. package/dist/webpack.d.ts +1 -1
  61. package/dist/webpack.js +7 -7
  62. package/dist/webpack.mjs +5 -5
  63. package/dist/webpack4.d.mts +1 -1
  64. package/dist/webpack4.d.ts +1 -1
  65. package/dist/webpack4.js +41 -36
  66. package/dist/webpack4.mjs +12 -7
  67. package/package.json +8 -4
@@ -1192,12 +1192,14 @@ function resolveUniAppXOptions(option) {
1192
1192
  if (typeof option === "object" && option) {
1193
1193
  return {
1194
1194
  enabled: option.enabled !== false,
1195
- componentLocalStyles: resolveComponentLocalStyles(option)
1195
+ componentLocalStyles: resolveComponentLocalStyles(option),
1196
+ uvueUnsupported: option.uvueUnsupported ?? "warn"
1196
1197
  };
1197
1198
  }
1198
1199
  return {
1199
1200
  enabled: Boolean(option),
1200
- componentLocalStyles: resolveComponentLocalStyles(option)
1201
+ componentLocalStyles: resolveComponentLocalStyles(option),
1202
+ uvueUnsupported: "warn"
1201
1203
  };
1202
1204
  }
1203
1205
  function isUniAppXEnabled(option) {
@@ -11,7 +11,7 @@ import {
11
11
  isMpx,
12
12
  patchMpxLoaderResolve,
13
13
  setupMpxTailwindcssRedirect
14
- } from "./chunk-JIERVBTX.mjs";
14
+ } from "./chunk-ZR3KN3FG.mjs";
15
15
  import {
16
16
  pushConcurrentTaskFactories,
17
17
  resolveDisabledOptions,
@@ -27,18 +27,19 @@ import {
27
27
  ensureRuntimeClassSet,
28
28
  getCompilerContext,
29
29
  pluginName,
30
- setupPatchRecorder
31
- } from "./chunk-AB2RGZQO.mjs";
30
+ setupPatchRecorder,
31
+ shouldSkipJsTransform
32
+ } from "./chunk-QNRJCEZN.mjs";
32
33
  import {
33
34
  getRuntimeClassSetSignature,
34
35
  resolveTailwindcssOptions
35
- } from "./chunk-OMARW5NC.mjs";
36
+ } from "./chunk-AYJ4HLWZ.mjs";
36
37
  import {
37
38
  getGroupedEntries
38
39
  } from "./chunk-OOHJLO5M.mjs";
39
40
  import {
40
41
  __dirname
41
- } from "./chunk-EFBQ4SQR.mjs";
42
+ } from "./chunk-HL3US2OT.mjs";
42
43
 
43
44
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
44
45
  import process3 from "process";
@@ -236,7 +237,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
236
237
  const currentAsset = compilation.getAsset(file);
237
238
  const currentSourceValue = currentAsset?.source.source();
238
239
  const currentSource = typeof currentSourceValue === "string" ? currentSourceValue : currentSourceValue?.toString() ?? "";
239
- const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, {
240
+ const handlerOptions = {
240
241
  staleClassNameFallback,
241
242
  tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
242
243
  filename: absoluteFile,
@@ -244,7 +245,11 @@ function setupWebpackV5ProcessAssetsHook(options) {
244
245
  babelParserOptions: {
245
246
  sourceFilename: absoluteFile
246
247
  }
247
- });
248
+ };
249
+ if (shouldSkipJsTransform(currentSource, handlerOptions)) {
250
+ return { result: new ConcatSource(currentSource) };
251
+ }
252
+ const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, handlerOptions);
248
253
  const source = new ConcatSource(code);
249
254
  compilerOptions.onUpdate(file, currentSource, code);
250
255
  debug2("js handle: %s", file);
@@ -7,7 +7,8 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkTT5WHNGSjs = require('./chunk-TT5WHNGS.js');
10
+
11
+ var _chunkGC7WXUOWjs = require('./chunk-GC7WXUOW.js');
11
12
 
12
13
  // src/bundlers/gulp/index.ts
13
14
  var _buffer = require('buffer');
@@ -15,12 +16,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
15
16
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
16
17
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
17
18
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
18
- var debug = _chunkTT5WHNGSjs.createDebug.call(void 0, );
19
+ var debug = _chunkGC7WXUOWjs.createDebug.call(void 0, );
19
20
  var Transform = _stream2.default.Transform;
20
21
  function createPlugins(options = {}) {
21
- const opts = _chunkTT5WHNGSjs.getCompilerContext.call(void 0, options);
22
+ const opts = _chunkGC7WXUOWjs.getCompilerContext.call(void 0, options);
22
23
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
23
- const patchRecorderState = _chunkTT5WHNGSjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
24
+ const patchRecorderState = _chunkGC7WXUOWjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
24
25
  source: "runtime",
25
26
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
26
27
  });
@@ -38,13 +39,13 @@ function createPlugins(options = {}) {
38
39
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
39
40
  let runtimeSetInitialized = false;
40
41
  async function refreshRuntimeState(force) {
41
- await _chunkTT5WHNGSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
42
+ await _chunkGC7WXUOWjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
42
43
  }
43
44
  async function refreshRuntimeSet(force = false) {
44
45
  if (!force && runtimeSetInitialized) {
45
46
  return runtimeSet;
46
47
  }
47
- runtimeSet = await _chunkTT5WHNGSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
48
+ runtimeSet = await _chunkGC7WXUOWjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
48
49
  forceRefresh: force,
49
50
  forceCollect: force,
50
51
  clearCache: force,
@@ -225,6 +226,9 @@ function createPlugins(options = {}) {
225
226
  async transform() {
226
227
  await runtimeState.patchPromise;
227
228
  const currentSource = _nullishCoalesce(_optionalChain([file, 'access', _2 => _2.contents, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]), () => ( rawSource));
229
+ if (_chunkGC7WXUOWjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
230
+ return { result: currentSource };
231
+ }
228
232
  const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
229
233
  debug("js handle: %s", file.path);
230
234
  return {
@@ -8,7 +8,8 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkQK6VNNNLjs = require('./chunk-QK6VNNNL.js');
11
+
12
+ var _chunkNIS74SI6js = require('./chunk-NIS74SI6.js');
12
13
 
13
14
 
14
15
  var _chunkA5PB4KZTjs = require('./chunk-A5PB4KZT.js');
@@ -39,7 +40,7 @@ var debug = createDebug("[tailwindcss:runtime] ");
39
40
  var refreshTailwindcssPatcherSymbol = /* @__PURE__ */ Symbol.for("weapp-tailwindcss.refreshTailwindcssPatcher");
40
41
  function createTailwindPatchPromise(twPatcher, onPatched) {
41
42
  return Promise.resolve(twPatcher.patch()).then(async () => {
42
- _chunkQK6VNNNLjs.invalidateRuntimeClassSet.call(void 0, twPatcher);
43
+ _chunkNIS74SI6js.invalidateRuntimeClassSet.call(void 0, twPatcher);
43
44
  if (onPatched) {
44
45
  try {
45
46
  await onPatched();
@@ -94,7 +95,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
94
95
  }
95
96
  await state.patchPromise;
96
97
  const entry = getRuntimeClassSetStateEntry(state);
97
- const signature = _chunkQK6VNNNLjs.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
98
+ const signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
98
99
  const signatureChanged = entry.signature !== signature;
99
100
  const shouldForceCollect = forceCollect || forceRefresh || signatureChanged;
100
101
  if (!shouldForceCollect) {
@@ -129,7 +130,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
129
130
  try {
130
131
  const runtimeSet = await task;
131
132
  entry.value = runtimeSet;
132
- entry.signature = _chunkQK6VNNNLjs.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
133
+ entry.signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
133
134
  return runtimeSet;
134
135
  } finally {
135
136
  if (entry.promise === task) {
@@ -186,8 +187,8 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
186
187
  }
187
188
  }
188
189
  }
189
- const entry = _chunkQK6VNNNLjs.getRuntimeClassSetCacheEntry.call(void 0, activePatcher);
190
- const signature = _chunkQK6VNNNLjs.getRuntimeClassSetSignature.call(void 0, activePatcher);
190
+ const entry = _chunkNIS74SI6js.getRuntimeClassSetCacheEntry.call(void 0, activePatcher);
191
+ const signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, activePatcher);
191
192
  if (!options.force) {
192
193
  if (entry.value && entry.signature === signature) {
193
194
  return entry.value;
@@ -428,7 +429,7 @@ function formatRelativeToBase(targetPath, baseDir) {
428
429
  }
429
430
  function resolveRecordLocation(baseDir) {
430
431
  const normalizedBase = _path2.default.normalize(baseDir);
431
- const packageRoot = _nullishCoalesce(_chunkQK6VNNNLjs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
432
+ const packageRoot = _nullishCoalesce(_chunkNIS74SI6js.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
432
433
  const packageJsonPath = _path2.default.join(packageRoot, "package.json");
433
434
  const hasPackageJson = _fs.existsSync.call(void 0, packageJsonPath);
434
435
  const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
@@ -465,7 +466,7 @@ function getRecordFileCandidates(baseDir) {
465
466
  // package.json
466
467
  var package_default = {
467
468
  name: "weapp-tailwindcss",
468
- version: "4.11.2",
469
+ version: "4.12.0-next.0",
469
470
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
470
471
  author: "ice breaker <1324318532@qq.com>",
471
472
  license: "MIT",
@@ -667,6 +668,7 @@ var package_default = {
667
668
  "@weapp-core/regex": "~1.0.1",
668
669
  "@weapp-tailwindcss/logger": "workspace:*",
669
670
  "@weapp-tailwindcss/postcss": "workspace:*",
671
+ "@weapp-tailwindcss/reset": "workspace:*",
670
672
  "@weapp-tailwindcss/shared": "workspace:*",
671
673
  cac: "6.7.14",
672
674
  "comment-json": "^4.6.2",
@@ -681,6 +683,9 @@ var package_default = {
681
683
  "tailwindcss-patch": "catalog:tailwindcssPatch",
682
684
  "webpack-sources": "3.3.4",
683
685
  yaml: "^2.8.3"
686
+ },
687
+ devDependencies: {
688
+ "fast-check": "^4.7.0"
684
689
  }
685
690
  };
686
691
 
@@ -1164,6 +1169,9 @@ function toCustomAttributesEntities(customAttributes) {
1164
1169
  // src/context/handlers.ts
1165
1170
  var _postcss = require('@weapp-tailwindcss/postcss');
1166
1171
 
1172
+ // src/js/index.ts
1173
+
1174
+
1167
1175
  // src/babel/index.ts
1168
1176
  var _traverse = require('@babel/traverse'); var _traverse2 = _interopRequireDefault(_traverse);
1169
1177
  var _parser = require('@babel/parser');
@@ -2981,6 +2989,49 @@ function jsHandler(rawSource, options) {
2981
2989
  }
2982
2990
 
2983
2991
  // src/js/index.ts
2992
+ var RESULT_CACHE_MAX = 512;
2993
+ var classNameSetIds = /* @__PURE__ */ new WeakMap();
2994
+ var nextClassNameSetId = 0;
2995
+ function getClassNameSetId(set) {
2996
+ if (!set) {
2997
+ return "none";
2998
+ }
2999
+ const existing = classNameSetIds.get(set);
3000
+ if (existing !== void 0) {
3001
+ return String(existing);
3002
+ }
3003
+ const id = nextClassNameSetId++;
3004
+ classNameSetIds.set(set, id);
3005
+ return String(id);
3006
+ }
3007
+ var fingerprintCache = /* @__PURE__ */ new WeakMap();
3008
+ function getOptionsFingerprint(options) {
3009
+ const cached = fingerprintCache.get(options);
3010
+ if (cached) {
3011
+ return cached;
3012
+ }
3013
+ const parts = [
3014
+ getClassNameSetId(options.classNameSet),
3015
+ JSON.stringify(_nullishCoalesce(options.escapeMap, () => ( null))),
3016
+ options.needEscaped ? "1" : "0",
3017
+ options.alwaysEscape ? "1" : "0",
3018
+ options.unescapeUnicode ? "1" : "0",
3019
+ options.generateMap ? "1" : "0",
3020
+ options.uniAppX ? "1" : "0",
3021
+ options.wrapExpression ? "1" : "0",
3022
+ String(_nullishCoalesce(options.tailwindcssMajorVersion, () => ( ""))),
3023
+ String(_nullishCoalesce(options.staleClassNameFallback, () => ( ""))),
3024
+ String(_nullishCoalesce(options.jsArbitraryValueFallback, () => ( ""))),
3025
+ JSON.stringify(_nullishCoalesce(options.arbitraryValues, () => ( null))),
3026
+ JSON.stringify(_nullishCoalesce(options.ignoreCallExpressionIdentifiers, () => ( null))),
3027
+ JSON.stringify(_nullishCoalesce(_optionalChain([options, 'access', _99 => _99.ignoreTaggedTemplateExpressionIdentifiers, 'optionalAccess', _100 => _100.map, 'call', _101 => _101((v) => v instanceof RegExp ? v.source : v)]), () => ( null))),
3028
+ JSON.stringify(_nullishCoalesce(options.moduleSpecifierReplacements, () => ( null))),
3029
+ JSON.stringify(_nullishCoalesce(options.babelParserOptions, () => ( null)))
3030
+ ];
3031
+ const fingerprint = parts.join("|");
3032
+ fingerprintCache.set(options, fingerprint);
3033
+ return fingerprint;
3034
+ }
2984
3035
  function hasDefinedOverrides(options) {
2985
3036
  if (!options) {
2986
3037
  return false;
@@ -2992,17 +3043,6 @@ function hasDefinedOverrides(options) {
2992
3043
  }
2993
3044
  return false;
2994
3045
  }
2995
- var CACHEABLE_SOURCE_MAX_LENGTH = 512;
2996
- var RESULT_CACHE_LIMIT = 256;
2997
- function shouldCacheJsResult(rawSource, options) {
2998
- if (rawSource.length === 0 || rawSource.length > CACHEABLE_SOURCE_MAX_LENGTH) {
2999
- return false;
3000
- }
3001
- if (options.moduleGraph || options.filename) {
3002
- return false;
3003
- }
3004
- return true;
3005
- }
3006
3046
  function createJsHandler(options) {
3007
3047
  const defaults = {
3008
3048
  escapeMap: options.escapeMap,
@@ -3021,11 +3061,10 @@ function createJsHandler(options) {
3021
3061
  uniAppX: options.uniAppX,
3022
3062
  moduleSpecifierReplacements: options.moduleSpecifierReplacements
3023
3063
  };
3024
- const resolvedOptionsByClassNameSet = /* @__PURE__ */ new WeakMap();
3064
+ const defaultOptionsCache = /* @__PURE__ */ new WeakMap();
3025
3065
  let resolvedOptionsWithoutClassNameSet;
3026
- const resolvedOverrideOptions = /* @__PURE__ */ new WeakMap();
3027
- const resolvedOverrideOptionsByClassNameSet = /* @__PURE__ */ new WeakMap();
3028
- const resultCache = /* @__PURE__ */ new WeakMap();
3066
+ const overrideOptionsCache = /* @__PURE__ */ new WeakMap();
3067
+ const resultCache = new (0, _lrucache.LRUCache)({ max: RESULT_CACHE_MAX });
3029
3068
  function resolveDefaultOptions(classNameSet) {
3030
3069
  if (!classNameSet) {
3031
3070
  if (!resolvedOptionsWithoutClassNameSet) {
@@ -3036,7 +3075,7 @@ function createJsHandler(options) {
3036
3075
  }
3037
3076
  return resolvedOptionsWithoutClassNameSet;
3038
3077
  }
3039
- const cached = resolvedOptionsByClassNameSet.get(classNameSet);
3078
+ const cached = defaultOptionsCache.get(classNameSet);
3040
3079
  if (cached) {
3041
3080
  return cached;
3042
3081
  }
@@ -3044,42 +3083,36 @@ function createJsHandler(options) {
3044
3083
  ...defaults,
3045
3084
  classNameSet
3046
3085
  };
3047
- resolvedOptionsByClassNameSet.set(classNameSet, created);
3086
+ defaultOptionsCache.set(classNameSet, created);
3048
3087
  return created;
3049
3088
  }
3050
3089
  function getCachedJsResult(rawSource, resolvedOptions) {
3051
- if (!shouldCacheJsResult(rawSource, resolvedOptions)) {
3090
+ if (rawSource.length === 0) {
3052
3091
  return void 0;
3053
3092
  }
3054
- const cache = resultCache.get(resolvedOptions);
3055
- return _optionalChain([cache, 'optionalAccess', _99 => _99.get, 'call', _100 => _100(rawSource)]);
3093
+ const key = `${getOptionsFingerprint(resolvedOptions)}:${_node.md5.call(void 0, rawSource)}`;
3094
+ return resultCache.get(key);
3056
3095
  }
3057
3096
  function setCachedJsResult(rawSource, resolvedOptions, result) {
3058
- if (!shouldCacheJsResult(rawSource, resolvedOptions) || result.error || result.linked) {
3097
+ if (rawSource.length === 0 || result.error || result.linked) {
3059
3098
  return result;
3060
3099
  }
3061
- let cache = resultCache.get(resolvedOptions);
3062
- if (!cache) {
3063
- cache = /* @__PURE__ */ new Map();
3064
- resultCache.set(resolvedOptions, cache);
3065
- }
3066
- cache.set(rawSource, result);
3067
- if (cache.size > RESULT_CACHE_LIMIT) {
3068
- const firstKey = cache.keys().next().value;
3069
- if (typeof firstKey === "string") {
3070
- cache.delete(firstKey);
3071
- }
3072
- }
3100
+ const key = `${getOptionsFingerprint(resolvedOptions)}:${_node.md5.call(void 0, rawSource)}`;
3101
+ resultCache.set(key, result);
3073
3102
  return result;
3074
3103
  }
3075
3104
  function resolveOptions(classNameSet, overrideOptions) {
3076
3105
  if (!hasDefinedOverrides(overrideOptions)) {
3077
3106
  return resolveDefaultOptions(classNameSet);
3078
3107
  }
3108
+ let entry = overrideOptionsCache.get(overrideOptions);
3109
+ if (!entry) {
3110
+ entry = { bySet: /* @__PURE__ */ new WeakMap() };
3111
+ overrideOptionsCache.set(overrideOptions, entry);
3112
+ }
3079
3113
  if (!classNameSet) {
3080
- const cached2 = resolvedOverrideOptions.get(overrideOptions);
3081
- if (cached2) {
3082
- return cached2;
3114
+ if (entry.noSet) {
3115
+ return entry.noSet;
3083
3116
  }
3084
3117
  const created2 = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
3085
3118
  {
@@ -3088,15 +3121,10 @@ function createJsHandler(options) {
3088
3121
  },
3089
3122
  defaults
3090
3123
  );
3091
- resolvedOverrideOptions.set(overrideOptions, created2);
3124
+ entry.noSet = created2;
3092
3125
  return created2;
3093
3126
  }
3094
- let cache = resolvedOverrideOptionsByClassNameSet.get(overrideOptions);
3095
- if (!cache) {
3096
- cache = /* @__PURE__ */ new WeakMap();
3097
- resolvedOverrideOptionsByClassNameSet.set(overrideOptions, cache);
3098
- }
3099
- const cached = cache.get(classNameSet);
3127
+ const cached = entry.bySet.get(classNameSet);
3100
3128
  if (cached) {
3101
3129
  return cached;
3102
3130
  }
@@ -3107,7 +3135,7 @@ function createJsHandler(options) {
3107
3135
  },
3108
3136
  defaults
3109
3137
  );
3110
- cache.set(classNameSet, created);
3138
+ entry.bySet.set(classNameSet, created);
3111
3139
  return created;
3112
3140
  }
3113
3141
  function handler(rawSource, classNameSet, options2) {
@@ -3200,7 +3228,7 @@ function shouldSkipLegacyStringLiteral(path5) {
3200
3228
  return true;
3201
3229
  }
3202
3230
  return Boolean(
3203
- t.isBinaryExpression(path5.parent) && (t.isConditionalExpression(_optionalChain([path5, 'access', _101 => _101.parentPath, 'optionalAccess', _102 => _102.parent])) || t.isLogicalExpression(_optionalChain([path5, 'access', _103 => _103.parentPath, 'optionalAccess', _104 => _104.parent])))
3231
+ t.isBinaryExpression(path5.parent) && (t.isConditionalExpression(_optionalChain([path5, 'access', _102 => _102.parentPath, 'optionalAccess', _103 => _103.parent])) || t.isLogicalExpression(_optionalChain([path5, 'access', _104 => _104.parentPath, 'optionalAccess', _105 => _105.parent])))
3204
3232
  );
3205
3233
  }
3206
3234
  function createLegacyTraverseOptions(options, jsTokenUpdater) {
@@ -3542,7 +3570,7 @@ async function customTemplateHandler(rawSource, options, cachedMatcher) {
3542
3570
  return;
3543
3571
  }
3544
3572
  const shouldHandleDefault = defaultTemplateHandlerEnabled && isDefaultTemplateAttribute(name);
3545
- const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _105 => _105(tag, name)]), () => ( false));
3573
+ const shouldHandleCustom = _nullishCoalesce(_optionalChain([matchCustomAttribute, 'optionalCall', _106 => _106(tag, name)]), () => ( false));
3546
3574
  if (!shouldHandleDefault && !shouldHandleCustom) {
3547
3575
  return;
3548
3576
  }
@@ -3582,7 +3610,7 @@ async function customTemplateHandler(rawSource, options, cachedMatcher) {
3582
3610
  getMagicString().update(startIndex, endIndex, code);
3583
3611
  }
3584
3612
  }
3585
- return _nullishCoalesce(_optionalChain([s, 'optionalAccess', _106 => _106.toString, 'call', _107 => _107()]), () => ( rawSource));
3613
+ return _nullishCoalesce(_optionalChain([s, 'optionalAccess', _107 => _107.toString, 'call', _108 => _108()]), () => ( rawSource));
3586
3614
  }
3587
3615
 
3588
3616
  // src/wxml/utils.ts
@@ -3594,7 +3622,7 @@ function createTemplateHandler(options = {}) {
3594
3622
  let cachedRuntimeSet;
3595
3623
  let cachedOptionsWithRuntimeSet;
3596
3624
  return (rawSource, opt) => {
3597
- const runtimeSet = _optionalChain([opt, 'optionalAccess', _108 => _108.runtimeSet]);
3625
+ const runtimeSet = _optionalChain([opt, 'optionalAccess', _109 => _109.runtimeSet]);
3598
3626
  if (runtimeSet === void 0) {
3599
3627
  return customTemplateHandler(rawSource, defaultOptions, cachedMatcher);
3600
3628
  }
@@ -3637,6 +3665,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
3637
3665
  cssRemoveProperty,
3638
3666
  cssRemoveHoverPseudoClass,
3639
3667
  cssPresetEnv,
3668
+ autoprefixer,
3640
3669
  uniAppX,
3641
3670
  px2rpx,
3642
3671
  unitsToPx,
@@ -3651,7 +3680,8 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
3651
3680
  disabledDefaultTemplateHandler,
3652
3681
  replaceRuntimePackages
3653
3682
  } = ctx;
3654
- const uniAppXEnabled = _chunkQK6VNNNLjs.isUniAppXEnabled.call(void 0, uniAppX);
3683
+ const uniAppXEnabled = _chunkNIS74SI6js.isUniAppXEnabled.call(void 0, uniAppX);
3684
+ const resolvedUniAppXOptions = _chunkNIS74SI6js.resolveUniAppXOptions.call(void 0, uniAppX);
3655
3685
  const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
3656
3686
  const styleHandler = _postcss.createStyleHandler.call(void 0, {
3657
3687
  cssPreflight,
@@ -3665,10 +3695,13 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
3665
3695
  cssRemoveProperty,
3666
3696
  cssRemoveHoverPseudoClass,
3667
3697
  cssPresetEnv,
3698
+ autoprefixer,
3668
3699
  uniAppX: uniAppXEnabled,
3700
+ uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
3669
3701
  cssCalc: cssCalcOptions,
3670
3702
  px2rpx,
3671
- unitsToPx
3703
+ unitsToPx,
3704
+ majorVersion: tailwindcssMajorVersion
3672
3705
  });
3673
3706
  const jsHandler2 = createJsHandler({
3674
3707
  escapeMap,
@@ -3715,7 +3748,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
3715
3748
  if (!patcher) {
3716
3749
  return;
3717
3750
  }
3718
- const cacheOptions = _optionalChain([patcher, 'access', _109 => _109.options, 'optionalAccess', _110 => _110.cache]);
3751
+ const cacheOptions = _optionalChain([patcher, 'access', _110 => _110.options, 'optionalAccess', _111 => _111.cache]);
3719
3752
  if (cacheOptions == null || typeof cacheOptions === "object" && cacheOptions.enabled === false) {
3720
3753
  return;
3721
3754
  }
@@ -3726,19 +3759,19 @@ async function clearTailwindcssPatcherCache(patcher, options) {
3726
3759
  _logger.logger.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
3727
3760
  }
3728
3761
  }
3729
- if (!_optionalChain([options, 'optionalAccess', _111 => _111.removeDirectory])) {
3762
+ if (!_optionalChain([options, 'optionalAccess', _112 => _112.removeDirectory])) {
3730
3763
  return;
3731
3764
  }
3732
3765
  const cachePaths = /* @__PURE__ */ new Map();
3733
3766
  const normalizedCacheOptions = typeof cacheOptions === "object" ? cacheOptions : void 0;
3734
- if (_optionalChain([normalizedCacheOptions, 'optionalAccess', _112 => _112.path])) {
3767
+ if (_optionalChain([normalizedCacheOptions, 'optionalAccess', _113 => _113.path])) {
3735
3768
  cachePaths.set(normalizedCacheOptions.path, false);
3736
3769
  }
3737
- const privateCachePath = _optionalChain([patcher, 'optionalAccess', _113 => _113.cacheStore, 'optionalAccess', _114 => _114.options, 'optionalAccess', _115 => _115.path]);
3770
+ const privateCachePath = _optionalChain([patcher, 'optionalAccess', _114 => _114.cacheStore, 'optionalAccess', _115 => _115.options, 'optionalAccess', _116 => _116.path]);
3738
3771
  if (privateCachePath) {
3739
3772
  cachePaths.set(privateCachePath, false);
3740
3773
  }
3741
- if (_optionalChain([options, 'optionalAccess', _116 => _116.removeDirectory]) && _optionalChain([normalizedCacheOptions, 'optionalAccess', _117 => _117.dir])) {
3774
+ if (_optionalChain([options, 'optionalAccess', _117 => _117.removeDirectory]) && _optionalChain([normalizedCacheOptions, 'optionalAccess', _118 => _118.dir])) {
3742
3775
  cachePaths.set(normalizedCacheOptions.dir, true);
3743
3776
  }
3744
3777
  if (!cachePaths.size) {
@@ -3749,7 +3782,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
3749
3782
  await _promises.rm.call(void 0, cachePath, { force: true, recursive });
3750
3783
  } catch (error) {
3751
3784
  const err = error;
3752
- if (_optionalChain([err, 'optionalAccess', _118 => _118.code]) === "ENOENT") {
3785
+ if (_optionalChain([err, 'optionalAccess', _119 => _119.code]) === "ENOENT") {
3753
3786
  continue;
3754
3787
  }
3755
3788
  _logger.logger.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
@@ -3764,15 +3797,15 @@ function createInternalCompilerContext(opts) {
3764
3797
  );
3765
3798
  ctx.escapeMap = ctx.customReplaceDictionary;
3766
3799
  applyLoggerLevel(ctx.logLevel);
3767
- const twPatcher = _chunkQK6VNNNLjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3800
+ const twPatcher = _chunkNIS74SI6js.createTailwindcssPatcherFromContext.call(void 0, ctx);
3768
3801
  logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
3769
3802
  logRuntimeTailwindcssVersion(
3770
3803
  ctx.tailwindcssBasedir,
3771
- _optionalChain([twPatcher, 'access', _119 => _119.packageInfo, 'optionalAccess', _120 => _120.rootPath]),
3772
- _optionalChain([twPatcher, 'access', _121 => _121.packageInfo, 'optionalAccess', _122 => _122.version])
3804
+ _optionalChain([twPatcher, 'access', _120 => _120.packageInfo, 'optionalAccess', _121 => _121.rootPath]),
3805
+ _optionalChain([twPatcher, 'access', _122 => _122.packageInfo, 'optionalAccess', _123 => _123.version])
3773
3806
  );
3774
- _chunkQK6VNNNLjs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
3775
- const cssCalcOptions = _chunkQK6VNNNLjs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
3807
+ _chunkNIS74SI6js.warnMissingCssEntries.call(void 0, ctx, twPatcher);
3808
+ const cssCalcOptions = _chunkNIS74SI6js.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
3776
3809
  ctx.cssCalc = cssCalcOptions;
3777
3810
  const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
3778
3811
  const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
@@ -3788,11 +3821,11 @@ function createInternalCompilerContext(opts) {
3788
3821
  ctx.twPatcher = twPatcher;
3789
3822
  const refreshTailwindcssPatcher = async (options) => {
3790
3823
  const previousPatcher = ctx.twPatcher;
3791
- if (_optionalChain([options, 'optionalAccess', _123 => _123.clearCache]) !== false) {
3824
+ if (_optionalChain([options, 'optionalAccess', _124 => _124.clearCache]) !== false) {
3792
3825
  await clearTailwindcssPatcherCache(previousPatcher);
3793
3826
  }
3794
- _chunkQK6VNNNLjs.invalidateRuntimeClassSet.call(void 0, previousPatcher);
3795
- const nextPatcher = _chunkQK6VNNNLjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
3827
+ _chunkNIS74SI6js.invalidateRuntimeClassSet.call(void 0, previousPatcher);
3828
+ const nextPatcher = _chunkNIS74SI6js.createTailwindcssPatcherFromContext.call(void 0, ctx);
3796
3829
  Object.assign(previousPatcher, nextPatcher);
3797
3830
  ctx.twPatcher = previousPatcher;
3798
3831
  return previousPatcher;
@@ -3808,14 +3841,39 @@ function getCompilerContext(opts) {
3808
3841
  return withCompilerContextCache(opts, () => createInternalCompilerContext(opts));
3809
3842
  }
3810
3843
 
3844
+ // src/js/precheck.ts
3845
+ var FAST_JS_TRANSFORM_HINT_RE = /className\b|class\s*=|classList\.|\b(?:twMerge|clsx|classnames|cn|cva)\b|\[["'`]class["'`]\]|text-\[|bg-\[|\b(?:[whpm]|px|py|mx|my|rounded|flex|grid|gap)-/;
3846
+ var DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
3847
+ function shouldSkipJsTransform(rawSource, options) {
3848
+ if (process.env.WEAPP_TW_DISABLE_JS_PRECHECK === "1") {
3849
+ return false;
3850
+ }
3851
+ if (!rawSource) {
3852
+ return true;
3853
+ }
3854
+ if (_optionalChain([options, 'optionalAccess', _125 => _125.alwaysEscape])) {
3855
+ return false;
3856
+ }
3857
+ if (_optionalChain([options, 'optionalAccess', _126 => _126.moduleSpecifierReplacements]) && Object.keys(options.moduleSpecifierReplacements).length > 0) {
3858
+ return false;
3859
+ }
3860
+ if (_optionalChain([options, 'optionalAccess', _127 => _127.wrapExpression])) {
3861
+ return false;
3862
+ }
3863
+ if (DEPENDENCY_HINT_RE.test(rawSource)) {
3864
+ return false;
3865
+ }
3866
+ return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
3867
+ }
3868
+
3811
3869
  // src/tailwindcss/recorder.ts
3812
3870
  function setupPatchRecorder(patcher, baseDir, options) {
3813
3871
  const recorder = createPatchTargetRecorder(baseDir, patcher, options);
3814
- if (_optionalChain([recorder, 'optionalAccess', _124 => _124.message]) && _optionalChain([options, 'optionalAccess', _125 => _125.logMessage]) !== false) {
3815
- const prefix = _optionalChain([options, 'optionalAccess', _126 => _126.messagePrefix]) ? `${options.messagePrefix} ` : "";
3816
- _chunkQK6VNNNLjs.logger.info("%s%s", prefix, recorder.message);
3872
+ if (_optionalChain([recorder, 'optionalAccess', _128 => _128.message]) && _optionalChain([options, 'optionalAccess', _129 => _129.logMessage]) !== false) {
3873
+ const prefix = _optionalChain([options, 'optionalAccess', _130 => _130.messagePrefix]) ? `${options.messagePrefix} ` : "";
3874
+ _chunkNIS74SI6js.logger.info("%s%s", prefix, recorder.message);
3817
3875
  }
3818
- const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _127 => _127.onPatched]) ? async () => {
3876
+ const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _131 => _131.onPatched]) ? async () => {
3819
3877
  await recorder.onPatched();
3820
3878
  } : void 0;
3821
3879
  const patchPromise = patcher ? createTailwindPatchPromise(patcher, onPatchCompleted) : Promise.resolve();
@@ -3844,4 +3902,5 @@ function setupPatchRecorder(patcher, baseDir, options) {
3844
3902
 
3845
3903
 
3846
3904
 
3847
- exports.createDebug = createDebug; exports.refreshTailwindRuntimeState = refreshTailwindRuntimeState; exports.ensureRuntimeClassSet = ensureRuntimeClassSet; exports.collectRuntimeClassSet = collectRuntimeClassSet; exports.pluginName = pluginName; exports.vitePluginName = vitePluginName; exports.toCustomAttributesEntities = toCustomAttributesEntities; exports.traverse = traverse; exports.babelParse = babelParse; exports.replaceWxml = replaceWxml; exports.isClassContextLiteralPath = isClassContextLiteralPath; exports.JsTokenUpdater = JsTokenUpdater; exports.analyzeSource = analyzeSource; exports.createAttributeMatcher = createAttributeMatcher; exports.generateCode = generateCode; exports.getCompilerContext = getCompilerContext; exports.setupPatchRecorder = setupPatchRecorder;
3905
+
3906
+ exports.createDebug = createDebug; exports.refreshTailwindRuntimeState = refreshTailwindRuntimeState; exports.ensureRuntimeClassSet = ensureRuntimeClassSet; exports.collectRuntimeClassSet = collectRuntimeClassSet; exports.pluginName = pluginName; exports.vitePluginName = vitePluginName; exports.toCustomAttributesEntities = toCustomAttributesEntities; exports.traverse = traverse; exports.babelParse = babelParse; exports.replaceWxml = replaceWxml; exports.isClassContextLiteralPath = isClassContextLiteralPath; exports.JsTokenUpdater = JsTokenUpdater; exports.analyzeSource = analyzeSource; exports.createAttributeMatcher = createAttributeMatcher; exports.generateCode = generateCode; exports.getCompilerContext = getCompilerContext; exports.shouldSkipJsTransform = shouldSkipJsTransform; exports.setupPatchRecorder = setupPatchRecorder;