weapp-tailwindcss 4.8.4 → 4.8.5

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 (50) hide show
  1. package/dist/{chunk-7KTLLGAG.mjs → chunk-3XGTIDA6.mjs} +72 -49
  2. package/dist/{chunk-JMYADIPN.mjs → chunk-67CD2S5L.mjs} +1 -1
  3. package/dist/{chunk-6EATUPTN.js → chunk-6CS6EPEP.js} +27 -20
  4. package/dist/{chunk-K234IGOT.js → chunk-AB45L5FP.js} +2 -2
  5. package/dist/{chunk-IHJU6M6B.mjs → chunk-FE63QKGM.mjs} +13 -6
  6. package/dist/chunk-FVSKLXO5.js +29 -0
  7. package/dist/{chunk-WTOLVORM.mjs → chunk-K62QTSOE.mjs} +389 -52
  8. package/dist/{chunk-NLLCK6RM.mjs → chunk-OKBZMEXY.mjs} +11 -4
  9. package/dist/{chunk-AXEKXGG7.js → chunk-P6ACVBPQ.js} +427 -90
  10. package/dist/{chunk-KSHK56CW.mjs → chunk-PSYJXCQJ.mjs} +1 -1
  11. package/dist/{chunk-MG4O3AGN.js → chunk-RA4QKEFU.js} +14 -7
  12. package/dist/{chunk-ZXU4EYKV.js → chunk-RJRLVYVJ.js} +77 -54
  13. package/dist/{chunk-5P342MNS.js → chunk-RXCVTHDO.js} +52 -39
  14. package/dist/chunk-SFQCTDJA.mjs +29 -0
  15. package/dist/{chunk-47NJZTIW.js → chunk-TWBCI2I3.js} +5 -5
  16. package/dist/{chunk-WGLBMNPG.js → chunk-UTZLVU3M.js} +1 -1
  17. package/dist/{chunk-UUVGNRUM.mjs → chunk-WSMJXGQQ.mjs} +36 -23
  18. package/dist/cli.js +217 -20
  19. package/dist/cli.mjs +215 -18
  20. package/dist/core.js +19 -11
  21. package/dist/core.mjs +14 -6
  22. package/dist/css-macro/postcss.js +1 -1
  23. package/dist/css-macro/postcss.mjs +1 -1
  24. package/dist/css-macro.js +1 -1
  25. package/dist/css-macro.mjs +1 -1
  26. package/dist/defaults.js +1 -1
  27. package/dist/defaults.mjs +1 -1
  28. package/dist/gulp.js +6 -5
  29. package/dist/gulp.mjs +5 -4
  30. package/dist/index.js +10 -9
  31. package/dist/index.mjs +8 -7
  32. package/dist/postcss-html-transform.js +1 -1
  33. package/dist/postcss-html-transform.mjs +1 -1
  34. package/dist/presets.js +4 -6
  35. package/dist/presets.mjs +3 -5
  36. package/dist/reset.d.mts +30 -0
  37. package/dist/reset.d.ts +32 -0
  38. package/dist/reset.js +161 -0
  39. package/dist/reset.mjs +161 -0
  40. package/dist/types.js +1 -1
  41. package/dist/types.mjs +1 -1
  42. package/dist/vite.js +7 -6
  43. package/dist/vite.mjs +5 -4
  44. package/dist/webpack.js +8 -7
  45. package/dist/webpack.mjs +6 -5
  46. package/dist/webpack4.js +29 -22
  47. package/dist/webpack4.mjs +14 -7
  48. package/package.json +9 -2
  49. package/dist/chunk-OXASK55Q.js +0 -6
  50. package/dist/chunk-PMF2CCKK.mjs +0 -6
@@ -3,7 +3,6 @@ import {
3
3
  } from "./chunk-ZNKIYZRQ.mjs";
4
4
 
5
5
  // src/context/tailwindcss.ts
6
- import { existsSync as existsSync3 } from "fs";
7
6
  import { createRequire as createRequire2 } from "module";
8
7
  import path3 from "path";
9
8
  import process2 from "process";
@@ -41,6 +40,23 @@ function findWorkspaceRoot(startDir) {
41
40
  current = parent;
42
41
  }
43
42
  }
43
+ function findNearestPackageRoot(startDir) {
44
+ if (!startDir) {
45
+ return void 0;
46
+ }
47
+ let current = path.resolve(startDir);
48
+ while (true) {
49
+ const pkgPath = path.join(current, "package.json");
50
+ if (existsSync(pkgPath)) {
51
+ return current;
52
+ }
53
+ const parent = path.dirname(current);
54
+ if (parent === current) {
55
+ return void 0;
56
+ }
57
+ current = parent;
58
+ }
59
+ }
44
60
  function findWorkspacePackageDir(rootDir, packageName) {
45
61
  const visited = /* @__PURE__ */ new Set();
46
62
  const queue = [path.resolve(rootDir)];
@@ -167,23 +183,6 @@ function createFallbackTailwindcssPatcher() {
167
183
  };
168
184
  }
169
185
  var hasLoggedMissingTailwind = false;
170
- function findNearestPackageRoot(startDir) {
171
- if (!startDir) {
172
- return void 0;
173
- }
174
- let current = path2.resolve(startDir);
175
- while (true) {
176
- const pkgPath = path2.join(current, "package.json");
177
- if (existsSync2(pkgPath)) {
178
- return current;
179
- }
180
- const parent = path2.dirname(current);
181
- if (parent === current) {
182
- return void 0;
183
- }
184
- current = parent;
185
- }
186
- }
187
186
  function appendNodeModules(paths, dir) {
188
187
  if (!dir) {
189
188
  return;
@@ -446,6 +445,11 @@ function createTailwindcssPatcher(options) {
446
445
  }
447
446
  }
448
447
 
448
+ // src/tailwindcss/index.ts
449
+ function getTailwindcssPackageInfo(options) {
450
+ return getPackageInfoSync("tailwindcss", options);
451
+ }
452
+
449
453
  // src/context/tailwindcss.ts
450
454
  var ENV_BASEDIR_KEYS = [
451
455
  "WEAPP_TAILWINDCSS_BASEDIR",
@@ -536,7 +540,9 @@ function resolveTailwindcssBasedir(basedir, fallback) {
536
540
  const packageEnvBasedir = pickPackageEnvBasedir();
537
541
  const shouldDetectCaller = !envBasedir || envBasedirIsGeneric;
538
542
  const callerBasedir = shouldDetectCaller ? detectCallerBasedir() : void 0;
539
- const anchor = envBasedir ?? packageEnvBasedir ?? fallback ?? callerBasedir ?? process2.cwd();
543
+ const cwd = process2.cwd();
544
+ const anchor = envBasedir ?? packageEnvBasedir ?? fallback ?? callerBasedir ?? cwd;
545
+ const resolveRelative = (value) => path3.isAbsolute(value) ? path3.normalize(value) : path3.normalize(path3.resolve(anchor, value));
540
546
  if (process2.env.WEAPP_TW_DEBUG_STACK === "1") {
541
547
  logger2.debug("resolveTailwindcssBasedir anchor %O", {
542
548
  basedir,
@@ -547,22 +553,18 @@ function resolveTailwindcssBasedir(basedir, fallback) {
547
553
  fallback,
548
554
  callerBasedir,
549
555
  npm_package_json: process2.env.npm_package_json,
550
- cwd: process2.cwd(),
556
+ cwd,
551
557
  anchor
552
558
  });
553
559
  }
554
560
  if (basedir && basedir.trim().length > 0) {
555
- if (path3.isAbsolute(basedir)) {
556
- return path3.normalize(basedir);
557
- }
558
- return path3.resolve(anchor, basedir);
561
+ return resolveRelative(basedir);
559
562
  }
560
563
  if (envBasedir && !envBasedirIsGeneric) {
561
564
  return path3.normalize(envBasedir);
562
565
  }
563
566
  if (fallback && fallback.trim().length > 0) {
564
- const resolvedFallback = path3.isAbsolute(fallback) ? fallback : path3.resolve(anchor, fallback);
565
- return path3.normalize(resolvedFallback);
567
+ return resolveRelative(fallback);
566
568
  }
567
569
  if (packageEnvBasedir) {
568
570
  return path3.normalize(packageEnvBasedir);
@@ -599,24 +601,7 @@ function resolveTailwindcssBasedir(basedir, fallback) {
599
601
  if (envBasedir) {
600
602
  return path3.normalize(envBasedir);
601
603
  }
602
- return path3.normalize(process2.cwd());
603
- }
604
- function findNearestPackageRootFromDir(startDir) {
605
- if (!startDir) {
606
- return void 0;
607
- }
608
- let current = path3.resolve(startDir);
609
- while (true) {
610
- const pkgPath = path3.join(current, "package.json");
611
- if (existsSync3(pkgPath)) {
612
- return current;
613
- }
614
- const parent = path3.dirname(current);
615
- if (parent === current) {
616
- return void 0;
617
- }
618
- current = parent;
619
- }
604
+ return path3.normalize(cwd);
620
605
  }
621
606
  function guessBasedirFromEntries(entries) {
622
607
  if (!entries) {
@@ -631,7 +616,7 @@ function guessBasedirFromEntries(entries) {
631
616
  continue;
632
617
  }
633
618
  const entryDir = path3.dirname(trimmed);
634
- const resolved = findNearestPackageRootFromDir(entryDir) ?? entryDir;
619
+ const resolved = findNearestPackageRoot(entryDir) ?? entryDir;
635
620
  if (resolved) {
636
621
  return resolved;
637
622
  }
@@ -656,10 +641,37 @@ function normalizeCssEntries(entries, anchor) {
656
641
  }
657
642
  return normalized.size > 0 ? [...normalized] : void 0;
658
643
  }
659
- function groupCssEntriesByBase(entries) {
644
+ function isSubPath(parent, child) {
645
+ if (!parent || !child) {
646
+ return false;
647
+ }
648
+ const relative = path3.relative(parent, child);
649
+ return relative === "" || !relative.startsWith("..") && !path3.isAbsolute(relative);
650
+ }
651
+ function resolveCssEntryBase(entryDir, options) {
652
+ const normalizedDir = path3.normalize(entryDir);
653
+ const { preferredBaseDir, workspaceRoot } = options;
654
+ if (preferredBaseDir && isSubPath(preferredBaseDir, normalizedDir)) {
655
+ return preferredBaseDir;
656
+ }
657
+ if (workspaceRoot && isSubPath(workspaceRoot, normalizedDir)) {
658
+ return workspaceRoot;
659
+ }
660
+ const packageRoot = findNearestPackageRoot(normalizedDir);
661
+ if (packageRoot) {
662
+ return path3.normalize(packageRoot);
663
+ }
664
+ return normalizedDir;
665
+ }
666
+ function groupCssEntriesByBase(entries, options = {}) {
667
+ const normalizedOptions = {
668
+ preferredBaseDir: options.preferredBaseDir ? path3.normalize(options.preferredBaseDir) : void 0,
669
+ workspaceRoot: options.workspaceRoot ? path3.normalize(options.workspaceRoot) : void 0
670
+ };
660
671
  const groups = /* @__PURE__ */ new Map();
661
672
  for (const entry of entries) {
662
- const baseDir = path3.normalize(path3.dirname(entry));
673
+ const entryDir = path3.dirname(entry);
674
+ const baseDir = resolveCssEntryBase(entryDir, normalizedOptions);
663
675
  const bucket = groups.get(baseDir);
664
676
  if (bucket) {
665
677
  bucket.push(entry);
@@ -889,7 +901,11 @@ function createTailwindcssPatcherFromContext(ctx) {
889
901
  supportCustomLengthUnitsPatch,
890
902
  appType
891
903
  };
892
- const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries) : void 0;
904
+ const workspaceRoot = findWorkspaceRoot(resolvedTailwindcssBasedir) ?? (absoluteCssEntryBasedir ? findWorkspaceRoot(absoluteCssEntryBasedir) : void 0);
905
+ const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, {
906
+ preferredBaseDir: resolvedTailwindcssBasedir,
907
+ workspaceRoot
908
+ }) : void 0;
893
909
  const multiPatcher = groupedCssEntries ? tryCreateMultiTailwindcssPatcher(groupedCssEntries, patcherOptions) : void 0;
894
910
  if (multiPatcher) {
895
911
  return multiPatcher;
@@ -909,7 +925,14 @@ function createTailwindcssPatcherFromContext(ctx) {
909
925
  );
910
926
  }
911
927
 
928
+ // src/logger/index.ts
929
+ import { logger as logger3 } from "@weapp-tailwindcss/logger";
930
+
912
931
  export {
932
+ findWorkspaceRoot,
933
+ findNearestPackageRoot,
934
+ getTailwindcssPackageInfo,
913
935
  resolveTailwindcssBasedir,
914
- createTailwindcssPatcherFromContext
936
+ createTailwindcssPatcherFromContext,
937
+ logger3 as logger
915
938
  };
@@ -1,4 +1,4 @@
1
- // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.3_@swc+h_9054a2496b61d5cb5fe8cf4fe2f0b0d1/node_modules/tsup/assets/esm_shims.js
1
+ // ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.53.1_@types+node@24.10.1__@swc+core@1.15.3_@swc+h_5a981c295142658a01fde01f36b7c0a8/node_modules/tsup/assets/esm_shims.js
2
2
  import path from "path";
3
3
  import { fileURLToPath } from "url";
4
4
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -1,24 +1,26 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunk47NJZTIWjs = require('./chunk-47NJZTIW.js');
4
+ var _chunkTWBCI2I3js = require('./chunk-TWBCI2I3.js');
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _chunkK234IGOTjs = require('./chunk-K234IGOT.js');
10
+ var _chunkAB45L5FPjs = require('./chunk-AB45L5FP.js');
11
11
 
12
12
 
13
13
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
14
14
 
15
15
 
16
+ var _chunkFVSKLXO5js = require('./chunk-FVSKLXO5.js');
16
17
 
17
18
 
18
19
 
19
20
 
20
21
 
21
- var _chunkAXEKXGG7js = require('./chunk-AXEKXGG7.js');
22
+
23
+ var _chunkP6ACVBPQjs = require('./chunk-P6ACVBPQ.js');
22
24
 
23
25
 
24
26
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
@@ -27,11 +29,11 @@ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
27
29
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
28
30
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
29
31
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
30
- var debug = _chunkAXEKXGG7js.createDebug.call(void 0, );
31
- var weappTailwindcssPackageDir = _chunkK234IGOTjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
32
+ var debug = _chunkP6ACVBPQjs.createDebug.call(void 0, );
33
+ var weappTailwindcssPackageDir = _chunkAB45L5FPjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
32
34
  var UnifiedWebpackPluginV5 = class {
33
35
  constructor(options = {}) {
34
- this.options = _chunkAXEKXGG7js.getCompilerContext.call(void 0, options);
36
+ this.options = _chunkP6ACVBPQjs.getCompilerContext.call(void 0, options);
35
37
  this.userSpecifiedRewriteCssImports = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
36
38
  this.appType = this.options.appType;
37
39
  }
@@ -56,25 +58,30 @@ var UnifiedWebpackPluginV5 = class {
56
58
  }
57
59
  const shouldRewriteCssImports = this.options.rewriteCssImports !== false && (this.userSpecifiedRewriteCssImports || (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4);
58
60
  if (shouldRewriteCssImports) {
59
- _chunk47NJZTIWjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
61
+ _chunkTWBCI2I3js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
60
62
  pkgDir: weappTailwindcssPackageDir,
61
63
  enabled: true
62
64
  });
63
65
  }
66
+ const patchRecorderState = _chunkFVSKLXO5js.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
67
+ source: "runtime",
68
+ cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
69
+ });
64
70
  const runtimeState = {
65
71
  twPatcher: initialTwPatcher,
66
- patchPromise: _chunkAXEKXGG7js.createTailwindPatchPromise.call(void 0, initialTwPatcher),
67
- refreshTailwindcssPatcher
72
+ patchPromise: patchRecorderState.patchPromise,
73
+ refreshTailwindcssPatcher,
74
+ onPatchCompleted: patchRecorderState.onPatchCompleted
68
75
  };
69
76
  const refreshRuntimeState = async (force) => {
70
- await _chunkAXEKXGG7js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
77
+ await _chunkP6ACVBPQjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
71
78
  };
72
79
  const { Compilation, sources, NormalModule } = compiler.webpack;
73
80
  const { ConcatSource } = sources;
74
81
  async function getClassSetInLoader() {
75
82
  await refreshRuntimeState(true);
76
83
  await runtimeState.patchPromise;
77
- await _chunkAXEKXGG7js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
84
+ await _chunkP6ACVBPQjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
78
85
  }
79
86
  onLoad();
80
87
  const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
@@ -92,8 +99,8 @@ var UnifiedWebpackPluginV5 = class {
92
99
  ident: null,
93
100
  type: null
94
101
  });
95
- compiler.hooks.compilation.tap(_chunkAXEKXGG7js.pluginName, (compilation) => {
96
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkAXEKXGG7js.pluginName, (_loaderContext, module) => {
102
+ compiler.hooks.compilation.tap(_chunkP6ACVBPQjs.pluginName, (compilation) => {
103
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkP6ACVBPQjs.pluginName, (_loaderContext, module) => {
97
104
  if (isExisted) {
98
105
  const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
99
106
  const runtimeLoaderEntry = createRuntimeLoaderEntry();
@@ -106,7 +113,7 @@ var UnifiedWebpackPluginV5 = class {
106
113
  });
107
114
  compilation.hooks.processAssets.tapPromise(
108
115
  {
109
- name: _chunkAXEKXGG7js.pluginName,
116
+ name: _chunkP6ACVBPQjs.pluginName,
110
117
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
111
118
  },
112
119
  async (assets) => {
@@ -124,13 +131,13 @@ var UnifiedWebpackPluginV5 = class {
124
131
  const jsAssets = /* @__PURE__ */ new Map();
125
132
  for (const [file] of entries) {
126
133
  if (this.options.jsMatcher(file) || this.options.wxsMatcher(file)) {
127
- const absolute = _chunkK234IGOTjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
134
+ const absolute = _chunkAB45L5FPjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
128
135
  jsAssets.set(absolute, file);
129
136
  }
130
137
  }
131
138
  const moduleGraphOptions = {
132
139
  resolve(specifier, importer) {
133
- return _chunkK234IGOTjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
140
+ return _chunkAB45L5FPjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
134
141
  },
135
142
  load: (id) => {
136
143
  const assetName = jsAssets.get(id);
@@ -175,7 +182,7 @@ var UnifiedWebpackPluginV5 = class {
175
182
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
176
183
  await refreshRuntimeState(true);
177
184
  await runtimeState.patchPromise;
178
- const runtimeSet = await _chunkAXEKXGG7js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
185
+ const runtimeSet = await _chunkP6ACVBPQjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
179
186
  debug("get runtimeSet, class count: %d", runtimeSet.size);
180
187
  const tasks = [];
181
188
  if (Array.isArray(groupedEntries.html)) {
@@ -212,12 +219,12 @@ var UnifiedWebpackPluginV5 = class {
212
219
  const jsTaskFactories = [];
213
220
  if (Array.isArray(groupedEntries.js)) {
214
221
  for (const [file] of groupedEntries.js) {
215
- const cacheKey = _chunk47NJZTIWjs.getCacheKey.call(void 0, file);
222
+ const cacheKey = _chunkTWBCI2I3js.getCacheKey.call(void 0, file);
216
223
  const asset = compilation.getAsset(file);
217
224
  if (!asset) {
218
225
  continue;
219
226
  }
220
- const absoluteFile = _chunkK234IGOTjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
227
+ const absoluteFile = _chunkAB45L5FPjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
221
228
  const initialSource = asset.source.source();
222
229
  const initialRawSource = typeof initialSource === "string" ? initialSource : initialSource.toString();
223
230
  jsTaskFactories.push(async () => {
@@ -292,7 +299,7 @@ var UnifiedWebpackPluginV5 = class {
292
299
  );
293
300
  }
294
301
  }
295
- _chunkK234IGOTjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
302
+ _chunkAB45L5FPjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
296
303
  await Promise.all(tasks);
297
304
  debug("end");
298
305
  onEnd();
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
- var _chunkWGLBMNPGjs = require('./chunk-WGLBMNPG.js');
3
+ var _chunkUTZLVU3Mjs = require('./chunk-UTZLVU3M.js');
4
4
 
5
5
  // src/utils/resolve-package.ts
6
6
  var _module = require('module');
7
7
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
8
- var require2 = _module.createRequire.call(void 0, _chunkWGLBMNPGjs.importMetaUrl);
8
+ var require2 = _module.createRequire.call(void 0, _chunkUTZLVU3Mjs.importMetaUrl);
9
9
  function resolvePackageDir(name) {
10
10
  const pkgPath = require2.resolve(`${name}/package.json`);
11
11
  return _path2.default.dirname(pkgPath);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  applyTailwindcssCssImportRewrite,
3
3
  getCacheKey
4
- } from "./chunk-KSHK56CW.mjs";
4
+ } from "./chunk-PSYJXCQJ.mjs";
5
5
  import {
6
6
  pushConcurrentTaskFactories,
7
7
  resolveOutputSpecifier,
@@ -11,20 +11,22 @@ import {
11
11
  import {
12
12
  processCachedTask
13
13
  } from "./chunk-RRHPTTCP.mjs";
14
+ import {
15
+ setupPatchRecorder
16
+ } from "./chunk-SFQCTDJA.mjs";
14
17
  import {
15
18
  collectRuntimeClassSet,
16
19
  createDebug,
17
- createTailwindPatchPromise,
18
20
  getCompilerContext,
19
21
  pluginName,
20
22
  refreshTailwindRuntimeState
21
- } from "./chunk-WTOLVORM.mjs";
23
+ } from "./chunk-K62QTSOE.mjs";
22
24
  import {
23
25
  getGroupedEntries
24
26
  } from "./chunk-ZNKIYZRQ.mjs";
25
27
  import {
26
28
  __dirname
27
- } from "./chunk-JMYADIPN.mjs";
29
+ } from "./chunk-67CD2S5L.mjs";
28
30
 
29
31
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
30
32
  import fs from "fs";
@@ -64,10 +66,15 @@ var UnifiedWebpackPluginV5 = class {
64
66
  enabled: true
65
67
  });
66
68
  }
69
+ const patchRecorderState = setupPatchRecorder(initialTwPatcher, this.options.tailwindcssBasedir, {
70
+ source: "runtime",
71
+ cwd: this.options.tailwindcssBasedir ?? process.cwd()
72
+ });
67
73
  const runtimeState = {
68
74
  twPatcher: initialTwPatcher,
69
- patchPromise: createTailwindPatchPromise(initialTwPatcher),
70
- refreshTailwindcssPatcher
75
+ patchPromise: patchRecorderState.patchPromise,
76
+ refreshTailwindcssPatcher,
77
+ onPatchCompleted: patchRecorderState.onPatchCompleted
71
78
  };
72
79
  const refreshRuntimeState = async (force) => {
73
80
  await refreshTailwindRuntimeState(runtimeState, force);
@@ -0,0 +1,29 @@
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
+
3
+
4
+ var _chunkP6ACVBPQjs = require('./chunk-P6ACVBPQ.js');
5
+
6
+
7
+ var _chunkRJRLVYVJjs = require('./chunk-RJRLVYVJ.js');
8
+
9
+ // src/tailwindcss/recorder.ts
10
+ function setupPatchRecorder(patcher, baseDir, options) {
11
+ const recorder = _chunkP6ACVBPQjs.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
12
+ if (_optionalChain([recorder, 'optionalAccess', _ => _.message]) && _optionalChain([options, 'optionalAccess', _2 => _2.logMessage]) !== false) {
13
+ const prefix = _optionalChain([options, 'optionalAccess', _3 => _3.messagePrefix]) ? `${options.messagePrefix} ` : "";
14
+ _chunkRJRLVYVJjs.logger.info("%s%s", prefix, recorder.message);
15
+ }
16
+ const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _4 => _4.onPatched]) ? async () => {
17
+ await recorder.onPatched();
18
+ } : void 0;
19
+ const patchPromise = patcher ? _chunkP6ACVBPQjs.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
20
+ return {
21
+ recorder,
22
+ patchPromise,
23
+ onPatchCompleted
24
+ };
25
+ }
26
+
27
+
28
+
29
+ exports.setupPatchRecorder = setupPatchRecorder;