weapp-tailwindcss 4.11.0 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{chunk-KWSWZP5H.mjs → chunk-4O2J5ZM6.mjs} +3 -3
  2. package/dist/{chunk-2PXISDSY.js → chunk-6YV5WADN.js} +28 -28
  3. package/dist/{chunk-LL3QUKJI.js → chunk-A5PB4KZT.js} +2 -0
  4. package/dist/{chunk-UO725AHQ.mjs → chunk-KX2JVTVM.mjs} +154 -38
  5. package/dist/{chunk-ZQAWDXIW.js → chunk-Q2HTQFI4.js} +3 -3
  6. package/dist/{chunk-Z6RS5OPN.js → chunk-SSASUP5F.js} +4 -4
  7. package/dist/{chunk-Y75XZ6KA.mjs → chunk-SV55AOBL.mjs} +2 -2
  8. package/dist/{chunk-GVYD6TY7.js → chunk-VOCOKTZW.js} +172 -56
  9. package/dist/{chunk-FTFADUJ4.mjs → chunk-WSMWD4MC.mjs} +1 -1
  10. package/dist/{chunk-23K4XDKF.mjs → chunk-XAKAD2CR.mjs} +2 -0
  11. package/dist/{chunk-C4CWDYUP.js → chunk-Y6JUVWRU.js} +6 -6
  12. package/dist/{chunk-MAIS4SDW.mjs → chunk-ZUV5AZRB.mjs} +1 -1
  13. package/dist/cli.js +2 -2
  14. package/dist/cli.mjs +2 -2
  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 @@ 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
@@ -423,7 +423,7 @@ import { logger as logger2 } from "@weapp-tailwindcss/logger";
423
423
  // package.json
424
424
  var package_default = {
425
425
  name: "weapp-tailwindcss",
426
- version: "4.11.0",
426
+ version: "4.11.1",
427
427
  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
428
  author: "ice breaker <1324318532@qq.com>",
429
429
  license: "MIT",
@@ -618,7 +618,7 @@ var package_default = {
618
618
  "@babel/parser": "~7.29.2",
619
619
  "@babel/traverse": "~7.29.0",
620
620
  "@babel/types": "~7.29.0",
621
- "@tailwindcss-mangle/config": "^6.1.3",
621
+ "@tailwindcss-mangle/config": "^7.0.0",
622
622
  "@vue/compiler-dom": "catalog:vue3",
623
623
  "@vue/compiler-sfc": "catalog:vue3",
624
624
  "@weapp-core/escape": "~7.0.0",
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkZQAWDXIWjs = require('./chunk-ZQAWDXIW.js');
14
+ var _chunkQ2HTQFI4js = require('./chunk-Q2HTQFI4.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 _chunkSSASUP5Fjs = require('./chunk-SSASUP5F.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(_chunkSSASUP5Fjs.pluginName, (compilation) => {
67
67
  compilation.hooks.processAssets.tapPromise(
68
68
  {
69
- name: _chunkZ6RS5OPNjs.pluginName,
69
+ name: _chunkSSASUP5Fjs.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 = _chunkQ2HTQFI4js.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 _chunkSSASUP5Fjs.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 = _chunkQ2HTQFI4js.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 = _chunkQ2HTQFI4js.isMpx.call(void 0, appType);
317
317
  if (shouldRewriteCssImports && isMpxApp) {
318
- _chunkZQAWDXIWjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
318
+ _chunkQ2HTQFI4js.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 } = _chunkQ2HTQFI4js.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
+ _chunkQ2HTQFI4js.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(_chunkSSASUP5Fjs.pluginName, (compilation) => {
358
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkSSASUP5Fjs.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
+ _chunkQ2HTQFI4js.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 = _chunkQ2HTQFI4js.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 && !_chunkQ2HTQFI4js.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 = _chunkSSASUP5Fjs.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 = _chunkSSASUP5Fjs.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 = _chunkQ2HTQFI4js.isMpx.call(void 0, this.appType);
435
435
  if (shouldRewriteCssImports) {
436
- _chunkZQAWDXIWjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
436
+ _chunkQ2HTQFI4js.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
+ _chunkQ2HTQFI4js.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 = _chunkSSASUP5Fjs.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 || _chunkQ2HTQFI4js.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(_chunkSSASUP5Fjs.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(_chunkSSASUP5Fjs.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(_chunkSSASUP5Fjs.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(_chunkSSASUP5Fjs.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 _chunkSSASUP5Fjs.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;
@@ -26,7 +26,7 @@ import {
26
26
  toCustomAttributesEntities,
27
27
  traverse,
28
28
  vitePluginName
29
- } from "./chunk-KWSWZP5H.mjs";
29
+ } from "./chunk-4O2J5ZM6.mjs";
30
30
  import {
31
31
  findNearestPackageRoot,
32
32
  findTailwindConfig,
@@ -40,9 +40,10 @@ import {
40
40
  } from "./chunk-OOHJLO5M.mjs";
41
41
 
42
42
  // src/bundlers/vite/index.ts
43
- import { existsSync } from "fs";
44
- import path5 from "path";
43
+ import { existsSync as existsSync2 } from "fs";
44
+ import path6 from "path";
45
45
  import process4 from "process";
46
+ import { logger as logger2 } from "@weapp-tailwindcss/logger";
46
47
  import postcssHtmlTransform from "@weapp-tailwindcss/postcss/html-transform";
47
48
 
48
49
  // src/uni-app-x/transform.ts
@@ -64,18 +65,18 @@ function createStableHash(input) {
64
65
  }
65
66
  return (hash >>> 0).toString(36);
66
67
  }
67
- function extractLiteralValue(path6) {
68
- const allowDoubleQuotes = path6.isTemplateElement();
69
- if (path6.isStringLiteral()) {
68
+ function extractLiteralValue(path7) {
69
+ const allowDoubleQuotes = path7.isTemplateElement();
70
+ if (path7.isStringLiteral()) {
70
71
  return {
71
72
  allowDoubleQuotes,
72
- literal: path6.node.value,
73
+ literal: path7.node.value,
73
74
  offset: 1
74
75
  };
75
76
  }
76
77
  return {
77
78
  allowDoubleQuotes,
78
- literal: path6.node.value.raw,
79
+ literal: path7.node.value.raw,
79
80
  offset: 0
80
81
  };
81
82
  }
@@ -134,10 +135,10 @@ var UniAppXComponentLocalStyleCollector = class {
134
135
  sourceType: options.wrapExpression ? "module" : "unambiguous"
135
136
  });
136
137
  const analysis = analyzeSource(ast, {}, void 0, false);
137
- for (const path6 of analysis.targetPaths) {
138
- const { literal, allowDoubleQuotes } = extractLiteralValue(path6);
138
+ for (const path7 of analysis.targetPaths) {
139
+ const { literal, allowDoubleQuotes } = extractLiteralValue(path7);
139
140
  const candidates = splitCode(literal, allowDoubleQuotes);
140
- const classContext = options.wrapExpression || isClassContextLiteralPath(path6);
141
+ const classContext = options.wrapExpression || isClassContextLiteralPath(path7);
141
142
  for (const candidate of candidates) {
142
143
  if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) {
143
144
  continue;
@@ -165,8 +166,8 @@ var UniAppXComponentLocalStyleCollector = class {
165
166
  return rawSource;
166
167
  }
167
168
  const updater = new JsTokenUpdater();
168
- for (const path6 of analysis.targetPaths) {
169
- const { literal, allowDoubleQuotes, offset } = extractLiteralValue(path6);
169
+ for (const path7 of analysis.targetPaths) {
170
+ const { literal, allowDoubleQuotes, offset } = extractLiteralValue(path7);
170
171
  const candidates = splitCode(literal, allowDoubleQuotes);
171
172
  if (candidates.length === 0) {
172
173
  continue;
@@ -184,14 +185,14 @@ var UniAppXComponentLocalStyleCollector = class {
184
185
  mutated = true;
185
186
  }
186
187
  }
187
- if (!mutated || typeof path6.node.start !== "number" || typeof path6.node.end !== "number") {
188
+ if (!mutated || typeof path7.node.start !== "number" || typeof path7.node.end !== "number") {
188
189
  continue;
189
190
  }
190
191
  updater.addToken({
191
- start: path6.node.start + offset,
192
- end: path6.node.end - offset,
192
+ start: path7.node.start + offset,
193
+ end: path7.node.end - offset,
193
194
  value: rewritten,
194
- path: path6
195
+ path: path7
195
196
  });
196
197
  }
197
198
  if (updater.length === 0) {
@@ -824,14 +825,14 @@ function createJsRuntimeAffectingSignature(source) {
824
825
  const parts = [];
825
826
  traverse(ast, {
826
827
  noScope: true,
827
- StringLiteral(path6) {
828
- parts.push(`s:${path6.node.value}`);
828
+ StringLiteral(path7) {
829
+ parts.push(`s:${path7.node.value}`);
829
830
  },
830
- TemplateElement(path6) {
831
- parts.push(`t:${path6.node.value.raw}`);
831
+ TemplateElement(path7) {
832
+ parts.push(`t:${path7.node.value.raw}`);
832
833
  },
833
- JSXText(path6) {
834
- const value = path6.node.value.trim();
834
+ JSXText(path7) {
835
+ const value = path7.node.value.trim();
835
836
  if (value.length > 0) {
836
837
  parts.push(`x:${value}`);
837
838
  }
@@ -1954,6 +1955,102 @@ function createBundleRuntimeClassSetManager(options = {}) {
1954
1955
  };
1955
1956
  }
1956
1957
 
1958
+ // src/bundlers/vite/resolve-app-type.ts
1959
+ import { existsSync, readFileSync } from "fs";
1960
+ import path5 from "path";
1961
+ var PACKAGE_JSON_FILE = "package.json";
1962
+ var MPX_SCRIPT_RE = /\bmpx(?:-cli-service)?\b/u;
1963
+ var TARO_SCRIPT_RE = /\btaro\b/u;
1964
+ var TAILWINDCSS_VITE_MARKERS = [
1965
+ ["src/app.mpx", "mpx"],
1966
+ ["app.mpx", "mpx"]
1967
+ ];
1968
+ function resolveDependencyNames(pkg) {
1969
+ return /* @__PURE__ */ new Set([
1970
+ ...Object.keys(pkg.dependencies ?? {}),
1971
+ ...Object.keys(pkg.devDependencies ?? {}),
1972
+ ...Object.keys(pkg.peerDependencies ?? {}),
1973
+ ...Object.keys(pkg.optionalDependencies ?? {})
1974
+ ]);
1975
+ }
1976
+ function hasScriptMatch(pkg, pattern) {
1977
+ return Object.values(pkg.scripts ?? {}).some((script) => pattern.test(script));
1978
+ }
1979
+ function resolveAppTypeFromPackageJson(pkg) {
1980
+ const dependencyNames = resolveDependencyNames(pkg);
1981
+ if (dependencyNames.has("weapp-vite") || [...dependencyNames].some((name) => name.startsWith("@weapp-vite/"))) {
1982
+ return "weapp-vite";
1983
+ }
1984
+ if ([...dependencyNames].some((name) => name.startsWith("@mpxjs/")) || hasScriptMatch(pkg, MPX_SCRIPT_RE)) {
1985
+ return "mpx";
1986
+ }
1987
+ if ([...dependencyNames].some((name) => name.startsWith("@tarojs/")) || hasScriptMatch(pkg, TARO_SCRIPT_RE)) {
1988
+ return "taro";
1989
+ }
1990
+ if (dependencyNames.has("@dcloudio/vite-plugin-uni")) {
1991
+ return "uni-app-vite";
1992
+ }
1993
+ if (dependencyNames.has("@dcloudio/vue-cli-plugin-uni") || dependencyNames.has("@dcloudio/uni-app") || Object.hasOwn(pkg, "uni-app")) {
1994
+ return "uni-app";
1995
+ }
1996
+ }
1997
+ function tryReadUniAppManifest(root) {
1998
+ const manifestPath = path5.join(root, "manifest.json");
1999
+ if (!existsSync(manifestPath)) {
2000
+ return;
2001
+ }
2002
+ try {
2003
+ return JSON.parse(readFileSync(manifestPath, "utf8"));
2004
+ } catch {
2005
+ }
2006
+ }
2007
+ function tryReadPackageJson(root) {
2008
+ const packageJsonPath = path5.join(root, PACKAGE_JSON_FILE);
2009
+ if (!existsSync(packageJsonPath)) {
2010
+ return;
2011
+ }
2012
+ try {
2013
+ return JSON.parse(readFileSync(packageJsonPath, "utf8"));
2014
+ } catch {
2015
+ }
2016
+ }
2017
+ function resolveAppTypeFromMarkers(root) {
2018
+ for (const [relativePath, appType] of TAILWINDCSS_VITE_MARKERS) {
2019
+ if (existsSync(path5.join(root, relativePath))) {
2020
+ return appType;
2021
+ }
2022
+ }
2023
+ }
2024
+ function resolveImplicitAppTypeFromViteRoot(root) {
2025
+ const resolvedRoot = path5.resolve(root);
2026
+ if (!existsSync(resolvedRoot)) {
2027
+ return;
2028
+ }
2029
+ const markerDetected = resolveAppTypeFromMarkers(resolvedRoot);
2030
+ if (markerDetected) {
2031
+ return markerDetected;
2032
+ }
2033
+ let current = resolvedRoot;
2034
+ while (true) {
2035
+ const manifest = tryReadUniAppManifest(current);
2036
+ if (manifest && Object.hasOwn(manifest, "uni-app-x")) {
2037
+ return "uni-app-x";
2038
+ }
2039
+ const pkg = tryReadPackageJson(current);
2040
+ if (pkg) {
2041
+ const detected = resolveAppTypeFromPackageJson(pkg);
2042
+ if (detected) {
2043
+ return detected;
2044
+ }
2045
+ }
2046
+ const parent = path5.dirname(current);
2047
+ if (parent === current) {
2048
+ break;
2049
+ }
2050
+ current = parent;
2051
+ }
2052
+ }
2053
+
1957
2054
  // src/bundlers/vite/rewrite-css-imports.ts
1958
2055
  function joinPosixPath(base, subpath) {
1959
2056
  if (base.endsWith("/")) {
@@ -1972,7 +2069,8 @@ function createRewriteCssImportsPlugins(options) {
1972
2069
  if (!options.shouldRewrite) {
1973
2070
  return [];
1974
2071
  }
1975
- const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
2072
+ const { appType, getAppType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
2073
+ const resolveAppType = () => getAppType?.() ?? appType;
1976
2074
  return [
1977
2075
  {
1978
2076
  name: `${vitePluginName}:rewrite-css-imports`,
@@ -1982,7 +2080,7 @@ function createRewriteCssImportsPlugins(options) {
1982
2080
  handler(id, importer) {
1983
2081
  const replacement = resolveTailwindcssImport(id, weappTailwindcssDirPosix2, {
1984
2082
  join: joinPosixPath,
1985
- appType
2083
+ appType: resolveAppType()
1986
2084
  });
1987
2085
  if (!replacement) {
1988
2086
  return null;
@@ -2001,7 +2099,7 @@ function createRewriteCssImportsPlugins(options) {
2001
2099
  }
2002
2100
  const rewritten = rewriteTailwindcssImportsInCode(code, weappTailwindcssDirPosix2, {
2003
2101
  join: joinPosixPath,
2004
- appType
2102
+ appType: resolveAppType()
2005
2103
  });
2006
2104
  if (!rewritten) {
2007
2105
  return null;
@@ -2020,17 +2118,17 @@ function createRewriteCssImportsPlugins(options) {
2020
2118
  var debug2 = createDebug();
2021
2119
  var weappTailwindcssPackageDir = resolvePackageDir("weapp-tailwindcss");
2022
2120
  var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
2023
- var PACKAGE_JSON_FILE = "package.json";
2121
+ var PACKAGE_JSON_FILE2 = "package.json";
2024
2122
  function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
2025
- const resolvedRoot = path5.resolve(root);
2026
- if (!existsSync(resolvedRoot)) {
2123
+ const resolvedRoot = path6.resolve(root);
2124
+ if (!existsSync2(resolvedRoot)) {
2027
2125
  return resolvedRoot;
2028
2126
  }
2029
2127
  const searchRoots = [];
2030
2128
  let current = resolvedRoot;
2031
2129
  while (true) {
2032
2130
  searchRoots.push(current);
2033
- const parent = path5.dirname(current);
2131
+ const parent = path6.dirname(current);
2034
2132
  if (parent === current) {
2035
2133
  break;
2036
2134
  }
@@ -2038,15 +2136,16 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
2038
2136
  }
2039
2137
  const tailwindConfigPath = findTailwindConfig(searchRoots);
2040
2138
  if (tailwindConfigPath) {
2041
- return path5.dirname(tailwindConfigPath);
2139
+ return path6.dirname(tailwindConfigPath);
2042
2140
  }
2043
2141
  const packageRoot = findNearestPackageRoot(resolvedRoot);
2044
- if (packageRoot && existsSync(path5.join(packageRoot, PACKAGE_JSON_FILE))) {
2142
+ if (packageRoot && existsSync2(path6.join(packageRoot, PACKAGE_JSON_FILE2))) {
2045
2143
  return packageRoot;
2046
2144
  }
2047
2145
  return resolvedRoot;
2048
2146
  }
2049
2147
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2148
+ const hasExplicitAppType = typeof options.appType === "string" && options.appType.trim().length > 0;
2050
2149
  const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
2051
2150
  const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
2052
2151
  const opts = getCompilerContext(options);
@@ -2055,7 +2154,6 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2055
2154
  customAttributes,
2056
2155
  onLoad,
2057
2156
  mainCssChunkMatcher,
2058
- appType,
2059
2157
  styleHandler,
2060
2158
  jsHandler,
2061
2159
  twPatcher: initialTwPatcher,
@@ -2068,7 +2166,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2068
2166
  const tailwindcssMajorVersion = initialTwPatcher.majorVersion ?? 0;
2069
2167
  const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
2070
2168
  const rewritePlugins = createRewriteCssImportsPlugins({
2071
- appType,
2169
+ getAppType: () => opts.appType,
2072
2170
  shouldRewrite: shouldRewriteCssImports,
2073
2171
  weappTailwindcssDirPosix
2074
2172
  });
@@ -2096,7 +2194,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2096
2194
  const configPath = resolveTailwindcssOptions(runtimeState.twPatcher.options)?.config;
2097
2195
  const signature = getRuntimeClassSetSignature(runtimeState.twPatcher);
2098
2196
  const optionsKey = JSON.stringify({
2099
- appType,
2197
+ appType: opts.appType,
2100
2198
  uniAppX: uniAppXEnabled,
2101
2199
  customAttributesEntities,
2102
2200
  disabledDefaultTemplateHandler,
@@ -2198,7 +2296,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2198
2296
  const utsPlatform = resolveUniUtsPlatform();
2199
2297
  const isIosPlatform = utsPlatform.isAppIos;
2200
2298
  const uniAppXPlugins = uniAppXEnabled ? createUniAppXPlugins({
2201
- appType,
2299
+ appType: opts.appType ?? "uni-app-x",
2202
2300
  customAttributesEntities,
2203
2301
  disabledDefaultTemplateHandler,
2204
2302
  isIosPlatform,
@@ -2217,7 +2315,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2217
2315
  enforce: "post",
2218
2316
  async configResolved(config) {
2219
2317
  resolvedConfig = config;
2220
- const resolvedRoot = config.root ? path5.resolve(config.root) : void 0;
2318
+ const resolvedRoot = config.root ? path6.resolve(config.root) : void 0;
2319
+ let shouldRefreshRuntime = false;
2221
2320
  if (!hasExplicitTailwindcssBasedir && resolvedRoot) {
2222
2321
  const nextTailwindcssBasedir = resolveImplicitTailwindcssBasedirFromViteRoot(resolvedRoot);
2223
2322
  if (opts.tailwindcssBasedir !== nextTailwindcssBasedir) {
@@ -2228,9 +2327,26 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
2228
2327
  previousBasedir ?? "undefined",
2229
2328
  nextTailwindcssBasedir
2230
2329
  );
2231
- await refreshRuntimeState(true);
2330
+ shouldRefreshRuntime = true;
2232
2331
  }
2233
2332
  }
2333
+ if (!hasExplicitAppType && resolvedRoot) {
2334
+ const nextAppType = resolveImplicitAppTypeFromViteRoot(resolvedRoot);
2335
+ if (nextAppType && opts.appType !== nextAppType) {
2336
+ const previousAppType = opts.appType;
2337
+ opts.appType = nextAppType;
2338
+ logger2.info("\u6839\u636E Vite \u9879\u76EE\u6839\u76EE\u5F55\u81EA\u52A8\u63A8\u65AD appType -> %s", nextAppType);
2339
+ debug2(
2340
+ "align appType with vite root: %s -> %s",
2341
+ previousAppType ?? "undefined",
2342
+ nextAppType
2343
+ );
2344
+ shouldRefreshRuntime = true;
2345
+ }
2346
+ }
2347
+ if (shouldRefreshRuntime) {
2348
+ await refreshRuntimeState(true);
2349
+ }
2234
2350
  if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
2235
2351
  const postcssPlugins = config.css.postcss.plugins;
2236
2352
  const idx = postcssPlugins.findIndex((x) => (
@@ -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 _chunkSSASUP5Fjs = require('./chunk-SSASUP5F.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(_chunkSSASUP5Fjs.pluginName, (factory) => {
159
+ factory.hooks.beforeResolve.tap(_chunkSSASUP5Fjs.pluginName, (data) => {
160
160
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
161
161
  });
162
162
  });
@@ -11,7 +11,7 @@
11
11
  var _chunkQK6VNNNLjs = require('./chunk-QK6VNNNL.js');
12
12
 
13
13
 
14
- var _chunkLL3QUKJIjs = require('./chunk-LL3QUKJI.js');
14
+ var _chunkA5PB4KZTjs = require('./chunk-A5PB4KZT.js');
15
15
 
16
16
 
17
17
 
@@ -423,7 +423,7 @@ function getRecordFileCandidates(baseDir) {
423
423
  // package.json
424
424
  var package_default = {
425
425
  name: "weapp-tailwindcss",
426
- version: "4.11.0",
426
+ version: "4.11.1",
427
427
  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
428
  author: "ice breaker <1324318532@qq.com>",
429
429
  license: "MIT",
@@ -618,7 +618,7 @@ var package_default = {
618
618
  "@babel/parser": "~7.29.2",
619
619
  "@babel/traverse": "~7.29.0",
620
620
  "@babel/types": "~7.29.0",
621
- "@tailwindcss-mangle/config": "^6.1.3",
621
+ "@tailwindcss-mangle/config": "^7.0.0",
622
622
  "@vue/compiler-dom": "catalog:vue3",
623
623
  "@vue/compiler-sfc": "catalog:vue3",
624
624
  "@weapp-core/escape": "~7.0.0",
@@ -3713,7 +3713,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
3713
3713
  function createInternalCompilerContext(opts) {
3714
3714
  const ctx = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
3715
3715
  opts,
3716
- _chunkLL3QUKJIjs.getDefaultOptions.call(void 0, ),
3716
+ _chunkA5PB4KZTjs.getDefaultOptions.call(void 0, ),
3717
3717
  {}
3718
3718
  );
3719
3719
  ctx.escapeMap = ctx.customReplaceDictionary;
@@ -11,7 +11,7 @@ import {
11
11
  isMpx,
12
12
  patchMpxLoaderResolve,
13
13
  setupMpxTailwindcssRedirect
14
- } from "./chunk-MAIS4SDW.mjs";
14
+ } from "./chunk-ZUV5AZRB.mjs";
15
15
  import {
16
16
  pushConcurrentTaskFactories,
17
17
  resolveDisabledOptions,
@@ -28,7 +28,7 @@ import {
28
28
  getCompilerContext,
29
29
  pluginName,
30
30
  setupPatchRecorder
31
- } from "./chunk-KWSWZP5H.mjs";
31
+ } from "./chunk-4O2J5ZM6.mjs";
32
32
  import {
33
33
  getRuntimeClassSetSignature,
34
34
  resolveTailwindcssOptions