weapp-tailwindcss 5.1.14 → 5.1.16

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 (149) 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/cache-state.d.ts +71 -0
  5. package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +43 -0
  6. package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +4 -2
  7. package/dist/bundlers/shared/framework-postcss.d.ts +14 -0
  8. package/dist/bundlers/shared/generated-css-marker.d.ts +2 -2
  9. package/dist/bundlers/shared/generator-css/generation-helpers/preflight.d.ts +18 -0
  10. package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +25 -0
  11. package/dist/bundlers/shared/generator-css/generation-helpers/runtime-isolation.d.ts +30 -0
  12. package/dist/bundlers/shared/generator-css/generation-helpers/source-order.d.ts +2 -0
  13. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +4 -72
  14. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +3 -1
  15. package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
  16. package/dist/bundlers/shared/generator-css/pipeline/deferred-output.d.ts +14 -0
  17. package/dist/bundlers/shared/generator-css/pipeline/execution.d.ts +12 -0
  18. package/dist/bundlers/shared/generator-css/pipeline/fallback-output.d.ts +12 -0
  19. package/dist/bundlers/shared/generator-css/pipeline/ordered-output.d.ts +25 -0
  20. package/dist/bundlers/shared/generator-css/pipeline.d.ts +2 -0
  21. package/dist/bundlers/shared/generator-css/result-helpers.d.ts +6 -0
  22. package/dist/bundlers/shared/generator-css/scoped-rules.d.ts +1 -0
  23. package/dist/bundlers/shared/generator-css/source-resolver/configuration.d.ts +33 -0
  24. package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +2 -0
  25. package/dist/bundlers/shared/generator-css/source-resolver/resolve-source.d.ts +4 -0
  26. package/dist/bundlers/shared/generator-css/source-resolver/resolve-sources.d.ts +4 -0
  27. package/dist/bundlers/shared/generator-css/source-resolver/single-source.d.ts +16 -0
  28. package/dist/bundlers/shared/generator-css/source-resolver/source-entries.d.ts +3 -0
  29. package/dist/bundlers/shared/generator-css/source-resolver/source-matching.d.ts +5 -0
  30. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +3 -6
  31. package/dist/bundlers/shared/generator-css/types.d.ts +5 -0
  32. package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +9 -0
  33. package/dist/bundlers/shared/generator-css/user-css/at-rules.d.ts +3 -0
  34. package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +4 -0
  35. package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +9 -0
  36. package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +10 -0
  37. package/dist/bundlers/shared/generator-css/user-css/user-layers.d.ts +15 -0
  38. package/dist/bundlers/shared/generator-css/user-css.d.ts +5 -33
  39. package/dist/bundlers/shared/generator-css.d.ts +1 -2
  40. package/dist/bundlers/shared/style-requests.d.ts +1 -0
  41. package/dist/bundlers/shared/v4-generation-core.d.ts +3 -0
  42. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  43. package/dist/bundlers/vite/css-finalizer/options.d.ts +54 -0
  44. package/dist/bundlers/vite/css-finalizer/plugin.d.ts +3 -0
  45. package/dist/bundlers/vite/css-finalizer.d.ts +1 -43
  46. package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +20 -0
  47. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
  48. package/dist/bundlers/vite/generate-bundle/finalize/bundle.d.ts +2 -0
  49. package/dist/bundlers/vite/generate-bundle/finalize/root-import-shell.d.ts +69 -0
  50. package/dist/bundlers/vite/generate-bundle/finalize.d.ts +2 -70
  51. package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -0
  52. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
  53. package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +1 -0
  54. package/dist/bundlers/vite/generate-bundle/types.d.ts +5 -0
  55. package/dist/bundlers/vite/generate-bundle-runtime.d.ts +6 -0
  56. package/dist/bundlers/vite/generate-bundle.d.ts +1 -1
  57. package/dist/bundlers/vite/processed-css-assets/cleanup.d.ts +12 -0
  58. package/dist/bundlers/vite/processed-css-assets/collector.d.ts +4 -0
  59. package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +34 -0
  60. package/dist/bundlers/vite/processed-css-assets/injection-plan.d.ts +42 -0
  61. package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +89 -0
  62. package/dist/bundlers/vite/processed-css-assets/style-files.d.ts +3 -0
  63. package/dist/bundlers/vite/processed-css-assets.d.ts +4 -71
  64. package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
  65. package/dist/bundlers/vite/serve-css-generation.d.ts +4 -2
  66. package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +2 -0
  67. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +5 -4
  68. package/dist/bundlers/vite/source-candidates/collector.d.ts +8 -0
  69. package/dist/bundlers/vite/source-candidates/store.d.ts +2 -0
  70. package/dist/bundlers/vite/source-candidates/types-and-cache.d.ts +69 -0
  71. package/dist/bundlers/vite/source-candidates.d.ts +4 -68
  72. package/dist/bundlers/vite/watch-css-post.d.ts +10 -0
  73. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  74. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +1 -0
  75. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/finalize-assets.d.ts +2 -0
  76. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/generated-css-result.d.ts +3 -0
  77. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/generated-css-task.d.ts +2 -0
  78. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/html-js-tasks.d.ts +5 -0
  79. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/finalize.d.ts +30 -0
  80. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/generated-css.d.ts +8 -0
  81. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/memory-trace.d.ts +78 -0
  82. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/preflight-runtime.d.ts +43 -0
  83. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/resources.d.ts +30 -0
  84. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/runtime-candidates.d.ts +1 -0
  85. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/sources.d.ts +28 -0
  86. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css-markers.d.ts +1 -0
  87. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers/user-css.d.ts +21 -0
  88. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +9 -217
  89. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/processed-css-task.d.ts +4 -0
  90. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -0
  91. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +6 -0
  92. package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +4 -0
  93. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -0
  94. package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +20 -0
  95. package/dist/bundlers/webpack/shared/create-framework-plugin/watch-output.d.ts +13 -0
  96. package/dist/bundlers/webpack/shared/create-framework-plugin.d.ts +3 -21
  97. package/dist/cli.js +14 -18
  98. package/dist/cli.mjs +14 -18
  99. package/dist/{context-VeFq_8vW.js → context-BtLIID4m.js} +3 -3
  100. package/dist/{context-BL8Gy71H.mjs → context-JzwzSX36.mjs} +3 -3
  101. package/dist/core.js +1 -1
  102. package/dist/core.mjs +1 -1
  103. package/dist/css-macro.mjs +1 -1
  104. package/dist/{generator-CEnUsjed.js → generator-B91GhUJQ.js} +636 -505
  105. package/dist/{generator-B59OA64h.mjs → generator-Bv7myuhY.mjs} +557 -432
  106. package/dist/generator.js +1 -1
  107. package/dist/generator.mjs +1 -1
  108. package/dist/{gulp-DUYWxmZC.mjs → gulp-CKSklPlH.mjs} +218 -153
  109. package/dist/{gulp-C1Q3LRzg.js → gulp-Q1wITegn.js} +218 -153
  110. package/dist/gulp.js +1 -1
  111. package/dist/gulp.mjs +1 -1
  112. package/dist/{hmr-timing-C3ed5vCx.mjs → hmr-timing-BXg7nI8N.mjs} +3406 -3145
  113. package/dist/{hmr-timing-BZ5sWIqO.js → hmr-timing-CMPaWn9P.js} +3474 -3147
  114. package/dist/index.js +4 -4
  115. package/dist/index.mjs +4 -4
  116. package/dist/postcss.js +1 -1
  117. package/dist/postcss.mjs +1 -1
  118. package/dist/presets.js +1 -1
  119. package/dist/presets.mjs +1 -1
  120. package/dist/rspack.js +1 -1
  121. package/dist/rspack.mjs +1 -1
  122. package/dist/shared/mpx-plugin-owner.d.ts +2 -0
  123. package/dist/shared/mpx.d.ts +4 -1
  124. package/dist/{source-candidate-scan-signature-R3dzamcm.js → source-candidate-scan-signature-BKZZk_e6.js} +144 -96
  125. package/dist/{source-candidate-scan-signature-D7RWjWsY.mjs → source-candidate-scan-signature-CtK-mB_C.mjs} +127 -60
  126. package/dist/tailwindcss/v4-engine/generator/cache-stats.d.ts +26 -0
  127. package/dist/tailwindcss/v4-engine/generator/engine.d.ts +2 -0
  128. package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +52 -0
  129. package/dist/tailwindcss/v4-engine/generator.d.ts +2 -28
  130. package/dist/{tailwindcss-KBYPJ2DW.js → tailwindcss-B4phC0kB.js} +2 -2
  131. package/dist/{tailwindcss-DPcKMLxL.mjs → tailwindcss-BTcXX8Ka.mjs} +2 -2
  132. package/dist/{transform-D5JUgMpE.mjs → transform-B_KM9sLX.mjs} +47 -5
  133. package/dist/{transform-COFRlmDF.js → transform-CcYptivi.js} +47 -5
  134. package/dist/uni-app-x/component-local-style.d.ts +1 -0
  135. package/dist/uni-app-x/style-asset/style-value.d.ts +1 -1
  136. package/dist/{vite-CBU5NXTX.mjs → vite-BwQWl9ft.mjs} +1269 -878
  137. package/dist/{vite-BNlPdsGM.js → vite-DhVnXvAQ.js} +1314 -923
  138. package/dist/vite.js +1 -1
  139. package/dist/vite.mjs +1 -1
  140. package/dist/weapp-tw-css-generation-loader.js +12 -0
  141. package/dist/weapp-tw-css-import-rewrite-loader-B0tVkJLH.js +10524 -0
  142. package/dist/weapp-tw-css-import-rewrite-loader.js +6 -10255
  143. package/dist/weapp-tw-runtime-classset-loader.js +10 -4
  144. package/dist/{webpack-CZ38fMGC.mjs → webpack-Bo1QrFPf.mjs} +1518 -1079
  145. package/dist/{webpack-Jpe048pQ.js → webpack-kh78iMSS.js} +1519 -1080
  146. package/dist/webpack.js +1 -1
  147. package/dist/webpack.mjs +1 -1
  148. package/package.json +17 -7
  149. package/dist/auto-CrJJc5rK.mjs +0 -13
@@ -1,11 +1,13 @@
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 { i as normalizeWeappTailwindcssGeneratorOptions, q as preferScopedGeneratedCssRules } from "./generator-Bv7myuhY.mjs";
3
+ import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-2dg_uhEJ.mjs";
4
+ import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-BTcXX8Ka.mjs";
4
5
  import { _ as babelParse, n as Parser, v as traverse } from "./wxml-DdGdeqaH.mjs";
5
- import { u as generateCssByGenerator } from "./hmr-timing-C3ed5vCx.mjs";
6
+ import { _ as isVueScopedStyleRequest, b as resolvePostcssRequestOption, g as isSourceStyleRequest, i as generateCssByGenerator, m as finalizeMiniProgramGeneratorCss } from "./hmr-timing-BXg7nI8N.mjs";
6
7
  import { createRequire } from "node:module";
7
8
  import path from "node:path";
8
9
  import process from "node:process";
10
+ import { removeTailwindPostcssPlugins } from "@weapp-tailwindcss/postcss";
9
11
  import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
10
12
  import { Buffer } from "node:buffer";
11
13
  import { weappStyleInjector } from "weapp-style-injector/vite";
@@ -225,37 +227,107 @@ function resolvePackageDir(name) {
225
227
  return path.dirname(pkgPath);
226
228
  }
227
229
  //#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;
230
+ //#region src/bundlers/shared/framework-postcss.ts
231
+ const FRAMEWORK_POSTCSS_REGISTRY = Symbol.for("weapp-tailwindcss.framework-postcss-options");
232
+ const registryHost = globalThis;
233
+ const frameworkPostcssOptions = registryHost[FRAMEWORK_POSTCSS_REGISTRY] ?? (registryHost[FRAMEWORK_POSTCSS_REGISTRY] = /* @__PURE__ */ new WeakMap());
234
+ function isObject(value) {
235
+ return typeof value === "object" && value !== null;
236
+ }
237
+ function normalizePlugins(plugins) {
238
+ const entries = Array.isArray(plugins) ? plugins : isObject(plugins) ? Object.values(plugins) : [];
239
+ const resolved = [...new Set(entries.filter(Boolean))];
240
+ removeTailwindPostcssPlugins(resolved);
241
+ return resolved;
242
+ }
243
+ function resolveFrameworkPostcssOptions(value) {
244
+ if (!isObject(value)) return;
245
+ const plugins = normalizePlugins(value["plugins"]);
246
+ const options = Object.fromEntries(Object.entries(value).filter(([key]) => key !== "plugins" && key !== "config"));
247
+ if (plugins.length === 0 && Object.keys(options).length === 0) return;
248
+ return {
249
+ plugins,
250
+ options
251
+ };
252
+ }
253
+ function mergeFrameworkPostcssOptions(left, right) {
254
+ if (!left) return right;
255
+ if (!right) return left;
256
+ return {
257
+ plugins: [.../* @__PURE__ */ new Set([...normalizePlugins(left.plugins), ...normalizePlugins(right.plugins)])],
258
+ options: {
259
+ ...left.options ?? {},
260
+ ...right.options ?? {}
261
+ }
262
+ };
263
+ }
264
+ function collectFrameworkPostcssOptionsFromLoaderEntries(entries, loaderContext) {
265
+ let resolved;
266
+ const visit = (value) => {
267
+ if (Array.isArray(value)) {
268
+ value.forEach(visit);
269
+ return;
270
+ }
271
+ if (!isObject(value)) return;
272
+ const loader = value["loader"];
273
+ if (typeof loader === "string" && loader.includes("postcss-loader")) {
274
+ const loaderOptions = value["options"];
275
+ const rawOptions = isObject(loaderOptions) ? loaderOptions["postcssOptions"] : void 0;
276
+ const options = typeof rawOptions === "function" ? rawOptions(loaderContext) : rawOptions;
277
+ resolved = mergeFrameworkPostcssOptions(resolved, resolveFrameworkPostcssOptions(options));
278
+ return;
279
+ }
280
+ visit(value["rules"]);
281
+ visit(value["oneOf"]);
282
+ visit(value["use"]);
283
+ };
284
+ entries.forEach(visit);
285
+ return resolved;
286
+ }
287
+ function captureFrameworkPostcssOptions(owner, options) {
288
+ const resolved = resolveFrameworkPostcssOptions(options);
289
+ if (!resolved) {
290
+ frameworkPostcssOptions.delete(owner);
291
+ return;
257
292
  }
258
- return blocks;
293
+ frameworkPostcssOptions.set(owner, resolved);
294
+ return resolved;
295
+ }
296
+ function captureResolvedFrameworkPostcssOptions(owner, options) {
297
+ if (!options) {
298
+ frameworkPostcssOptions.delete(owner);
299
+ return;
300
+ }
301
+ frameworkPostcssOptions.set(owner, options);
302
+ return options;
303
+ }
304
+ function hasFrameworkPostcssOptions(owner) {
305
+ return frameworkPostcssOptions.has(owner);
306
+ }
307
+ function createGeneratedCssHandlerOptions(owner, options, from) {
308
+ const frameworkOptions = frameworkPostcssOptions.get(owner);
309
+ const merged = mergeFrameworkPostcssOptions(options.postcssOptions, frameworkOptions);
310
+ return {
311
+ ...options,
312
+ postcssOptions: {
313
+ ...merged ?? {},
314
+ options: {
315
+ ...merged?.options ?? {},
316
+ from
317
+ }
318
+ }
319
+ };
320
+ }
321
+ async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options) {
322
+ const handled = await options.styleHandler(generated.css, createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file));
323
+ const preflightMode = generated.metadata?.preflightMode;
324
+ const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
325
+ const preservePreflight = preflightMode?.preserve ?? options.cssHandlerOptions.isMainChunk;
326
+ return finalizeMiniProgramGeneratorCss(handled.css, generated.target, options.majorVersion, owner.cssPreflight, {
327
+ ...injectPreflight === void 0 ? {} : { injectPreflight },
328
+ ...preservePreflight === void 0 ? {} : { preservePreflight },
329
+ styleOptions: options.cssHandlerOptions
330
+ });
259
331
  }
260
332
  //#endregion
261
333
  //#region src/bundlers/shared/module-graph.ts
@@ -302,38 +374,32 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
302
374
  return matchWithExtensions(candidate, hasOutput);
303
375
  }
304
376
  //#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
377
  //#region src/bundlers/shared/v4-generation-core.ts
330
378
  async function generateTailwindV4Css(options) {
331
379
  const majorVersion = options.runtimeState.tailwindRuntime.majorVersion;
332
380
  if (majorVersion !== 4) throw new Error("weapp-tailwindcss 生成管线仅支持 Tailwind CSS v4。");
333
- const generated = await generateCssByGenerator(options);
381
+ const frameworkPostcssOwner = options.frameworkPostcssOwner ?? options.opts;
382
+ const shouldReplayFrameworkPostcss = options.frameworkPostcssStage === "complete" && hasFrameworkPostcssOptions(frameworkPostcssOwner) && normalizeWeappTailwindcssGeneratorOptions(options.opts.generator, {
383
+ appType: options.opts.appType,
384
+ platform: options.generatorPlatform ?? options.opts.cssOptions?.platform ?? options.opts.platform,
385
+ tailwindcssMajorVersion: majorVersion,
386
+ uniAppX: options.opts.uniAppX
387
+ }).target === "weapp";
388
+ const generated = await generateCssByGenerator(shouldReplayFrameworkPostcss ? {
389
+ ...options,
390
+ deferCssAdaptation: true
391
+ } : options);
334
392
  if (!generated) return;
393
+ const adaptedCss = shouldReplayFrameworkPostcss ? await adaptGeneratedCssWithFrameworkPipeline(frameworkPostcssOwner, generated, {
394
+ cssHandlerOptions: options.cssHandlerOptions,
395
+ file: options.file,
396
+ majorVersion,
397
+ styleHandler: options.styleHandler
398
+ }) : generated.css;
399
+ const css = isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions)) ? preferScopedGeneratedCssRules(adaptedCss) : adaptedCss;
335
400
  return {
336
401
  ...generated,
402
+ css,
337
403
  classSet: generated.classSet,
338
404
  dependencies: generated.dependencies,
339
405
  metadata: {
@@ -506,6 +572,7 @@ function createBundleBuildState() {
506
572
  runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
507
573
  linkedByEntry: /* @__PURE__ */ new Map(),
508
574
  dependentsByLinkedFile: /* @__PURE__ */ new Map(),
575
+ bundleMarkupCandidatesByFile: /* @__PURE__ */ new Map(),
509
576
  generatorCandidateSignature: void 0
510
577
  };
511
578
  }
@@ -526,7 +593,7 @@ function createProcessFiles() {
526
593
  }
527
594
  function readEntrySource(output) {
528
595
  if (output.type === "chunk") return output.code;
529
- return output.source.toString();
596
+ return typeof output.source === "string" ? output.source : Buffer.from(output.source).toString();
530
597
  }
531
598
  function classifyBundleEntry(file, opts) {
532
599
  if (opts.htmlMatcher(file) || isHTMLRequest(file)) return "html";
@@ -784,4 +851,4 @@ function createSourceCandidateScanSignature(input) {
784
851
  });
785
852
  }
786
853
  //#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 };
854
+ export { collectFrameworkPostcssOptionsFromLoaderEntries as A, createBundleModuleGraphOptions as C, toAbsoluteOutputPath as D, resolveOutputSpecifier as E, viteStyleInjectorDelegates as F, webpackStyleInjectorDelegates as I, resolveViteFrameworkProfile as L, resolvePluginDisabledState as M, createBuiltinViteStyleInjectorPlugins as N, captureFrameworkPostcssOptions as O, createBuiltinWebpackStyleInjectorPlugin as P, resolveWebpackFrameworkProfile as R, 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, resolvePackageDir as j, captureResolvedFrameworkPostcssOptions 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 };
@@ -0,0 +1,26 @@
1
+ export declare function getTailwindV4IncrementalGenerateCacheStats(): {
2
+ max: number;
3
+ entryCandidatesMax: number;
4
+ entryCssBytesMax: number;
5
+ size: number;
6
+ taskMax: number;
7
+ taskSize: number;
8
+ entries: {
9
+ candidates: number;
10
+ classSet: number;
11
+ cssBytes: number;
12
+ rawCssBytes: number;
13
+ keyHash: string;
14
+ keyBytes: number;
15
+ }[];
16
+ keys: {
17
+ keyHash: string;
18
+ keyBytes: number;
19
+ }[];
20
+ taskKeys: {
21
+ keyHash: string;
22
+ keyBytes: number;
23
+ }[];
24
+ };
25
+ export declare const getTailwindV4IncrementalGenerateCacheStatsForTest: typeof getTailwindV4IncrementalGenerateCacheStats;
26
+ export declare function clearTailwindV4IncrementalGenerateCacheForTest(): void;
@@ -0,0 +1,2 @@
1
+ import type { TailwindV4Engine, TailwindV4ResolvedSource } from '../types';
2
+ export declare function createTailwindV4Engine(source: TailwindV4ResolvedSource): TailwindV4Engine;
@@ -0,0 +1,52 @@
1
+ import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
+ import type { TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourcePattern } from '../types';
3
+ import { LRUCache } from 'lru-cache';
4
+ export declare const INCREMENTAL_GENERATE_CACHE_MAX = 8;
5
+ export declare const INCREMENTAL_GENERATE_TASK_CACHE_MAX = 32;
6
+ export declare const INCREMENTAL_GENERATE_ENTRY_CANDIDATES_MAX = 12000;
7
+ export declare const INCREMENTAL_GENERATE_ENTRY_CSS_BYTES_MAX: number;
8
+ export declare const incrementalGenerateCache: LRUCache<string, TailwindV4IncrementalGenerateCacheEntry, unknown>;
9
+ export declare const incrementalGenerateTaskCache: LRUCache<string, Promise<import("..").TailwindV4GenerateResult>, unknown>;
10
+ interface TailwindV4IncrementalGenerateCacheEntry {
11
+ seenCandidates: Set<string>;
12
+ classSet: Set<string>;
13
+ css: string;
14
+ rawCss: string;
15
+ customPropertyValues: Map<string, string>;
16
+ designSystemPromise: Promise<TailwindV4DesignSystem>;
17
+ dependencies: string[];
18
+ sources: TailwindV4SourcePattern[];
19
+ root: null | 'none' | {
20
+ base: string;
21
+ pattern: string;
22
+ };
23
+ target: TailwindV4GenerateTarget;
24
+ }
25
+ interface TailwindV4IncrementalCacheSeedOptions {
26
+ compatibleSource: TailwindV4ResolvedSource;
27
+ generated: Awaited<ReturnType<TailwindV4Engine['generate']>>;
28
+ requestedCandidates: Set<string>;
29
+ styleOptions: Partial<IStyleHandlerOptions> | undefined;
30
+ target: TailwindV4GenerateTarget;
31
+ }
32
+ export declare function collectCandidates(candidates: Iterable<string> | undefined): Set<string>;
33
+ export declare function hasRemovedCandidates(previousCandidates: Set<string>, nextCandidates: Set<string>): boolean;
34
+ export declare function createIncrementalGenerateCacheKey(source: TailwindV4ResolvedSource, target: TailwindV4GenerateTarget, styleOptions: Partial<IStyleHandlerOptions> | undefined): string;
35
+ export declare function runIncrementalGenerateTask(cacheKey: string, requestedCandidates: Set<string>, scanSources: TailwindV4GenerateOptions['scanSources'], task: () => Promise<Awaited<ReturnType<TailwindV4Engine['generate']>>>): Promise<import("..").TailwindV4GenerateResult>;
36
+ export declare function resolveTargetCandidates(candidates: Iterable<string> | undefined, target: TailwindV4GenerateTarget): Set<string>;
37
+ export declare function shouldDelegateWebSourceScanToTailwind(target: TailwindV4GenerateTarget, scanSources: TailwindV4GenerateOptions['scanSources']): boolean;
38
+ export declare function createIncrementalStyleOptions(styleOptions: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
39
+ export declare function resolveStyleOptions(source: TailwindV4ResolvedSource, options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions> | undefined;
40
+ export declare function mergeCustomPropertyValues(target: Map<string, string>, css: string): void;
41
+ export declare function summarizeIncrementalCacheKey(key: string): {
42
+ keyHash: string;
43
+ keyBytes: number;
44
+ };
45
+ export declare function shouldRebuildIncrementalEntry(cached: TailwindV4IncrementalGenerateCacheEntry, requestedCandidates: Set<string>, missingCandidates: string[]): boolean;
46
+ export declare function seedIncrementalGenerateCache(options: TailwindV4IncrementalCacheSeedOptions): boolean;
47
+ export declare function normalizeTargetRpxLengthCandidates(candidates: Iterable<string>, target: TailwindV4GenerateTarget, styleOptions: Partial<IStyleHandlerOptions> | undefined): {
48
+ candidates: Set<string>;
49
+ restoreCandidates: Map<string, string>;
50
+ };
51
+ export declare function resolveGeneratedSourcePatterns(generatedSources: TailwindV4SourcePattern[], scanSources: TailwindV4GenerateOptions['scanSources']): import("@tailwindcss-mangle/engine").TailwindV4SourcePattern[];
52
+ export {};
@@ -1,28 +1,2 @@
1
- import type { TailwindV4Engine, TailwindV4ResolvedSource } from './types';
2
- export declare function createTailwindV4Engine(source: TailwindV4ResolvedSource): TailwindV4Engine;
3
- export declare function getTailwindV4IncrementalGenerateCacheStats(): {
4
- max: number;
5
- entryCandidatesMax: number;
6
- entryCssBytesMax: number;
7
- size: number;
8
- taskMax: number;
9
- taskSize: number;
10
- entries: {
11
- candidates: number;
12
- classSet: number;
13
- cssBytes: number;
14
- rawCssBytes: number;
15
- keyHash: string;
16
- keyBytes: number;
17
- }[];
18
- keys: {
19
- keyHash: string;
20
- keyBytes: number;
21
- }[];
22
- taskKeys: {
23
- keyHash: string;
24
- keyBytes: number;
25
- }[];
26
- };
27
- export declare const getTailwindV4IncrementalGenerateCacheStatsForTest: typeof getTailwindV4IncrementalGenerateCacheStats;
28
- export declare function clearTailwindV4IncrementalGenerateCacheForTest(): void;
1
+ export { clearTailwindV4IncrementalGenerateCacheForTest, getTailwindV4IncrementalGenerateCacheStats, getTailwindV4IncrementalGenerateCacheStatsForTest } from './generator/cache-stats';
2
+ export { createTailwindV4Engine } from './generator/engine';
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
- const require_generator = require("./generator-CEnUsjed.js");
2
+ const require_generator = require("./generator-B91GhUJQ.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");
@@ -896,7 +896,7 @@ function warnMissingCssEntries(ctx, tailwindRuntime) {
896
896
  _weapp_tailwindcss_logger.logger.warn("[tailwindcss@4] 未检测到 cssEntries 配置。请传入包含 tailwindcss 引用的 CSS 绝对路径,例如 cssEntries: [\"/absolute/path/to/src/app.css\"],否则 tailwindcss 生成的类名不会参与转译。");
897
897
  }
898
898
  function applyV4CssCalcDefaults(cssCalc, tailwindRuntime) {
899
- const cssCalcOptions = cssCalc ?? true;
899
+ const cssCalcOptions = cssCalc ?? false;
900
900
  if (tailwindRuntime && cssCalcOptions) return ensureDefaultsIncluded(cssCalcOptions);
901
901
  return cssCalcOptions;
902
902
  }
@@ -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 { C as findWorkspaceRoot, D as normalizeStringListOption, E as resolveTailwindcssOptions, Et as resolveCssSourceEntries, Ft as loadTailwindV4DesignSystem, Mt as resolveCssMacroTailwindV4Source, Ot as resolveTailwindV4CssSourceBase, S as findWorkspacePackageDir, St as expandTailwindSourceEntries, T as normalizeTailwindcssRuntimeOptions, Tt as parseConfigParam, _ as groupCssEntriesByBase, b as normalizeCssEntries, bt as FULL_SOURCE_SCAN_PATTERN, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as guessBasedirFromEntries, w as normalizeExtendLengthUnits, wt as normalizeLegacyContentEntries, x as findNearestPackageRoot, xt as createTailwindSourceEntryMatcher, y as isTailwindV4CssEntry } from "./generator-Bv7myuhY.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";
@@ -892,7 +892,7 @@ function warnMissingCssEntries(ctx, tailwindRuntime) {
892
892
  logger.warn("[tailwindcss@4] 未检测到 cssEntries 配置。请传入包含 tailwindcss 引用的 CSS 绝对路径,例如 cssEntries: [\"/absolute/path/to/src/app.css\"],否则 tailwindcss 生成的类名不会参与转译。");
893
893
  }
894
894
  function applyV4CssCalcDefaults(cssCalc, tailwindRuntime) {
895
- const cssCalcOptions = cssCalc ?? true;
895
+ const cssCalcOptions = cssCalc ?? false;
896
896
  if (tailwindRuntime && cssCalcOptions) return ensureDefaultsIncluded(cssCalcOptions);
897
897
  return cssCalcOptions;
898
898
  }
@@ -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 {};