weapp-tailwindcss 4.11.0-alpha.1 → 4.11.0-alpha.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 (73) hide show
  1. package/dist/{chunk-35EI5JMK.mjs → chunk-23K4XDKF.mjs} +3 -1
  2. package/dist/{chunk-W2EMGF7H.js → chunk-2W24MRCQ.js} +10 -12
  3. package/dist/chunk-4AFQP74Z.js +24 -0
  4. package/dist/{chunk-SQG2MOFQ.js → chunk-4TTPYMVM.js} +12 -8
  5. package/dist/{chunk-4LPOQMFS.js → chunk-5KSBT6GU.js} +396 -219
  6. package/dist/{chunk-LD7LZ4IK.mjs → chunk-66E76FQE.mjs} +91 -50
  7. package/dist/{chunk-GWDHNCL2.js → chunk-6O7HJU2F.js} +123 -42
  8. package/dist/{chunk-RRHPTTCP.mjs → chunk-76S2EME4.mjs} +2 -0
  9. package/dist/{chunk-G3G437UE.js → chunk-7LKMJZD2.js} +2 -2
  10. package/dist/{chunk-OV7FX6XR.js → chunk-CRDOWYG4.js} +1 -1
  11. package/dist/{chunk-DOH7FULQ.mjs → chunk-EFBQ4SQR.mjs} +1 -1
  12. package/dist/{chunk-IEZ5RBMG.mjs → chunk-EW2K6CO5.mjs} +365 -188
  13. package/dist/{chunk-FZNYV7VH.mjs → chunk-HADJCWHU.mjs} +212 -258
  14. package/dist/{chunk-CZLXTEHN.js → chunk-K7CZXT46.js} +132 -91
  15. package/dist/{chunk-ACTJYB33.js → chunk-LL3QUKJI.js} +3 -1
  16. package/dist/{chunk-G5NLM3AL.js → chunk-LYGLQCWI.js} +278 -324
  17. package/dist/{chunk-LTJQUORK.js → chunk-OF6MFURR.js} +2 -0
  18. package/dist/{chunk-KKT2DKMW.mjs → chunk-RED7Y22U.mjs} +91 -10
  19. package/dist/{chunk-R6KEYO3F.mjs → chunk-SJ3SG6DU.mjs} +5 -1
  20. package/dist/{chunk-JBM3HGHP.mjs → chunk-UCUAXK7F.mjs} +4 -6
  21. package/dist/cli.js +1006 -147
  22. package/dist/cli.mjs +942 -107
  23. package/dist/core.d.mts +2 -2
  24. package/dist/core.d.ts +2 -2
  25. package/dist/core.js +9 -11
  26. package/dist/core.mjs +6 -8
  27. package/dist/css-macro/postcss.js +1 -1
  28. package/dist/css-macro/postcss.mjs +1 -1
  29. package/dist/css-macro.js +3 -3
  30. package/dist/css-macro.mjs +4 -4
  31. package/dist/defaults.d.mts +2 -2
  32. package/dist/defaults.d.ts +2 -2
  33. package/dist/defaults.js +3 -3
  34. package/dist/defaults.mjs +2 -2
  35. package/dist/gulp.d.mts +2 -2
  36. package/dist/gulp.d.ts +2 -2
  37. package/dist/gulp.js +7 -8
  38. package/dist/gulp.mjs +6 -7
  39. package/dist/{index-t_VBjwYm.d.ts → index-BMwzhITq.d.mts} +6 -6
  40. package/dist/{index-t_VBjwYm.d.mts → index-BMwzhITq.d.ts} +6 -6
  41. package/dist/index.d.mts +2 -2
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.js +11 -12
  44. package/dist/index.mjs +9 -10
  45. package/dist/postcss-html-transform.js +1 -1
  46. package/dist/postcss-html-transform.mjs +1 -1
  47. package/dist/presets.d.mts +2 -2
  48. package/dist/presets.d.ts +2 -2
  49. package/dist/presets.js +5 -5
  50. package/dist/presets.mjs +2 -2
  51. package/dist/reset.js +1 -1
  52. package/dist/reset.mjs +1 -1
  53. package/dist/types.d.mts +4 -4
  54. package/dist/types.d.ts +4 -4
  55. package/dist/types.js +1 -1
  56. package/dist/types.mjs +1 -1
  57. package/dist/vite.d.mts +2 -2
  58. package/dist/vite.d.ts +2 -2
  59. package/dist/vite.js +8 -9
  60. package/dist/vite.mjs +6 -7
  61. package/dist/weapp-tw-css-import-rewrite-loader.js +3 -1
  62. package/dist/weapp-tw-runtime-classset-loader.js +29 -2
  63. package/dist/webpack.d.mts +2 -2
  64. package/dist/webpack.d.ts +2 -2
  65. package/dist/webpack.js +9 -10
  66. package/dist/webpack.mjs +7 -8
  67. package/dist/webpack4.d.mts +2 -2
  68. package/dist/webpack4.d.ts +2 -2
  69. package/dist/webpack4.js +41 -41
  70. package/dist/webpack4.mjs +12 -12
  71. package/package.json +8 -8
  72. package/dist/chunk-NOKJXG3W.js +0 -29
  73. package/dist/chunk-QYZCRG7F.mjs +0 -29
@@ -6,13 +6,12 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkG3G437UEjs = require('./chunk-G3G437UE.js');
9
+ var _chunk7LKMJZD2js = require('./chunk-7LKMJZD2.js');
10
10
 
11
11
 
12
- var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
12
+ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
13
13
 
14
14
 
15
- var _chunkNOKJXG3Wjs = require('./chunk-NOKJXG3W.js');
16
15
 
17
16
 
18
17
 
@@ -24,19 +23,19 @@ var _chunkNOKJXG3Wjs = require('./chunk-NOKJXG3W.js');
24
23
 
25
24
 
26
25
 
26
+ var _chunkLYGLQCWIjs = require('./chunk-LYGLQCWI.js');
27
27
 
28
28
 
29
- var _chunkG5NLM3ALjs = require('./chunk-G5NLM3AL.js');
30
29
 
31
30
 
32
31
 
33
- var _chunk4LPOQMFSjs = require('./chunk-4LPOQMFS.js');
32
+ var _chunk5KSBT6GUjs = require('./chunk-5KSBT6GU.js');
34
33
 
35
34
 
36
35
  var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
37
36
 
38
37
 
39
- var _chunkOV7FX6XRjs = require('./chunk-OV7FX6XR.js');
38
+ var _chunkCRDOWYG4js = require('./chunk-CRDOWYG4.js');
40
39
 
41
40
  // src/bundlers/vite/index.ts
42
41
  var _fs = require('fs');
@@ -65,7 +64,7 @@ function updateStaticAttribute(ms, prop) {
65
64
  const start = prop.value.loc.start.offset + 1;
66
65
  const end = prop.value.loc.end.offset - 1;
67
66
  if (start < end) {
68
- ms.update(start, end, _chunkG5NLM3ALjs.replaceWxml.call(void 0, prop.value.content));
67
+ ms.update(start, end, _chunkLYGLQCWIjs.replaceWxml.call(void 0, prop.value.content));
69
68
  }
70
69
  }
71
70
  function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
@@ -77,7 +76,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
77
76
  if (start >= end) {
78
77
  return;
79
78
  }
80
- const generated = _chunkG5NLM3ALjs.generateCode.call(void 0, prop.exp.content, {
79
+ const generated = _chunkLYGLQCWIjs.generateCode.call(void 0, prop.exp.content, {
81
80
  jsHandler,
82
81
  runtimeSet,
83
82
  wrapExpression: true
@@ -107,7 +106,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
107
106
  return;
108
107
  }
109
108
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
110
- const matchCustomAttribute = _chunkG5NLM3ALjs.createAttributeMatcher.call(void 0, customAttributesEntities);
109
+ const matchCustomAttribute = _chunkLYGLQCWIjs.createAttributeMatcher.call(void 0, customAttributesEntities);
111
110
  const ms = new (0, _magicstring2.default)(code);
112
111
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
113
112
  if (errors.length === 0) {
@@ -383,11 +382,11 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
383
382
  runtimeSet,
384
383
  applyLinkedResults: applyLinkedResults2
385
384
  } = options;
386
- const absoluteFile = _chunkG3G437UEjs.toAbsoluteOutputPath.call(void 0, file, outDir);
385
+ const absoluteFile = _chunk7LKMJZD2js.toAbsoluteOutputPath.call(void 0, file, outDir);
387
386
  const rawSource = originalSource.source.toString();
388
387
  const rawHashSource = options.hashSalt ? `${rawSource}
389
388
  /*${options.hashSalt}*/` : rawSource;
390
- await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
389
+ await _chunkOF6MFURRjs.processCachedTask.call(void 0, {
391
390
  cache,
392
391
  cacheKey: file,
393
392
  hashKey,
@@ -423,6 +422,8 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
423
422
  // src/bundlers/vite/generate-bundle.ts
424
423
 
425
424
 
425
+ var _logger = require('@weapp-tailwindcss/logger');
426
+ var _extractors = require('@weapp-tailwindcss/shared/extractors');
426
427
 
427
428
  // src/bundlers/vite/bundle-entries.ts
428
429
  var _buffer = require('buffer');
@@ -455,7 +456,7 @@ function isJavaScriptEntry(entry) {
455
456
  function createBundleModuleGraphOptions(outputDir, entries) {
456
457
  return {
457
458
  resolve(specifier, importer) {
458
- return _chunkG3G437UEjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
459
+ return _chunk7LKMJZD2js.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
459
460
  },
460
461
  load(id) {
461
462
  const entry = entries.get(id);
@@ -529,14 +530,14 @@ function createHtmlRuntimeAffectingSignature(source) {
529
530
  }
530
531
  function createJsRuntimeAffectingSignature(source) {
531
532
  try {
532
- const ast = _chunkG5NLM3ALjs.babelParse.call(void 0, source, {
533
+ const ast = _chunkLYGLQCWIjs.babelParse.call(void 0, source, {
533
534
  cache: true,
534
535
  cacheKey: "vite-runtime-affecting:unambiguous",
535
536
  plugins: ["jsx", "typescript"],
536
537
  sourceType: "unambiguous"
537
538
  });
538
539
  const parts = [];
539
- _chunkG5NLM3ALjs.traverse.call(void 0, ast, {
540
+ _chunkLYGLQCWIjs.traverse.call(void 0, ast, {
540
541
  noScope: true,
541
542
  StringLiteral(path5) {
542
543
  parts.push(`s:${path5.node.value}`);
@@ -628,7 +629,7 @@ function collectJsEntries(fileName, output, outDir, store) {
628
629
  if (!isJavaScriptEntry(entry)) {
629
630
  return;
630
631
  }
631
- const absolute = _chunkG3G437UEjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
632
+ const absolute = _chunk7LKMJZD2js.toAbsoluteOutputPath.call(void 0, fileName, outDir);
632
633
  store.set(absolute, entry);
633
634
  }
634
635
  function markProcessFile(type, file, processFiles) {
@@ -710,34 +711,6 @@ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
710
711
  linkedImpactsByEntry
711
712
  };
712
713
  }
713
- function buildBundleSnapshotForBuild(bundle, opts, outDir) {
714
- const processFiles = createProcessFiles();
715
- const jsEntries = /* @__PURE__ */ new Map();
716
- const entries = [];
717
- for (const [file, output] of Object.entries(bundle)) {
718
- const type = classifyBundleEntry(file, opts);
719
- const source = readEntrySource(output);
720
- markProcessFile(type, file, processFiles);
721
- collectJsEntries(file, output, outDir, jsEntries);
722
- entries.push({
723
- file,
724
- output,
725
- source,
726
- type
727
- });
728
- }
729
- return {
730
- entries,
731
- jsEntries,
732
- sourceHashByFile: /* @__PURE__ */ new Map(),
733
- runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
734
- runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
735
- changedByType: createChangedByType(),
736
- runtimeAffectingChangedByType: createChangedByType(),
737
- processFiles,
738
- linkedImpactsByEntry: /* @__PURE__ */ new Map()
739
- };
740
- }
741
714
  function invertLinkedByEntry(linkedByEntry) {
742
715
  const dependentsByLinkedFile = /* @__PURE__ */ new Map();
743
716
  for (const [entryFile, linkedFiles] of linkedByEntry.entries()) {
@@ -752,12 +725,22 @@ function invertLinkedByEntry(linkedByEntry) {
752
725
  }
753
726
  return dependentsByLinkedFile;
754
727
  }
755
- function updateBundleBuildState(state, snapshot, linkedByEntry) {
728
+ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
729
+ const incremental = options.incremental === true;
756
730
  state.iteration += 1;
757
- state.sourceHashByFile = snapshot.sourceHashByFile;
758
- state.runtimeAffectingHashByFile = snapshot.runtimeAffectingHashByFile;
759
- state.linkedByEntry = linkedByEntry;
760
- state.dependentsByLinkedFile = invertLinkedByEntry(linkedByEntry);
731
+ state.sourceHashByFile = incremental ? new Map([
732
+ ...state.sourceHashByFile,
733
+ ...snapshot.sourceHashByFile
734
+ ]) : snapshot.sourceHashByFile;
735
+ state.runtimeAffectingHashByFile = incremental ? new Map([
736
+ ...state.runtimeAffectingHashByFile,
737
+ ...snapshot.runtimeAffectingHashByFile
738
+ ]) : snapshot.runtimeAffectingHashByFile;
739
+ state.linkedByEntry = incremental ? new Map([
740
+ ...state.linkedByEntry,
741
+ ...linkedByEntry
742
+ ]) : linkedByEntry;
743
+ state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
761
744
  }
762
745
 
763
746
  // src/bundlers/vite/js-precheck.ts
@@ -865,6 +848,39 @@ function hasRuntimeAffectingSourceChanges(changedByType) {
865
848
  function canShareCssTransformResult(rawSource) {
866
849
  return !rawSource.includes("@import") && !rawSource.includes("url(");
867
850
  }
851
+ function hasOmittedKnownBundleFiles(currentBundleFiles, previousBundleFiles) {
852
+ const currentFileSet = new Set(currentBundleFiles);
853
+ for (const file of previousBundleFiles) {
854
+ if (!currentFileSet.has(file)) {
855
+ return true;
856
+ }
857
+ }
858
+ return false;
859
+ }
860
+ var MUSTACHE_EXPRESSION_RE = /\{\{[\s\S]*?\}\}/g;
861
+ var QUOTED_LITERAL_RE = /'([^']*)'|"([^"]*)"|`([^`]*)`/g;
862
+ function isArbitraryValueCandidate(candidate) {
863
+ return candidate.includes("[") && candidate.includes("]");
864
+ }
865
+ function collectUnescapedDynamicCandidates(source) {
866
+ const matches = /* @__PURE__ */ new Set();
867
+ for (const expression of _nullishCoalesce(source.match(MUSTACHE_EXPRESSION_RE), () => ( []))) {
868
+ QUOTED_LITERAL_RE.lastIndex = 0;
869
+ let quoted = QUOTED_LITERAL_RE.exec(expression);
870
+ while (quoted !== null) {
871
+ const literal = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(quoted[1], () => ( quoted[2])), () => ( quoted[3])), () => ( ""));
872
+ for (const candidate of _extractors.splitCode.call(void 0, literal, true)) {
873
+ const normalized = candidate.trim();
874
+ if (!normalized || !isArbitraryValueCandidate(normalized)) {
875
+ continue;
876
+ }
877
+ matches.add(normalized);
878
+ }
879
+ quoted = QUOTED_LITERAL_RE.exec(expression);
880
+ }
881
+ }
882
+ return [...matches];
883
+ }
868
884
  function createGenerateBundleHook(context) {
869
885
  const state = createBundleBuildState();
870
886
  const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
@@ -917,10 +933,12 @@ function createGenerateBundleHook(context) {
917
933
  const disableJsPrecheck = _process2.default.env.WEAPP_TW_VITE_DISABLE_JS_PRECHECK === "1";
918
934
  const debugCssDiff = _process2.default.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
919
935
  const resolvedConfig = getResolvedConfig();
920
- const useIncrementalMode = _optionalChain([resolvedConfig, 'optionalAccess', _26 => _26.command]) !== "build";
936
+ const bundleFiles = Object.keys(bundle);
937
+ const buildCommand = _optionalChain([resolvedConfig, 'optionalAccess', _26 => _26.command]) === "build";
938
+ const useIncrementalMode = !buildCommand || hasOmittedKnownBundleFiles(bundleFiles, state.sourceHashByFile.keys());
921
939
  const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _27 => _27.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
922
940
  const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _28 => _28.build, 'optionalAccess', _29 => _29.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
923
- const snapshot = useIncrementalMode ? buildBundleSnapshot(bundle, opts, outDir, state, disableDirtyOptimization) : buildBundleSnapshotForBuild(bundle, opts, outDir);
941
+ const snapshot = buildBundleSnapshot(bundle, opts, outDir, state, disableDirtyOptimization || !useIncrementalMode);
924
942
  const useBundleRuntimeClassSet = useIncrementalMode || runtimeState.twPatcher.majorVersion === 4;
925
943
  const forceRuntimeRefreshBySource = useIncrementalMode && hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
926
944
  const processFiles = snapshot.processFiles;
@@ -974,7 +992,7 @@ function createGenerateBundleHook(context) {
974
992
  );
975
993
  }
976
994
  debug3("get runtimeSet, class count: %d", runtime.size);
977
- const runtimeSignature = _nullishCoalesce(_chunkG5NLM3ALjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
995
+ const runtimeSignature = _nullishCoalesce(_chunk5KSBT6GUjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
978
996
  const handleLinkedUpdate = (fileName, previous, next) => {
979
997
  onUpdate(fileName, previous, next);
980
998
  debug3("js linked handle: %s", fileName);
@@ -1015,7 +1033,7 @@ function createGenerateBundleHook(context) {
1015
1033
  }
1016
1034
  const rawSource = originalEntrySource;
1017
1035
  tasks.push(
1018
- _chunkLTJQUORKjs.processCachedTask.call(void 0, {
1036
+ _chunkOF6MFURRjs.processCachedTask.call(void 0, {
1019
1037
  cache,
1020
1038
  cacheKey: file,
1021
1039
  rawSource,
@@ -1029,7 +1047,27 @@ function createGenerateBundleHook(context) {
1029
1047
  },
1030
1048
  async transform() {
1031
1049
  const start = performance.now();
1032
- const transformed = await templateHandler(rawSource, defaultTemplateHandlerOptions);
1050
+ let transformed = await templateHandler(rawSource, defaultTemplateHandlerOptions);
1051
+ let unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed);
1052
+ if (unresolvedDynamicCandidates.length > 0) {
1053
+ _logger.logger.warn(
1054
+ "\u68C0\u6D4B\u5230 WXML \u52A8\u6001\u7C7B\u540D\u672A\u5B8C\u6210\u8F6C\u8BD1\uFF0C\u5DF2\u56DE\u9000\u5230\u5B8C\u6574 runtimeSet \u91CD\u8BD5: %s -> %O",
1055
+ file,
1056
+ unresolvedDynamicCandidates
1057
+ );
1058
+ const fullRuntimeSet = await context.ensureRuntimeClassSet(true);
1059
+ transformed = await templateHandler(rawSource, {
1060
+ runtimeSet: fullRuntimeSet
1061
+ });
1062
+ unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed);
1063
+ if (unresolvedDynamicCandidates.length > 0) {
1064
+ _logger.logger.warn(
1065
+ "WXML \u52A8\u6001\u7C7B\u540D\u5728\u5B8C\u6574 runtimeSet \u91CD\u8BD5\u540E\u4ECD\u672A\u5B8C\u6210\u8F6C\u8BD1: %s -> %O",
1066
+ file,
1067
+ unresolvedDynamicCandidates
1068
+ );
1069
+ }
1070
+ }
1033
1071
  metrics.html.elapsed += measureElapsed(start);
1034
1072
  metrics.html.transformed++;
1035
1073
  onUpdate(file, rawSource, transformed);
@@ -1049,7 +1087,7 @@ function createGenerateBundleHook(context) {
1049
1087
  const shareCssResult = canShareCssTransformResult(rawSource);
1050
1088
  const cssSharedCacheKey = shareCssResult ? `${runtimeSignature}:${_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown"))}:${getCssHandlerOptions(file).isMainChunk ? "1" : "0"}:${cssRuntimeAffectingSignature}` : void 0;
1051
1089
  tasks.push(
1052
- _chunkLTJQUORKjs.processCachedTask.call(void 0, {
1090
+ _chunkOF6MFURRjs.processCachedTask.call(void 0, {
1053
1091
  cache,
1054
1092
  cacheKey: file,
1055
1093
  hashKey: `${file}:css:${runtimeSignature}:${_nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown"))}`,
@@ -1122,7 +1160,7 @@ function createGenerateBundleHook(context) {
1122
1160
  snapshot.sourceHashByFile
1123
1161
  ) : void 0;
1124
1162
  const hashSalt = createJsHashSalt(runtimeSignature, linkedImpactSignature);
1125
- await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
1163
+ await _chunkOF6MFURRjs.processCachedTask.call(void 0, {
1126
1164
  cache,
1127
1165
  cacheKey: file,
1128
1166
  hashKey: `${file}:js`,
@@ -1239,14 +1277,17 @@ function createGenerateBundleHook(context) {
1239
1277
  });
1240
1278
  }
1241
1279
  }
1242
- _chunkG3G437UEjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
1280
+ _chunk7LKMJZD2js.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
1243
1281
  await Promise.all(tasks);
1244
1282
  for (const apply of pendingLinkedUpdates) {
1245
1283
  apply();
1246
1284
  }
1247
- if (useIncrementalMode) {
1248
- updateBundleBuildState(state, snapshot, _nullishCoalesce(linkedByEntry, () => ( /* @__PURE__ */ new Map())));
1249
- }
1285
+ updateBundleBuildState(
1286
+ state,
1287
+ snapshot,
1288
+ useIncrementalMode ? _nullishCoalesce(linkedByEntry, () => ( /* @__PURE__ */ new Map())) : /* @__PURE__ */ new Map(),
1289
+ { incremental: useIncrementalMode }
1290
+ );
1250
1291
  debug3(
1251
1292
  "metrics iteration=%d runtime=%sms html(total=%d transform=%d hit=%d rate=%s elapsed=%sms) js(total=%d transform=%d hit=%d rate=%s elapsed=%sms) css(total=%d transform=%d hit=%d rate=%s elapsed=%sms)",
1252
1293
  useIncrementalMode ? state.iteration : 0,
@@ -1278,8 +1319,8 @@ var _module = require('module');
1278
1319
 
1279
1320
 
1280
1321
  var _tailwindcsspatch = require('tailwindcss-patch');
1281
- var debug = _chunkG5NLM3ALjs.createDebug.call(void 0, "[vite:runtime-set] ");
1282
- var require2 = _module.createRequire.call(void 0, _chunkOV7FX6XRjs.importMetaUrl);
1322
+ var debug = _chunkLYGLQCWIjs.createDebug.call(void 0, "[vite:runtime-set] ");
1323
+ var require2 = _module.createRequire.call(void 0, _chunkCRDOWYG4js.importMetaUrl);
1283
1324
  var EXTENSION_DOT_PREFIX_RE = /^\./;
1284
1325
  var VALIDATION_FILE_NAME = "runtime-candidates.html";
1285
1326
  var tailwindNodeModulePromise;
@@ -1296,23 +1337,23 @@ function isPostcssPluginImportTarget(value) {
1296
1337
  return value === "@tailwindcss/postcss" || value === "@tailwindcss/postcss7-compat" || value.includes("/postcss");
1297
1338
  }
1298
1339
  function resolveTailwindCssImportTarget(patcher) {
1299
- const tailwindOptions = _optionalChain([patcher, 'access', _31 => _31.options, 'optionalAccess', _32 => _32.tailwind]);
1300
- const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess', _33 => _33.v4, 'optionalAccess', _34 => _34.cssEntries, 'optionalAccess', _35 => _35.filter, 'call', _36 => _36((item) => typeof item === "string" && item.length > 0)]);
1340
+ const tailwindOptions = _chunk5KSBT6GUjs.resolveTailwindcssOptions.call(void 0, patcher.options);
1341
+ const cssEntries = _optionalChain([tailwindOptions, 'optionalAccess', _31 => _31.v4, 'optionalAccess', _32 => _32.cssEntries, 'optionalAccess', _33 => _33.filter, 'call', _34 => _34((item) => typeof item === "string" && item.length > 0)]);
1301
1342
  if (cssEntries && cssEntries.length > 0) {
1302
1343
  return createCssImportSource(cssEntries);
1303
1344
  }
1304
- const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess', _37 => _37.packageName]);
1345
+ const configuredPackageName = _optionalChain([tailwindOptions, 'optionalAccess', _35 => _35.packageName]);
1305
1346
  if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) {
1306
1347
  return createCssImportSource([configuredPackageName]);
1307
1348
  }
1308
- const packageName = _optionalChain([patcher, 'access', _38 => _38.packageInfo, 'optionalAccess', _39 => _39.name]);
1349
+ const packageName = _optionalChain([patcher, 'access', _36 => _36.packageInfo, 'optionalAccess', _37 => _37.name]);
1309
1350
  if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) {
1310
1351
  return createCssImportSource([packageName]);
1311
1352
  }
1312
1353
  return createCssImportSource(["tailwindcss"]);
1313
1354
  }
1314
1355
  function getProjectRoot(patcher) {
1315
- return _nullishCoalesce(_optionalChain([patcher, 'access', _40 => _40.options, 'optionalAccess', _41 => _41.projectRoot]), () => ( _process2.default.cwd()));
1356
+ return _nullishCoalesce(_optionalChain([patcher, 'access', _38 => _38.options, 'optionalAccess', _39 => _39.projectRoot]), () => ( _process2.default.cwd()));
1316
1357
  }
1317
1358
  async function importTailwindNodeModule() {
1318
1359
  if (!tailwindNodeModulePromise) {
@@ -1339,16 +1380,16 @@ function resolveMaybeAbsolute(base, value) {
1339
1380
  }
1340
1381
  async function resolveTailwindCssSource(patcher) {
1341
1382
  const projectRoot = getProjectRoot(patcher);
1342
- const tailwindOptions = _optionalChain([patcher, 'access', _42 => _42.options, 'optionalAccess', _43 => _43.tailwind]);
1343
- const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess', _44 => _44.v4, 'optionalAccess', _45 => _45.base]));
1344
- const configDir = _optionalChain([tailwindOptions, 'optionalAccess', _46 => _46.config]) ? _path2.default.dirname(tailwindOptions.config) : void 0;
1383
+ const tailwindOptions = _chunk5KSBT6GUjs.resolveTailwindcssOptions.call(void 0, patcher.options);
1384
+ const configuredBase = resolveMaybeAbsolute(projectRoot, _optionalChain([tailwindOptions, 'optionalAccess', _40 => _40.v4, 'optionalAccess', _41 => _41.base]));
1385
+ const configDir = _optionalChain([tailwindOptions, 'optionalAccess', _42 => _42.config]) ? _path2.default.dirname(tailwindOptions.config) : void 0;
1345
1386
  const sharedFallbacks = [
1346
1387
  configuredBase,
1347
1388
  projectRoot,
1348
- _optionalChain([tailwindOptions, 'optionalAccess', _47 => _47.cwd]),
1389
+ _optionalChain([tailwindOptions, 'optionalAccess', _43 => _43.cwd]),
1349
1390
  configDir
1350
1391
  ].filter((item) => typeof item === "string" && item.length > 0);
1351
- if (_optionalChain([tailwindOptions, 'optionalAccess', _48 => _48.v4, 'optionalAccess', _49 => _49.css])) {
1392
+ if (_optionalChain([tailwindOptions, 'optionalAccess', _44 => _44.v4, 'optionalAccess', _45 => _45.css])) {
1352
1393
  return {
1353
1394
  projectRoot,
1354
1395
  base: _nullishCoalesce(configuredBase, () => ( projectRoot)),
@@ -1356,7 +1397,7 @@ async function resolveTailwindCssSource(patcher) {
1356
1397
  css: tailwindOptions.v4.css
1357
1398
  };
1358
1399
  }
1359
- const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess', _50 => _50.v4, 'optionalAccess', _51 => _51.cssEntries, 'optionalAccess', _52 => _52.filter, 'call', _53 => _53((item) => typeof item === "string" && item.length > 0)]), () => ( []));
1400
+ const cssEntries = _nullishCoalesce(_optionalChain([tailwindOptions, 'optionalAccess', _46 => _46.v4, 'optionalAccess', _47 => _47.cssEntries, 'optionalAccess', _48 => _48.filter, 'call', _49 => _49((item) => typeof item === "string" && item.length > 0)]), () => ( []));
1360
1401
  if (cssEntries.length > 0) {
1361
1402
  const resolvedEntries = cssEntries.map((entry) => _nullishCoalesce(resolveMaybeAbsolute(projectRoot, entry), () => ( entry)));
1362
1403
  const cssChunks = [];
@@ -1537,7 +1578,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
1537
1578
  const matches = await extractRawCandidates(entry.source, resolveEntryExtension(entry));
1538
1579
  const candidates = /* @__PURE__ */ new Set();
1539
1580
  for (const match of matches) {
1540
- const candidate = _optionalChain([match, 'optionalAccess', _54 => _54.rawCandidate]);
1581
+ const candidate = _optionalChain([match, 'optionalAccess', _50 => _50.rawCandidate]);
1541
1582
  if (typeof candidate === "string" && candidate.length > 0) {
1542
1583
  candidates.add(candidate);
1543
1584
  }
@@ -1545,7 +1586,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
1545
1586
  return candidates;
1546
1587
  }
1547
1588
  async function sync(patcher, snapshot) {
1548
- const nextSignature = _nullishCoalesce(_chunkG5NLM3ALjs.getRuntimeClassSetSignature.call(void 0, patcher), () => ( "runtime:missing"));
1589
+ const nextSignature = _nullishCoalesce(_chunk5KSBT6GUjs.getRuntimeClassSetSignature.call(void 0, patcher), () => ( "runtime:missing"));
1549
1590
  const runtimeEntries = createRuntimeEntries(snapshot);
1550
1591
  const runtimeEntriesByFile = new Map(runtimeEntries.map((entry) => [entry.file, entry]));
1551
1592
  const currentRuntimeFiles = new Set(runtimeEntriesByFile.keys());
@@ -1649,12 +1690,12 @@ function createRewriteCssImportsPlugins(options) {
1649
1690
  const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
1650
1691
  return [
1651
1692
  {
1652
- name: `${_chunkG5NLM3ALjs.vitePluginName}:rewrite-css-imports`,
1693
+ name: `${_chunkLYGLQCWIjs.vitePluginName}:rewrite-css-imports`,
1653
1694
  enforce: "pre",
1654
1695
  resolveId: {
1655
1696
  order: "pre",
1656
1697
  handler(id, importer) {
1657
- const replacement = _chunkG3G437UEjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
1698
+ const replacement = _chunk7LKMJZD2js.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
1658
1699
  join: joinPosixPath,
1659
1700
  appType
1660
1701
  });
@@ -1673,7 +1714,7 @@ function createRewriteCssImportsPlugins(options) {
1673
1714
  if (!isCSSRequest(id)) {
1674
1715
  return null;
1675
1716
  }
1676
- const rewritten = _chunkG3G437UEjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
1717
+ const rewritten = _chunk7LKMJZD2js.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
1677
1718
  join: joinPosixPath,
1678
1719
  appType
1679
1720
  });
@@ -1691,8 +1732,8 @@ function createRewriteCssImportsPlugins(options) {
1691
1732
  }
1692
1733
 
1693
1734
  // src/bundlers/vite/index.ts
1694
- var debug2 = _chunkG5NLM3ALjs.createDebug.call(void 0, );
1695
- var weappTailwindcssPackageDir = _chunkG3G437UEjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
1735
+ var debug2 = _chunkLYGLQCWIjs.createDebug.call(void 0, );
1736
+ var weappTailwindcssPackageDir = _chunk7LKMJZD2js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
1696
1737
  var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
1697
1738
  var PACKAGE_JSON_FILE = "package.json";
1698
1739
  function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
@@ -1710,11 +1751,11 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
1710
1751
  }
1711
1752
  current = parent;
1712
1753
  }
1713
- const tailwindConfigPath = _chunk4LPOQMFSjs.findTailwindConfig.call(void 0, searchRoots);
1754
+ const tailwindConfigPath = _chunk5KSBT6GUjs.findTailwindConfig.call(void 0, searchRoots);
1714
1755
  if (tailwindConfigPath) {
1715
1756
  return _path2.default.dirname(tailwindConfigPath);
1716
1757
  }
1717
- const packageRoot = _chunk4LPOQMFSjs.findNearestPackageRoot.call(void 0, resolvedRoot);
1758
+ const packageRoot = _chunk5KSBT6GUjs.findNearestPackageRoot.call(void 0, resolvedRoot);
1718
1759
  if (packageRoot && _fs.existsSync.call(void 0, _path2.default.join(packageRoot, PACKAGE_JSON_FILE))) {
1719
1760
  return packageRoot;
1720
1761
  }
@@ -1723,7 +1764,7 @@ function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
1723
1764
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1724
1765
  const rewriteCssImportsSpecified = Object.hasOwn(options, "rewriteCssImports");
1725
1766
  const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
1726
- const opts = _chunkG5NLM3ALjs.getCompilerContext.call(void 0, options);
1767
+ const opts = _chunkLYGLQCWIjs.getCompilerContext.call(void 0, options);
1727
1768
  const {
1728
1769
  disabled,
1729
1770
  customAttributes,
@@ -1737,7 +1778,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1737
1778
  uniAppX,
1738
1779
  disabledDefaultTemplateHandler
1739
1780
  } = opts;
1740
- const disabledOptions = _chunkG3G437UEjs.resolveDisabledOptions.call(void 0, disabled);
1781
+ const disabledOptions = _chunk7LKMJZD2js.resolveDisabledOptions.call(void 0, disabled);
1741
1782
  const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
1742
1783
  const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
1743
1784
  const rewritePlugins = createRewriteCssImportsPlugins({
@@ -1748,8 +1789,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1748
1789
  if (disabledOptions.plugin) {
1749
1790
  return rewritePlugins.length ? rewritePlugins : void 0;
1750
1791
  }
1751
- const customAttributesEntities = _chunkG5NLM3ALjs.toCustomAttributesEntities.call(void 0, customAttributes);
1752
- const patchRecorderState = _chunkNOKJXG3Wjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
1792
+ const customAttributesEntities = _chunkLYGLQCWIjs.toCustomAttributesEntities.call(void 0, customAttributes);
1793
+ const patchRecorderState = _chunkLYGLQCWIjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
1753
1794
  source: "runtime",
1754
1795
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
1755
1796
  });
@@ -1766,8 +1807,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1766
1807
  let runtimeRefreshOptionsKey;
1767
1808
  const bundleRuntimeClassSetManager = createBundleRuntimeClassSetManager();
1768
1809
  function resolveRuntimeRefreshOptions() {
1769
- const configPath = _optionalChain([runtimeState, 'access', _55 => _55.twPatcher, 'access', _56 => _56.options, 'optionalAccess', _57 => _57.tailwind, 'optionalAccess', _58 => _58.config]);
1770
- const signature = _chunkG5NLM3ALjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
1810
+ const configPath = _optionalChain([_chunk5KSBT6GUjs.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options), 'optionalAccess', _51 => _51.config]);
1811
+ const signature = _chunk5KSBT6GUjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
1771
1812
  const optionsKey = JSON.stringify({
1772
1813
  appType,
1773
1814
  uniAppX: Boolean(uniAppX),
@@ -1788,7 +1829,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1788
1829
  async function refreshRuntimeState(force) {
1789
1830
  const invalidation = resolveRuntimeRefreshOptions();
1790
1831
  const shouldRefresh = force || invalidation.changed;
1791
- const refreshed = await _chunkG5NLM3ALjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
1832
+ const refreshed = await _chunkLYGLQCWIjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
1792
1833
  force: shouldRefresh,
1793
1834
  clearCache: force || invalidation.changed
1794
1835
  });
@@ -1809,7 +1850,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1809
1850
  }
1810
1851
  if (forceRuntimeRefresh || !runtimeSetPromise) {
1811
1852
  const invalidation = resolveRuntimeRefreshOptions();
1812
- const task2 = _chunkG5NLM3ALjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1853
+ const task2 = _chunkLYGLQCWIjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1813
1854
  force: forceRuntimeRefresh || invalidation.changed,
1814
1855
  skipRefresh: forceRuntimeRefresh,
1815
1856
  clearCache: forceRuntimeRefresh || invalidation.changed
@@ -1851,7 +1892,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1851
1892
  if (!forceRuntimeRefresh && !invalidation.changed && !forceCollectBySource && runtimeSet) {
1852
1893
  return runtimeSet;
1853
1894
  }
1854
- const task = _chunkG5NLM3ALjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1895
+ const task = _chunkLYGLQCWIjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1855
1896
  force: forceRuntimeRefresh || invalidation.changed || forceCollectBySource,
1856
1897
  skipRefresh: forceRuntimeRefresh,
1857
1898
  clearCache: forceRuntimeRefresh || invalidation.changed
@@ -1885,7 +1926,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1885
1926
  const plugins = [
1886
1927
  ...rewritePlugins,
1887
1928
  {
1888
- name: `${_chunkG5NLM3ALjs.vitePluginName}:post`,
1929
+ name: `${_chunkLYGLQCWIjs.vitePluginName}:post`,
1889
1930
  enforce: "post",
1890
1931
  async configResolved(config) {
1891
1932
  resolvedConfig = config;
@@ -13,6 +13,7 @@ function normalizePath(p) {
13
13
  }
14
14
  var MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
15
15
  var KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
16
+ var IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
16
17
  var MAIN_CSS_CHUNK_MATCHERS = {
17
18
  "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
18
19
  "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
@@ -33,7 +34,8 @@ var alwaysFalse = () => false;
33
34
  function createMainCssChunkMatcher() {
34
35
  return (file, appType) => {
35
36
  if (!appType) {
36
- return true;
37
+ const normalized = normalizePath(file);
38
+ return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
37
39
  }
38
40
  const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
39
41
  return matcher ? matcher(file) : true;