weapp-tailwindcss 4.11.0 → 4.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{chunk-2PXISDSY.js → chunk-3QHYEMEW.js} +28 -28
  2. package/dist/{chunk-LL3QUKJI.js → chunk-A5PB4KZT.js} +2 -0
  3. package/dist/{chunk-KWSWZP5H.mjs → chunk-AB2RGZQO.mjs} +92 -46
  4. package/dist/{chunk-ZQAWDXIW.js → chunk-AV3XB6EQ.js} +3 -3
  5. package/dist/{chunk-MAIS4SDW.mjs → chunk-JIERVBTX.mjs} +1 -1
  6. package/dist/{chunk-C4CWDYUP.js → chunk-SUKOZ6OG.js} +6 -6
  7. package/dist/{chunk-Z6RS5OPN.js → chunk-TT5WHNGS.js} +61 -15
  8. package/dist/{chunk-Y75XZ6KA.mjs → chunk-VGPAKLMZ.mjs} +2 -2
  9. package/dist/{chunk-UO725AHQ.mjs → chunk-W3DXDWYC.mjs} +154 -38
  10. package/dist/{chunk-GVYD6TY7.js → chunk-WJIRXC26.js} +172 -56
  11. package/dist/{chunk-23K4XDKF.mjs → chunk-XAKAD2CR.mjs} +2 -0
  12. package/dist/{chunk-FTFADUJ4.mjs → chunk-ZZ36BKM5.mjs} +1 -1
  13. package/dist/cli.js +115 -82
  14. package/dist/cli.mjs +115 -82
  15. package/dist/core.d.mts +1 -1
  16. package/dist/core.d.ts +1 -1
  17. package/dist/core.js +7 -7
  18. package/dist/core.mjs +2 -2
  19. package/dist/defaults.d.mts +1 -1
  20. package/dist/defaults.d.ts +1 -1
  21. package/dist/defaults.js +2 -2
  22. package/dist/defaults.mjs +1 -1
  23. package/dist/gulp.d.mts +1 -1
  24. package/dist/gulp.d.ts +1 -1
  25. package/dist/gulp.js +4 -4
  26. package/dist/gulp.mjs +3 -3
  27. package/dist/{index-D8E0GGqB.d.mts → index-CoXntW_P.d.mts} +1 -1
  28. package/dist/{index-D8E0GGqB.d.ts → index-CoXntW_P.d.ts} +1 -1
  29. package/dist/index.d.mts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +7 -7
  32. package/dist/index.mjs +6 -6
  33. package/dist/presets.d.mts +1 -1
  34. package/dist/presets.d.ts +1 -1
  35. package/dist/types.d.mts +2 -2
  36. package/dist/types.d.ts +2 -2
  37. package/dist/vite.d.mts +2 -2
  38. package/dist/vite.d.ts +2 -2
  39. package/dist/vite.js +4 -4
  40. package/dist/vite.mjs +3 -3
  41. package/dist/webpack.d.mts +1 -1
  42. package/dist/webpack.d.ts +1 -1
  43. package/dist/webpack.js +5 -5
  44. package/dist/webpack.mjs +4 -4
  45. package/dist/webpack4.d.mts +1 -1
  46. package/dist/webpack4.d.ts +1 -1
  47. package/dist/webpack4.js +25 -25
  48. package/dist/webpack4.mjs +3 -3
  49. package/package.json +3 -3
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkZQAWDXIWjs = require('./chunk-ZQAWDXIW.js');
14
+ var _chunkAV3XB6EQjs = require('./chunk-AV3XB6EQ.js');
15
15
 
16
16
 
17
17
 
@@ -28,7 +28,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
28
28
 
29
29
 
30
30
 
31
- var _chunkZ6RS5OPNjs = require('./chunk-Z6RS5OPN.js');
31
+ var _chunkTT5WHNGSjs = require('./chunk-TT5WHNGS.js');
32
32
 
33
33
 
34
34
 
@@ -63,10 +63,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
63
63
  const { Compilation, sources } = compiler.webpack;
64
64
  const { ConcatSource } = sources;
65
65
  const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
66
- compiler.hooks.compilation.tap(_chunkZ6RS5OPNjs.pluginName, (compilation) => {
66
+ compiler.hooks.compilation.tap(_chunkTT5WHNGSjs.pluginName, (compilation) => {
67
67
  compilation.hooks.processAssets.tapPromise(
68
68
  {
69
- name: _chunkZ6RS5OPNjs.pluginName,
69
+ name: _chunkTT5WHNGSjs.pluginName,
70
70
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
71
71
  },
72
72
  async (assets) => {
@@ -78,7 +78,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
78
78
  compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
79
79
  }
80
80
  }
81
- const assetHashByChunk = _chunkZQAWDXIWjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
81
+ const assetHashByChunk = _chunkAV3XB6EQjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
82
82
  const entries = Object.entries(assets);
83
83
  const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
84
84
  const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
@@ -157,7 +157,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
157
157
  const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
158
158
  const forceRuntimeRefresh = getRuntimeRefreshRequirement();
159
159
  debug2("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, _nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown")));
160
- const runtimeSet = await _chunkZ6RS5OPNjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
160
+ const runtimeSet = await _chunkTT5WHNGSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
161
161
  forceRefresh: forceRuntimeRefresh,
162
162
  // webpack 的 script-only 热更新可能不会触发 runtime classset loader,
163
163
  // 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
@@ -207,7 +207,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
207
207
  const jsTaskFactories = [];
208
208
  if (Array.isArray(groupedEntries.js)) {
209
209
  for (const [file] of groupedEntries.js) {
210
- const cacheKey = _chunkZQAWDXIWjs.getCacheKey.call(void 0, file);
210
+ const cacheKey = _chunkAV3XB6EQjs.getCacheKey.call(void 0, file);
211
211
  const asset = compilation.getAsset(file);
212
212
  if (!asset) {
213
213
  continue;
@@ -313,9 +313,9 @@ function setupWebpackV5Loaders(options) {
313
313
  getRuntimeWatchDependencies,
314
314
  debug: debug2
315
315
  } = options;
316
- const isMpxApp = _chunkZQAWDXIWjs.isMpx.call(void 0, appType);
316
+ const isMpxApp = _chunkAV3XB6EQjs.isMpx.call(void 0, appType);
317
317
  if (shouldRewriteCssImports && isMpxApp) {
318
- _chunkZQAWDXIWjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
318
+ _chunkAV3XB6EQjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
319
319
  }
320
320
  const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
321
321
  const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
@@ -329,12 +329,12 @@ function setupWebpackV5Loaders(options) {
329
329
  getClassSet: getClassSetInLoader,
330
330
  getWatchDependencies: getRuntimeWatchDependencies
331
331
  };
332
- const { findRewriteAnchor, findClassSetAnchor } = _chunkZQAWDXIWjs.createLoaderAnchorFinders.call(void 0, appType);
332
+ const { findRewriteAnchor, findClassSetAnchor } = _chunkAV3XB6EQjs.createLoaderAnchorFinders.call(void 0, appType);
333
333
  const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
334
334
  rewriteCssImports: runtimeLoaderRewriteOptions
335
335
  } : void 0;
336
336
  if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
337
- _chunkZQAWDXIWjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
337
+ _chunkAV3XB6EQjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
338
338
  }
339
339
  const createRuntimeClassSetLoaderEntry = () => ({
340
340
  loader: runtimeClassSetLoader,
@@ -354,17 +354,17 @@ function setupWebpackV5Loaders(options) {
354
354
  };
355
355
  };
356
356
  const { NormalModule } = compiler.webpack;
357
- compiler.hooks.compilation.tap(_chunkZ6RS5OPNjs.pluginName, (compilation) => {
358
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkZ6RS5OPNjs.pluginName, (_loaderContext, module) => {
357
+ compiler.hooks.compilation.tap(_chunkTT5WHNGSjs.pluginName, (compilation) => {
358
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkTT5WHNGSjs.pluginName, (_loaderContext, module) => {
359
359
  const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
360
360
  if (!hasRuntimeLoader) {
361
361
  return;
362
362
  }
363
- _chunkZQAWDXIWjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
363
+ _chunkAV3XB6EQjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
364
364
  const loaderEntries = module.loaders || [];
365
365
  let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
366
366
  const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
367
- const isCssModule = _chunkZQAWDXIWjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
367
+ const isCssModule = _chunkAV3XB6EQjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
368
368
  if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
369
369
  debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
370
370
  }
@@ -396,7 +396,7 @@ function setupWebpackV5Loaders(options) {
396
396
  rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
397
397
  }
398
398
  }
399
- if (runtimeClassSetLoaderExists && !_chunkZQAWDXIWjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
399
+ if (runtimeClassSetLoaderExists && !_chunkAV3XB6EQjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
400
400
  const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
401
401
  const anchorIndex = findClassSetAnchor(loaderEntries);
402
402
  if (anchorIndex === -1) {
@@ -411,11 +411,11 @@ function setupWebpackV5Loaders(options) {
411
411
  }
412
412
 
413
413
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
414
- var debug = _chunkZ6RS5OPNjs.createDebug.call(void 0, );
414
+ var debug = _chunkTT5WHNGSjs.createDebug.call(void 0, );
415
415
  var weappTailwindcssPackageDir = _chunk7LKMJZD2js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
416
416
  var UnifiedWebpackPluginV5 = class {
417
417
  constructor(options = {}) {
418
- this.options = _chunkZ6RS5OPNjs.getCompilerContext.call(void 0, options);
418
+ this.options = _chunkTT5WHNGSjs.getCompilerContext.call(void 0, options);
419
419
  this.appType = this.options.appType;
420
420
  }
421
421
  apply(compiler) {
@@ -431,19 +431,19 @@ var UnifiedWebpackPluginV5 = class {
431
431
  const disabledOptions = _chunk7LKMJZD2js.resolveDisabledOptions.call(void 0, disabled);
432
432
  const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
433
433
  const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
434
- const isMpxApp = _chunkZQAWDXIWjs.isMpx.call(void 0, this.appType);
434
+ const isMpxApp = _chunkAV3XB6EQjs.isMpx.call(void 0, this.appType);
435
435
  if (shouldRewriteCssImports) {
436
- _chunkZQAWDXIWjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
436
+ _chunkAV3XB6EQjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
437
437
  pkgDir: weappTailwindcssPackageDir,
438
438
  enabled: true,
439
439
  appType: this.appType
440
440
  });
441
- _chunkZQAWDXIWjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
441
+ _chunkAV3XB6EQjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
442
442
  }
443
443
  if (disabledOptions.plugin) {
444
444
  return;
445
445
  }
446
- const patchRecorderState = _chunkZ6RS5OPNjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
446
+ const patchRecorderState = _chunkTT5WHNGSjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
447
447
  source: "runtime",
448
448
  cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
449
449
  });
@@ -501,21 +501,21 @@ var UnifiedWebpackPluginV5 = class {
501
501
  runtimeMetadataPrepared = true;
502
502
  };
503
503
  const syncRuntimeRefreshRequirement = () => {
504
- runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || _chunkZQAWDXIWjs.hasWatchChanges.call(void 0, compiler);
504
+ runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || _chunkAV3XB6EQjs.hasWatchChanges.call(void 0, compiler);
505
505
  };
506
506
  const resetRuntimePreparation = () => {
507
507
  runtimeSetPrepared = false;
508
508
  runtimeMetadataPrepared = false;
509
509
  syncRuntimeRefreshRequirement();
510
510
  };
511
- _optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(_chunkZ6RS5OPNjs.pluginName, () => {
511
+ _optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(_chunkTT5WHNGSjs.pluginName, () => {
512
512
  runtimeRefreshRequiredForCompilation = true;
513
513
  })]);
514
- _optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(_chunkZ6RS5OPNjs.pluginName, syncRuntimeRefreshRequirement)]);
514
+ _optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(_chunkTT5WHNGSjs.pluginName, syncRuntimeRefreshRequirement)]);
515
515
  if (_optionalChain([compiler, 'access', _28 => _28.hooks, 'access', _29 => _29.thisCompilation, 'optionalAccess', _30 => _30.tap])) {
516
- compiler.hooks.thisCompilation.tap(_chunkZ6RS5OPNjs.pluginName, resetRuntimePreparation);
516
+ compiler.hooks.thisCompilation.tap(_chunkTT5WHNGSjs.pluginName, resetRuntimePreparation);
517
517
  } else if (_optionalChain([compiler, 'access', _31 => _31.hooks, 'access', _32 => _32.compilation, 'optionalAccess', _33 => _33.tap])) {
518
- compiler.hooks.compilation.tap(_chunkZ6RS5OPNjs.pluginName, resetRuntimePreparation);
518
+ compiler.hooks.compilation.tap(_chunkTT5WHNGSjs.pluginName, resetRuntimePreparation);
519
519
  }
520
520
  async function getClassSetInLoader() {
521
521
  if (runtimeSetPrepared) {
@@ -525,7 +525,7 @@ var UnifiedWebpackPluginV5 = class {
525
525
  const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
526
526
  debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
527
527
  runtimeSetPrepared = true;
528
- await _chunkZ6RS5OPNjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
528
+ await _chunkTT5WHNGSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
529
529
  forceRefresh,
530
530
  forceCollect: true,
531
531
  clearCache: forceRefresh,
@@ -17,6 +17,7 @@ var IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
17
17
  var MAIN_CSS_CHUNK_MATCHERS = {
18
18
  "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
19
19
  "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
20
+ "uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
20
21
  "mpx": (file) => {
21
22
  const normalized = normalizePath(file);
22
23
  if (normalized.startsWith("app")) {
@@ -28,6 +29,7 @@ var MAIN_CSS_CHUNK_MATCHERS = {
28
29
  "remax": (file) => file.startsWith("app"),
29
30
  "rax": (file) => file.startsWith("bundle"),
30
31
  "native": (file) => file.startsWith("app"),
32
+ "weapp-vite": (file) => file.startsWith("app"),
31
33
  "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
32
34
  };
33
35
  var alwaysFalse = () => false;
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-OMARW5NC.mjs";
12
12
  import {
13
13
  getDefaultOptions
14
- } from "./chunk-23K4XDKF.mjs";
14
+ } from "./chunk-XAKAD2CR.mjs";
15
15
  import {
16
16
  defuOverrideArray,
17
17
  isMap
@@ -256,7 +256,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
256
256
 
257
257
  // src/context/index.ts
258
258
  import { rm } from "fs/promises";
259
- import { logger as logger6, pc } from "@weapp-tailwindcss/logger";
259
+ import { logger as logger7 } from "@weapp-tailwindcss/logger";
260
260
 
261
261
  // src/cache/index.ts
262
262
  import { LRUCache } from "lru-cache";
@@ -361,9 +361,51 @@ function initializeCache(cacheConfig) {
361
361
  return cacheConfig;
362
362
  }
363
363
 
364
+ // src/tailwindcss/runtime-logs.ts
365
+ import process from "process";
366
+ import { logger as logger2, pc } from "@weapp-tailwindcss/logger";
367
+ var runtimeLogDedupeHolder = globalThis;
368
+ var runtimeLogDedupe = runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ = /* @__PURE__ */ new Set());
369
+ function createRuntimeLogKey(category, baseDir, rootPath, version) {
370
+ return JSON.stringify([
371
+ category,
372
+ baseDir ?? process.cwd(),
373
+ rootPath ?? "",
374
+ version ?? ""
375
+ ]);
376
+ }
377
+ function markRuntimeLog(category, baseDir, rootPath, version) {
378
+ const key = createRuntimeLogKey(category, baseDir, rootPath, version);
379
+ if (runtimeLogDedupe.has(key)) {
380
+ return false;
381
+ }
382
+ runtimeLogDedupe.add(key);
383
+ return true;
384
+ }
385
+ function logRuntimeTailwindcssTarget(baseDir, rootPath, version) {
386
+ if (!markRuntimeLog("target", baseDir, rootPath, version)) {
387
+ return;
388
+ }
389
+ const versionText = version ? ` (v${version})` : "";
390
+ logger2.info("%s \u4F7F\u7528 Tailwind CSS%s", "Weapp-tailwindcss", versionText);
391
+ }
392
+ function logRuntimeTailwindcssVersion(baseDir, rootPath, version) {
393
+ if (version) {
394
+ if (!markRuntimeLog("version", baseDir, rootPath, version)) {
395
+ return;
396
+ }
397
+ logger2.success(`\u5F53\u524D\u4F7F\u7528 ${pc.cyanBright("Tailwind CSS")} \u7248\u672C\u4E3A: ${pc.underline(pc.bold(pc.green(version)))}`);
398
+ return;
399
+ }
400
+ if (!markRuntimeLog("missing", baseDir, rootPath, version)) {
401
+ return;
402
+ }
403
+ logger2.warn(`${pc.cyanBright("Tailwind CSS")} \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u7248\u672C\u68C0\u6D4B\u4E0E\u8865\u4E01\u5E94\u7528\u3002`);
404
+ }
405
+
364
406
  // src/tailwindcss/targets.ts
365
- import process3 from "process";
366
- import { logger as logger3 } from "@weapp-tailwindcss/logger";
407
+ import process4 from "process";
408
+ import { logger as logger4 } from "@weapp-tailwindcss/logger";
367
409
 
368
410
  // src/tailwindcss/targets/paths.ts
369
411
  import { existsSync } from "fs";
@@ -417,13 +459,13 @@ function getRecordFileCandidates(baseDir) {
417
459
  import { existsSync as existsSync2, readFileSync } from "fs";
418
460
  import { mkdir, writeFile } from "fs/promises";
419
461
  import path2 from "path";
420
- import process from "process";
421
- import { logger as logger2 } from "@weapp-tailwindcss/logger";
462
+ import process2 from "process";
463
+ import { logger as logger3 } from "@weapp-tailwindcss/logger";
422
464
 
423
465
  // package.json
424
466
  var package_default = {
425
467
  name: "weapp-tailwindcss",
426
- version: "4.11.0",
468
+ version: "4.11.2",
427
469
  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!",
428
470
  author: "ice breaker <1324318532@qq.com>",
429
471
  license: "MIT",
@@ -618,7 +660,7 @@ var package_default = {
618
660
  "@babel/parser": "~7.29.2",
619
661
  "@babel/traverse": "~7.29.0",
620
662
  "@babel/types": "~7.29.0",
621
- "@tailwindcss-mangle/config": "^6.1.3",
663
+ "@tailwindcss-mangle/config": "^7.0.0",
622
664
  "@vue/compiler-dom": "catalog:vue3",
623
665
  "@vue/compiler-sfc": "catalog:vue3",
624
666
  "@weapp-core/escape": "~7.0.0",
@@ -661,9 +703,9 @@ function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
661
703
  }
662
704
  loggedInvalidPatchRecords.add(normalizedPath);
663
705
  const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
664
- const baseDisplay = formatRelativeToBase(path2.normalize(baseDir), process.cwd());
706
+ const baseDisplay = formatRelativeToBase(path2.normalize(baseDir), process2.cwd());
665
707
  const reasonMessage = reason ? `\uFF1A${reason}` : "";
666
- logger2.warn(
708
+ logger3.warn(
667
709
  `\u68C0\u6D4B\u5230\u635F\u574F\u7684 Tailwind CSS \u76EE\u6807\u8BB0\u5F55 ${fileDisplay}${reasonMessage}\u3002\u8BF7\u5728 ${baseDisplay} \u91CD\u65B0\u6267\u884C "weapp-tw patch --record-target" \u6216\u5220\u9664\u8BE5\u6587\u4EF6\u540E\u518D\u8FD0\u884C\u3002`
668
710
  );
669
711
  }
@@ -720,23 +762,23 @@ async function saveCliPatchTargetRecord(baseDir, patcher, options) {
720
762
  `, "utf8");
721
763
  return recordPath;
722
764
  } catch (error) {
723
- const baseDisplay = formatRelativeToBase(normalizedBase, process.cwd());
724
- logger2.warn(
765
+ const baseDisplay = formatRelativeToBase(normalizedBase, process2.cwd());
766
+ logger3.warn(
725
767
  '\u81EA\u52A8\u66F4\u65B0 Tailwind CSS \u8865\u4E01\u8BB0\u5F55\u5931\u8D25\uFF0C\u8BF7\u5728 %s \u8FD0\u884C "weapp-tw patch --cwd %s"\u3002',
726
768
  baseDisplay,
727
769
  normalizedBase
728
770
  );
729
- logger2.debug("failed to persist patch target record %s: %O", recordPath, error);
771
+ logger3.debug("failed to persist patch target record %s: %O", recordPath, error);
730
772
  return void 0;
731
773
  }
732
774
  }
733
775
 
734
776
  // src/tailwindcss/targets/recorder.ts
735
777
  import path3 from "path";
736
- import process2 from "process";
778
+ import process3 from "process";
737
779
  function findPatchTargetRecord(baseDir) {
738
780
  const visited = /* @__PURE__ */ new Set();
739
- const fallback = baseDir ?? process2.cwd();
781
+ const fallback = baseDir ?? process3.cwd();
740
782
  let current = path3.resolve(fallback);
741
783
  while (!visited.has(current)) {
742
784
  const record = readPatchTargetRecord(current);
@@ -814,25 +856,29 @@ function createPatchTargetRecorder(baseDir, patcher, options) {
814
856
  // src/tailwindcss/targets.ts
815
857
  function logTailwindcssTarget(kind, patcher, baseDir) {
816
858
  const packageInfo = patcher?.packageInfo;
817
- const label = kind === "cli" ? "weapp-tw patch" : "tailwindcss-patcher";
859
+ const label = kind === "cli" ? "weapp-tw patch" : "Weapp-tailwindcss";
818
860
  if (!packageInfo?.rootPath) {
819
- logger3.warn(
861
+ logger4.warn(
820
862
  "%s \u672A\u627E\u5230 Tailwind CSS \u4F9D\u8D56\uFF0C\u8BF7\u68C0\u67E5\u5728 %s \u662F\u5426\u5DF2\u5B89\u88C5 tailwindcss",
821
863
  label,
822
- baseDir ?? process3.cwd()
864
+ baseDir ?? process4.cwd()
823
865
  );
824
866
  return;
825
867
  }
826
868
  const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
827
869
  const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
828
- logger3.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
870
+ if (kind === "runtime") {
871
+ logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
872
+ return;
873
+ }
874
+ logger4.info("%s \u7ED1\u5B9A Tailwind CSS -> %s%s", label, displayPath, version);
829
875
  }
830
876
 
831
877
  // src/context/compiler-context-cache.ts
832
878
  import { Buffer } from "buffer";
833
879
  import path4 from "path";
834
- import process4 from "process";
835
- import { logger as logger4 } from "@weapp-tailwindcss/logger";
880
+ import process5 from "process";
881
+ import { logger as logger5 } from "@weapp-tailwindcss/logger";
836
882
  var PAREN_CONTENT_RE = /\(([^)]+)\)/u;
837
883
  var AT_LOCATION_RE = /at\s+(\S.*)$/u;
838
884
  var TRAILING_LINE_COL_RE = /:\d+(?::\d+)?$/u;
@@ -865,7 +911,7 @@ function shouldProbeCallerLocation(opts) {
865
911
  if (hasExplicitOptionBasedir(opts)) {
866
912
  return false;
867
913
  }
868
- return !(process4.env.WEAPP_TAILWINDCSS_BASEDIR || process4.env.WEAPP_TAILWINDCSS_BASE_DIR || process4.env.TAILWINDCSS_BASEDIR || process4.env.TAILWINDCSS_BASE_DIR);
914
+ return !(process5.env.WEAPP_TAILWINDCSS_BASEDIR || process5.env.WEAPP_TAILWINDCSS_BASE_DIR || process5.env.TAILWINDCSS_BASEDIR || process5.env.TAILWINDCSS_BASE_DIR);
869
915
  }
870
916
  function detectCallerLocation() {
871
917
  const stack = new Error("compiler-context-cache stack probe").stack;
@@ -898,20 +944,20 @@ function getRuntimeCacheScope(opts) {
898
944
  }
899
945
  const runtimeScope = {
900
946
  caller: void 0,
901
- cwd: process4.cwd(),
902
- init_cwd: process4.env.INIT_CWD,
903
- npm_config_local_prefix: process4.env.npm_config_local_prefix,
904
- npm_package_json: process4.env.npm_package_json,
905
- pnpm_package_name: process4.env.PNPM_PACKAGE_NAME,
906
- pwd: process4.env.PWD,
907
- tailwindcss_base_dir: process4.env.TAILWINDCSS_BASE_DIR,
908
- tailwindcss_basedir: process4.env.TAILWINDCSS_BASEDIR,
909
- uni_app_input_dir: process4.env.UNI_APP_INPUT_DIR,
910
- uni_cli_root: process4.env.UNI_CLI_ROOT,
911
- uni_input_dir: process4.env.UNI_INPUT_DIR,
912
- uni_input_root: process4.env.UNI_INPUT_ROOT,
913
- weapp_tailwindcss_base_dir: process4.env.WEAPP_TAILWINDCSS_BASE_DIR,
914
- weapp_tailwindcss_basedir: process4.env.WEAPP_TAILWINDCSS_BASEDIR
947
+ cwd: process5.cwd(),
948
+ init_cwd: process5.env.INIT_CWD,
949
+ npm_config_local_prefix: process5.env.npm_config_local_prefix,
950
+ npm_package_json: process5.env.npm_package_json,
951
+ pnpm_package_name: process5.env.PNPM_PACKAGE_NAME,
952
+ pwd: process5.env.PWD,
953
+ tailwindcss_base_dir: process5.env.TAILWINDCSS_BASE_DIR,
954
+ tailwindcss_basedir: process5.env.TAILWINDCSS_BASEDIR,
955
+ uni_app_input_dir: process5.env.UNI_APP_INPUT_DIR,
956
+ uni_cli_root: process5.env.UNI_CLI_ROOT,
957
+ uni_input_dir: process5.env.UNI_INPUT_DIR,
958
+ uni_input_root: process5.env.UNI_INPUT_ROOT,
959
+ weapp_tailwindcss_base_dir: process5.env.WEAPP_TAILWINDCSS_BASE_DIR,
960
+ weapp_tailwindcss_basedir: process5.env.WEAPP_TAILWINDCSS_BASEDIR
915
961
  };
916
962
  if (shouldProbeCallerLocation(opts)) {
917
963
  runtimeScope.caller = detectCallerLocation();
@@ -1083,7 +1129,7 @@ function createCompilerContextCacheKey(opts) {
1083
1129
  keyStore.set(runtimeCacheScopeKey, cacheKey);
1084
1130
  return cacheKey;
1085
1131
  } catch (error) {
1086
- logger4.debug("skip compiler context cache: %O", error);
1132
+ logger5.debug("skip compiler context cache: %O", error);
1087
1133
  return void 0;
1088
1134
  }
1089
1135
  }
@@ -3653,7 +3699,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
3653
3699
  }
3654
3700
 
3655
3701
  // src/context/logger.ts
3656
- import { logger as logger5 } from "@weapp-tailwindcss/logger";
3702
+ import { logger as logger6 } from "@weapp-tailwindcss/logger";
3657
3703
  var loggerLevelMap = {
3658
3704
  error: 0,
3659
3705
  warn: 1,
@@ -3661,7 +3707,7 @@ var loggerLevelMap = {
3661
3707
  silent: -999
3662
3708
  };
3663
3709
  function applyLoggerLevel(logLevel) {
3664
- logger5.level = loggerLevelMap[logLevel ?? "info"] ?? loggerLevelMap.info;
3710
+ logger6.level = loggerLevelMap[logLevel ?? "info"] ?? loggerLevelMap.info;
3665
3711
  }
3666
3712
 
3667
3713
  // src/context/index.ts
@@ -3677,7 +3723,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
3677
3723
  try {
3678
3724
  await patcher.clearCache({ scope: "all" });
3679
3725
  } catch (error) {
3680
- logger6.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
3726
+ logger7.debug("failed to clear tailwindcss patcher cache via clearCache(): %O", error);
3681
3727
  }
3682
3728
  }
3683
3729
  if (!options?.removeDirectory) {
@@ -3706,7 +3752,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
3706
3752
  if (err?.code === "ENOENT") {
3707
3753
  continue;
3708
3754
  }
3709
- logger6.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
3755
+ logger7.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
3710
3756
  }
3711
3757
  }
3712
3758
  }
@@ -3720,11 +3766,11 @@ function createInternalCompilerContext(opts) {
3720
3766
  applyLoggerLevel(ctx.logLevel);
3721
3767
  const twPatcher = createTailwindcssPatcherFromContext(ctx);
3722
3768
  logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
3723
- if (twPatcher.packageInfo?.version) {
3724
- logger6.success(`\u5F53\u524D\u4F7F\u7528 ${pc.cyanBright("Tailwind CSS")} \u7248\u672C\u4E3A: ${pc.underline(pc.bold(pc.green(twPatcher.packageInfo.version)))}`);
3725
- } else {
3726
- logger6.warn(`${pc.cyanBright("Tailwind CSS")} \u672A\u5B89\u88C5\uFF0C\u5DF2\u8DF3\u8FC7\u7248\u672C\u68C0\u6D4B\u4E0E\u8865\u4E01\u5E94\u7528\u3002`);
3727
- }
3769
+ logRuntimeTailwindcssVersion(
3770
+ ctx.tailwindcssBasedir,
3771
+ twPatcher.packageInfo?.rootPath,
3772
+ twPatcher.packageInfo?.version
3773
+ );
3728
3774
  warnMissingCssEntries(ctx, twPatcher);
3729
3775
  const cssCalcOptions = applyV4CssCalcDefaults(ctx.cssCalc, twPatcher);
3730
3776
  ctx.cssCalc = cssCalcOptions;
@@ -3,7 +3,7 @@
3
3
  var _chunk7LKMJZD2js = require('./chunk-7LKMJZD2.js');
4
4
 
5
5
 
6
- var _chunkZ6RS5OPNjs = require('./chunk-Z6RS5OPN.js');
6
+ var _chunkTT5WHNGSjs = require('./chunk-TT5WHNGS.js');
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -155,8 +155,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
155
155
  if (!options.enabled) {
156
156
  return;
157
157
  }
158
- compiler.hooks.normalModuleFactory.tap(_chunkZ6RS5OPNjs.pluginName, (factory) => {
159
- factory.hooks.beforeResolve.tap(_chunkZ6RS5OPNjs.pluginName, (data) => {
158
+ compiler.hooks.normalModuleFactory.tap(_chunkTT5WHNGSjs.pluginName, (factory) => {
159
+ factory.hooks.beforeResolve.tap(_chunkTT5WHNGSjs.pluginName, (data) => {
160
160
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
161
161
  });
162
162
  });
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-F2CKKG6Q.mjs";
4
4
  import {
5
5
  pluginName
6
- } from "./chunk-KWSWZP5H.mjs";
6
+ } from "./chunk-AB2RGZQO.mjs";
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  import path2 from "path";
@@ -7,7 +7,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkZ6RS5OPNjs = require('./chunk-Z6RS5OPN.js');
10
+ var _chunkTT5WHNGSjs = require('./chunk-TT5WHNGS.js');
11
11
 
12
12
  // src/bundlers/gulp/index.ts
13
13
  var _buffer = require('buffer');
@@ -15,12 +15,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
15
15
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
16
16
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
17
17
  var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
18
- var debug = _chunkZ6RS5OPNjs.createDebug.call(void 0, );
18
+ var debug = _chunkTT5WHNGSjs.createDebug.call(void 0, );
19
19
  var Transform = _stream2.default.Transform;
20
20
  function createPlugins(options = {}) {
21
- const opts = _chunkZ6RS5OPNjs.getCompilerContext.call(void 0, options);
21
+ const opts = _chunkTT5WHNGSjs.getCompilerContext.call(void 0, options);
22
22
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
23
- const patchRecorderState = _chunkZ6RS5OPNjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
23
+ const patchRecorderState = _chunkTT5WHNGSjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
24
24
  source: "runtime",
25
25
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
26
26
  });
@@ -38,13 +38,13 @@ function createPlugins(options = {}) {
38
38
  const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
39
39
  let runtimeSetInitialized = false;
40
40
  async function refreshRuntimeState(force) {
41
- await _chunkZ6RS5OPNjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
41
+ await _chunkTT5WHNGSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
42
42
  }
43
43
  async function refreshRuntimeSet(force = false) {
44
44
  if (!force && runtimeSetInitialized) {
45
45
  return runtimeSet;
46
46
  }
47
- runtimeSet = await _chunkZ6RS5OPNjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
47
+ runtimeSet = await _chunkTT5WHNGSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
48
48
  forceRefresh: force,
49
49
  forceCollect: force,
50
50
  clearCache: force,