weapp-tailwindcss 5.5.1 → 5.5.3

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 (80) hide show
  1. package/dist/bundlers/shared/css-imports.d.ts +1 -0
  2. package/dist/bundlers/shared/framework-user-css.d.ts +3 -0
  3. package/dist/bundlers/shared/generator-css/output-import-shell.d.ts +6 -2
  4. package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +1 -1
  5. package/dist/bundlers/shared/v4-generation-core.d.ts +1 -0
  6. package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -1
  7. package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +3 -2
  8. package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +1 -0
  9. package/dist/bundlers/vite/generate-bundle/entry-style-graph.d.ts +6 -0
  10. package/dist/bundlers/vite/generate-bundle/runtime-configured-css.d.ts +1 -0
  11. package/dist/bundlers/vite/serve-js-transform.d.ts +1 -1
  12. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +2 -0
  13. package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +1 -1
  14. package/dist/bundlers/webpack/loaders/watch-dependencies.d.ts +3 -1
  15. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +1 -0
  16. package/dist/compiler/runtime-snapshot.d.ts +4 -1
  17. package/dist/{compiler-B0YSc0DY.js → compiler-C9X5Afn4.js} +3 -3
  18. package/dist/{compiler-D2ZJc3uA.cjs → compiler-DMPaUcH6.cjs} +6 -6
  19. package/dist/core.cjs +1 -1
  20. package/dist/core.js +1 -1
  21. package/dist/{css-imports-BFMU7Hpd.cjs → css-imports-DXplvodk.cjs} +29 -0
  22. package/dist/{css-loader-runtime-CSv0lKqV.cjs → css-loader-runtime-DGqsWVua.cjs} +2 -1
  23. package/dist/{defaults-B5ep0ojb.js → defaults-CKx-4LcW.js} +1 -1
  24. package/dist/{defaults-BI9j1znS.cjs → defaults-CiGsr8Xq.cjs} +1 -1
  25. package/dist/defaults.cjs +1 -1
  26. package/dist/defaults.js +1 -1
  27. package/dist/{generator-DsrQ9txU.cjs → generator-BoZIiZD5.cjs} +130 -77
  28. package/dist/{generator-DyXTBPmE.js → generator-C2aWns8n.js} +119 -78
  29. package/dist/generator.cjs +1 -1
  30. package/dist/generator.js +1 -1
  31. package/dist/{gulp-DXeQfvVC.js → gulp-COAAztkm.js} +4 -4
  32. package/dist/{gulp-C9ENAx3f.cjs → gulp-D50z06nw.cjs} +5 -5
  33. package/dist/gulp.cjs +1 -1
  34. package/dist/gulp.js +1 -1
  35. package/dist/{hmr-timing-DNxQm-bN.js → hmr-timing-CTk1uZr9.js} +245 -183
  36. package/dist/{hmr-timing-Cz4IesEM.cjs → hmr-timing-DK0MJKpl.cjs} +5 -5
  37. package/dist/index.cjs +4 -4
  38. package/dist/index.js +4 -4
  39. package/dist/{pipeline-helpers-CSGnR5gh.cjs → pipeline-helpers-BzjYXNTa.cjs} +4 -4
  40. package/dist/postcss.cjs +1 -1
  41. package/dist/postcss.js +1 -1
  42. package/dist/presets.cjs +2 -2
  43. package/dist/presets.js +2 -2
  44. package/dist/rspack.cjs +6 -3
  45. package/dist/rspack.js +6 -3
  46. package/dist/{scoped-generator-kRj_5Axx.js → scoped-generator-C21A7fis.js} +3 -3
  47. package/dist/{scoped-generator-TVjEaOeP.cjs → scoped-generator-CTkuf9Ae.cjs} +3 -3
  48. package/dist/{source-candidate-scan-signature-B7cUxqqX.cjs → source-candidate-scan-signature-4mZDDaKT.cjs} +2 -2
  49. package/dist/{source-candidate-scan-signature-CsP4BQNa.js → source-candidate-scan-signature-BB5DfjO2.js} +2 -2
  50. package/dist/tailwindcss/v4-engine/css-import.d.ts +14 -0
  51. package/dist/{tailwindcss-C-jBBQfw.cjs → tailwindcss-Bji4u8In.cjs} +1 -1
  52. package/dist/{tailwindcss-BK9S7zuq.js → tailwindcss-c4PkOe1F.js} +1 -1
  53. package/dist/{transform-DUPOPZ54.cjs → transform-Cy0ddBWf.cjs} +14 -14
  54. package/dist/{transform-CfOzh007.js → transform-DmLonqPE.js} +14 -14
  55. package/dist/uni-app-x/border-preflight.d.ts +18 -0
  56. package/dist/uni-app-x/style-asset/source-parser.d.ts +2 -0
  57. package/dist/uni-app-x/style-reference-path.d.ts +1 -0
  58. package/dist/uni-app-x/transform.d.ts +2 -0
  59. package/dist/uni-app-x/vite/plugin-options.d.ts +2 -0
  60. package/dist/uni-app-x/vite/style-request.d.ts +5 -0
  61. package/dist/uni-app-x/vite/style-source.d.ts +14 -4
  62. package/dist/uni-app-x/vite/web-sfc-hmr.d.ts +14 -0
  63. package/dist/{v4-generation-core-CRNUU_Rr.cjs → v4-generation-core-DQeiq-g1.cjs} +243 -181
  64. package/dist/vite/web.cjs +1 -1
  65. package/dist/vite/web.js +1 -1
  66. package/dist/{vite-BXe-axax.js → vite-CaUxtQx5.js} +340 -88
  67. package/dist/{vite-D_mAIfTU.cjs → vite-OG66oLpb.cjs} +356 -85
  68. package/dist/vite.cjs +1 -1
  69. package/dist/vite.js +1 -1
  70. package/dist/{watch-dependencies-DLZDrWdH.cjs → watch-dependencies-GbC14Rlt.cjs} +14 -11
  71. package/dist/weapp-tw-css-generation-loader.cjs +3 -2
  72. package/dist/weapp-tw-css-import-rewrite-loader.cjs +11 -10
  73. package/dist/weapp-tw-runtime-classset-loader.cjs +16 -11
  74. package/dist/{web-Cv7ualrU.js → web-Bd-9OHFE.js} +7 -6
  75. package/dist/{web-B2Ea9K4B.cjs → web-CZKIefdl.cjs} +9 -8
  76. package/dist/{webpack-7Um2GFtx.js → webpack-Cyvq3H7Z.js} +38 -23
  77. package/dist/{webpack-Ce04-btG.cjs → webpack-DJGgU27Y.cjs} +37 -23
  78. package/dist/webpack.cjs +1 -1
  79. package/dist/webpack.js +1 -1
  80. package/package.json +7 -5
@@ -1,19 +1,19 @@
1
1
  import { resolveImplicitAppTypeFromViteRoot } from "./framework.js";
2
- import { $ as hasTailwindRootDirectives, At as resolveTailwindV4CssSourceBase, It as getTailwindV4IncrementalGenerateCacheStats, J as splitUserCssLayerBlocks, Lt as filterUnsupportedMiniProgramTailwindV4Candidates, O as resolveTailwindcssOptions, R as hasMiniProgramCssSpecificityPlaceholders, T as omitUndefined, Tt as isFileMatchedByTailwindSourceEntries, V as stripMiniProgramCssSpecificityPlaceholders, W as normalizeEmptyTailwindCustomVariants, Z as hasTailwindApplyDirective, _ as upsertTailwindV4CssSource, a as resolveGeneratorRuntimeBranch, at as removeTailwindSourceDirectives, b as isTailwindV4CssEntry, c as shouldUseNativeAppCssBranch, dt as hasTailwindGeneratedCssMarkers, et as hasTailwindSourceDirectives, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, it as parseImportRequest, l as resolveUniUtsPlatform, m as filterTailwindV4CssSourceRoots, q as hasUserCssLayerBlocks, rt as normalizeTailwindSourceForGenerator, s as shouldUseMiniProgramCssBranch, tt as normalizeTailwindConfigDirectives, x as normalizeCssEntries } from "./generator-DyXTBPmE.js";
3
- import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as resolveTailwindV4CssDependencies, p as discoverTailwindV4CssEntries, r as isUniAppXEnabled } from "./tailwindcss-BK9S7zuq.js";
2
+ import { $ as hasTailwindRootDirectives, At as resolveTailwindV4CssSourceBase, J as splitUserCssLayerBlocks, Nt as parseCssImportSpecifier, O as resolveTailwindcssOptions, Pt as quoteCssImportSpecifier, R as hasMiniProgramCssSpecificityPlaceholders, Rt as getTailwindV4IncrementalGenerateCacheStats, T as omitUndefined, Tt as isFileMatchedByTailwindSourceEntries, V as stripMiniProgramCssSpecificityPlaceholders, W as normalizeEmptyTailwindCustomVariants, Z as hasTailwindApplyDirective, _ as upsertTailwindV4CssSource, a as resolveGeneratorRuntimeBranch, at as removeTailwindSourceDirectives, b as isTailwindV4CssEntry, c as shouldUseNativeAppCssBranch, dt as hasTailwindGeneratedCssMarkers, et as hasTailwindSourceDirectives, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, it as parseImportRequest, l as resolveUniUtsPlatform, m as filterTailwindV4CssSourceRoots, q as hasUserCssLayerBlocks, rt as normalizeTailwindSourceForGenerator, s as shouldUseMiniProgramCssBranch, tt as normalizeTailwindConfigDirectives, x as normalizeCssEntries, zt as filterUnsupportedMiniProgramTailwindV4Candidates } from "./generator-C2aWns8n.js";
3
+ import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as resolveTailwindV4CssDependencies, p as discoverTailwindV4CssEntries, r as isUniAppXEnabled } from "./tailwindcss-c4PkOe1F.js";
4
4
  import "./utils-MVwpU07P.js";
5
- import { A as createCssSourceTraceCacheSignature, B as createSourceCandidateCollector, C as isSourceStyleRequest, D as parseBundlerGeneratedCssMarkerBlocks, E as hasBundlerGeneratedCssMarker, H as isSourceCandidateRequest, I as isPureLocalCssImportWrapper, M as isCssSourceTraceEnabled, O as stripBundlerGeneratedCssMarkers, S as isSourcePreprocessorRequest, T as createBundlerGeneratedCssMarker, U as extractCandidatesFromSource, a as extractMarkedUserLayerComponentsCss, d as runWithConcurrency, f as normalizeMiniProgramGeneratorCssSource, i as validateCandidatesByGenerator, j as createCssTokenSourceMap, k as annotateCssSourceTrace, m as scoreTailwindV4CssSourceFileMatch, o as mergeMarkedUserLayerComponentsCss, p as normalizeMiniProgramImportShell, r as generateTailwindV4Css, s as collectGeneratedRawSourceCandidatesFromCss, t as createHmrTimingRecorder, z as finalizeCompilerShadowRun } from "./hmr-timing-DNxQm-bN.js";
6
- import { E as normalizeFrameworkStylePlatform, G as replaceWxml, K as createDebug, L as createCompilationDependencyChanges, N as recordCompilationDependencyChanges, O as AssetEmissionPlan, a as beginCompilerShadowRun, b as logTailwindcssTarget, f as getCompilerContext, g as vitePluginName, i as disposeCompilerOwner, n as createRuntimeAffectingSourceSignature, v as shouldSkipJsTransform, x as logRuntimeTailwindcssVersion, y as toCustomAttributesEntities } from "./compiler-B0YSc0DY.js";
5
+ import { A as createCssSourceTraceCacheSignature, B as createSourceCandidateCollector, C as isSourceStyleRequest, D as parseBundlerGeneratedCssMarkerBlocks, E as hasBundlerGeneratedCssMarker, H as isSourceCandidateRequest, I as isPureLocalCssImportWrapper, M as isCssSourceTraceEnabled, O as stripBundlerGeneratedCssMarkers, S as isSourcePreprocessorRequest, T as createBundlerGeneratedCssMarker, U as extractCandidatesFromSource, a as collectGeneratedRawSourceCandidatesFromCss, d as normalizeMiniProgramImportShell, f as scoreTailwindV4CssSourceFileMatch, h as mergeMarkedUserLayerComponentsCss, i as validateCandidatesByGenerator, j as createCssTokenSourceMap, k as annotateCssSourceTrace, l as runWithConcurrency, m as extractMarkedUserLayerComponentsCss, r as generateTailwindV4Css, t as createHmrTimingRecorder, u as normalizeMiniProgramGeneratorCssSource, z as finalizeCompilerShadowRun } from "./hmr-timing-CTk1uZr9.js";
6
+ import { E as normalizeFrameworkStylePlatform, G as replaceWxml, K as createDebug, L as createCompilationDependencyChanges, N as recordCompilationDependencyChanges, O as AssetEmissionPlan, a as beginCompilerShadowRun, b as logTailwindcssTarget, f as getCompilerContext, g as vitePluginName, i as disposeCompilerOwner, n as createRuntimeAffectingSourceSignature, v as shouldSkipJsTransform, x as logRuntimeTailwindcssVersion, y as toCustomAttributesEntities } from "./compiler-C9X5Afn4.js";
7
7
  import { i as buildRuntimeCompilationSnapshot, l as updateRuntimeCompilationBuildState, n as hasEmptyCssBlockCandidate, o as createRuntimeCompilationBuildState, r as processCachedTask, t as finalizeMiniProgramCssStructure } from "./final-css-cleanup-B0HUBtiE.js";
8
- import { a as createJsHashSalt, c as hasRuntimeAffectingSourceChanges, d as resolvePluginDisabledState, f as createBuiltinViteStyleInjectorPlugins, g as resolveViteFrameworkProfile, i as createCandidateSignature, l as summarizeStringDiff, m as viteStyleInjectorDelegates, n as createScopedGeneratorRuntime, o as createLinkedImpactSignature, r as createScopedGeneratorSourceTraceMap, s as getSnapshotHash, t as createScopedGeneratorCandidateSignature, u as classifyRuntimeEntry } from "./scoped-generator-kRj_5Axx.js";
9
- import { $ as isMatchingCssSourceFile, A as createGenericWebProductionSourceCandidatesApply, At as resolveViteCssPipelineOutputFileFromSourceFile, B as parseVueRequest, Bt as createViteCssAssetIdentityResolver, C as collectViteProcessedCssSources, Ct as SOURCE_STYLE_OUTPUT_EXT_RE, D as registerGeneratorDependencies$1, Dt as resolveReplayCssOutputFile, E as inferPlatformFromViteOutDir$1, Et as resolveMiniProgramStyleOutputExtension, F as resolveHotSourceModulesByIds, Ft as normalizePath, G as hasSfcStyleSources, Gt as frameworkViteCapabilityProfile, H as shouldApplyViteWebCssCompat, Ht as getActiveViteSourceOutputRelationOwner, I as resolveHotTailwindCssModules, It as resolveViteCssPipelineRequestFile, J as normalizeSfcSourceFileForCompare, K as hasTailwindGenerationSource, L as sendFullReloadForUnresolvedHotUpdate, Lt as slash, M as hasSelfAcceptingNonStyleHotModule, Mt as formatPostcssSourceMap, N as mergeHotModulesByIdentity, Nt as isCSSRequest, O as shouldGenerateCssByGenerator, Ot as resolveViteCssOutputFile, P as resolveHotSourceModules, Pt as isHTMLRequest, Q as hasMatchingStyleFileBase, R as sendSupplementalCssHotUpdates, Rt as createCssHandlerOptionsCache, S as tryFinalizeGenericWebCss, St as CSS_SOURCE_OUTPUT_EXT_RE, T as finalizeWebCss, Tt as normalizeCssSourceForCompare, U as collectChunkModuleIds$3, Ut as withViteSourceOutputRelationOwner, V as resolveViteWebCssCompatOptions, Vt as createViteSourceOutputRelationOwner, W as extractSfcStyleBlocks, Wt as createGenericWebViteCapabilityProfile, X as resolveSfcStyleSourceFromOutputFile, Y as resolveSfcStyleRequestFromKnownSource, Z as resolveSourceStyleSourceFromOutputFile, _ as summarizeStringCache, _t as resolveViteProcessedCssAssetSource, a as createFrameworkProcessedCssRegistry, at as createCssAssetPipelineContext, b as touchMapEntry, bt as isRootStyleOutputFile, c as createViteHmrCssModuleVersionTracker, ct as hasNonCommentCss, d as createViteCssGenerationPlugins, dt as normalizeInjectableCssForTarget, et as appendCss$1, f as createViteRuntimeClassSet, ft as normalizeInjectableCssForTargetWithImports, g as normalizeVitePersistentCacheKey, gt as removeTailwindEntryDirectivesFromCss, h as isMissingInternalCssSource, ht as removeDuplicateUnlinkedRootCssAssetsReferencedByHtml, i as syncFrameworkSourceCandidatesForHotUpdate, it as collectRootStyleBundleCssSources, j as shouldSkipGenericWebProductionSourceCandidates, jt as cleanUrl$1, k as createGenericWebProductionBundleHooks, kt as resolveViteCssPipelineOutputFile, l as createViteHmrCandidateState, lt as isMatchingGeneratedCssMarkerFile, m as hasVitePipelineTailwindGenerationDirective, mt as readAssetSource$2, n as createFrameworkTailwindRootCss, nt as collectImportedStyleFiles, o as createFrameworkPostPlugin, ot as dedupeViteCssResults, p as createRewriteCssImportsPlugins, pt as normalizeMarkerOutputFile, q as isSfcStyleSourceFile, r as createFrameworkSourceScanSession, rt as collectMatchingGeneratedCssMarkerFiles, s as createViteHmrCssModuleVersionFilterPlugin, st as getAssetFile$1, t as createGenericWebVitePlugins, tt as clearAssetSource, u as createFrameworkCssGenerationQueue, ut as isStyleImportRequest, v as createViteCssMemory, vt as isCssOutputFile, w as createCssHandlerOptions, wt as canProcessViteSourceStyleAsCss, x as createViteWebCssFinalizerOutputPlugin, xt as posix, y as shouldCollectTransformedSourceCandidates, yt as isMiniProgramStyleOutputFile, z as resolveViteModuleIdentity, zt as resolveViteCssHandlerExtraOptions } from "./web-Cv7ualrU.js";
10
- import { a as toAbsoluteOutputPath, i as resolveOutputSpecifier, n as resolvePackageDir, r as normalizeOutputPathKey } from "./source-candidate-scan-signature-CsP4BQNa.js";
8
+ import { a as createJsHashSalt, c as hasRuntimeAffectingSourceChanges, d as resolvePluginDisabledState, f as createBuiltinViteStyleInjectorPlugins, g as resolveViteFrameworkProfile, i as createCandidateSignature, l as summarizeStringDiff, m as viteStyleInjectorDelegates, n as createScopedGeneratorRuntime, o as createLinkedImpactSignature, r as createScopedGeneratorSourceTraceMap, s as getSnapshotHash, t as createScopedGeneratorCandidateSignature, u as classifyRuntimeEntry } from "./scoped-generator-C21A7fis.js";
9
+ import { $ as isMatchingCssSourceFile, A as createGenericWebProductionSourceCandidatesApply, At as resolveViteCssPipelineOutputFileFromSourceFile, B as parseVueRequest, Bt as createViteCssAssetIdentityResolver, C as collectViteProcessedCssSources, Ct as SOURCE_STYLE_OUTPUT_EXT_RE, D as registerGeneratorDependencies$1, Dt as resolveReplayCssOutputFile, E as inferPlatformFromViteOutDir$1, Et as resolveMiniProgramStyleOutputExtension, F as resolveHotSourceModulesByIds, Ft as normalizePath, G as hasSfcStyleSources, Gt as frameworkViteCapabilityProfile, H as shouldApplyViteWebCssCompat, Ht as getActiveViteSourceOutputRelationOwner, I as resolveHotTailwindCssModules, It as resolveViteCssPipelineRequestFile, J as normalizeSfcSourceFileForCompare, K as hasTailwindGenerationSource, L as sendFullReloadForUnresolvedHotUpdate, Lt as slash, M as hasSelfAcceptingNonStyleHotModule, Mt as formatPostcssSourceMap, N as mergeHotModulesByIdentity, Nt as isCSSRequest, O as shouldGenerateCssByGenerator, Ot as resolveViteCssOutputFile, P as resolveHotSourceModules, Pt as isHTMLRequest, Q as hasMatchingStyleFileBase, R as sendSupplementalCssHotUpdates, Rt as createCssHandlerOptionsCache, S as tryFinalizeGenericWebCss, St as CSS_SOURCE_OUTPUT_EXT_RE, T as finalizeWebCss, Tt as normalizeCssSourceForCompare, U as collectChunkModuleIds$3, Ut as withViteSourceOutputRelationOwner, V as resolveViteWebCssCompatOptions, Vt as createViteSourceOutputRelationOwner, W as extractSfcStyleBlocks, Wt as createGenericWebViteCapabilityProfile, X as resolveSfcStyleSourceFromOutputFile, Y as resolveSfcStyleRequestFromKnownSource, Z as resolveSourceStyleSourceFromOutputFile, _ as summarizeStringCache, _t as resolveViteProcessedCssAssetSource, a as createFrameworkProcessedCssRegistry, at as createCssAssetPipelineContext, b as touchMapEntry, bt as isRootStyleOutputFile, c as createViteHmrCssModuleVersionTracker, ct as hasNonCommentCss, d as createViteCssGenerationPlugins, dt as normalizeInjectableCssForTarget, et as appendCss$1, f as createViteRuntimeClassSet, ft as normalizeInjectableCssForTargetWithImports, g as normalizeVitePersistentCacheKey, gt as removeTailwindEntryDirectivesFromCss, h as isMissingInternalCssSource, ht as removeDuplicateUnlinkedRootCssAssetsReferencedByHtml, i as syncFrameworkSourceCandidatesForHotUpdate, it as collectRootStyleBundleCssSources, j as shouldSkipGenericWebProductionSourceCandidates, jt as cleanUrl$1, k as createGenericWebProductionBundleHooks, kt as resolveViteCssPipelineOutputFile, l as createViteHmrCandidateState, lt as isMatchingGeneratedCssMarkerFile, m as hasVitePipelineTailwindGenerationDirective, mt as readAssetSource$2, n as createFrameworkTailwindRootCss, nt as collectImportedStyleFiles, o as createFrameworkPostPlugin, ot as dedupeViteCssResults, p as createRewriteCssImportsPlugins, pt as normalizeMarkerOutputFile, q as isSfcStyleSourceFile, r as createFrameworkSourceScanSession, rt as collectMatchingGeneratedCssMarkerFiles, s as createViteHmrCssModuleVersionFilterPlugin, st as getAssetFile$1, t as createGenericWebVitePlugins, tt as clearAssetSource, u as createFrameworkCssGenerationQueue, ut as isStyleImportRequest, v as createViteCssMemory, vt as isCssOutputFile, w as createCssHandlerOptions, wt as canProcessViteSourceStyleAsCss, x as createViteWebCssFinalizerOutputPlugin, xt as posix, y as shouldCollectTransformedSourceCandidates, yt as isMiniProgramStyleOutputFile, z as resolveViteModuleIdentity, zt as resolveViteCssHandlerExtraOptions } from "./web-Bd-9OHFE.js";
10
+ import { a as toAbsoluteOutputPath, i as resolveOutputSpecifier, n as resolvePackageDir, r as normalizeOutputPathKey } from "./source-candidate-scan-signature-BB5DfjO2.js";
11
11
  import { t as logger$1 } from "./logger-BNzxZbZj.js";
12
12
  import fs, { existsSync, readFileSync } from "node:fs";
13
13
  import path from "node:path";
14
14
  import process from "node:process";
15
15
  import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
16
- import { compileCssMacroConditionalComments, containsCssAfterMinify, filterExistingCssRules, isMiniProgramLocalCssImportRequest, mergeCoveredCssRuleDeclarations, mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations, normalizeTailwindcssV4InfinityCalcCss, normalizeUniAppXImportantApplyForSass, parseTailwindCssDirectiveRequest, postcss, restoreUniAppXImportantApplyMarker, transformWebCssCompat, transformWebCssSafeSelectors, unwrapUnsupportedCascadeLayers } from "@weapp-tailwindcss/postcss";
16
+ import { compileCssMacroConditionalComments, containsCssAfterMinify, createCssRuleMatcher, createInjectPreflight, filterExistingCssRules, isMiniProgramLocalCssImportRequest, mergeCoveredCssRuleDeclarations, mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations, normalizeTailwindcssV4InfinityCalcCss, normalizeUniAppXImportantApplyForSass, parseTailwindCssDirectiveRequest, postcss, restoreUniAppXImportantApplyMarker, transformWebCssCompat, transformWebCssSafeSelectors, unwrapUnsupportedCascadeLayers } from "@weapp-tailwindcss/postcss";
17
17
  import { LRUCache } from "lru-cache";
18
18
  import { readFile } from "node:fs/promises";
19
19
  import micromatch from "micromatch";
@@ -21,7 +21,21 @@ import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
21
21
  import { Buffer } from "node:buffer";
22
22
  import { logger } from "@weapp-tailwindcss/logger";
23
23
  import { AsyncLocalStorage } from "node:async_hooks";
24
- import { parse } from "comment-json";
24
+ import scss from "postcss-scss";
25
+ import { NodeTypes } from "@vue/compiler-dom";
26
+ import { parse as parse$1 } from "comment-json";
27
+ //#region src/uni-app-x/style-asset/source-parser.ts
28
+ function parseUniAppXStyleSource(source) {
29
+ return scss.parse(source, { from: void 0 });
30
+ }
31
+ function isUniAppXStyleSourceEmpty(source) {
32
+ try {
33
+ return parseUniAppXStyleSource(source).nodes.every((node) => node.type === "comment");
34
+ } catch {
35
+ return false;
36
+ }
37
+ }
38
+ //#endregion
25
39
  //#region src/uni-app-x/style-asset/harmony-apply.ts
26
40
  const SFC_STYLE_BLOCK_RE$1 = /(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi;
27
41
  function createGeneratedRuleMap(css) {
@@ -45,7 +59,7 @@ function expandUniAppXHarmonyApplyStyles(source, generatedCss) {
45
59
  if (!styleSource.includes("@apply")) return block;
46
60
  let root;
47
61
  try {
48
- root = postcss.parse(styleSource);
62
+ root = parseUniAppXStyleSource(styleSource);
49
63
  } catch {
50
64
  return block;
51
65
  }
@@ -79,6 +93,14 @@ function shouldEnablePageLocalStyle(id, matcher) {
79
93
  return matcher ? matcher(normalizedId) : PAGE_RE.test(normalizedId);
80
94
  }
81
95
  //#endregion
96
+ //#region src/uni-app-x/style-reference-path.ts
97
+ const WINDOWS_SOURCE_RE = /^[a-z]:[\\/]|^[\\/]{2}[^\\/]/i;
98
+ /** 按来源文件的盘符或共享根目录解析,再在 CSS 引用边界统一分隔符。 */
99
+ function resolveStyleReferencePath(sourceFile, request) {
100
+ const paths = WINDOWS_SOURCE_RE.test(sourceFile) ? path.win32 : path;
101
+ return paths.resolve(paths.dirname(sourceFile), request).replaceAll("\\", "/");
102
+ }
103
+ //#endregion
82
104
  //#region src/uni-app-x/style-asset/style-value.ts
83
105
  const GEN_APP_STYLES_RE = /const\s+GenAppStyles\s*=\s*\[_uM\(\[([\s\S]*?)\]\)\]/;
84
106
  const STYLE_ENTRY_RE = /\[\s*("((?:\\.|[^"\\])+)")\s*,\s*(_pS\(_uM\(\[[\s\S]*?\]\)\))\s*\]/g;
@@ -237,7 +259,7 @@ function createStyleValueFromApplySources(sources, utilityStyles) {
237
259
  for (const styleSource of styleSources) {
238
260
  let root;
239
261
  try {
240
- root = postcss.parse(styleSource);
262
+ root = parseUniAppXStyleSource(styleSource);
241
263
  } catch {
242
264
  continue;
243
265
  }
@@ -266,15 +288,14 @@ function createStyleValueFromApplySources(sources, utilityStyles) {
266
288
  return Object.keys(result).length > 0 ? result : void 0;
267
289
  }
268
290
  function resolveReferencePaths(styleSource, sourceId) {
269
- if (!sourceId || !styleSource.includes("@reference")) return styleSource;
270
291
  let root;
271
292
  try {
272
- root = postcss.parse(styleSource);
293
+ root = parseUniAppXStyleSource(styleSource);
273
294
  } catch {
274
295
  return styleSource;
275
296
  }
297
+ if (!sourceId || !styleSource.includes("@reference")) return root.toString();
276
298
  const cleanSourceId = sourceId.replace(/\?.*$/, "");
277
- const pathApi = /^[a-z]:[\\/]/i.test(cleanSourceId) ? path.win32 : path;
278
299
  root.walkAtRules("reference", (rule) => {
279
300
  const quote = rule.params[0];
280
301
  if (quote !== "\"" && quote !== "'") return;
@@ -282,7 +303,7 @@ function resolveReferencePaths(styleSource, sourceId) {
282
303
  if (closingQuoteIndex <= 1) return;
283
304
  const referencePath = rule.params.slice(1, closingQuoteIndex);
284
305
  if (!referencePath.startsWith(".")) return;
285
- rule.params = `${quote}${pathApi.resolve(pathApi.dirname(cleanSourceId), referencePath).replaceAll("\\", "/")}${quote}${rule.params.slice(closingQuoteIndex + 1)}`;
306
+ rule.params = `${quote}${resolveStyleReferencePath(cleanSourceId, referencePath)}${quote}${rule.params.slice(closingQuoteIndex + 1)}`;
286
307
  });
287
308
  return root.toString();
288
309
  }
@@ -294,7 +315,7 @@ function collectUniAppXHarmonyApplyUtilitiesFromSources(sources) {
294
315
  for (const source of sources) for (const styleSource of collectUniAppXHarmonyApplyStyleSourcesFromSource(source)) {
295
316
  let root;
296
317
  try {
297
- root = postcss.parse(styleSource);
318
+ root = parseUniAppXStyleSource(styleSource);
298
319
  } catch {
299
320
  continue;
300
321
  }
@@ -518,7 +539,7 @@ function createUniAppXHarmonyApplyGeneratorSource(applyStyleSources, _applyUtili
518
539
  return applyStyleSources.map((source) => {
519
540
  let root;
520
541
  try {
521
- root = postcss.parse(source);
542
+ root = parseUniAppXStyleSource(source);
522
543
  } catch {
523
544
  return source;
524
545
  }
@@ -1456,7 +1477,7 @@ function shouldKeepRootMiniProgramStyleAsImportShell(enabled) {
1456
1477
  return enabled === true;
1457
1478
  }
1458
1479
  function shouldPreserveFrameworkRootMiniProgramImportShell(options) {
1459
- return !options.isWebGeneratorTarget && options.matchesCss && isRootMiniProgramStyleOutputFile$1(options.file) && isPureLocalCssImportWrapper(options.css) && shouldKeepRootMiniProgramStyleAsImportShell(options.shouldKeep());
1480
+ return !options.isWebGeneratorTarget && options.matchesCss && isRootStyleOutputFile(options.file) && isPureLocalCssImportWrapper(options.css) && shouldKeepRootMiniProgramStyleAsImportShell(options.shouldKeep());
1460
1481
  }
1461
1482
  function resolveFrameworkRootImportShellPlan(options) {
1462
1483
  const isCurrentImportShell = shouldPreserveFrameworkRootMiniProgramImportShell({
@@ -1471,7 +1492,7 @@ function resolveFrameworkRootImportShellPlan(options) {
1471
1492
  return {
1472
1493
  isCurrentImportShell,
1473
1494
  reusableTarget: options.rememberedTarget,
1474
- targetToRemember: importedFile && isRootMiniProgramStyleOutputFile$1(importedFile) ? importedFile : void 0
1495
+ targetToRemember: importedFile && isRootStyleOutputFile(importedFile) ? importedFile : void 0
1475
1496
  };
1476
1497
  }
1477
1498
  if (options.rememberedTarget) return {
@@ -1498,7 +1519,7 @@ function restoreFrameworkRootMiniProgramImportShellAssets(bundle, options) {
1498
1519
  const writeTargets = /* @__PURE__ */ new Map();
1499
1520
  let restored = 0;
1500
1521
  for (const [sourceFile, targetFile] of options.targetByFile) {
1501
- if (!options.matchesCss(sourceFile) || !options.matchesCss(targetFile) || !isRootMiniProgramStyleOutputFile$1(sourceFile) || !isRootMiniProgramStyleOutputFile$1(targetFile) || normalizeOutputPathKey(sourceFile) === normalizeOutputPathKey(targetFile)) continue;
1522
+ if (!options.matchesCss(sourceFile) || !options.matchesCss(targetFile) || !isRootStyleOutputFile(sourceFile) || !isRootStyleOutputFile(targetFile) || normalizeOutputPathKey(sourceFile) === normalizeOutputPathKey(targetFile)) continue;
1502
1523
  const output = Object.entries(bundle).find(([bundleFile, candidate]) => candidate.type === "asset" && normalizeOutputPathKey(candidate.fileName || bundleFile) === normalizeOutputPathKey(sourceFile))?.[1];
1503
1524
  if (output?.type !== "asset") continue;
1504
1525
  const rawSource = output.source.toString();
@@ -1668,6 +1689,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
1668
1689
  if (removableRecords.length === 0) return 0;
1669
1690
  const recordFileKeys = new Set(removableRecords.map((record) => normalizeOutputPathKey(record.file)));
1670
1691
  const recordCss = new Set(removableRecords.map((record) => record.css.trim()));
1692
+ const targetMatcher = createCssRuleMatcher(targetCss);
1671
1693
  let removed = 0;
1672
1694
  for (const [candidateFile, candidateOutput] of Object.entries(bundle)) {
1673
1695
  if (candidateOutput.type !== "asset") continue;
@@ -1676,7 +1698,7 @@ function removeCoveredInjectedSourceAssets(bundle, targetFile, targetCss, record
1676
1698
  const candidateIsRootWebStyle = isRootStyleOutputFile(candidateKey) && !isMiniProgramStyleOutputFile(candidateKey);
1677
1699
  if (candidateIsRootWebStyle && !targetIsRootWebStyle) continue;
1678
1700
  const candidateSource = readAssetSource$2(candidateOutput).trim();
1679
- if (!(recordFileKeys.has(candidateKey) || candidateSource.length > 0 && (recordCss.has(candidateSource) || containsCssAfterMinify(targetCss, candidateSource) || targetIsRootWebStyle && candidateIsRootWebStyle && !hasNonCommentCss(filterExistingCssRules(targetCss, candidateSource).trim())))) continue;
1701
+ if (!(recordFileKeys.has(candidateKey) || candidateSource.length > 0 && (recordCss.has(candidateSource) || targetMatcher.contains(candidateSource) || targetIsRootWebStyle && candidateIsRootWebStyle && !hasNonCommentCss(targetMatcher.filter(candidateSource).trim())))) continue;
1680
1702
  if (candidateIsRootWebStyle) delete bundle[candidateFile];
1681
1703
  else clearAssetSource(candidateOutput);
1682
1704
  options.debug?.("remove injected vite-processed source css asset: %s -> %s", candidateKey, targetFile);
@@ -2062,15 +2084,22 @@ function createTransformFilterSignature(options) {
2062
2084
  //#region src/bundlers/vite/generate-bundle/bundle-markup-candidates.ts
2063
2085
  async function collectBundleMarkupCandidates(options) {
2064
2086
  const { extractSourceCandidates, previousCandidatesByFile, preserveMissingFiles, resolveSourceCandidateFile, rootDir, snapshot, transformFilter } = options;
2065
- const candidatesByFile = preserveMissingFiles ? new Map([...previousCandidatesByFile ?? []].map(([file, candidates]) => [file, new Set(candidates)])) : /* @__PURE__ */ new Map();
2087
+ const candidatesByFile = preserveMissingFiles ? new Map([...previousCandidatesByFile ?? []].map(([file, entry]) => [file, {
2088
+ ...entry,
2089
+ candidates: new Set(entry.candidates)
2090
+ }])) : /* @__PURE__ */ new Map();
2091
+ for (const file of snapshot.removedFiles) candidatesByFile.delete(file);
2066
2092
  await Promise.all(snapshot.entries.map(async (entry) => {
2067
2093
  if (!extractSourceCandidates || entry.type !== "html" || entry.output.type !== "asset" || shouldSkipViteAssetTransform(entry.output, entry.file, rootDir, transformFilter)) return;
2068
2094
  const sourceFile = resolveSourceCandidateFile(entry.file) ?? path.resolve(rootDir, entry.file);
2069
- candidatesByFile.set(sourceFile, await extractSourceCandidates(sourceFile, entry.source));
2095
+ candidatesByFile.set(entry.file, {
2096
+ sourceFile,
2097
+ candidates: await extractSourceCandidates(sourceFile, entry.source)
2098
+ });
2070
2099
  }));
2071
2100
  const valuesForEntries = (entries, filterOptions = {}) => {
2072
2101
  const values = /* @__PURE__ */ new Set();
2073
- for (const [file, candidates] of candidatesByFile) {
2102
+ for (const { sourceFile: file, candidates } of candidatesByFile.values()) {
2074
2103
  if (entries !== void 0 && !isFileMatchedByTailwindSourceEntries(file, entries)) continue;
2075
2104
  if (filterOptions.excludeEntries?.length && isFileMatchedByTailwindSourceEntries(file, filterOptions.excludeEntries)) continue;
2076
2105
  for (const candidate of candidates) values.add(candidate);
@@ -2567,7 +2596,11 @@ async function processViteCssBundleEntry(options) {
2567
2596
  const { activeViteCssCacheFiles, addWatchFile, annotateCssSourceTrace, applyCssResultToBundle, applyViteCssCacheResult, applyViteCssTransformTaskResult, bundle, bundleFiles, cache, collectedBundlerGeneratedCssFiles, configuredTailwindV4CssSourceFileKeysForScope, configuredTailwindV4ExplicitCssEntryFileKeysForScope, context, createCandidateSignature, createCssSourceTraceCacheSignature, createCssTokenSourceMap, createCssTransformShareScopeKey, createInitialCssPipelineContext, createRuntimeAffectingSourceSignature, createScopedGeneratorCandidateSignature, createScopedGeneratorRuntime, createScopedGeneratorSourceTraceMap, createScopedSourceCandidateGetter, createScopedSourceCandidateSourceGetter, cssTaskFactories, currentSubpackageRoots, debug, defaultStyleOutputExtension, emitOrReplayCssAsset, envFlags, executeViteCssTransformTask, file, frameworkRootImportShellTargetByFile, generatorCandidatesChanged, generatorPlatform, generatorRuntime, getConfiguredTailwindV4CssSourceEntries, getCssHandlerOptions, getCssSource, getCssUserHandlerOptions, getLastCssResult, getOriginalCssLayerSource, getRememberedCssSources, getSfcSource, getSourceCandidateSources, getViteProcessedCssAssetResult, getViteProcessedCssAssetResults, hasExplicitConfiguredRootCssEntryForOutput, hasRuntimeAffectingChanges, hasViteProcessedCssResultForSource, isCssAssetProcessed, isCssImportOnlyBundleAsset, isMiniProgramStyleOutputFile, isRootMiniProgramStyleOutputFile, isSubpackageOutputFile, isTemporaryCssAssetFile, isViteProcessedCssAsset, isWebGeneratorTarget, lastCssResultByFile, lastCssSourceHashByFile, markCssAssetProcessed, measureElapsed, metrics, normalizeConfiguredTailwindV4CssEntryFileKey, normalizeGeneratorUserRawSource, normalizeMiniProgramGeneratorRawSource, normalizeOutputPathKey, normalizeRelativeCssConfigDirectives, normalizeViteCssCacheKey, onUpdate, opts, originalEntrySource, originalSource, outDir, processFiles, processViteCssCacheTask, recordCssAssetResult, recordViteProcessedCssAssetResult, rememberCssSource, rememberProcessCacheKey, removeCssCoveredByRootStyleBundleSources, resolveAssetSourceFile, resolveConfiguredCssEntryRootInjectionTarget, resolveConfiguredRootCssSourceStyle, resolveCssAssetIdentity, resolveCssAssetOutputPlan, resolveFrameworkRootImportShellPlan, resolveMatchedCssSourceOutputFile, resolveReplayCssOutputFile, resolveViteCssCompositionPlan, resolveViteCssLinkedImpactSignature, resolveViteCssPipelineOutputFile, resolveViteCssSourcePlan, resolveViteCssTransformCachePlan, resolveViteCssTransformDecisionPlan, rootDir, runtimeLinkedCssFiles, runtimeSignature, runtimeState, selectConfiguredRootCssSourceEntry, sharedCssResultCache, shouldExcludeSubpackageSourceCandidates, shouldGenerateWebCssByGenerator, shouldInjectCssIntoMainFromOutput, shouldKeepCurrentRootCssOutputForConfiguredSource, shouldKeepCurrentRootMiniProgramStyleOutputAsImportShell, shouldKeepRootMiniProgramStyleAsImportShell, shouldMoveRootMiniProgramStyleToImportShellOrigin, shouldPreserveAppCssExtension, shouldProcessTailwindGeneration, shouldSkipRawRememberedCssSource, shouldSkipRawSourceStyleAsset, shouldSkipViteAssetTransform, snapshot, sourceRoot, state, styleHandler, temporaryCssAssetSourceResolver, timeTask, transformFilter, transformRuntime, transformWebTargetCss, useIncrementalMode, usedConfiguredTailwindV4CssSourceFiles } = options;
2568
2597
  metrics.css.total++;
2569
2598
  const assetSourceFile = resolveAssetSourceFile(originalSource, file);
2570
- const rawSource = normalizeRelativeCssConfigDirectives(originalEntrySource, assetSourceFile, outDir, opts);
2599
+ const rawSource = normalizeRelativeCssConfigDirectives(isWebGeneratorTarget ? originalEntrySource : normalizeMiniProgramImportShell(originalEntrySource, {
2600
+ cssOnly: true,
2601
+ outputFile: originalSource.fileName || file,
2602
+ outputFiles: [...bundleFiles, ...lastCssResultByFile.keys()]
2603
+ }), assetSourceFile, outDir, opts);
2571
2604
  const currentRawSourceHasExplicitScanContext = rawSource.includes("@source") || rawSource.includes("@config");
2572
2605
  const cssPipelineContext2 = {
2573
2606
  ...createInitialCssPipelineContext(file),
@@ -2626,7 +2659,10 @@ async function processViteCssBundleEntry(options) {
2626
2659
  }))
2627
2660
  });
2628
2661
  let outputFile = cssAssetOutputPlan.outputFile;
2629
- const resolveMatchedOutputFileForCurrentAsset = cssAssetOutputPlan.resolveMatchedOutputFile;
2662
+ const resolveMatchedOutputFileForCurrentAsset = (sourceFile) => {
2663
+ const matched = cssAssetOutputPlan.resolveMatchedOutputFile(sourceFile);
2664
+ return matched ? frameworkRootImportShellTargetByFile.get(matched) ?? matched : matched;
2665
+ };
2630
2666
  const resolvedFromConfiguredOriginalCssEntry = cssAssetOutputPlan.resolvedFromConfiguredOriginalCssEntry;
2631
2667
  if (cssAssetOutputPlan.reusedRootImportShellTarget) debug("css reuse framework root import shell target: %s -> %s", rootImportShellOutputFile, outputFile);
2632
2668
  activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
@@ -2949,7 +2985,7 @@ async function processViteCssBundleEntry(options) {
2949
2985
  function resolveCssBundleOutputFile(options) {
2950
2986
  const { bundleFiles, defaultStyleOutputExtension, file, isWebGeneratorTarget, opts, pipelineContext, cssPipelineStrategy, shouldPreserveAppCssExtension } = options;
2951
2987
  let outputFile = resolveViteCssOutputFile(file, opts, isWebGeneratorTarget, shouldPreserveAppCssExtension, defaultStyleOutputExtension, bundleFiles);
2952
- if (outputFile === file && isRootMiniProgramStyleOutputFile$1(file) && shouldMoveRootMiniProgramStyleToImportShellOrigin(cssPipelineStrategy?.shouldMoveRootMiniProgramStyleToImportShellOrigin?.({
2988
+ if (outputFile === file && normalizeOutputPathKey(options.assetOutputFile ?? file) === normalizeOutputPathKey(file) && isRootMiniProgramStyleOutputFile$1(file) && shouldMoveRootMiniProgramStyleToImportShellOrigin(cssPipelineStrategy?.shouldMoveRootMiniProgramStyleToImportShellOrigin?.({
2953
2989
  ...pipelineContext,
2954
2990
  file
2955
2991
  }))) outputFile = createRootMiniProgramOriginStyleOutputFile(file);
@@ -2986,7 +3022,10 @@ function createMatchedCssSourceOutputResolver(options) {
2986
3022
  };
2987
3023
  }
2988
3024
  function resolveCssAssetOutputPlan(options) {
2989
- let outputFile = resolveCssBundleOutputFile(options);
3025
+ let outputFile = resolveCssBundleOutputFile({
3026
+ ...options,
3027
+ assetOutputFile: options.rootImportShellOutputFile
3028
+ });
2990
3029
  const reusedRootImportShellTarget = Boolean(options.rootImportShellTarget && !options.isWebGeneratorTarget && (options.opts.cssMatcher(options.rootImportShellOutputFile) || options.opts.cssMatcher(options.file)) && options.shouldReuseRootImportShell());
2991
3030
  if (reusedRootImportShellTarget && options.rootImportShellTarget) outputFile = options.rootImportShellTarget;
2992
3031
  const resolveMatchedOutputFile = createMatchedCssSourceOutputResolver({
@@ -3498,21 +3537,22 @@ function applyViteCssTransformTaskResult(options) {
3498
3537
  }
3499
3538
  //#endregion
3500
3539
  //#region src/bundlers/vite/generate-bundle/css-transform-task.ts
3501
- function resolveGeneratorUserRawSource(options) {
3502
- const bundleUserRawSource = options.vitePipelineCssAsset && !hasBundlerGeneratedCssMarker(options.rawSource) && normalizeCssSourceForCompare(options.rawSource) !== normalizeCssSourceForCompare(options.generatorRawSource) ? options.normalizeMiniProgramGeneratorRawSource(options.normalizeGeneratorUserRawSource(options.rawSource, options.generatorSourceFile, options.assetSourceFile), options.outputFile) : void 0;
3503
- return [options.generatorUserLayerRawSource, bundleUserRawSource].filter((source) => typeof source === "string" && source.trim().length > 0).join("\n");
3540
+ function resolveBundleUserRawSource(options) {
3541
+ return options.vitePipelineCssAsset && !hasBundlerGeneratedCssMarker(options.rawSource) && normalizeCssSourceForCompare(options.rawSource) !== normalizeCssSourceForCompare(options.generatorRawSource) ? options.normalizeMiniProgramGeneratorRawSource(options.normalizeGeneratorUserRawSource(options.rawSource, options.generatorSourceFile, options.assetSourceFile), options.outputFile) : void 0;
3504
3542
  }
3505
3543
  async function executeViteCssTransformTask(options) {
3506
3544
  await options.runtimeState.readyPromise;
3507
3545
  const previousGeneratorCss = options.previousCss && !options.isWebGeneratorTarget ? options.normalizeMiniProgramGeneratorRawSource(options.previousCss, options.outputFile) : options.previousCss;
3508
3546
  if (hasTailwindGenerationSource(options.generatorRawSource) || !options.isWebGeneratorTarget && hasBundlerGeneratedCssMarker(options.rawSource)) {
3509
- const generatorUserRawSource = resolveGeneratorUserRawSource(options);
3547
+ const bundleUserRawSource = resolveBundleUserRawSource(options);
3548
+ const generatorUserRawSource = [options.generatorUserLayerRawSource, options.isWebGeneratorTarget ? bundleUserRawSource : void 0].filter((source) => typeof source === "string" && source.trim().length > 0).join("\n");
3510
3549
  const generated = await (options.generateCss ?? generateTailwindV4Css)({
3511
3550
  cssHandlerOptions: options.generatorCssHandlerOptions,
3512
3551
  cssStage: "framework-processed",
3513
3552
  cssUserHandlerOptions: options.cssUserHandlerOptions,
3514
3553
  debug: options.debug,
3515
3554
  file: options.generatorSourceFile,
3555
+ frameworkProcessedUserCss: options.isWebGeneratorTarget ? void 0 : bundleUserRawSource,
3516
3556
  generatorPlatform: options.generatorPlatform,
3517
3557
  getSourceCandidatesForEntries: options.getSourceCandidatesForEntries,
3518
3558
  opts: options.opts,
@@ -4345,6 +4385,61 @@ function isUniAppXNativeAppOutDir(outDir) {
4345
4385
  return typeof outDir === "string" && /(?:^|[/\\-])(?:\.uvue[/\\])?app-(?:android|ios|harmony)(?:[/\\-]|$)/.test(outDir);
4346
4386
  }
4347
4387
  //#endregion
4388
+ //#region src/uni-app-x/border-preflight.ts
4389
+ const BORDER_PREFLIGHT_CLASS = "weapp-tw-border";
4390
+ /** 框架回放组件样式后恢复基础规则的顺序,确保作者 class 可以覆盖重置。 */
4391
+ function hoistUniAppXBorderPreflight(css) {
4392
+ if (!css.includes("weapp-tw-border")) return css;
4393
+ const root = postcss.parse(css);
4394
+ const resets = root.nodes.filter((node) => node.type === "rule" && node.selector === `.weapp-tw-border`);
4395
+ const anchor = root.nodes.find((node) => !resets.includes(node) && node.type !== "comment" && !(node.type === "atrule" && ["charset", "import"].includes(node.name)));
4396
+ if (!anchor || resets.length === 0) return css;
4397
+ for (const reset of resets) {
4398
+ reset.remove();
4399
+ root.insertBefore(anchor, reset);
4400
+ }
4401
+ return root.toString();
4402
+ }
4403
+ /** uni-app x 移除通配符 preflight 后,用独立基础类承载用户配置的边框默认值。 */
4404
+ function createUniAppXBorderPreflight(options) {
4405
+ const declarations = createInjectPreflight(options)().filter(({ prop }) => prop === "border" || prop.startsWith("border-"));
4406
+ if (declarations.length === 0) return;
4407
+ const rule = postcss.rule({ selector: `.${BORDER_PREFLIGHT_CLASS}` });
4408
+ for (const declaration of declarations) rule.append(postcss.decl(declaration));
4409
+ return rule.toString();
4410
+ }
4411
+ function resolveUniAppXBorderPreflightOptions(options, isWeb) {
4412
+ const borderPreflight = isWeb ? void 0 : createUniAppXBorderPreflight(options.cssPreflight);
4413
+ return borderPreflight ? {
4414
+ borderPreflight,
4415
+ borderPreflightRange: options.cssPreflightRange
4416
+ } : {};
4417
+ }
4418
+ function shouldInjectBorderPreflight(node, range) {
4419
+ return range === "all" ? ![
4420
+ "template",
4421
+ "slot",
4422
+ "block"
4423
+ ].includes(node.tag) : node.tag === "view" || node.tag === "text";
4424
+ }
4425
+ /** 在既有 class 转换完成后插入基础类,保持 utility 与动态绑定的原始顺序。 */
4426
+ function injectBorderPreflightClass(ms, node, offset) {
4427
+ const attribute = node.props.find((prop) => prop.type === NodeTypes.ATTRIBUTE && prop.name === "class");
4428
+ if (attribute?.type === NodeTypes.ATTRIBUTE) {
4429
+ if (attribute.value) {
4430
+ if (attribute.value.content.split(/\s+/).includes("weapp-tw-border")) return;
4431
+ const start = offset + attribute.value.loc.start.offset;
4432
+ if (/^["']/.test(attribute.value.loc.source)) ms.prependRight(start + 1, `${BORDER_PREFLIGHT_CLASS} `);
4433
+ else {
4434
+ ms.prependRight(start, `"${BORDER_PREFLIGHT_CLASS} `);
4435
+ ms.appendLeft(offset + attribute.value.loc.end.offset, "\"");
4436
+ }
4437
+ } else ms.appendLeft(offset + attribute.loc.end.offset, `="${BORDER_PREFLIGHT_CLASS}"`);
4438
+ return;
4439
+ }
4440
+ ms.appendLeft(offset + node.loc.start.offset + node.tag.length + 1, ` class="${BORDER_PREFLIGHT_CLASS}"`);
4441
+ }
4442
+ //#endregion
4348
4443
  //#region src/uni-app-x/style-isolation.ts
4349
4444
  const manifestCache = /* @__PURE__ */ new Map();
4350
4445
  function resolveUniAppXStyleIsolationEnabled(root) {
@@ -4356,7 +4451,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
4356
4451
  let enabled = false;
4357
4452
  try {
4358
4453
  const raw = fs.readFileSync(manifestPath, "utf8");
4359
- enabled = `${parse(raw)["uni-app-x"]?.styleIsolationVersion ?? ""}` === "2";
4454
+ enabled = `${parse$1(raw)["uni-app-x"]?.styleIsolationVersion ?? ""}` === "2";
4360
4455
  } catch {
4361
4456
  enabled = false;
4362
4457
  }
@@ -4526,7 +4621,6 @@ function createUniAppXNativeBuildTargetResolver(getResolvedConfig) {
4526
4621
  const UVUE_NVUE_RE$1 = /\.(?:uvue|nvue)$/;
4527
4622
  const CSS_MODULE_EXPORT_RE = /^\s*export\s+default\s+(?:\{|\w|\[\])/;
4528
4623
  const RELATIVE_REFERENCE_RE = /@reference\s+(["'])(\.\.?[\\/][^"']+)\1\s*;?/g;
4529
- const WINDOWS_ABSOLUTE_PATH_RE$1 = /^[a-z]:[\\/]/i;
4530
4624
  function isPreprocessorRequest(id, lang) {
4531
4625
  return isSourcePreprocessorRequest(id, lang);
4532
4626
  }
@@ -4539,10 +4633,8 @@ function isCssModuleExport(code) {
4539
4633
  function normalizeRelativeTailwindReferences(code, id) {
4540
4634
  if (!code.includes("@reference")) return code;
4541
4635
  const sourceFile = cleanUrl$1(id);
4542
- const pathApi = WINDOWS_ABSOLUTE_PATH_RE$1.test(sourceFile) ? path.win32 : path;
4543
- const sourceDir = pathApi.dirname(sourceFile);
4544
4636
  return code.replace(RELATIVE_REFERENCE_RE, (_full, quote, request) => {
4545
- return `@reference ${quote}${pathApi.resolve(sourceDir, request).replace(/\\/g, "/")}${quote};`;
4637
+ return `@reference ${quote}${resolveStyleReferencePath(sourceFile, request)}${quote};`;
4546
4638
  });
4547
4639
  }
4548
4640
  function resolvePreprocessorTransform(code, id, lang, options) {
@@ -4556,12 +4648,64 @@ function resolvePreprocessorTransform(code, id, lang, options) {
4556
4648
  }
4557
4649
  if (!options.isNativeAppStyleTarget) return { result: void 0 };
4558
4650
  }
4651
+ function reportStyleWarnings(result) {
4652
+ const warnings = typeof result.warnings === "function" ? result.warnings() : [];
4653
+ for (const warning of warnings) logger$1.warn(warning.toString());
4654
+ }
4559
4655
  //#endregion
4560
4656
  //#region src/uni-app-x/vite/style-source.ts
4561
4657
  const VITE_CSS_HMR_MODULE_RE = /\b(?:const\s+__vite__css\s*=|__vite__updateStyle\s*\()/;
4562
- function resolveUniAppXStyleSource(code, query) {
4563
- if (!query.vue || query.type !== "style") return { code };
4658
+ function createUniAppXSfcStyleSources() {
4659
+ const authoredByFile = /* @__PURE__ */ new Map();
4660
+ const generatedByFile = /* @__PURE__ */ new Map();
4661
+ const generatedIndicesByFile = /* @__PURE__ */ new Map();
4662
+ function getGenerated(id, index) {
4663
+ const file = cleanUrl$1(id);
4664
+ if (authoredByFile.get(file)?.[index]) return;
4665
+ return generatedByFile.get(file)?.get(index) ?? (generatedIndicesByFile.get(file)?.has(index) ? "" : void 0);
4666
+ }
4667
+ return {
4668
+ rememberSource(id, source) {
4669
+ authoredByFile.set(cleanUrl$1(id), extractSfcStyleBlocks(source));
4670
+ },
4671
+ rememberGenerated(id, source) {
4672
+ const file = cleanUrl$1(id);
4673
+ const authoredCount = authoredByFile.get(file)?.length ?? 0;
4674
+ const generated = /* @__PURE__ */ new Map();
4675
+ const generatedIndices = generatedIndicesByFile.get(file) ?? /* @__PURE__ */ new Set();
4676
+ for (const [index, style] of extractSfcStyleBlocks(source).entries()) if (index >= authoredCount) {
4677
+ generated.set(index, style.source);
4678
+ generatedIndices.add(index);
4679
+ }
4680
+ generatedByFile.set(file, generated);
4681
+ generatedIndicesByFile.set(file, generatedIndices);
4682
+ },
4683
+ getGenerated,
4684
+ hasGenerated(id) {
4685
+ return Boolean(generatedByFile.get(cleanUrl$1(id))?.size);
4686
+ },
4687
+ load(id, index) {
4688
+ const file = cleanUrl$1(id);
4689
+ const style = authoredByFile.get(file)?.[index];
4690
+ if (!style) {
4691
+ const generated = getGenerated(file, index);
4692
+ return generated === void 0 ? void 0 : {
4693
+ code: generated,
4694
+ map: null
4695
+ };
4696
+ }
4697
+ const normalized = normalizeUniAppXImportantApplyForSass(style.source);
4698
+ return normalized === style.source ? void 0 : {
4699
+ code: normalized,
4700
+ map: null
4701
+ };
4702
+ }
4703
+ };
4704
+ }
4705
+ function resolveUniAppXStyleSource(code, query, generatedSource) {
4564
4706
  if (VITE_CSS_HMR_MODULE_RE.test(code)) return { skip: true };
4707
+ if (!query.vue || query.type !== "style") return { code };
4708
+ if (generatedSource !== void 0) return { code: generatedSource };
4565
4709
  const styleBlocks = extractSfcStyleBlocks(code);
4566
4710
  if (styleBlocks.length === 0) return { code };
4567
4711
  const style = styleBlocks[query.index ?? 0];
@@ -4603,6 +4747,37 @@ function createUniAppXWebLocalStyleBridge(isEnabled, hmrCssModuleVersions) {
4603
4747
  };
4604
4748
  }
4605
4749
  //#endregion
4750
+ //#region src/uni-app-x/vite/web-sfc-hmr.ts
4751
+ function createUniAppXWebSfcHmr(options) {
4752
+ const sources = /* @__PURE__ */ new WeakMap();
4753
+ function enabled(ctx) {
4754
+ return options.isEnabled() && /\.(?:uvue|nvue)$/.test(ctx.file) && typeof ctx.read === "function";
4755
+ }
4756
+ return {
4757
+ async prepare(ctx) {
4758
+ if (!enabled(ctx)) return;
4759
+ const source = await ctx.read();
4760
+ sources.set(ctx, source);
4761
+ const result = await options.transform(source, ctx.file);
4762
+ ctx.read = async () => result?.code ?? source;
4763
+ },
4764
+ async finish(ctx) {
4765
+ if (!enabled(ctx)) return false;
4766
+ options.hmrCssModuleVersions?.clear();
4767
+ const source = sources.get(ctx) ?? await ctx.read();
4768
+ if (hasUniAppXImportantApply(source, normalizeUniAppXImportantApplyForSass)) {
4769
+ ctx.server.ws.send({
4770
+ type: "full-reload",
4771
+ path: ctx.file
4772
+ });
4773
+ return true;
4774
+ }
4775
+ if (!sources.has(ctx)) await options.transform(source, ctx.file);
4776
+ return false;
4777
+ }
4778
+ };
4779
+ }
4780
+ //#endregion
4606
4781
  //#region src/uni-app-x/vite/asset-task.ts
4607
4782
  function resolveUniAppXJsTransformEnabled(uniAppX) {
4608
4783
  return uniAppX === void 0 ? true : isUniAppXEnabled(uniAppX);
@@ -4646,7 +4821,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
4646
4821
  //#region src/uni-app-x/vite.ts
4647
4822
  let transformUVuePromise;
4648
4823
  function loadTransformUVue() {
4649
- transformUVuePromise ?? (transformUVuePromise = import("./transform-CfOzh007.js").then((mod) => mod.transformUVue));
4824
+ transformUVuePromise ?? (transformUVuePromise = import("./transform-DmLonqPE.js").then((mod) => mod.transformUVue));
4650
4825
  return transformUVuePromise;
4651
4826
  }
4652
4827
  const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
@@ -4658,8 +4833,13 @@ function createUniAppXPlugins(options) {
4658
4833
  const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
4659
4834
  const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
4660
4835
  const nativeLocalStyleModuleIds = /* @__PURE__ */ new Set();
4661
- const knownSfcSources = /* @__PURE__ */ new Map();
4836
+ const sfcStyleSources = createUniAppXSfcStyleSources();
4662
4837
  const pendingSfcTransforms = /* @__PURE__ */ new Map();
4838
+ const webSfcHmr = createUniAppXWebSfcHmr({
4839
+ isEnabled: () => isEnabled() && isWebGeneratorTarget() && getResolvedConfig()?.command === "serve",
4840
+ transform: (source, id) => runTransformSfc(source, id, {}),
4841
+ hmrCssModuleVersions
4842
+ });
4663
4843
  const webLocalStyle = createUniAppXWebLocalStyleBridge(isWebGeneratorTarget, hmrCssModuleVersions);
4664
4844
  let componentLocalStyleEnabled;
4665
4845
  const isNativeAppBuildTarget = createUniAppXNativeBuildTargetResolver(getResolvedConfig);
@@ -4715,10 +4895,6 @@ function createUniAppXPlugins(options) {
4715
4895
  }
4716
4896
  return styleHandlerOptions;
4717
4897
  }
4718
- function reportStyleWarnings(result) {
4719
- const warnings = typeof result.warnings === "function" ? result.warnings() : [];
4720
- for (const warning of warnings) logger$1.warn(warning.toString());
4721
- }
4722
4898
  async function transformStyle(code, id, query, hookContext) {
4723
4899
  const isNativeStyle = isNativeAppBuildTarget(id);
4724
4900
  const parsed = query ?? parseVueRequest(id).query;
@@ -4772,19 +4948,17 @@ function createUniAppXPlugins(options) {
4772
4948
  }, {
4773
4949
  name: "weapp-tailwindcss:uni-app-x:css:pre",
4774
4950
  enforce: "pre",
4951
+ handleHotUpdate: {
4952
+ order: "pre",
4953
+ handler: (ctx) => webSfcHmr.prepare(ctx)
4954
+ },
4775
4955
  load: {
4776
4956
  order: "pre",
4777
4957
  async handler(id) {
4778
4958
  const { filename, query } = parseVueRequest(id);
4779
4959
  if (!query.vue || query.type !== "style" || !UVUE_NVUE_RE.test(filename)) return;
4780
- const source = knownSfcSources.get(filename);
4781
- const style = source ? extractSfcStyleBlocks(source)[query.index ?? 0] : void 0;
4782
- if (!style) return;
4783
- const normalized = normalizeUniAppXImportantApplyForSass(style.source);
4784
- return normalized === style.source ? void 0 : {
4785
- code: normalized,
4786
- map: null
4787
- };
4960
+ await pendingSfcTransforms.get(cleanUrl$1(filename));
4961
+ return sfcStyleSources.load(filename, query.index ?? 0);
4788
4962
  }
4789
4963
  },
4790
4964
  async transform(code, id) {
@@ -4792,9 +4966,10 @@ function createUniAppXPlugins(options) {
4792
4966
  await runtimeState.readyPromise;
4793
4967
  const { filename, query } = parseVueRequest(id);
4794
4968
  if (query.vue && query.type === "style") await pendingSfcTransforms.get(cleanUrl$1(filename));
4795
- const resolvedSource = resolveUniAppXStyleSource(code, query);
4969
+ const generatedSource = sfcStyleSources.getGenerated(filename, query.index ?? 0);
4970
+ const resolvedSource = resolveUniAppXStyleSource(code, query, generatedSource);
4796
4971
  if (resolvedSource.skip) return;
4797
- const styleCode = query.vue && query.type === "style" ? webLocalStyle.appendToStyle(resolvedSource.code, id) : resolvedSource.code;
4972
+ const styleCode = query.vue && query.type === "style" && generatedSource === void 0 && !sfcStyleSources.hasGenerated(filename) ? webLocalStyle.appendToStyle(resolvedSource.code, id) : resolvedSource.code;
4798
4973
  const preprocessorCode = query.vue && query.type === "style" ? normalizeUniAppXImportantApplyForSass(styleCode) : styleCode;
4799
4974
  const preprocessor = resolvePreprocessorTransform(preprocessorCode, id, query.lang, {
4800
4975
  isIosPlatform,
@@ -4804,11 +4979,14 @@ function createUniAppXPlugins(options) {
4804
4979
  code: preprocessorCode,
4805
4980
  map: null
4806
4981
  } : void 0);
4807
- return transformStyle(preprocessorCode, id, query, this);
4982
+ return await transformStyle(preprocessorCode, id, query, this) ?? (preprocessorCode !== code ? {
4983
+ code: preprocessorCode,
4984
+ map: null
4985
+ } : void 0);
4808
4986
  }
4809
4987
  }];
4810
4988
  async function transformSfc(code, id, context) {
4811
- knownSfcSources.set(cleanUrl$1(id), code);
4989
+ sfcStyleSources.rememberSource(id, code);
4812
4990
  if (isWebGeneratorTarget()) for (const style of extractSfcStyleBlocks(code)) webCssEntryDiagnostics?.observeSourceImports(style.source, id);
4813
4991
  if (isNativeAppBuildTarget(id)) {
4814
4992
  nativeLocalStyleModuleIds.add(id);
@@ -4831,6 +5009,7 @@ function createUniAppXPlugins(options) {
4831
5009
  ...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
4832
5010
  ...enablePageLocalStyle ? { enablePageLocalStyle } : {},
4833
5011
  native: true,
5012
+ ...resolveUniAppXBorderPreflightOptions(options, isWebGeneratorTarget()),
4834
5013
  pageMatcher: resolvedUniAppXOptions.componentLocalStyles.pageMatcher,
4835
5014
  ...isWebGeneratorTarget() && customAttributesEntities.length > 0 ? { webCustomAttributeDeep: true } : {},
4836
5015
  ...isWebGeneratorTarget() ? { onWebLocalStyleRules: (rules) => {
@@ -4839,6 +5018,7 @@ function createUniAppXPlugins(options) {
4839
5018
  } } : {}
4840
5019
  });
4841
5020
  const result = Object.keys(transformOptions).length > 0 ? transformUVue(code, id, jsHandler, currentRuntimeSet, transformOptions) : transformUVue(code, id, jsHandler, currentRuntimeSet);
5021
+ sfcStyleSources.rememberGenerated(id, isWebGeneratorTarget() ? result?.code ?? "" : "");
4842
5022
  if (!result?.code) return result;
4843
5023
  harmonyApply.rememberSource(result.code, id);
4844
5024
  const expandedCode = await harmonyApply.expandStyles(result.code, id, context);
@@ -4867,7 +5047,9 @@ function createUniAppXPlugins(options) {
4867
5047
  order: "pre",
4868
5048
  async handler(code, id) {
4869
5049
  if (!isEnabled()) return;
4870
- if (!UVUE_NVUE_QUERY_RE.test(id)) return;
5050
+ const { query } = parseVueRequest(id);
5051
+ if (!UVUE_NVUE_QUERY_RE.test(id) || query.vue && query.type === "style") return;
5052
+ if (isWebGeneratorTarget() && query.vue && query.type) return;
4871
5053
  return runTransformSfc(code, id, this);
4872
5054
  }
4873
5055
  },
@@ -4876,17 +5058,7 @@ function createUniAppXPlugins(options) {
4876
5058
  async handler(ctx) {
4877
5059
  if (!isEnabled() || getResolvedConfig()?.command !== "serve") return;
4878
5060
  if (!UVUE_NVUE_RE.test(ctx.file) && !isCSSRequest(ctx.file)) return;
4879
- if (isWebGeneratorTarget() && UVUE_NVUE_RE.test(ctx.file) && typeof ctx.read === "function") {
4880
- const source = await ctx.read();
4881
- if (hasUniAppXImportantApply(source, normalizeUniAppXImportantApplyForSass)) {
4882
- ctx.server.ws.send({
4883
- type: "full-reload",
4884
- path: ctx.file
4885
- });
4886
- return [];
4887
- }
4888
- await runTransformSfc(source, ctx.file, this);
4889
- }
5061
+ if (await webSfcHmr.finish(ctx)) return [];
4890
5062
  return webLocalStyle.handleHotUpdate(ctx) ?? nativeHmrReloader.handleHotUpdate(ctx);
4891
5063
  }
4892
5064
  },
@@ -5146,8 +5318,13 @@ async function processRememberedCssReplay(options) {
5146
5318
  const rememberedKeys = replayableRememberedGroup.map((item) => item.key);
5147
5319
  const rememberedCssSource = mergeRememberedCssSources(replayableRememberedGroup.map((item) => item.remembered), outputFile);
5148
5320
  if (!rememberedCssSource) continue;
5149
- const { rawSource, sourceFile } = rememberedCssSource;
5150
- const generatorRawSource = isWebGeneratorTarget ? rawSource : normalizeMiniProgramGeneratorCssSource(rawSource, outputFile);
5321
+ const { sourceFile } = rememberedCssSource;
5322
+ const rawSource = isWebGeneratorTarget ? rememberedCssSource.rawSource : normalizeMiniProgramImportShell(rememberedCssSource.rawSource, {
5323
+ cssOnly: true,
5324
+ outputFile,
5325
+ outputFiles: [...bundleFiles, ...lastCssResultByFile.keys()]
5326
+ });
5327
+ const generatorRawSource = isWebGeneratorTarget ? rawSource : normalizeMiniProgramGeneratorCssSource(rawSource, outputFile, [...bundleFiles, ...lastCssResultByFile.keys()]);
5151
5328
  activeViteCssCacheFiles.add(normalizeViteCssCacheKey(outputFile));
5152
5329
  activeViteCssCacheFiles.add(normalizeViteCssCacheKey(sourceFile));
5153
5330
  const outputCssHandlerOptions = getCssHandlerOptions(rememberedOutputFile);
@@ -5228,7 +5405,7 @@ async function processRememberedCssReplay(options) {
5228
5405
  if (shouldEmitRememberedReplayCssAsset) emitRememberedCssAsset(css);
5229
5406
  metrics.css.elapsed += measureElapsed(start);
5230
5407
  metrics.css.transformed++;
5231
- onUpdate(outputFile, rawSource, css);
5408
+ onUpdate(outputFile, rememberedCssSource.rawSource, css);
5232
5409
  debug("css replay preserve local import shell: %s", outputFile);
5233
5410
  }));
5234
5411
  continue;
@@ -5268,7 +5445,7 @@ async function processRememberedCssReplay(options) {
5268
5445
  if (shouldEmitRememberedReplayCssAsset) emitRememberedCssAsset(css);
5269
5446
  metrics.css.elapsed += measureElapsed(start);
5270
5447
  metrics.css.transformed++;
5271
- onUpdate(outputFile, rawSource, css);
5448
+ onUpdate(outputFile, rememberedCssSource.rawSource, css);
5272
5449
  debug("css replay handle: %s", outputFile);
5273
5450
  }));
5274
5451
  }
@@ -5352,7 +5529,7 @@ function createConfiguredCssRootResolvers(options) {
5352
5529
  if (matchedOriginalEntry && outputFile.replace(/[?#].*$/, "").endsWith(".css")) return matchedOriginalEntry;
5353
5530
  const shouldRequireExplicitEntry = !options.cssPipelineContext.currentGeneratorBranch.isWeb && options.opts.cssMatcher(outputFile) && isRootStyleOutputFile(outputFile);
5354
5531
  const generationEntries = entries.filter((entry) => hasTailwindGenerationSource(entry.source) && (!shouldRequireExplicitEntry || explicitFileKeys.has(normalizeEntryFile(entry.file))));
5355
- const matchedOutputEntries = generationEntries.filter((entry) => normalizeOutputPathKey(resolveEntryOutputFile(entry.file).replace(/[?#].*$/, "")) === normalizeOutputPathKey(outputFile.replace(/[?#].*$/, "")));
5532
+ const matchedOutputEntries = generationEntries.filter((entry) => normalizeOutputPathKey(resolveEntryOutputFile(entry.file).replace(/[?#].*$/, "")) === normalizeOutputPathKey(outputFile.replace(/[?#].*$/, "")) || (originalFileNames?.length ?? 0) === 0 && normalizeOutputPathKey(options.rootImportShellTargets?.get(resolveEntryOutputFile(entry.file)) ?? "") === normalizeOutputPathKey(outputFile.replace(/[?#].*$/, "")));
5356
5533
  if (matchedOutputEntries.length === 1) return matchedOutputEntries[0];
5357
5534
  if (!shouldSelectRootOutput(outputFile)) return;
5358
5535
  if (generationEntries.length <= 1) return generationEntries[0];
@@ -5416,7 +5593,7 @@ function createConfiguredCssRootResolvers(options) {
5416
5593
  }
5417
5594
  //#endregion
5418
5595
  //#region src/bundlers/vite/generate-bundle/runtime-linked-css.ts
5419
- const MINI_PROGRAM_TEMPLATE_OUTPUT_EXT_RE = /\.(?:wxml|axml|jxml|ksml|ttml|qml|tyml|xhsml|swan)$/i;
5596
+ const MINI_PROGRAM_TEMPLATE_OUTPUT_EXT_RE = /\.(?:wxml|axml|jxml|ksml|ttml|qml|qxml|tyml|xhsml|swan)$/i;
5420
5597
  const JS_STYLE_IMPORT_RE = /\b(?:import|require)\s*(?:\(\s*)?["']([^"']+\.(?:css|less|sass|scss|styl|stylus|pcss|postcss))(?:[?#][^"']*)?["']/g;
5421
5598
  function addSiblingCssFile(files, file, extensionByStem, fallbackExtension) {
5422
5599
  const templateMatch = file.replace(/[?#].*$/, "").match(MINI_PROGRAM_TEMPLATE_OUTPUT_EXT_RE);
@@ -5897,7 +6074,7 @@ function createGenerateBundleHook$1(context) {
5897
6074
  const outDir = resolvedConfig?.build?.outDir ? path.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
5898
6075
  const defaultStyleOutputExtension = resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) });
5899
6076
  const normalizeMiniProgramGeneratorRawSource = (source, outputFile) => {
5900
- return isWebGeneratorTarget ? source : normalizeMiniProgramGeneratorCssSource(source, outputFile);
6077
+ return isWebGeneratorTarget ? source : normalizeMiniProgramGeneratorCssSource(source, outputFile, [...Object.keys(bundle), ...lastCssResultByFile.keys()]);
5901
6078
  };
5902
6079
  await runtimeState.readyPromise;
5903
6080
  debug("start");
@@ -5957,6 +6134,7 @@ function createGenerateBundleHook$1(context) {
5957
6134
  currentSubpackageRoots,
5958
6135
  defaultStyleOutputExtension,
5959
6136
  entries: configuredTailwindV4CssSourceEntriesForScope,
6137
+ rootImportShellTargets: frameworkRootImportShellTargetByFile,
5960
6138
  explicitCssEntryFiles: configuredTailwindV4ExplicitCssEntryFiles,
5961
6139
  isWebGeneratorTarget,
5962
6140
  opts,
@@ -6521,6 +6699,55 @@ function createGenerateBundleHook(context) {
6521
6699
  };
6522
6700
  }
6523
6701
  //#endregion
6702
+ //#region src/bundlers/vite/generate-bundle/entry-style-graph.ts
6703
+ function linkEntryChunkStyles(bundle, options) {
6704
+ const assets = new Map(Object.entries(bundle).flatMap(([key, output]) => output.type === "asset" ? [[normalizeOutputPathKey(output.fileName || key), output]] : []));
6705
+ const imports = /* @__PURE__ */ new Map();
6706
+ for (const [file, asset] of assets) {
6707
+ if (!options.matchesCss(file)) continue;
6708
+ const targets = /* @__PURE__ */ new Set();
6709
+ postcss.parse(asset.source.toString()).walkAtRules("import", (rule) => {
6710
+ const request = parseCssImportSpecifier(rule.params)?.specifier;
6711
+ if (request && !/^(?:[a-z][a-z\d+.-]*:|\/\/|\/)/i.test(request)) {
6712
+ const target = path.posix.normalize(path.posix.join(path.posix.dirname(file), request));
6713
+ if (assets.has(target)) targets.add(target);
6714
+ }
6715
+ });
6716
+ imports.set(file, targets);
6717
+ }
6718
+ const reaches = (from, target, visited = /* @__PURE__ */ new Set()) => {
6719
+ if (from === target) return true;
6720
+ if (visited.has(from)) return false;
6721
+ visited.add(from);
6722
+ return [...imports.get(from) ?? []].some((next) => reaches(next, target, visited));
6723
+ };
6724
+ for (const chunk of Object.values(bundle)) {
6725
+ if (chunk.type !== "chunk" || !chunk.isEntry) continue;
6726
+ const entry = path.posix.parse(normalizeOutputPathKey(chunk.fileName));
6727
+ const roots = [...assets].filter(([file]) => {
6728
+ const style = path.posix.parse(file);
6729
+ return options.matchesCss(file) && style.dir === entry.dir && style.name === entry.name;
6730
+ });
6731
+ if (roots.length !== 1) continue;
6732
+ const [file, asset] = roots[0];
6733
+ const original = asset.source.toString();
6734
+ const requests = [];
6735
+ for (const id of Object.keys(chunk.modules ?? {})) {
6736
+ const output = options.resolveOutputFile(id);
6737
+ const target = output && normalizeOutputPathKey(output);
6738
+ if (!target || !imports.has(target) || reaches(file, target) || reaches(target, file)) continue;
6739
+ imports.get(file).add(target);
6740
+ const relative = path.posix.relative(path.posix.dirname(file), target);
6741
+ requests.push(`@import ${quoteCssImportSpecifier(relative.startsWith(".") ? relative : `./${relative}`)};\n`);
6742
+ }
6743
+ if (requests.length > 0) {
6744
+ const next = requests.join("") + original;
6745
+ asset.source = next;
6746
+ options.onUpdate?.(file, original, next);
6747
+ }
6748
+ }
6749
+ }
6750
+ //#endregion
6524
6751
  //#region src/bundlers/vite/css-finalizer/plugin.ts
6525
6752
  function createViteCssFinalizerOutputPlugin(context) {
6526
6753
  return {
@@ -6607,6 +6834,17 @@ function createViteCssFinalizerOutputPlugin(context) {
6607
6834
  finalCssAssetFiles.add(file);
6608
6835
  opts.onUpdate(file, original, generated);
6609
6836
  };
6837
+ const linkEntryStyles = () => {
6838
+ if (isWebGeneratorTarget) return;
6839
+ linkEntryChunkStyles(bundle, {
6840
+ matchesCss: opts.cssMatcher,
6841
+ onUpdate: trackFinalCssAssetUpdate,
6842
+ resolveOutputFile: (id) => {
6843
+ if (!opts.cssMatcher(id) || id.includes("?")) return;
6844
+ return resolveViteCssPipelineOutputFile(id, opts, rootDir, false, false, sourceRoot, resolveMiniProgramStyleOutputExtension({ files: Object.keys(bundle) }), Object.keys(bundle));
6845
+ }
6846
+ });
6847
+ };
6610
6848
  restoreFrameworkRootMiniProgramImportShellAssets(bundle, {
6611
6849
  debug,
6612
6850
  isWebGeneratorTarget,
@@ -6713,6 +6951,7 @@ function createViteCssFinalizerOutputPlugin(context) {
6713
6951
  await injectHarmonyBundleStyles(getRecordedGeneratorCandidates?.() ?? getSourceCandidates?.() ?? await ensureRuntimeClassSet());
6714
6952
  collectViteProcessedCssAssets();
6715
6953
  injectViteProcessedCssIntoMainCss();
6954
+ linkEntryStyles();
6716
6955
  normalizeRootMiniProgramImportShellAssets(bundle, {
6717
6956
  cssMatcher: opts.cssMatcher,
6718
6957
  debug,
@@ -6837,6 +7076,7 @@ function createViteCssFinalizerOutputPlugin(context) {
6837
7076
  await injectHarmonyBundleStyles();
6838
7077
  collectViteProcessedCssAssets();
6839
7078
  injectViteProcessedCssIntoMainCss();
7079
+ linkEntryStyles();
6840
7080
  normalizeRootMiniProgramImportShellAssets(bundle, {
6841
7081
  cssMatcher: opts.cssMatcher,
6842
7082
  debug,
@@ -6875,7 +7115,7 @@ function createViteServeJsTransformPlugin(options) {
6875
7115
  if (!options.shouldTransform() || !isViteServeJsRequest(id, options.getCommand())) return;
6876
7116
  const handlerOptions = options.createHandlerOptions(id);
6877
7117
  if (shouldSkipJsTransform(code, handlerOptions)) return;
6878
- const runtime = await options.transformRuntime();
7118
+ const runtime = await options.transformRuntime(id, code);
6879
7119
  const { code: transformed } = await options.jsHandler(code, runtime, handlerOptions);
6880
7120
  if (transformed === code) return;
6881
7121
  return {
@@ -7013,9 +7253,9 @@ function createConfiguredCssEntryDiagnostics(options) {
7013
7253
  //#endregion
7014
7254
  //#region src/bundlers/vite/shared/framework-module-candidates.ts
7015
7255
  function createFrameworkModuleCandidateRegistrar(options) {
7016
- return async (id, source) => {
7256
+ return async (id, source, extension) => {
7017
7257
  await options.runtimeState.readyPromise;
7018
- const candidates = await options.sourceCandidateCollector.syncModuleSource(id, source);
7258
+ const candidates = await options.sourceCandidateCollector.syncModuleSource(id, source, extension);
7019
7259
  options.invalidateRecordedGeneratorCandidates();
7020
7260
  options.cacheCurrent();
7021
7261
  const cssHandlerOptions = options.getCssHandlerOptions(id);
@@ -7754,7 +7994,7 @@ ${previousTracedCss}`;
7754
7994
  previousCss: previousGeneratorCss,
7755
7995
  previousClassSet: pendingHmrChange && !forceFullHmrCssRegeneration ? generatedClassSetByFile.get(fileKey) : void 0,
7756
7996
  deferEmptyScopedCssSource: shouldDeferEmptyScopedCssSource,
7757
- deferCssAdaptation: !transient && !currentGeneratorBranch.isWeb && !shouldAdaptFrameworkWatchCss(),
7997
+ deferCssAdaptation: resolvedConfig?.command === "build" && !transient && !currentGeneratorBranch.isWeb && !shouldAdaptFrameworkWatchCss(),
7758
7998
  disableSourceScan: hookContext?.disableSourceScan === true,
7759
7999
  cssStage: hookContext?.cssStage,
7760
8000
  restoreLocalCssImports: !currentGeneratorBranch.isWeb
@@ -7947,6 +8187,8 @@ ${tracedCss}`;
7947
8187
  await sourceScanSession.sync();
7948
8188
  };
7949
8189
  const extraPlugins = capability.frameworkExtras ? frameworkBranch.createExtraPlugins?.({
8190
+ cssPreflight: opts.cssPreflight,
8191
+ cssPreflightRange: opts.cssPreflightRange,
7950
8192
  customAttributesEntities,
7951
8193
  disabledDefaultTemplateHandler,
7952
8194
  ensureRuntimeClassSet,
@@ -8051,7 +8293,7 @@ ${tracedCss}`;
8051
8293
  getCommand: () => resolvedConfig?.command,
8052
8294
  jsHandler,
8053
8295
  shouldTransform: () => shouldOwnTailwindGeneration && (frameworkCssPipelineStrategy?.shouldTransformServeJs?.(createCssPipelineContext()) ?? !resolveCurrentGeneratorBranch().isWeb),
8054
- transformRuntime: ensureRuntimeClassSet
8296
+ transformRuntime: (id, code) => registerModuleGraphCandidates(id, code, "js")
8055
8297
  }) : void 0;
8056
8298
  const plugins = [
8057
8299
  ...sourceAndRewritePlugins,
@@ -8100,7 +8342,7 @@ function wrapPluginCloseBundle(hook, dispose) {
8100
8342
  try {
8101
8343
  return await hook.apply(this, args);
8102
8344
  } finally {
8103
- dispose();
8345
+ dispose.call(this);
8104
8346
  }
8105
8347
  };
8106
8348
  if (hook && typeof hook === "object" && "handler" in hook && typeof hook.handler === "function") return {
@@ -8109,7 +8351,7 @@ function wrapPluginCloseBundle(hook, dispose) {
8109
8351
  try {
8110
8352
  return await hook.handler.apply(this, args);
8111
8353
  } finally {
8112
- dispose();
8354
+ dispose.call(this);
8113
8355
  }
8114
8356
  }
8115
8357
  };
@@ -8133,7 +8375,12 @@ function createViteFrameworkPlugins(options = {}, frameworkBranch) {
8133
8375
  })
8134
8376
  }));
8135
8377
  const cleanupPlugin = wrappedPlugins.at(-1);
8136
- if (cleanupPlugin) cleanupPlugin.closeBundle = wrapPluginCloseBundle(cleanupPlugin.closeBundle, relationOwner.dispose);
8378
+ if (cleanupPlugin) {
8379
+ cleanupPlugin.closeBundle = wrapPluginCloseBundle(cleanupPlugin.closeBundle, function() {
8380
+ if (!this.meta?.watchMode) relationOwner.dispose();
8381
+ });
8382
+ cleanupPlugin.closeWatcher = wrapPluginCloseBundle(cleanupPlugin.closeWatcher, relationOwner.dispose);
8383
+ }
8137
8384
  return wrappedPlugins;
8138
8385
  }
8139
8386
  //#endregion
@@ -8172,11 +8419,13 @@ function createTaroAlipayBrowserslistAssetPlugin() {
8172
8419
  };
8173
8420
  }
8174
8421
  function createTaroVitePlugins(options = {}) {
8175
- return [createTaroAlipayBrowserslistAssetPlugin(), ...createViteFrameworkPlugins(options, {
8422
+ const plugins = createViteFrameworkPlugins(options, {
8176
8423
  frameworkName: "taro",
8177
8424
  cssPipelineStrategy: taroCssPipelineStrategy,
8178
8425
  styleInjectorDelegate: viteStyleInjectorDelegates.taro
8179
- })];
8426
+ });
8427
+ if (!plugins) return;
8428
+ return [createTaroAlipayBrowserslistAssetPlugin(), ...plugins];
8180
8429
  }
8181
8430
  //#endregion
8182
8431
  //#region src/bundlers/vite/frameworks/uni-app/index.ts
@@ -8371,7 +8620,8 @@ const uniAppXCssPipelineStrategy = {
8371
8620
  },
8372
8621
  transformGeneratedCss(css, context) {
8373
8622
  const webCss = context.shouldApplyWebCssCompat ? context.defaultWebCssCompat(css) : css;
8374
- return withUniAppXWebPreflightReset(context.removeScopedPreflight(webCss), context.currentGeneratorBranch.isWeb);
8623
+ const output = withUniAppXWebPreflightReset(context.removeScopedPreflight(webCss), context.currentGeneratorBranch.isWeb);
8624
+ return context.currentGeneratorBranch.isWeb ? output : hoistUniAppXBorderPreflight(output);
8375
8625
  }
8376
8626
  };
8377
8627
  function createUniAppXVitePlugins(options = {}) {
@@ -8385,6 +8635,8 @@ function createUniAppXVitePlugins(options = {}) {
8385
8635
  sourceCandidatesBeforeExtraPlugin: (plugin) => plugin.name === "weapp-tailwindcss:uni-app-x:nvue",
8386
8636
  createExtraPlugins: (context) => createUniAppXPlugins({
8387
8637
  appType: "uni-app-x",
8638
+ cssPreflight: context.cssPreflight,
8639
+ cssPreflightRange: context.cssPreflightRange,
8388
8640
  customAttributesEntities: context.customAttributesEntities,
8389
8641
  disabledDefaultTemplateHandler: context.disabledDefaultTemplateHandler,
8390
8642
  ensureRuntimeClassSet: context.ensureRuntimeClassSet,
@@ -8663,4 +8915,4 @@ function WeappTailwindcss(options = {}) {
8663
8915
  return createDispatcher(options);
8664
8916
  }
8665
8917
  //#endregion
8666
- export { shouldEnableComponentLocalStyle as n, shouldEnablePageLocalStyle as r, WeappTailwindcss as t };
8918
+ export { shouldEnablePageLocalStyle as a, shouldEnableComponentLocalStyle as i, injectBorderPreflightClass as n, isUniAppXStyleSourceEmpty as o, shouldInjectBorderPreflight as r, WeappTailwindcss as t };