weapp-tailwindcss 5.1.14 → 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 (63) 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/generate-bundle/bundle-markup-candidates.d.ts +20 -0
  12. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
  13. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -0
  14. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
  15. package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +1 -0
  16. package/dist/bundlers/vite/generate-bundle/types.d.ts +5 -0
  17. package/dist/bundlers/vite/serve-css-generation.d.ts +3 -2
  18. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
  19. package/dist/bundlers/vite/watch-css-post.d.ts +10 -0
  20. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  21. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +1 -0
  22. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -0
  23. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -0
  24. package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +4 -0
  25. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -0
  26. package/dist/{context-BL8Gy71H.mjs → context-BgGWVAmN.mjs} +2 -2
  27. package/dist/core.mjs +1 -1
  28. package/dist/css-macro.mjs +1 -1
  29. package/dist/{generator-B59OA64h.mjs → generator-CEo920So.mjs} +1 -1
  30. package/dist/generator.mjs +1 -1
  31. package/dist/{gulp-C1Q3LRzg.js → gulp-3m1dAiig.js} +84 -50
  32. package/dist/{gulp-DUYWxmZC.mjs → gulp-DP71z1jG.mjs} +87 -53
  33. package/dist/gulp.js +1 -1
  34. package/dist/gulp.mjs +1 -1
  35. package/dist/{hmr-timing-C3ed5vCx.mjs → hmr-timing-1aS6--U7.mjs} +170 -44
  36. package/dist/{hmr-timing-BZ5sWIqO.js → hmr-timing-B8p4f0ca.js} +219 -39
  37. package/dist/index.js +3 -3
  38. package/dist/index.mjs +4 -4
  39. package/dist/postcss.mjs +1 -1
  40. package/dist/presets.mjs +1 -1
  41. package/dist/rspack.js +1 -1
  42. package/dist/rspack.mjs +1 -1
  43. package/dist/shared/mpx.d.ts +4 -1
  44. package/dist/{source-candidate-scan-signature-R3dzamcm.js → source-candidate-scan-signature-BAahhiwb.js} +4 -96
  45. package/dist/{source-candidate-scan-signature-D7RWjWsY.mjs → source-candidate-scan-signature-Cf7259PR.mjs} +6 -62
  46. package/dist/{tailwindcss-DPcKMLxL.mjs → tailwindcss-xs704TRw.mjs} +1 -1
  47. package/dist/{transform-D5JUgMpE.mjs → transform-B_KM9sLX.mjs} +47 -5
  48. package/dist/{transform-COFRlmDF.js → transform-CcYptivi.js} +47 -5
  49. package/dist/uni-app-x/component-local-style.d.ts +1 -0
  50. package/dist/uni-app-x/style-asset/style-value.d.ts +1 -1
  51. package/dist/{vite-BNlPdsGM.js → vite-DUVjMduj.js} +550 -273
  52. package/dist/{vite-CBU5NXTX.mjs → vite-nXZEiwG0.mjs} +501 -224
  53. package/dist/vite.js +1 -1
  54. package/dist/vite.mjs +1 -1
  55. package/dist/weapp-tw-css-generation-loader.js +12 -0
  56. package/dist/weapp-tw-css-import-rewrite-loader-DNk0IxAt.js +10198 -0
  57. package/dist/weapp-tw-css-import-rewrite-loader.js +6 -10255
  58. package/dist/{webpack-CZ38fMGC.mjs → webpack-C_UUFRgj.mjs} +223 -57
  59. package/dist/{webpack-Jpe048pQ.js → webpack-nppysF4B.js} +232 -66
  60. package/dist/webpack.js +1 -1
  61. package/dist/webpack.mjs +1 -1
  62. package/package.json +11 -3
  63. package/dist/auto-CrJJc5rK.mjs +0 -13
@@ -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-DPcKMLxL.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-C3ed5vCx.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";
@@ -784,4 +728,4 @@ function createSourceCandidateScanSignature(input) {
784
728
  });
785
729
  }
786
730
  //#endregion
787
- 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,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-B59OA64h.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 {}
@@ -14618,6 +14618,48 @@ function isRuntimeCandidate(candidate, runtimeSet) {
14618
14618
  if (!runtimeSet || runtimeSet.size === 0) return false;
14619
14619
  return runtimeSet.has(candidate) || runtimeSet.has(require_wxml.replaceWxml(candidate));
14620
14620
  }
14621
+ function hasTopLevelVariant(candidate) {
14622
+ let bracketDepth = 0;
14623
+ let parenthesisDepth = 0;
14624
+ let quote = "";
14625
+ let escaped = false;
14626
+ for (const char of candidate) {
14627
+ if (escaped) {
14628
+ escaped = false;
14629
+ continue;
14630
+ }
14631
+ if (char === "\\") {
14632
+ escaped = true;
14633
+ continue;
14634
+ }
14635
+ if (quote) {
14636
+ if (char === quote) quote = "";
14637
+ continue;
14638
+ }
14639
+ if (char === "\"" || char === "'") {
14640
+ quote = char;
14641
+ continue;
14642
+ }
14643
+ if (char === "[") {
14644
+ bracketDepth += 1;
14645
+ continue;
14646
+ }
14647
+ if (char === "]") {
14648
+ bracketDepth = Math.max(0, bracketDepth - 1);
14649
+ continue;
14650
+ }
14651
+ if (char === "(") {
14652
+ parenthesisDepth += 1;
14653
+ continue;
14654
+ }
14655
+ if (char === ")") {
14656
+ parenthesisDepth = Math.max(0, parenthesisDepth - 1);
14657
+ continue;
14658
+ }
14659
+ if (char === ":" && bracketDepth === 0 && parenthesisDepth === 0) return true;
14660
+ }
14661
+ return false;
14662
+ }
14621
14663
  function shouldEnableComponentLocalStyle(id) {
14622
14664
  return COMPONENT_RE.test(id);
14623
14665
  }
@@ -14640,18 +14682,18 @@ var UniAppXComponentLocalStyleCollector = class {
14640
14682
  this.aliasByLookup.set(require_wxml.replaceWxml(utility), alias);
14641
14683
  return alias;
14642
14684
  }
14643
- rewriteLiteral(literal, shouldInclude) {
14685
+ rewriteLiteral(literal) {
14644
14686
  const candidates = (0, _tailwindcss_mangle_engine.splitCandidateTokens)(literal);
14645
14687
  if (candidates.length === 0) return literal;
14646
14688
  let rewritten = literal;
14647
14689
  for (const candidate of candidates) {
14648
- if (!shouldInclude(candidate)) continue;
14649
- rewritten = rewritten.replace(candidate, this.ensureAlias(candidate));
14690
+ if (!isRuntimeCandidate(candidate, this.runtimeSet)) continue;
14691
+ rewritten = rewritten.replace(candidate, hasTopLevelVariant(candidate) ? require_wxml.replaceWxml(candidate) : this.ensureAlias(candidate));
14650
14692
  }
14651
14693
  return rewritten;
14652
14694
  }
14653
14695
  collectAndRewriteStaticClass(literal) {
14654
- return this.rewriteLiteral(literal, (candidate) => isRuntimeCandidate(candidate, this.runtimeSet));
14696
+ return this.rewriteLiteral(literal);
14655
14697
  }
14656
14698
  collectRuntimeClasses(rawSource, options = {}) {
14657
14699
  const wrapped = options.wrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
@@ -14666,7 +14708,7 @@ var UniAppXComponentLocalStyleCollector = class {
14666
14708
  const classContext = options.wrapExpression || require_wxml.isClassContextLiteralPath(path);
14667
14709
  for (const candidate of candidates) {
14668
14710
  if (!candidate || !classContext && !isRuntimeCandidate(candidate, this.runtimeSet)) continue;
14669
- if (isRuntimeCandidate(candidate, this.runtimeSet)) this.ensureAlias(candidate);
14711
+ if (isRuntimeCandidate(candidate, this.runtimeSet) && !hasTopLevelVariant(candidate)) this.ensureAlias(candidate);
14670
14712
  }
14671
14713
  }
14672
14714
  } catch {}
@@ -1,6 +1,7 @@
1
1
  interface RewriteCodeOptions {
2
2
  wrapExpression?: boolean;
3
3
  }
4
+ export declare function hasTopLevelVariant(candidate: string): boolean;
4
5
  export declare function shouldEnableComponentLocalStyle(id: string): boolean;
5
6
  export declare function shouldEnablePageLocalStyle(id: string): boolean;
6
7
  export declare class UniAppXComponentLocalStyleCollector {
@@ -10,7 +10,7 @@ export declare function createUtsStyleArrayFromAppStyles(code: string, appSource
10
10
  export declare function cssSourceToStyleValue(source: string): StyleValue | undefined;
11
11
  export declare function mergeStyleValues(...items: Array<StyleValue | undefined>): StyleValue | undefined;
12
12
  export declare function createStyleValueFromApplySources(sources: string[], utilityStyles: StyleValue | undefined): StyleValue | undefined;
13
- export declare function collectUniAppXHarmonyApplyStyleSourcesFromSource(source: string): string[];
13
+ export declare function collectUniAppXHarmonyApplyStyleSourcesFromSource(source: string, sourceId?: string): string[];
14
14
  export declare function collectUniAppXHarmonyApplyUtilitiesFromSources(sources: Iterable<string>): Set<string>;
15
15
  export declare function createMergedStyleValue(code: string, localStyle: StyleValue | undefined, appStyle: StyleValue): StyleValue | undefined;
16
16
  export {};