weapp-tailwindcss 5.1.13 → 5.1.15

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 (78) hide show
  1. package/dist/auto-2dg_uhEJ.mjs +13 -0
  2. package/dist/bundlers/gulp/frameworks/native/index.d.ts +2 -0
  3. package/dist/bundlers/gulp/index.d.ts +2 -0
  4. package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +2 -0
  5. package/dist/bundlers/shared/generated-css-marker.d.ts +2 -2
  6. package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
  7. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +2 -0
  8. package/dist/bundlers/shared/generator-css/types.d.ts +5 -0
  9. package/dist/bundlers/shared/style-requests.d.ts +1 -0
  10. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  11. package/dist/bundlers/vite/css-finalizer.d.ts +1 -0
  12. package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -0
  13. package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +2 -0
  14. package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +2 -0
  15. package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +20 -0
  16. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
  17. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +4 -0
  18. package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +18 -0
  19. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
  20. package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +1 -0
  21. package/dist/bundlers/vite/generate-bundle/types.d.ts +7 -0
  22. package/dist/bundlers/vite/serve-css-generation.d.ts +3 -2
  23. package/dist/bundlers/vite/serve-root-import-shell.d.ts +8 -0
  24. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
  25. package/dist/bundlers/vite/source-candidates.d.ts +3 -0
  26. package/dist/bundlers/vite/watch-css-post.d.ts +10 -0
  27. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  28. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +1 -0
  29. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -0
  30. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -0
  31. package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +4 -0
  32. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -0
  33. package/dist/{context-xSJE588m.mjs → context-BgGWVAmN.mjs} +5 -3
  34. package/dist/{context-DRRgW7i2.js → context-VeFq_8vW.js} +5 -3
  35. package/dist/core.js +1 -1
  36. package/dist/core.mjs +1 -1
  37. package/dist/css-macro.mjs +1 -1
  38. package/dist/{generator-CS10c9g1.js → generator-CEnUsjed.js} +17 -3
  39. package/dist/{generator-BvPcmqxU.mjs → generator-CEo920So.mjs} +18 -4
  40. package/dist/generator.js +1 -1
  41. package/dist/generator.mjs +1 -1
  42. package/dist/{gulp-DNZZvUMq.js → gulp-3m1dAiig.js} +92 -54
  43. package/dist/{gulp-BEOzXrbp.mjs → gulp-DP71z1jG.mjs} +92 -54
  44. package/dist/gulp.js +1 -1
  45. package/dist/gulp.mjs +1 -1
  46. package/dist/{hmr-timing-hRhRAjYV.mjs → hmr-timing-1aS6--U7.mjs} +272 -56
  47. package/dist/{hmr-timing-DW1g3zjl.js → hmr-timing-B8p4f0ca.js} +323 -53
  48. package/dist/index.js +4 -4
  49. package/dist/index.mjs +4 -4
  50. package/dist/postcss.js +1 -1
  51. package/dist/postcss.mjs +1 -1
  52. package/dist/presets.js +1 -1
  53. package/dist/presets.mjs +1 -1
  54. package/dist/rspack.js +1 -1
  55. package/dist/rspack.mjs +1 -1
  56. package/dist/shared/mpx.d.ts +4 -1
  57. package/dist/{source-candidate-scan-signature-CMgu5bJk.js → source-candidate-scan-signature-BAahhiwb.js} +20 -139
  58. package/dist/{source-candidate-scan-signature-t4XKAQ04.mjs → source-candidate-scan-signature-Cf7259PR.mjs} +21 -104
  59. package/dist/tailwindcss/candidates.d.ts +4 -0
  60. package/dist/{tailwindcss-z9JMF-qU.js → tailwindcss-KBYPJ2DW.js} +1 -1
  61. package/dist/{tailwindcss-DZT_pWrd.mjs → tailwindcss-xs704TRw.mjs} +1 -1
  62. package/dist/{transform-D5JUgMpE.mjs → transform-B_KM9sLX.mjs} +47 -5
  63. package/dist/{transform-COFRlmDF.js → transform-CcYptivi.js} +47 -5
  64. package/dist/uni-app-x/component-local-style.d.ts +1 -0
  65. package/dist/uni-app-x/style-asset/style-value.d.ts +1 -1
  66. package/dist/{vite-DnkObu2L.js → vite-DUVjMduj.js} +807 -320
  67. package/dist/{vite-Tpgi77vE.mjs → vite-nXZEiwG0.mjs} +757 -270
  68. package/dist/vite.js +1 -1
  69. package/dist/vite.mjs +1 -1
  70. package/dist/weapp-tw-css-generation-loader.js +12 -0
  71. package/dist/weapp-tw-css-import-rewrite-loader-DNk0IxAt.js +10198 -0
  72. package/dist/weapp-tw-css-import-rewrite-loader.js +6 -8209
  73. package/dist/{webpack-CTYm19zA.mjs → webpack-C_UUFRgj.mjs} +228 -58
  74. package/dist/{webpack-CzXjfvYS.js → webpack-nppysF4B.js} +240 -70
  75. package/dist/webpack.js +1 -1
  76. package/dist/webpack.mjs +1 -1
  77. package/package.json +11 -3
  78. package/dist/auto-CrJJc5rK.mjs +0 -13
package/dist/rspack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
3
- const require_webpack = require("./webpack-CzXjfvYS.js");
3
+ const require_webpack = require("./webpack-nppysF4B.js");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_rolldown_runtime.__toESM(node_path);
6
6
  //#region src/bundlers/rspack/index.ts
package/dist/rspack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-CTYm19zA.mjs";
1
+ import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-C_UUFRgj.mjs";
2
2
  import path from "node:path";
3
3
  //#region src/bundlers/rspack/index.ts
4
4
  const CSS_IMPORT_REWRITE_LOADER_NAME = "weapp-tw-css-import-rewrite-loader";
@@ -1,7 +1,10 @@
1
1
  import type { AppType } from '../types';
2
+ import path from 'node:path';
2
3
  export declare function isMpx(appType?: AppType): appType is "mpx";
3
4
  export declare function getTailwindcssCssEntry(pkgDir: string): string;
4
- export declare function patchMpxWebpackPluginNormalizeLib(compiler: any, mpxWebpackPluginDir: string | undefined): boolean;
5
+ export declare function rewriteMpxWebpackPluginRequests(request: string, mpxWebpackPluginDir: string, pathImpl?: Pick<typeof path, 'join'>): string;
6
+ export declare function patchMpxWebpackPluginRequests(compiler: any, mpxWebpackPluginDir: string | undefined): boolean;
7
+ export declare function patchMpxWebpackPluginNormalizeLib(_compiler: any, mpxWebpackPluginDir: string | undefined): boolean;
5
8
  export declare function ensureMpxTailwindcssAliases(compiler: any, pkgDir: string): string;
6
9
  export declare function patchMpxLoaderResolve(loaderContext: any, pkgDir: string, enabled: boolean): void;
7
10
  export declare function setupMpxTailwindcssRedirect(pkgDir: string, enabled: boolean): void;
@@ -1,9 +1,9 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
2
  const require_framework = require("./framework.js");
3
3
  require("./auto-DtU6f3X6.js");
4
- const require_tailwindcss = require("./tailwindcss-z9JMF-qU.js");
4
+ const require_tailwindcss = require("./tailwindcss-KBYPJ2DW.js");
5
5
  const require_wxml = require("./wxml-Ce10eREX.js");
6
- const require_hmr_timing = require("./hmr-timing-DW1g3zjl.js");
6
+ const require_hmr_timing = require("./hmr-timing-B8p4f0ca.js");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_rolldown_runtime.__toESM(node_path);
9
9
  let node_process = require("node:process");
@@ -229,39 +229,6 @@ function resolvePackageDir(name) {
229
229
  return node_path.default.dirname(pkgPath);
230
230
  }
231
231
  //#endregion
232
- //#region src/bundlers/shared/generated-css-marker.ts
233
- const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
234
- const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
235
- const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
236
- const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
237
- function createBundlerGeneratedCssMarker(bundler, file) {
238
- return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
239
- }
240
- function hasBundlerGeneratedCssMarker(source) {
241
- return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
242
- }
243
- function stripBundlerGeneratedCssMarkers(source) {
244
- return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
245
- }
246
- function parseBundlerGeneratedCssMarkerBlocks(source) {
247
- const blocks = [];
248
- BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
249
- let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
250
- while (match !== null) {
251
- const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
252
- const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
253
- const cssEnd = nextMatch?.index ?? source.length;
254
- const file = match[2] ? decodeURIComponent(match[2]) : void 0;
255
- blocks.push({
256
- bundler: match[1],
257
- file,
258
- css: source.slice(cssStart, cssEnd)
259
- });
260
- match = nextMatch;
261
- }
262
- return blocks;
263
- }
264
- //#endregion
265
232
  //#region src/bundlers/shared/module-graph.ts
266
233
  const QUERY_HASH_RE = /[?#].*$/u;
267
234
  const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
@@ -306,30 +273,6 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
306
273
  return matchWithExtensions(candidate, hasOutput);
307
274
  }
308
275
  //#endregion
309
- //#region src/bundlers/shared/style-requests.ts
310
- const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
311
- const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
312
- const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
313
- function stripHash(request) {
314
- const hashIndex = request.indexOf("#");
315
- return hashIndex === -1 ? request : request.slice(0, hashIndex);
316
- }
317
- function stripRequestQuery(request) {
318
- const normalized = stripHash(request);
319
- const queryIndex = normalized.indexOf("?");
320
- return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
321
- }
322
- function isSourceStyleRequest(request) {
323
- if (typeof request !== "string" || request.length === 0) return false;
324
- const normalized = stripHash(request);
325
- const queryIndex = normalized.indexOf("?");
326
- const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
327
- if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
328
- if (queryIndex === -1) return false;
329
- const query = normalized.slice(queryIndex + 1);
330
- return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
331
- }
332
- //#endregion
333
276
  //#region src/bundlers/shared/v4-generation-core.ts
334
277
  async function generateTailwindV4Css(options) {
335
278
  const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
@@ -476,7 +419,7 @@ const isWindows = node_process.default.platform === "win32";
476
419
  const cssLangRE = new RegExp(`\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)`);
477
420
  const htmlLangRE = /\.html?(?:$|\?)/;
478
421
  function isCSSRequest(request) {
479
- return cssLangRE.test(request) || isSourceStyleRequest(request);
422
+ return cssLangRE.test(request) || require_hmr_timing.isSourceStyleRequest(request);
480
423
  }
481
424
  function isHTMLRequest(request) {
482
425
  return htmlLangRE.test(request);
@@ -510,6 +453,7 @@ function createBundleBuildState() {
510
453
  runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
511
454
  linkedByEntry: /* @__PURE__ */ new Map(),
512
455
  dependentsByLinkedFile: /* @__PURE__ */ new Map(),
456
+ bundleMarkupCandidatesByFile: /* @__PURE__ */ new Map(),
513
457
  generatorCandidateSignature: void 0
514
458
  };
515
459
  }
@@ -530,7 +474,7 @@ function createProcessFiles() {
530
474
  }
531
475
  function readEntrySource(output) {
532
476
  if (output.type === "chunk") return output.code;
533
- return output.source.toString();
477
+ return typeof output.source === "string" ? output.source : node_buffer.Buffer.from(output.source).toString();
534
478
  }
535
479
  function classifyBundleEntry(file, opts) {
536
480
  if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
@@ -706,78 +650,51 @@ function createLocalSourceEntries(sourceFile) {
706
650
  }];
707
651
  }
708
652
  function intersectCandidates(first, second) {
709
- const scoped = /* @__PURE__ */ new Set();
653
+ if (first.size === 0 || second.size === 0) return /* @__PURE__ */ new Set();
710
654
  const [small, large] = first.size <= second.size ? [first, second] : [second, first];
655
+ const scoped = /* @__PURE__ */ new Set();
711
656
  for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
712
657
  return scoped;
713
658
  }
714
- function intersectCandidateSourceMaps(first, second) {
715
- if (first.size === 0 || second.size === 0) return /* @__PURE__ */ new Map();
716
- const scoped = /* @__PURE__ */ new Map();
717
- for (const [candidate, sources] of first) if (second.has(candidate)) scoped.set(candidate, sources);
718
- return scoped;
719
- }
720
659
  function mergeCandidates(first, second) {
721
660
  return /* @__PURE__ */ new Set([...first, ...second]);
722
661
  }
723
- function intersectExplicitSourceCandidates(scopedCandidates, localCandidates) {
724
- if (localCandidates.size === 0 && scopedCandidates.size > 0) return scopedCandidates;
725
- return intersectCandidates(scopedCandidates, localCandidates);
726
- }
727
- function resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates) {
728
- if (scopedCandidates.size === 0 && localCandidates.size === 0 && fallbackCandidates?.size) return fallbackCandidates;
729
- return intersectExplicitSourceCandidates(scopedCandidates, localCandidates);
730
- }
731
- function resolveExplicitSourceMaps(scopedSources, localSources, fallbackSources) {
732
- if (scopedSources.size === 0 && localSources.size === 0 && fallbackSources?.size) return fallbackSources;
733
- if (localSources.size === 0 && scopedSources.size > 0) return scopedSources;
734
- return intersectCandidateSourceMaps(scopedSources, localSources);
662
+ function canFallbackToOutputCandidates(rawSource, entries) {
663
+ return rawSource.includes("@source") && entries.length > 0 && entries.every((entry) => !entry.negated);
735
664
  }
736
665
  function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
737
666
  if (!hasOwnSourceDirectives(rawSource)) return {
738
667
  entries: resolvedEntries,
739
668
  localEntries: void 0
740
669
  };
741
- const localEntries = createLocalSourceEntries(sourceFile);
742
- if (!resolvedEntries || resolvedEntries.length === 0) return {
743
- entries: localEntries,
744
- localEntries: void 0
745
- };
746
- return {
747
- entries: resolvedEntries,
748
- localEntries
749
- };
670
+ if (resolvedEntries !== void 0) return { entries: resolvedEntries };
671
+ return { entries: createLocalSourceEntries(sourceFile) };
750
672
  }
751
673
  async function resolveScopedGeneratorSourceEntries(rawSource, sourceFile) {
752
674
  return resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
753
675
  }
754
676
  async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
755
677
  if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
756
- const { entries, localEntries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
678
+ const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
757
679
  if (entries === void 0) return fallbackSignature;
758
- const scopedCandidates = getSourceCandidatesForEntries(entries);
759
- const scopedSignature = createCandidateSignature(localEntries ? resolveExplicitSourceCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries), getSourceCandidatesForEntries(void 0)) : scopedCandidates);
680
+ const scopedSignature = createCandidateSignature(getSourceCandidatesForEntries(entries));
760
681
  return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
761
682
  }
762
683
  async function createScopedGeneratorSourceTraceMap(rawSource, sourceFile, getSourceCandidateSourcesForEntries) {
763
684
  if (!getSourceCandidateSourcesForEntries || !hasOwnSourceDirectives(rawSource)) return getSourceCandidateSourcesForEntries?.(void 0);
764
- const { entries, localEntries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
685
+ const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
765
686
  if (entries === void 0) return getSourceCandidateSourcesForEntries(void 0);
766
- const scopedSources = getSourceCandidateSourcesForEntries(entries);
767
- return localEntries ? resolveExplicitSourceMaps(scopedSources, getSourceCandidateSourcesForEntries(localEntries), getSourceCandidateSourcesForEntries(void 0)) : scopedSources;
687
+ return getSourceCandidateSourcesForEntries(entries);
768
688
  }
769
689
  async function createScopedGeneratorRuntime(options) {
770
690
  const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
771
691
  if (getSourceCandidatesForEntries && rawSource && sourceFile) {
772
- const { entries, localEntries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
692
+ const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
773
693
  if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
774
- const scopedCandidates = scopedSourceCandidateGetter?.(entries) ?? getSourceCandidatesForEntries(entries);
775
- const shouldMergeFallbackRuntime = (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4CustomVariantConditionalComments)(rawSource);
776
- if (!localEntries) return shouldMergeFallbackRuntime ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
777
- const localCandidates = scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries);
778
- const fallbackCandidates = scopedSourceCandidateGetter?.(void 0);
779
- const scopedLocalCandidates = resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates);
780
- return shouldMergeFallbackRuntime ? mergeCandidates(scopedLocalCandidates, fallbackRuntime) : scopedLocalCandidates;
694
+ const explicitCandidates = getSourceCandidatesForEntries(entries);
695
+ const outputCandidates = scopedSourceCandidateGetter?.(void 0);
696
+ const scopedCandidates = outputCandidates ? explicitCandidates.size === 0 && canFallbackToOutputCandidates(rawSource, entries) ? outputCandidates : intersectCandidates(explicitCandidates, outputCandidates) : explicitCandidates;
697
+ return (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4CustomVariantConditionalComments)(rawSource) ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
781
698
  }
782
699
  }
783
700
  const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
@@ -857,12 +774,6 @@ Object.defineProperty(exports, "createBundleModuleGraphOptions", {
857
774
  return createBundleModuleGraphOptions;
858
775
  }
859
776
  });
860
- Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
861
- enumerable: true,
862
- get: function() {
863
- return createBundlerGeneratedCssMarker;
864
- }
865
- });
866
777
  Object.defineProperty(exports, "createCandidateSignature", {
867
778
  enumerable: true,
868
779
  get: function() {
@@ -929,12 +840,6 @@ Object.defineProperty(exports, "getSnapshotHash", {
929
840
  return getSnapshotHash;
930
841
  }
931
842
  });
932
- Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
933
- enumerable: true,
934
- get: function() {
935
- return hasBundlerGeneratedCssMarker;
936
- }
937
- });
938
843
  Object.defineProperty(exports, "hasRuntimeAffectingSourceChanges", {
939
844
  enumerable: true,
940
845
  get: function() {
@@ -953,12 +858,6 @@ Object.defineProperty(exports, "isHTMLRequest", {
953
858
  return isHTMLRequest;
954
859
  }
955
860
  });
956
- Object.defineProperty(exports, "isSourceStyleRequest", {
957
- enumerable: true,
958
- get: function() {
959
- return isSourceStyleRequest;
960
- }
961
- });
962
861
  Object.defineProperty(exports, "normalizeOutputPathKey", {
963
862
  enumerable: true,
964
863
  get: function() {
@@ -971,12 +870,6 @@ Object.defineProperty(exports, "normalizePath", {
971
870
  return normalizePath;
972
871
  }
973
872
  });
974
- Object.defineProperty(exports, "parseBundlerGeneratedCssMarkerBlocks", {
975
- enumerable: true,
976
- get: function() {
977
- return parseBundlerGeneratedCssMarkerBlocks;
978
- }
979
- });
980
873
  Object.defineProperty(exports, "resolveOutputSpecifier", {
981
874
  enumerable: true,
982
875
  get: function() {
@@ -1013,18 +906,6 @@ Object.defineProperty(exports, "slash", {
1013
906
  return slash;
1014
907
  }
1015
908
  });
1016
- Object.defineProperty(exports, "stripBundlerGeneratedCssMarkers", {
1017
- enumerable: true,
1018
- get: function() {
1019
- return stripBundlerGeneratedCssMarkers;
1020
- }
1021
- });
1022
- Object.defineProperty(exports, "stripRequestQuery", {
1023
- enumerable: true,
1024
- get: function() {
1025
- return stripRequestQuery;
1026
- }
1027
- });
1028
909
  Object.defineProperty(exports, "summarizeStringDiff", {
1029
910
  enumerable: true,
1030
911
  get: function() {
@@ -1,8 +1,8 @@
1
1
  import { detectAppType } from "./framework.mjs";
2
- import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-CrJJc5rK.mjs";
3
- import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-DZT_pWrd.mjs";
2
+ import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-2dg_uhEJ.mjs";
3
+ import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-xs704TRw.mjs";
4
4
  import { _ as babelParse, n as Parser, v as traverse } from "./wxml-DdGdeqaH.mjs";
5
- import { u as generateCssByGenerator } from "./hmr-timing-hRhRAjYV.mjs";
5
+ import { O as isSourceStyleRequest, d as generateCssByGenerator } from "./hmr-timing-1aS6--U7.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import path from "node:path";
8
8
  import process from "node:process";
@@ -225,39 +225,6 @@ function resolvePackageDir(name) {
225
225
  return path.dirname(pkgPath);
226
226
  }
227
227
  //#endregion
228
- //#region src/bundlers/shared/generated-css-marker.ts
229
- const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
230
- const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
231
- const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
232
- const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
233
- function createBundlerGeneratedCssMarker(bundler, file) {
234
- return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
235
- }
236
- function hasBundlerGeneratedCssMarker(source) {
237
- return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
238
- }
239
- function stripBundlerGeneratedCssMarkers(source) {
240
- return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
241
- }
242
- function parseBundlerGeneratedCssMarkerBlocks(source) {
243
- const blocks = [];
244
- BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
245
- let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
246
- while (match !== null) {
247
- const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
248
- const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
249
- const cssEnd = nextMatch?.index ?? source.length;
250
- const file = match[2] ? decodeURIComponent(match[2]) : void 0;
251
- blocks.push({
252
- bundler: match[1],
253
- file,
254
- css: source.slice(cssStart, cssEnd)
255
- });
256
- match = nextMatch;
257
- }
258
- return blocks;
259
- }
260
- //#endregion
261
228
  //#region src/bundlers/shared/module-graph.ts
262
229
  const QUERY_HASH_RE = /[?#].*$/u;
263
230
  const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
@@ -302,30 +269,6 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
302
269
  return matchWithExtensions(candidate, hasOutput);
303
270
  }
304
271
  //#endregion
305
- //#region src/bundlers/shared/style-requests.ts
306
- const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
307
- const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
308
- const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
309
- function stripHash(request) {
310
- const hashIndex = request.indexOf("#");
311
- return hashIndex === -1 ? request : request.slice(0, hashIndex);
312
- }
313
- function stripRequestQuery(request) {
314
- const normalized = stripHash(request);
315
- const queryIndex = normalized.indexOf("?");
316
- return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
317
- }
318
- function isSourceStyleRequest(request) {
319
- if (typeof request !== "string" || request.length === 0) return false;
320
- const normalized = stripHash(request);
321
- const queryIndex = normalized.indexOf("?");
322
- const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
323
- if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
324
- if (queryIndex === -1) return false;
325
- const query = normalized.slice(queryIndex + 1);
326
- return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
327
- }
328
- //#endregion
329
272
  //#region src/bundlers/shared/v4-generation-core.ts
330
273
  async function generateTailwindV4Css(options) {
331
274
  const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
@@ -506,6 +449,7 @@ function createBundleBuildState() {
506
449
  runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
507
450
  linkedByEntry: /* @__PURE__ */ new Map(),
508
451
  dependentsByLinkedFile: /* @__PURE__ */ new Map(),
452
+ bundleMarkupCandidatesByFile: /* @__PURE__ */ new Map(),
509
453
  generatorCandidateSignature: void 0
510
454
  };
511
455
  }
@@ -526,7 +470,7 @@ function createProcessFiles() {
526
470
  }
527
471
  function readEntrySource(output) {
528
472
  if (output.type === "chunk") return output.code;
529
- return output.source.toString();
473
+ return typeof output.source === "string" ? output.source : Buffer.from(output.source).toString();
530
474
  }
531
475
  function classifyBundleEntry(file, opts) {
532
476
  if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
@@ -702,78 +646,51 @@ function createLocalSourceEntries(sourceFile) {
702
646
  }];
703
647
  }
704
648
  function intersectCandidates(first, second) {
705
- const scoped = /* @__PURE__ */ new Set();
649
+ if (first.size === 0 || second.size === 0) return /* @__PURE__ */ new Set();
706
650
  const [small, large] = first.size <= second.size ? [first, second] : [second, first];
651
+ const scoped = /* @__PURE__ */ new Set();
707
652
  for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
708
653
  return scoped;
709
654
  }
710
- function intersectCandidateSourceMaps(first, second) {
711
- if (first.size === 0 || second.size === 0) return /* @__PURE__ */ new Map();
712
- const scoped = /* @__PURE__ */ new Map();
713
- for (const [candidate, sources] of first) if (second.has(candidate)) scoped.set(candidate, sources);
714
- return scoped;
715
- }
716
655
  function mergeCandidates(first, second) {
717
656
  return /* @__PURE__ */ new Set([...first, ...second]);
718
657
  }
719
- function intersectExplicitSourceCandidates(scopedCandidates, localCandidates) {
720
- if (localCandidates.size === 0 && scopedCandidates.size > 0) return scopedCandidates;
721
- return intersectCandidates(scopedCandidates, localCandidates);
722
- }
723
- function resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates) {
724
- if (scopedCandidates.size === 0 && localCandidates.size === 0 && fallbackCandidates?.size) return fallbackCandidates;
725
- return intersectExplicitSourceCandidates(scopedCandidates, localCandidates);
726
- }
727
- function resolveExplicitSourceMaps(scopedSources, localSources, fallbackSources) {
728
- if (scopedSources.size === 0 && localSources.size === 0 && fallbackSources?.size) return fallbackSources;
729
- if (localSources.size === 0 && scopedSources.size > 0) return scopedSources;
730
- return intersectCandidateSourceMaps(scopedSources, localSources);
658
+ function canFallbackToOutputCandidates(rawSource, entries) {
659
+ return rawSource.includes("@source") && entries.length > 0 && entries.every((entry) => !entry.negated);
731
660
  }
732
661
  function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
733
662
  if (!hasOwnSourceDirectives(rawSource)) return {
734
663
  entries: resolvedEntries,
735
664
  localEntries: void 0
736
665
  };
737
- const localEntries = createLocalSourceEntries(sourceFile);
738
- if (!resolvedEntries || resolvedEntries.length === 0) return {
739
- entries: localEntries,
740
- localEntries: void 0
741
- };
742
- return {
743
- entries: resolvedEntries,
744
- localEntries
745
- };
666
+ if (resolvedEntries !== void 0) return { entries: resolvedEntries };
667
+ return { entries: createLocalSourceEntries(sourceFile) };
746
668
  }
747
669
  async function resolveScopedGeneratorSourceEntries(rawSource, sourceFile) {
748
670
  return resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
749
671
  }
750
672
  async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fallbackSignature, getSourceCandidatesForEntries, options = {}) {
751
673
  if (!getSourceCandidatesForEntries || !hasOwnSourceDirectives(rawSource)) return fallbackSignature;
752
- const { entries, localEntries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
674
+ const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
753
675
  if (entries === void 0) return fallbackSignature;
754
- const scopedCandidates = getSourceCandidatesForEntries(entries);
755
- const scopedSignature = createCandidateSignature(localEntries ? resolveExplicitSourceCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries), getSourceCandidatesForEntries(void 0)) : scopedCandidates);
676
+ const scopedSignature = createCandidateSignature(getSourceCandidatesForEntries(entries));
756
677
  return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
757
678
  }
758
679
  async function createScopedGeneratorSourceTraceMap(rawSource, sourceFile, getSourceCandidateSourcesForEntries) {
759
680
  if (!getSourceCandidateSourcesForEntries || !hasOwnSourceDirectives(rawSource)) return getSourceCandidateSourcesForEntries?.(void 0);
760
- const { entries, localEntries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
681
+ const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
761
682
  if (entries === void 0) return getSourceCandidateSourcesForEntries(void 0);
762
- const scopedSources = getSourceCandidateSourcesForEntries(entries);
763
- return localEntries ? resolveExplicitSourceMaps(scopedSources, getSourceCandidateSourcesForEntries(localEntries), getSourceCandidateSourcesForEntries(void 0)) : scopedSources;
683
+ return getSourceCandidateSourcesForEntries(entries);
764
684
  }
765
685
  async function createScopedGeneratorRuntime(options) {
766
686
  const { cssHandlerOptions, fallbackRuntime, getSourceCandidatesForEntries, outputFile, rawSource, shouldExcludeSubpackageSourceCandidates, sourceFile, scopedSourceCandidateGetter } = options;
767
687
  if (getSourceCandidatesForEntries && rawSource && sourceFile) {
768
- const { entries, localEntries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
688
+ const { entries } = await resolveScopedGeneratorSourceEntries(rawSource, sourceFile);
769
689
  if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
770
- const scopedCandidates = scopedSourceCandidateGetter?.(entries) ?? getSourceCandidatesForEntries(entries);
771
- const shouldMergeFallbackRuntime = hasCssMacroTailwindV4CustomVariantConditionalComments(rawSource);
772
- if (!localEntries) return shouldMergeFallbackRuntime ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
773
- const localCandidates = scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries);
774
- const fallbackCandidates = scopedSourceCandidateGetter?.(void 0);
775
- const scopedLocalCandidates = resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates);
776
- return shouldMergeFallbackRuntime ? mergeCandidates(scopedLocalCandidates, fallbackRuntime) : scopedLocalCandidates;
690
+ const explicitCandidates = getSourceCandidatesForEntries(entries);
691
+ const outputCandidates = scopedSourceCandidateGetter?.(void 0);
692
+ const scopedCandidates = outputCandidates ? explicitCandidates.size === 0 && canFallbackToOutputCandidates(rawSource, entries) ? outputCandidates : intersectCandidates(explicitCandidates, outputCandidates) : explicitCandidates;
693
+ return hasCssMacroTailwindV4CustomVariantConditionalComments(rawSource) ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
777
694
  }
778
695
  }
779
696
  const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
@@ -811,4 +728,4 @@ function createSourceCandidateScanSignature(input) {
811
728
  });
812
729
  }
813
730
  //#endregion
814
- export { createBundlerGeneratedCssMarker as A, resolveViteFrameworkProfile as B, createBundleModuleGraphOptions as C, normalizeOutputPathKey as D, stripRequestQuery as E, resolvePluginDisabledState as F, createBuiltinViteStyleInjectorPlugins as I, createBuiltinWebpackStyleInjectorPlugin as L, parseBundlerGeneratedCssMarkerBlocks as M, stripBundlerGeneratedCssMarkers as N, resolveOutputSpecifier as O, resolvePackageDir as P, viteStyleInjectorDelegates as R, applyLinkedResults as S, isSourceStyleRequest as T, resolveWebpackFrameworkProfile as V, isCSSRequest as _, createCandidateSignature as a, slash as b, getSnapshotHash as c, buildBundleSnapshot as d, classifyBundleEntry as f, formatPostcssSourceMap as g, cleanUrl as h, createScopedGeneratorSourceTraceMap as i, hasBundlerGeneratedCssMarker as j, toAbsoluteOutputPath as k, hasRuntimeAffectingSourceChanges as l, updateBundleBuildState as m, createScopedGeneratorCandidateSignature as n, createJsHashSalt as o, createBundleBuildState as p, createScopedGeneratorRuntime as r, createLinkedImpactSignature as s, createSourceCandidateScanSignature as t, summarizeStringDiff as u, isHTMLRequest as v, generateTailwindV4Css as w, createRuntimeAffectingSourceSignature as x, normalizePath as y, webpackStyleInjectorDelegates as z };
731
+ export { createBuiltinViteStyleInjectorPlugins as A, createBundleModuleGraphOptions as C, toAbsoluteOutputPath as D, resolveOutputSpecifier as E, resolveWebpackFrameworkProfile as F, viteStyleInjectorDelegates as M, webpackStyleInjectorDelegates as N, resolvePackageDir as O, resolveViteFrameworkProfile as P, applyLinkedResults as S, normalizeOutputPathKey as T, isCSSRequest as _, createCandidateSignature as a, slash as b, getSnapshotHash as c, buildBundleSnapshot as d, classifyBundleEntry as f, formatPostcssSourceMap as g, cleanUrl as h, createScopedGeneratorSourceTraceMap as i, createBuiltinWebpackStyleInjectorPlugin as j, resolvePluginDisabledState as k, hasRuntimeAffectingSourceChanges as l, updateBundleBuildState as m, createScopedGeneratorCandidateSignature as n, createJsHashSalt as o, createBundleBuildState as p, createScopedGeneratorRuntime as r, createLinkedImpactSignature as s, createSourceCandidateScanSignature as t, summarizeStringDiff as u, isHTMLRequest as v, generateTailwindV4Css as w, createRuntimeAffectingSourceSignature as x, normalizePath as y };
@@ -1,7 +1,11 @@
1
+ import type { ICustomAttributesEntities } from '../types';
1
2
  import type { IArbitraryValues } from '../types/shared';
2
3
  export interface SourceCandidateExtractionOptions {
3
4
  bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
5
+ customAttributesEntities?: ICustomAttributesEntities | undefined;
6
+ disabledDefaultTemplateHandler?: boolean | undefined;
4
7
  extractor?: ((source: string, extension: string) => Promise<Iterable<string>> | Iterable<string>) | undefined;
5
8
  }
6
9
  export declare function extractCandidatesFromSource(source: string, extension: string, options?: SourceCandidateExtractionOptions): Promise<Set<string>>;
10
+ export declare function extractTemplateAttributeCandidates(source: string, extension: string, options: SourceCandidateExtractionOptions): Promise<never[] | Set<string>>;
7
11
  export declare function extractScriptStringCandidates(source: string, extension: string, options: SourceCandidateExtractionOptions): Promise<never[] | Set<string>>;
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
- const require_generator = require("./generator-CS10c9g1.js");
2
+ const require_generator = require("./generator-CEnUsjed.js");
3
3
  const require_object = require("./object-COs_Mw6p.js");
4
4
  require("./utils-CuKLf1Zv.js");
5
5
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { At as resolveTailwindV4CssSourceBase, C as findWorkspaceRoot, Ct as createTailwindSourceEntryMatcher, D as normalizeStringListOption, Dt as parseConfigParam, E as resolveTailwindcssOptions, Et as normalizeLegacyContentEntries, Mt as resolveCssMacroTailwindV4Source, Ot as resolveCssSourceEntries, Pt as loadTailwindV4DesignSystem, S as findWorkspacePackageDir, St as FULL_SOURCE_SCAN_PATTERN, T as normalizeTailwindcssRuntimeOptions, _ as groupCssEntriesByBase, b as normalizeCssEntries, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as guessBasedirFromEntries, w as normalizeExtendLengthUnits, wt as expandTailwindSourceEntries, x as findNearestPackageRoot, y as isTailwindV4CssEntry } from "./generator-BvPcmqxU.mjs";
1
+ import { At as resolveTailwindV4CssSourceBase, C as findWorkspaceRoot, Ct as createTailwindSourceEntryMatcher, D as normalizeStringListOption, Dt as parseConfigParam, E as resolveTailwindcssOptions, Et as normalizeLegacyContentEntries, Mt as resolveCssMacroTailwindV4Source, Ot as resolveCssSourceEntries, Pt as loadTailwindV4DesignSystem, S as findWorkspacePackageDir, St as FULL_SOURCE_SCAN_PATTERN, T as normalizeTailwindcssRuntimeOptions, _ as groupCssEntriesByBase, b as normalizeCssEntries, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as guessBasedirFromEntries, w as normalizeExtendLengthUnits, wt as expandTailwindSourceEntries, x as findNearestPackageRoot, y as isTailwindV4CssEntry } from "./generator-CEo920So.mjs";
2
2
  import { t as omitUndefined } from "./object-BJSWl-E5.mjs";
3
3
  import { n as defuOverrideArray$1 } from "./utils-MVwpU07P.mjs";
4
4
  import { createRequire } from "node:module";
@@ -14621,6 +14621,48 @@ function isRuntimeCandidate(candidate, runtimeSet) {
14621
14621
  if (!runtimeSet || runtimeSet.size === 0) return false;
14622
14622
  return runtimeSet.has(candidate) || runtimeSet.has(replaceWxml(candidate));
14623
14623
  }
14624
+ function hasTopLevelVariant(candidate) {
14625
+ let bracketDepth = 0;
14626
+ let parenthesisDepth = 0;
14627
+ let quote = "";
14628
+ let escaped = false;
14629
+ for (const char of candidate) {
14630
+ if (escaped) {
14631
+ escaped = false;
14632
+ continue;
14633
+ }
14634
+ if (char === "\\") {
14635
+ escaped = true;
14636
+ continue;
14637
+ }
14638
+ if (quote) {
14639
+ if (char === quote) quote = "";
14640
+ continue;
14641
+ }
14642
+ if (char === "\"" || char === "'") {
14643
+ quote = char;
14644
+ continue;
14645
+ }
14646
+ if (char === "[") {
14647
+ bracketDepth += 1;
14648
+ continue;
14649
+ }
14650
+ if (char === "]") {
14651
+ bracketDepth = Math.max(0, bracketDepth - 1);
14652
+ continue;
14653
+ }
14654
+ if (char === "(") {
14655
+ parenthesisDepth += 1;
14656
+ continue;
14657
+ }
14658
+ if (char === ")") {
14659
+ parenthesisDepth = Math.max(0, parenthesisDepth - 1);
14660
+ continue;
14661
+ }
14662
+ if (char === ":" && bracketDepth === 0 && parenthesisDepth === 0) return true;
14663
+ }
14664
+ return false;
14665
+ }
14624
14666
  function shouldEnableComponentLocalStyle(id) {
14625
14667
  return COMPONENT_RE.test(id);
14626
14668
  }
@@ -14643,18 +14685,18 @@ var UniAppXComponentLocalStyleCollector = class {
14643
14685
  this.aliasByLookup.set(replaceWxml(utility), alias);
14644
14686
  return alias;
14645
14687
  }
14646
- rewriteLiteral(literal, shouldInclude) {
14688
+ rewriteLiteral(literal) {
14647
14689
  const candidates = splitCandidateTokens(literal);
14648
14690
  if (candidates.length === 0) return literal;
14649
14691
  let rewritten = literal;
14650
14692
  for (const candidate of candidates) {
14651
- if (!shouldInclude(candidate)) continue;
14652
- rewritten = rewritten.replace(candidate, this.ensureAlias(candidate));
14693
+ if (!isRuntimeCandidate(candidate, this.runtimeSet)) continue;
14694
+ rewritten = rewritten.replace(candidate, hasTopLevelVariant(candidate) ? replaceWxml(candidate) : this.ensureAlias(candidate));
14653
14695
  }
14654
14696
  return rewritten;
14655
14697
  }
14656
14698
  collectAndRewriteStaticClass(literal) {
14657
- return this.rewriteLiteral(literal, (candidate) => isRuntimeCandidate(candidate, this.runtimeSet));
14699
+ return this.rewriteLiteral(literal);
14658
14700
  }
14659
14701
  collectRuntimeClasses(rawSource, options = {}) {
14660
14702
  const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
@@ -14669,7 +14711,7 @@ var UniAppXComponentLocalStyleCollector = class {
14669
14711
  const classContext = options.wrapExpression || isClassContextLiteralPath(path);
14670
14712
  for (const candidate of candidates) {
14671
14713
  if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) continue;
14672
- if (isRuntimeCandidate(candidate, this.runtimeSet)) this.ensureAlias(candidate);
14714
+ if (isRuntimeCandidate(candidate, this.runtimeSet) && !hasTopLevelVariant(candidate)) this.ensureAlias(candidate);
14673
14715
  }
14674
14716
  }
14675
14717
  } catch {}