weapp-tailwindcss 4.8.10 → 4.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkW7H4R6CPjs = require('./chunk-W7H4R6CP.js');
6
+ var _chunk45BMEACSjs = require('./chunk-45BMEACS.js');
7
7
 
8
8
 
9
9
  var _chunk3URI7W6Xjs = require('./chunk-3URI7W6X.js');
@@ -187,7 +187,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
187
187
  // package.json
188
188
  var package_default = {
189
189
  name: "weapp-tailwindcss",
190
- version: "4.8.10",
190
+ version: "4.8.11",
191
191
  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!",
192
192
  author: "ice breaker <1324318532@qq.com>",
193
193
  license: "MIT",
@@ -441,7 +441,7 @@ function formatRelativeToBase(targetPath, baseDir) {
441
441
  }
442
442
  function resolveRecordLocation(baseDir) {
443
443
  const normalizedBase = _path2.default.normalize(baseDir);
444
- const packageRoot = _nullishCoalesce(_chunkW7H4R6CPjs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
444
+ const packageRoot = _nullishCoalesce(_chunk45BMEACSjs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
445
445
  const packageJsonPath = _path2.default.join(packageRoot, "package.json");
446
446
  const hasPackageJson = _fs.existsSync.call(void 0, packageJsonPath);
447
447
  const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
@@ -2771,15 +2771,15 @@ function createInternalCompilerContext(opts) {
2771
2771
  );
2772
2772
  ctx.escapeMap = ctx.customReplaceDictionary;
2773
2773
  applyLoggerLevel(ctx.logLevel);
2774
- const twPatcher = _chunkW7H4R6CPjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2774
+ const twPatcher = _chunk45BMEACSjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2775
2775
  logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
2776
2776
  if (_optionalChain([twPatcher, 'access', _95 => _95.packageInfo, 'optionalAccess', _96 => _96.version])) {
2777
2777
  _logger.logger.success(`\u5F53\u524D\u4F7F\u7528 ${_logger.pc.cyanBright("Tailwind CSS")} \u7248\u672C\u4E3A: ${_logger.pc.underline(_logger.pc.bold(_logger.pc.green(twPatcher.packageInfo.version)))}`);
2778
2778
  } else {
2779
2779
  _logger.logger.warn(`${_logger.pc.cyanBright("Tailwind CSS")} \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u7248\u672C\u68C0\u6D4B\u4E0E\u8865\u4E01\u5E94\u7528\u3002`);
2780
2780
  }
2781
- _chunkW7H4R6CPjs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
2782
- const cssCalcOptions = _chunkW7H4R6CPjs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
2781
+ _chunk45BMEACSjs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
2782
+ const cssCalcOptions = _chunk45BMEACSjs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
2783
2783
  ctx.cssCalc = cssCalcOptions;
2784
2784
  const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
2785
2785
  const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
@@ -2798,7 +2798,7 @@ function createInternalCompilerContext(opts) {
2798
2798
  await clearTailwindcssPatcherCache(previousPatcher);
2799
2799
  }
2800
2800
  invalidateRuntimeClassSet(previousPatcher);
2801
- const nextPatcher = _chunkW7H4R6CPjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2801
+ const nextPatcher = _chunk45BMEACSjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
2802
2802
  Object.assign(previousPatcher, nextPatcher);
2803
2803
  ctx.twPatcher = previousPatcher;
2804
2804
  return previousPatcher;
@@ -3,13 +3,13 @@
3
3
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
4
4
 
5
5
 
6
- var _chunkXP5623NLjs = require('./chunk-XP5623NL.js');
6
+ var _chunkFM3FLOYYjs = require('./chunk-FM3FLOYY.js');
7
7
 
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunkMNZW5VG5js = require('./chunk-MNZW5VG5.js');
12
+ var _chunk22ETJBBTjs = require('./chunk-22ETJBBT.js');
13
13
 
14
14
  // src/bundlers/gulp/index.ts
15
15
  var _buffer = require('buffer');
@@ -17,12 +17,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
17
17
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
18
18
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
19
19
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
20
- var debug = _chunkMNZW5VG5js.createDebug.call(void 0, );
20
+ var debug = _chunk22ETJBBTjs.createDebug.call(void 0, );
21
21
  var Transform = _stream2.default.Transform;
22
22
  function createPlugins(options = {}) {
23
- const opts = _chunkMNZW5VG5js.getCompilerContext.call(void 0, options);
23
+ const opts = _chunk22ETJBBTjs.getCompilerContext.call(void 0, options);
24
24
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
25
- const patchRecorderState = _chunkXP5623NLjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
25
+ const patchRecorderState = _chunkFM3FLOYYjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
26
26
  source: "runtime",
27
27
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
28
28
  });
@@ -36,7 +36,7 @@ function createPlugins(options = {}) {
36
36
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
37
37
  let runtimeSetInitialized = false;
38
38
  async function refreshRuntimeState(force) {
39
- await _chunkMNZW5VG5js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
39
+ await _chunk22ETJBBTjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
40
40
  }
41
41
  async function refreshRuntimeSet(force = false) {
42
42
  await refreshRuntimeState(force);
@@ -44,7 +44,7 @@ function createPlugins(options = {}) {
44
44
  if (!force && runtimeSetInitialized && runtimeSet.size > 0) {
45
45
  return runtimeSet;
46
46
  }
47
- runtimeSet = await _chunkMNZW5VG5js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
47
+ runtimeSet = await _chunk22ETJBBTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force, skipRefresh: force });
48
48
  runtimeSetInitialized = true;
49
49
  return runtimeSet;
50
50
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createPatchTargetRecorder,
3
3
  createTailwindPatchPromise
4
- } from "./chunk-JCG2LT63.mjs";
4
+ } from "./chunk-BSGZZCLH.mjs";
5
5
  import {
6
6
  logger
7
- } from "./chunk-IXK4ZWFR.mjs";
7
+ } from "./chunk-HHSKDU3Z.mjs";
8
8
 
9
9
  // src/tailwindcss/recorder.ts
10
10
  function setupPatchRecorder(patcher, baseDir, options) {
@@ -448,7 +448,7 @@ function createTailwindcssPatcher(options) {
448
448
  }
449
449
  const resolvePaths = createDefaultResolvePaths(_nullishCoalesce(_nullishCoalesce(cache.cwd, () => ( normalizedBasedir)), () => ( _process2.default.cwd())));
450
450
  const normalizedUserOptions = normalizeTailwindcssPatcherOptions(tailwindcssPatcherOptions);
451
- const extendLengthUnits = normalizeExtendLengthUnits(supportCustomLengthUnitsPatch);
451
+ const extendLengthUnits = normalizeExtendLengthUnits(_nullishCoalesce(supportCustomLengthUnitsPatch, () => ( true)));
452
452
  const baseTailwindOptions = _shared.defuOverrideArray.call(void 0,
453
453
  _nullishCoalesce(tailwindcss, () => ( {})),
454
454
  {
@@ -733,12 +733,34 @@ function createPatcherForBase(baseDir, cssEntries, options) {
733
733
  baseDir,
734
734
  _nullishCoalesce(cssEntries, () => ( []))
735
735
  );
736
- return createTailwindcssPatcher({
737
- basedir: baseDir,
738
- supportCustomLengthUnitsPatch: _nullishCoalesce(supportCustomLengthUnitsPatch, () => ( true)),
739
- tailwindcss: mergedTailwindOptions,
740
- tailwindcssPatcherOptions: patchedOptions
736
+ const configuredPackageName = _optionalChain([tailwindcss, 'optionalAccess', _42 => _42.packageName]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _43 => _43.tailwind, 'optionalAccess', _44 => _44.packageName]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _45 => _45.patch, 'optionalAccess', _46 => _46.tailwindcss, 'optionalAccess', _47 => _47.packageName]);
737
+ const configuredVersion = _optionalChain([tailwindcss, 'optionalAccess', _48 => _48.version]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _49 => _49.tailwind, 'optionalAccess', _50 => _50.version]) || _optionalChain([tailwindcssPatcherOptions, 'optionalAccess', _51 => _51.patch, 'optionalAccess', _52 => _52.tailwindcss, 'optionalAccess', _53 => _53.version]) || mergedTailwindOptions.version;
738
+ const isTailwindcss4Package = (packageName) => Boolean(
739
+ packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4"))
740
+ );
741
+ const isV4 = configuredVersion === 4 || mergedTailwindOptions.version === 4 || isTailwindcss4Package(_nullishCoalesce(configuredPackageName, () => ( mergedTailwindOptions.packageName)));
742
+ const tailwindPackageConfigured = Boolean(configuredPackageName);
743
+ const shouldPatchV4PostcssPackage = isV4 && !tailwindPackageConfigured;
744
+ const packageCandidates = /* @__PURE__ */ new Set();
745
+ if (shouldPatchV4PostcssPackage) {
746
+ packageCandidates.add("@tailwindcss/postcss");
747
+ }
748
+ packageCandidates.add(
749
+ _nullishCoalesce(_nullishCoalesce(mergedTailwindOptions.packageName, () => ( configuredPackageName)), () => ( "tailwindcss"))
750
+ );
751
+ const patchers = Array.from(packageCandidates).map((packageName) => {
752
+ const tailwindOptionsForPackage = {
753
+ ...mergedTailwindOptions,
754
+ packageName
755
+ };
756
+ return createTailwindcssPatcher({
757
+ basedir: baseDir,
758
+ supportCustomLengthUnitsPatch: _nullishCoalesce(supportCustomLengthUnitsPatch, () => ( true)),
759
+ tailwindcss: tailwindOptionsForPackage,
760
+ tailwindcssPatcherOptions: patchedOptions
761
+ });
741
762
  });
763
+ return patchers.length === 1 ? patchers[0] : createMultiTailwindcssPatcher(patchers);
742
764
  }
743
765
  function createMultiTailwindcssPatcher(patchers) {
744
766
  if (patchers.length <= 1) {
@@ -746,18 +768,18 @@ function createMultiTailwindcssPatcher(patchers) {
746
768
  }
747
769
  const [first] = patchers;
748
770
  const multiPatcher = {
749
- packageInfo: _optionalChain([first, 'optionalAccess', _42 => _42.packageInfo]),
750
- majorVersion: _optionalChain([first, 'optionalAccess', _43 => _43.majorVersion]),
751
- options: _optionalChain([first, 'optionalAccess', _44 => _44.options]),
771
+ packageInfo: _optionalChain([first, 'optionalAccess', _54 => _54.packageInfo]),
772
+ majorVersion: _optionalChain([first, 'optionalAccess', _55 => _55.majorVersion]),
773
+ options: _optionalChain([first, 'optionalAccess', _56 => _56.options]),
752
774
  async patch() {
753
775
  let exposeContext;
754
776
  let extendLengthUnits;
755
777
  for (const patcher of patchers) {
756
778
  const result = await patcher.patch();
757
- if (_optionalChain([result, 'optionalAccess', _45 => _45.exposeContext]) && exposeContext == null) {
779
+ if (_optionalChain([result, 'optionalAccess', _57 => _57.exposeContext]) && exposeContext == null) {
758
780
  exposeContext = result.exposeContext;
759
781
  }
760
- if (_optionalChain([result, 'optionalAccess', _46 => _46.extendLengthUnits]) && extendLengthUnits == null) {
782
+ if (_optionalChain([result, 'optionalAccess', _58 => _58.extendLengthUnits]) && extendLengthUnits == null) {
761
783
  extendLengthUnits = result.extendLengthUnits;
762
784
  }
763
785
  }
@@ -813,7 +835,7 @@ function createMultiTailwindcssPatcher(patchers) {
813
835
  multiPatcher.getClassSetSync = () => {
814
836
  const aggregated = /* @__PURE__ */ new Set();
815
837
  for (const patcher of patchers) {
816
- const current = _optionalChain([patcher, 'access', _47 => _47.getClassSetSync, 'optionalCall', _48 => _48()]);
838
+ const current = _optionalChain([patcher, 'access', _59 => _59.getClassSetSync, 'optionalCall', _60 => _60()]);
817
839
  if (!current) {
818
840
  continue;
819
841
  }
@@ -886,7 +908,7 @@ function detectCallerBasedir() {
886
908
  const lines = stack.split("\n");
887
909
  for (const line of lines) {
888
910
  const match = _nullishCoalesce(line.match(/\(([^)]+)\)/u), () => ( line.match(/at\s+(\S.*)$/u)));
889
- const location = _optionalChain([match, 'optionalAccess', _49 => _49[1]]);
911
+ const location = _optionalChain([match, 'optionalAccess', _61 => _61[1]]);
890
912
  if (!location) {
891
913
  continue;
892
914
  }
@@ -916,8 +938,8 @@ function detectCallerBasedir() {
916
938
  }
917
939
  function resolveTailwindcssBasedir(basedir, fallback) {
918
940
  const envBasedirResult = pickEnvBasedir();
919
- const envBasedir = _optionalChain([envBasedirResult, 'optionalAccess', _50 => _50.value]);
920
- const envBasedirKey = _optionalChain([envBasedirResult, 'optionalAccess', _51 => _51.key]);
941
+ const envBasedir = _optionalChain([envBasedirResult, 'optionalAccess', _62 => _62.value]);
942
+ const envBasedirKey = _optionalChain([envBasedirResult, 'optionalAccess', _63 => _63.key]);
921
943
  const envBasedirIsGeneric = envBasedirKey ? GENERIC_ENV_BASEDIR_KEYS.has(envBasedirKey) : false;
922
944
  const packageEnvBasedir = pickPackageEnvBasedir();
923
945
  const shouldDetectCaller = !envBasedir || envBasedirIsGeneric;
@@ -1080,7 +1102,7 @@ function createTailwindcssPatcherFromContext(ctx) {
1080
1102
  if (multiPatcher) {
1081
1103
  return multiPatcher;
1082
1104
  }
1083
- if (_optionalChain([groupedCssEntries, 'optionalAccess', _52 => _52.size]) === 1) {
1105
+ if (_optionalChain([groupedCssEntries, 'optionalAccess', _64 => _64.size]) === 1) {
1084
1106
  const firstGroup = groupedCssEntries.entries().next().value;
1085
1107
  if (firstGroup) {
1086
1108
  const [baseDir, entries] = firstGroup;
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkINF2Q5LIjs = require('./chunk-INF2Q5LI.js');
7
+ var _chunkFAKEMDGUjs = require('./chunk-FAKEMDGU.js');
8
8
 
9
9
 
10
10
 
@@ -21,14 +21,14 @@ var _chunkYXT3T3LHjs = require('./chunk-YXT3T3LH.js');
21
21
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
22
22
 
23
23
 
24
- var _chunkXP5623NLjs = require('./chunk-XP5623NL.js');
24
+ var _chunkFM3FLOYYjs = require('./chunk-FM3FLOYY.js');
25
25
 
26
26
 
27
27
 
28
28
 
29
29
 
30
30
 
31
- var _chunkMNZW5VG5js = require('./chunk-MNZW5VG5.js');
31
+ var _chunk22ETJBBTjs = require('./chunk-22ETJBBT.js');
32
32
 
33
33
 
34
34
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
@@ -37,11 +37,11 @@ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
37
37
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
38
38
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
39
39
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
40
- var debug = _chunkMNZW5VG5js.createDebug.call(void 0, );
40
+ var debug = _chunk22ETJBBTjs.createDebug.call(void 0, );
41
41
  var weappTailwindcssPackageDir = _chunkYXT3T3LHjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
42
42
  var UnifiedWebpackPluginV5 = class {
43
43
  constructor(options = {}) {
44
- this.options = _chunkMNZW5VG5js.getCompilerContext.call(void 0, options);
44
+ this.options = _chunk22ETJBBTjs.getCompilerContext.call(void 0, options);
45
45
  this.appType = this.options.appType;
46
46
  }
47
47
  apply(compiler) {
@@ -69,14 +69,14 @@ var UnifiedWebpackPluginV5 = class {
69
69
  const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false;
70
70
  const isMpxApp = _chunkYXT3T3LHjs.isMpx.call(void 0, this.appType);
71
71
  if (shouldRewriteCssImports) {
72
- _chunkINF2Q5LIjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
72
+ _chunkFAKEMDGUjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
73
73
  pkgDir: weappTailwindcssPackageDir,
74
74
  enabled: true,
75
75
  appType: this.appType
76
76
  });
77
77
  _chunkYXT3T3LHjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
78
78
  }
79
- const patchRecorderState = _chunkXP5623NLjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
79
+ const patchRecorderState = _chunkFM3FLOYYjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
80
80
  source: "runtime",
81
81
  cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
82
82
  });
@@ -87,14 +87,14 @@ var UnifiedWebpackPluginV5 = class {
87
87
  onPatchCompleted: patchRecorderState.onPatchCompleted
88
88
  };
89
89
  const refreshRuntimeState = async (force) => {
90
- await _chunkMNZW5VG5js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
90
+ await _chunk22ETJBBTjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
91
91
  };
92
92
  const { Compilation, sources, NormalModule } = compiler.webpack;
93
93
  const { ConcatSource } = sources;
94
94
  async function getClassSetInLoader() {
95
95
  await refreshRuntimeState(true);
96
96
  await runtimeState.patchPromise;
97
- await _chunkMNZW5VG5js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
97
+ await _chunk22ETJBBTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
98
98
  }
99
99
  const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
100
100
  const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
@@ -107,7 +107,7 @@ var UnifiedWebpackPluginV5 = class {
107
107
  const classSetLoaderOptions = {
108
108
  getClassSet: getClassSetInLoader
109
109
  };
110
- const { findRewriteAnchor, findClassSetAnchor } = _chunkINF2Q5LIjs.createLoaderAnchorFinders.call(void 0, this.appType);
110
+ const { findRewriteAnchor, findClassSetAnchor } = _chunkFAKEMDGUjs.createLoaderAnchorFinders.call(void 0, this.appType);
111
111
  const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
112
112
  rewriteCssImports: runtimeLoaderRewriteOptions
113
113
  } : void 0;
@@ -135,8 +135,8 @@ var UnifiedWebpackPluginV5 = class {
135
135
  type: null
136
136
  };
137
137
  };
138
- compiler.hooks.compilation.tap(_chunkMNZW5VG5js.pluginName, (compilation) => {
139
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkMNZW5VG5js.pluginName, (_loaderContext, module) => {
138
+ compiler.hooks.compilation.tap(_chunk22ETJBBTjs.pluginName, (compilation) => {
139
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunk22ETJBBTjs.pluginName, (_loaderContext, module) => {
140
140
  const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
141
141
  if (!hasRuntimeLoader) {
142
142
  return;
@@ -145,7 +145,7 @@ var UnifiedWebpackPluginV5 = class {
145
145
  const loaderEntries = module.loaders || [];
146
146
  let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
147
147
  const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
148
- const isCssModule = _chunkINF2Q5LIjs.isCssLikeModuleResource.call(void 0, module.resource, this.options.cssMatcher, this.appType);
148
+ const isCssModule = _chunkFAKEMDGUjs.isCssLikeModuleResource.call(void 0, module.resource, this.options.cssMatcher, this.appType);
149
149
  if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
150
150
  debug("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
151
151
  }
@@ -177,7 +177,7 @@ var UnifiedWebpackPluginV5 = class {
177
177
  rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
178
178
  }
179
179
  }
180
- if (runtimeClassSetLoaderExists && !_chunkINF2Q5LIjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
180
+ if (runtimeClassSetLoaderExists && !_chunkFAKEMDGUjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
181
181
  const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
182
182
  const anchorIndex = findClassSetAnchor(loaderEntries);
183
183
  if (anchorIndex === -1) {
@@ -190,7 +190,7 @@ var UnifiedWebpackPluginV5 = class {
190
190
  });
191
191
  compilation.hooks.processAssets.tapPromise(
192
192
  {
193
- name: _chunkMNZW5VG5js.pluginName,
193
+ name: _chunk22ETJBBTjs.pluginName,
194
194
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
195
195
  },
196
196
  async (assets) => {
@@ -259,7 +259,7 @@ var UnifiedWebpackPluginV5 = class {
259
259
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
260
260
  await refreshRuntimeState(true);
261
261
  await runtimeState.patchPromise;
262
- const runtimeSet = await _chunkMNZW5VG5js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
262
+ const runtimeSet = await _chunk22ETJBBTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
263
263
  debug("get runtimeSet, class count: %d", runtimeSet.size);
264
264
  const tasks = [];
265
265
  if (Array.isArray(groupedEntries.html)) {
@@ -296,7 +296,7 @@ var UnifiedWebpackPluginV5 = class {
296
296
  const jsTaskFactories = [];
297
297
  if (Array.isArray(groupedEntries.js)) {
298
298
  for (const [file] of groupedEntries.js) {
299
- const cacheKey = _chunkINF2Q5LIjs.getCacheKey.call(void 0, file);
299
+ const cacheKey = _chunkFAKEMDGUjs.getCacheKey.call(void 0, file);
300
300
  const asset = compilation.getAsset(file);
301
301
  if (!asset) {
302
302
  continue;
@@ -3,7 +3,7 @@ import {
3
3
  createTailwindcssPatcherFromContext,
4
4
  findNearestPackageRoot,
5
5
  warnMissingCssEntries
6
- } from "./chunk-IXK4ZWFR.mjs";
6
+ } from "./chunk-HHSKDU3Z.mjs";
7
7
  import {
8
8
  getDefaultOptions
9
9
  } from "./chunk-QF65JGNW.mjs";
@@ -187,7 +187,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
187
187
  // package.json
188
188
  var package_default = {
189
189
  name: "weapp-tailwindcss",
190
- version: "4.8.10",
190
+ version: "4.8.11",
191
191
  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!",
192
192
  author: "ice breaker <1324318532@qq.com>",
193
193
  license: "MIT",
@@ -11,7 +11,7 @@ var _chunkYXT3T3LHjs = require('./chunk-YXT3T3LH.js');
11
11
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
12
12
 
13
13
 
14
- var _chunkXP5623NLjs = require('./chunk-XP5623NL.js');
14
+ var _chunkFM3FLOYYjs = require('./chunk-FM3FLOYY.js');
15
15
 
16
16
 
17
17
 
@@ -22,7 +22,7 @@ var _chunkXP5623NLjs = require('./chunk-XP5623NL.js');
22
22
 
23
23
 
24
24
 
25
- var _chunkMNZW5VG5js = require('./chunk-MNZW5VG5.js');
25
+ var _chunk22ETJBBTjs = require('./chunk-22ETJBBT.js');
26
26
 
27
27
 
28
28
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
@@ -54,7 +54,7 @@ function updateStaticAttribute(ms, prop) {
54
54
  const start = prop.value.loc.start.offset + 1;
55
55
  const end = prop.value.loc.end.offset - 1;
56
56
  if (start < end) {
57
- ms.update(start, end, _chunkMNZW5VG5js.replaceWxml.call(void 0, prop.value.content));
57
+ ms.update(start, end, _chunk22ETJBBTjs.replaceWxml.call(void 0, prop.value.content));
58
58
  }
59
59
  }
60
60
  function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
@@ -66,7 +66,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
66
66
  if (start >= end) {
67
67
  return;
68
68
  }
69
- const generated = _chunkMNZW5VG5js.generateCode.call(void 0, prop.exp.content, {
69
+ const generated = _chunk22ETJBBTjs.generateCode.call(void 0, prop.exp.content, {
70
70
  jsHandler,
71
71
  runtimeSet,
72
72
  wrapExpression: true
@@ -95,7 +95,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
95
95
  return;
96
96
  }
97
97
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
98
- const matchCustomAttribute = _chunkMNZW5VG5js.createAttributeMatcher.call(void 0, customAttributesEntities);
98
+ const matchCustomAttribute = _chunk22ETJBBTjs.createAttributeMatcher.call(void 0, customAttributesEntities);
99
99
  const ms = new (0, _magicstring2.default)(code);
100
100
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
101
101
  if (errors.length === 0) {
@@ -361,7 +361,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
361
361
  }
362
362
 
363
363
  // src/bundlers/vite/index.ts
364
- var debug = _chunkMNZW5VG5js.createDebug.call(void 0, );
364
+ var debug = _chunk22ETJBBTjs.createDebug.call(void 0, );
365
365
  var weappTailwindcssPackageDir = _chunkYXT3T3LHjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
366
366
  var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
367
367
  function joinPosixPath(base, subpath) {
@@ -444,7 +444,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
444
444
  }
445
445
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
446
446
  const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
447
- const opts = _chunkMNZW5VG5js.getCompilerContext.call(void 0, options);
447
+ const opts = _chunk22ETJBBTjs.getCompilerContext.call(void 0, options);
448
448
  const {
449
449
  disabled,
450
450
  customAttributes,
@@ -466,8 +466,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
466
466
  if (disabled) {
467
467
  return;
468
468
  }
469
- const customAttributesEntities = _chunkMNZW5VG5js.toCustomAttributesEntities.call(void 0, customAttributes);
470
- const patchRecorderState = _chunkXP5623NLjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
469
+ const customAttributesEntities = _chunk22ETJBBTjs.toCustomAttributesEntities.call(void 0, customAttributes);
470
+ const patchRecorderState = _chunkFM3FLOYYjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
471
471
  source: "runtime",
472
472
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
473
473
  });
@@ -481,7 +481,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
481
481
  let runtimeSetPromise;
482
482
  let resolvedConfig;
483
483
  async function refreshRuntimeState(force) {
484
- const refreshed = await _chunkMNZW5VG5js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
484
+ const refreshed = await _chunk22ETJBBTjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
485
485
  if (refreshed) {
486
486
  runtimeSet = void 0;
487
487
  runtimeSetPromise = void 0;
@@ -494,7 +494,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
494
494
  return runtimeSet;
495
495
  }
496
496
  if (force || !runtimeSetPromise) {
497
- const task2 = _chunkMNZW5VG5js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
497
+ const task2 = _chunk22ETJBBTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
498
498
  force: force || !runtimeSet,
499
499
  skipRefresh: force
500
500
  });
@@ -514,7 +514,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
514
514
  const shouldRewriteCssImports = opts.rewriteCssImports !== false && (rewriteCssImportsSpecified || (_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( 0))) >= 4);
515
515
  const rewritePlugins = !shouldRewriteCssImports ? [] : [
516
516
  {
517
- name: `${_chunkMNZW5VG5js.vitePluginName}:rewrite-css-imports`,
517
+ name: `${_chunk22ETJBBTjs.vitePluginName}:rewrite-css-imports`,
518
518
  enforce: "pre",
519
519
  resolveId: {
520
520
  order: "pre",
@@ -568,7 +568,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
568
568
  const plugins = [
569
569
  ...rewritePlugins,
570
570
  {
571
- name: `${_chunkMNZW5VG5js.vitePluginName}:post`,
571
+ name: `${_chunk22ETJBBTjs.vitePluginName}:post`,
572
572
  enforce: "post",
573
573
  configResolved(config) {
574
574
  resolvedConfig = config;
@@ -4,7 +4,7 @@
4
4
  var _chunkYXT3T3LHjs = require('./chunk-YXT3T3LH.js');
5
5
 
6
6
 
7
- var _chunkMNZW5VG5js = require('./chunk-MNZW5VG5.js');
7
+ var _chunk22ETJBBTjs = require('./chunk-22ETJBBT.js');
8
8
 
9
9
  // src/bundlers/webpack/shared/css-imports.ts
10
10
  var CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
@@ -44,8 +44,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
44
44
  if (!options.enabled) {
45
45
  return;
46
46
  }
47
- compiler.hooks.normalModuleFactory.tap(_chunkMNZW5VG5js.pluginName, (factory) => {
48
- factory.hooks.beforeResolve.tap(_chunkMNZW5VG5js.pluginName, (data) => {
47
+ compiler.hooks.normalModuleFactory.tap(_chunk22ETJBBTjs.pluginName, (factory) => {
48
+ factory.hooks.beforeResolve.tap(_chunk22ETJBBTjs.pluginName, (data) => {
49
49
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
50
50
  });
51
51
  });
@@ -4,7 +4,7 @@ import {
4
4
  getCacheKey,
5
5
  hasLoaderEntry,
6
6
  isCssLikeModuleResource
7
- } from "./chunk-XXO2FHP7.mjs";
7
+ } from "./chunk-W6ASDRWZ.mjs";
8
8
  import {
9
9
  ensureMpxTailwindcssAliases,
10
10
  injectMpxCssRewritePreRules,
@@ -21,14 +21,14 @@ import {
21
21
  } from "./chunk-RRHPTTCP.mjs";
22
22
  import {
23
23
  setupPatchRecorder
24
- } from "./chunk-OBOKBKZQ.mjs";
24
+ } from "./chunk-3NLDVPXD.mjs";
25
25
  import {
26
26
  collectRuntimeClassSet,
27
27
  createDebug,
28
28
  getCompilerContext,
29
29
  pluginName,
30
30
  refreshTailwindRuntimeState
31
- } from "./chunk-JCG2LT63.mjs";
31
+ } from "./chunk-BSGZZCLH.mjs";
32
32
  import {
33
33
  getGroupedEntries
34
34
  } from "./chunk-ZNKIYZRQ.mjs";
@@ -1,22 +1,22 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkMNZW5VG5js = require('./chunk-MNZW5VG5.js');
4
+ var _chunk22ETJBBTjs = require('./chunk-22ETJBBT.js');
5
5
 
6
6
 
7
- var _chunkW7H4R6CPjs = require('./chunk-W7H4R6CP.js');
7
+ var _chunk45BMEACSjs = require('./chunk-45BMEACS.js');
8
8
 
9
9
  // src/tailwindcss/recorder.ts
10
10
  function setupPatchRecorder(patcher, baseDir, options) {
11
- const recorder = _chunkMNZW5VG5js.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
11
+ const recorder = _chunk22ETJBBTjs.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
12
12
  if (_optionalChain([recorder, 'optionalAccess', _ => _.message]) && _optionalChain([options, 'optionalAccess', _2 => _2.logMessage]) !== false) {
13
13
  const prefix = _optionalChain([options, 'optionalAccess', _3 => _3.messagePrefix]) ? `${options.messagePrefix} ` : "";
14
- _chunkW7H4R6CPjs.logger.info("%s%s", prefix, recorder.message);
14
+ _chunk45BMEACSjs.logger.info("%s%s", prefix, recorder.message);
15
15
  }
16
16
  const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _4 => _4.onPatched]) ? async () => {
17
17
  await recorder.onPatched();
18
18
  } : void 0;
19
- const patchPromise = patcher ? _chunkMNZW5VG5js.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
19
+ const patchPromise = patcher ? _chunk22ETJBBTjs.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
20
20
  return {
21
21
  recorder,
22
22
  patchPromise,
@@ -445,7 +445,7 @@ function createTailwindcssPatcher(options) {
445
445
  }
446
446
  const resolvePaths = createDefaultResolvePaths(cache.cwd ?? normalizedBasedir ?? process.cwd());
447
447
  const normalizedUserOptions = normalizeTailwindcssPatcherOptions(tailwindcssPatcherOptions);
448
- const extendLengthUnits = normalizeExtendLengthUnits(supportCustomLengthUnitsPatch);
448
+ const extendLengthUnits = normalizeExtendLengthUnits(supportCustomLengthUnitsPatch ?? true);
449
449
  const baseTailwindOptions = defuOverrideArray2(
450
450
  tailwindcss ?? {},
451
451
  {
@@ -730,12 +730,34 @@ function createPatcherForBase(baseDir, cssEntries, options) {
730
730
  baseDir,
731
731
  cssEntries ?? []
732
732
  );
733
- return createTailwindcssPatcher({
734
- basedir: baseDir,
735
- supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
736
- tailwindcss: mergedTailwindOptions,
737
- tailwindcssPatcherOptions: patchedOptions
733
+ const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwind?.packageName || tailwindcssPatcherOptions?.patch?.tailwindcss?.packageName;
734
+ const configuredVersion = tailwindcss?.version || tailwindcssPatcherOptions?.tailwind?.version || tailwindcssPatcherOptions?.patch?.tailwindcss?.version || mergedTailwindOptions.version;
735
+ const isTailwindcss4Package = (packageName) => Boolean(
736
+ packageName && (packageName === "tailwindcss4" || packageName === "@tailwindcss/postcss" || packageName.includes("tailwindcss4"))
737
+ );
738
+ const isV4 = configuredVersion === 4 || mergedTailwindOptions.version === 4 || isTailwindcss4Package(configuredPackageName ?? mergedTailwindOptions.packageName);
739
+ const tailwindPackageConfigured = Boolean(configuredPackageName);
740
+ const shouldPatchV4PostcssPackage = isV4 && !tailwindPackageConfigured;
741
+ const packageCandidates = /* @__PURE__ */ new Set();
742
+ if (shouldPatchV4PostcssPackage) {
743
+ packageCandidates.add("@tailwindcss/postcss");
744
+ }
745
+ packageCandidates.add(
746
+ mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss"
747
+ );
748
+ const patchers = Array.from(packageCandidates).map((packageName) => {
749
+ const tailwindOptionsForPackage = {
750
+ ...mergedTailwindOptions,
751
+ packageName
752
+ };
753
+ return createTailwindcssPatcher({
754
+ basedir: baseDir,
755
+ supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
756
+ tailwindcss: tailwindOptionsForPackage,
757
+ tailwindcssPatcherOptions: patchedOptions
758
+ });
738
759
  });
760
+ return patchers.length === 1 ? patchers[0] : createMultiTailwindcssPatcher(patchers);
739
761
  }
740
762
  function createMultiTailwindcssPatcher(patchers) {
741
763
  if (patchers.length <= 1) {
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-RRHPTTCP.mjs";
12
12
  import {
13
13
  setupPatchRecorder
14
- } from "./chunk-OBOKBKZQ.mjs";
14
+ } from "./chunk-3NLDVPXD.mjs";
15
15
  import {
16
16
  collectRuntimeClassSet,
17
17
  createAttributeMatcher,
@@ -22,7 +22,7 @@ import {
22
22
  replaceWxml,
23
23
  toCustomAttributesEntities,
24
24
  vitePluginName
25
- } from "./chunk-JCG2LT63.mjs";
25
+ } from "./chunk-BSGZZCLH.mjs";
26
26
  import {
27
27
  getGroupedEntries
28
28
  } from "./chunk-ZNKIYZRQ.mjs";