weapp-tailwindcss 5.3.2 → 5.3.4

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 (52) hide show
  1. package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +3 -0
  2. package/dist/bundlers/shared/style-requests.d.ts +1 -0
  3. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
  4. package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +15 -0
  5. package/dist/{context-Kvr3lLEC.js → context-4ittVpgt.js} +1 -1
  6. package/dist/{context-CB4Ef9U0.cjs → context-Ulhcd5lF.cjs} +3 -3
  7. package/dist/core.cjs +1 -1
  8. package/dist/core.js +1 -1
  9. package/dist/{gulp-QJ_oz-06.cjs → gulp-CDIXMhIO.cjs} +6 -6
  10. package/dist/{gulp-vz36-uQP.js → gulp-DwtrU4V1.js} +3 -3
  11. package/dist/gulp.cjs +1 -1
  12. package/dist/gulp.js +1 -1
  13. package/dist/{hmr-timing-W3kro20F.cjs → hmr-timing-DcFB_kwB.cjs} +2 -2
  14. package/dist/{hmr-timing-HGlM4hX3.js → hmr-timing-utmOgn6p.js} +57 -14
  15. package/dist/index.cjs +3 -3
  16. package/dist/index.js +3 -3
  17. package/dist/local-style-matcher-DRpFEu1s.cjs +34 -0
  18. package/dist/local-style-matcher-DsiI2wIc.js +17 -0
  19. package/dist/{options-CKZW99r4.cjs → options-BJrtIQbH.cjs} +3 -1
  20. package/dist/{pipeline-helpers-t95KPu4O.cjs → pipeline-helpers-kB7Mn2Jy.cjs} +2 -2
  21. package/dist/presets.cjs +2 -2
  22. package/dist/presets.js +1 -1
  23. package/dist/rspack.cjs +2 -2
  24. package/dist/rspack.js +2 -2
  25. package/dist/{source-candidate-scan-signature-BSad7bMQ.cjs → source-candidate-scan-signature-C1r5mHSi.cjs} +2 -2
  26. package/dist/{source-candidate-scan-signature-BHCPQVoD.js → source-candidate-scan-signature-CDrLxVKu.js} +2 -2
  27. package/dist/{style-options-PCgz2ywM.cjs → style-options-DW30H5PV.cjs} +1 -1
  28. package/dist/{tailwindcss-jKzY37Sk.cjs → tailwindcss-CexDJBhx.cjs} +1 -1
  29. package/dist/{tailwindcss-BSEdWieh.js → tailwindcss-ChnpCv25.js} +3 -1
  30. package/dist/{component-local-style-CNhEhd2B.cjs → transform-BQjg2T2T.cjs} +201 -27
  31. package/dist/{component-local-style-C2wC8o9F.js → transform-Cp4KybBy.js} +207 -16
  32. package/dist/types/user-defined-options/important.d.ts +2 -0
  33. package/dist/uni-app-x/component-local-style.d.ts +6 -4
  34. package/dist/uni-app-x/local-style-matcher.d.ts +4 -0
  35. package/dist/uni-app-x/options.d.ts +2 -0
  36. package/dist/uni-app-x/style-asset/harmony-global.d.ts +2 -0
  37. package/dist/uni-app-x/transform.d.ts +2 -0
  38. package/dist/uni-app-x/vite/plugin-options.d.ts +1 -0
  39. package/dist/uni-app-x/vite/style-request.d.ts +0 -1
  40. package/dist/{v4-generation-core-BfeXEc6R.cjs → v4-generation-core-OVshPBGo.cjs} +62 -13
  41. package/dist/{vite-CVr0vIgh.js → vite-D1a6OfVn.js} +130 -91
  42. package/dist/{vite-Dy6THt54.cjs → vite-cXJPnKXp.cjs} +77 -38
  43. package/dist/vite.cjs +1 -1
  44. package/dist/vite.js +1 -1
  45. package/dist/weapp-tw-css-import-rewrite-loader.cjs +4 -4
  46. package/dist/{webpack-Cf5RnhXt.cjs → webpack-DOhCcN_2.cjs} +8 -8
  47. package/dist/{webpack-DwtdWqwr.js → webpack-DQAbh1Z7.js} +4 -4
  48. package/dist/webpack.cjs +1 -1
  49. package/dist/webpack.js +1 -1
  50. package/package.json +2 -2
  51. package/dist/transform-CgohToUV.cjs +0 -200
  52. package/dist/transform-DSRPiBWz.js +0 -201
@@ -1,14 +1,14 @@
1
1
  import { resolveImplicitAppTypeFromViteRoot } from "./framework.js";
2
2
  import { $ as hasTailwindSourceDirectives, B as stripMiniProgramCssSpecificityPlaceholders, D as resolveTailwindcssOptions, Ft as filterUnsupportedMiniProgramTailwindV4Candidates, K as hasUserCssLayerBlocks, L as hasMiniProgramCssSpecificityPlaceholders, Ot as resolveSourceScanPath, Pt as getTailwindV4IncrementalGenerateCacheStats, Q as hasTailwindRootDirectives, S as findNearestPackageRoot, U as normalizeEmptyTailwindCustomVariants, X as hasTailwindApplyDirective, Y as hasLocalCssImport, Z as hasTailwindNonRootGenerationDirectives, _ as upsertTailwindV4CssSource, a as resolveGeneratorRuntimeBranch, b as isTailwindV4CssEntry, c as shouldUseNativeAppCssBranch, et as normalizeTailwindConfigDirectives, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, it as removeTailwindSourceDirectives, kt as resolveTailwindV4CssSourceBase, l as resolveUniUtsPlatform, lt as hasTailwindGeneratedCss, m as filterTailwindV4CssSourceRoots, mt as stripGeneratorPlaceholderMarkers, nt as normalizeTailwindSourceForGenerator, q as splitUserCssLayerBlocks, rt as parseImportRequest, s as shouldUseMiniProgramCssBranch, ut as hasTailwindGeneratedCssMarkers, wt as isFileMatchedByTailwindSourceEntries, x as normalizeCssEntries } from "./generator-EnTXLBlK.js";
3
3
  import { t as omitUndefined } from "./object-B-8IHefx.js";
4
- import { a as findTailwindConfig, f as resolveSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as resolveTailwindV4CssDependencies, p as discoverTailwindV4CssEntries, r as isUniAppXEnabled } from "./tailwindcss-BSEdWieh.js";
4
+ import { a as findTailwindConfig, f as resolveSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions, l as getRuntimeClassSetSignature, m as resolveTailwindV4CssDependencies, p as discoverTailwindV4CssEntries, r as isUniAppXEnabled } from "./tailwindcss-ChnpCv25.js";
5
5
  import "./utils-MVwpU07P.js";
6
- import { A as annotateCssSourceTrace, C as stripRequestQuery, D as stripBundlerGeneratedCssMarkers, E as parseBundlerGeneratedCssMarkerBlocks, F as createRuntimeClassSetManager, H as buildRuntimeCompilationSnapshot, J as createRuntimeAffectingSourceSignature, M as createCssTokenSourceMap, O as finalizeMiniProgramCssStructure, P as processCachedTask, Q as AssetEmissionPlan, R as isPureLocalCssImportWrapper, S as isSourceStyleRequest, T as hasBundlerGeneratedCssMarker, V as finalizeCompilerShadowRun, W as createRuntimeCompilationBuildState, X as beginCompilerShadowRun, Y as disposeCompilerOwner, a as extractMarkedUserLayerComponentsCss, at as isSourceCandidateRequest, d as runWithConcurrency, f as normalizeMiniProgramGeneratorCssSource, g as captureFrameworkPostcssOptions, i as validateCandidatesByGenerator, j as createCssSourceTraceCacheSignature, k as hasEmptyAtRuleBlockCandidate, m as scoreTailwindV4CssSourceFileMatch, nt as createCompilationDependencyChanges, o as mergeMarkedUserLayerComponentsCss, ot as extractCandidatesFromSource, p as normalizeMiniProgramImportShell, q as updateRuntimeCompilationBuildState, r as generateTailwindV4Css, rt as createSourceCandidateCollector, s as collectGeneratedRawSourceCandidatesFromCss, st as createSourceCandidateEligibilityMatcher, t as createHmrTimingRecorder, tt as recordCompilationDependencyChanges, w as createBundlerGeneratedCssMarker } from "./hmr-timing-HGlM4hX3.js";
6
+ import { $ as AssetEmissionPlan, A as hasEmptyAtRuleBlockCandidate, C as isSourceStyleRequest, D as parseBundlerGeneratedCssMarkerBlocks, E as hasBundlerGeneratedCssMarker, F as processCachedTask, G as createRuntimeCompilationBuildState, H as finalizeCompilerShadowRun, I as createRuntimeClassSetManager, J as updateRuntimeCompilationBuildState, M as createCssSourceTraceCacheSignature, N as createCssTokenSourceMap, O as stripBundlerGeneratedCssMarkers, S as isSourcePreprocessorRequest, T as createBundlerGeneratedCssMarker, U as buildRuntimeCompilationSnapshot, X as disposeCompilerOwner, Y as createRuntimeAffectingSourceSignature, Z as beginCompilerShadowRun, a as extractMarkedUserLayerComponentsCss, ct as createSourceCandidateEligibilityMatcher, d as runWithConcurrency, f as normalizeMiniProgramGeneratorCssSource, g as captureFrameworkPostcssOptions, i as validateCandidatesByGenerator, it as createSourceCandidateCollector, j as annotateCssSourceTrace, k as finalizeMiniProgramCssStructure, m as scoreTailwindV4CssSourceFileMatch, nt as recordCompilationDependencyChanges, o as mergeMarkedUserLayerComponentsCss, ot as isSourceCandidateRequest, p as normalizeMiniProgramImportShell, r as generateTailwindV4Css, rt as createCompilationDependencyChanges, s as collectGeneratedRawSourceCandidatesFromCss, st as extractCandidatesFromSource, t as createHmrTimingRecorder, w as stripRequestQuery, z as isPureLocalCssImportWrapper } from "./hmr-timing-utmOgn6p.js";
7
7
  import { m as createDebug, p as replaceWxml } from "./wxml-B7OAVpXJ.js";
8
- import { a as vitePluginName, c as collectRuntimeClassSet, d as refreshTailwindRuntimeState, f as normalizeFrameworkStylePlatform, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, s as toCustomAttributesEntities, t as getCompilerContext } from "./context-Kvr3lLEC.js";
9
- import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-BHCPQVoD.js";
8
+ import { a as vitePluginName, c as collectRuntimeClassSet, d as refreshTailwindRuntimeState, f as normalizeFrameworkStylePlatform, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, s as toCustomAttributesEntities, t as getCompilerContext } from "./context-4ittVpgt.js";
9
+ import { _ as createBuiltinViteStyleInjectorPlugins, a as createCandidateSignature, c as getSnapshotHash, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, i as createScopedGeneratorSourceTraceMap, l as hasRuntimeAffectingSourceChanges, m as normalizeOutputPathKey, n as createScopedGeneratorCandidateSignature, o as createJsHashSalt, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, s as createLinkedImpactSignature, t as createSourceCandidateScanSignature, u as summarizeStringDiff, x as resolveViteFrameworkProfile, y as viteStyleInjectorDelegates } from "./source-candidate-scan-signature-CDrLxVKu.js";
10
+ import { n as shouldEnableComponentLocalStyle, r as shouldEnablePageLocalStyle, t as normalizeUniAppXLocalStyleId } from "./local-style-matcher-DsiI2wIc.js";
10
11
  import { t as logger$1 } from "./logger-BNzxZbZj.js";
11
- import { r as shouldEnablePageLocalStyle } from "./component-local-style-C2wC8o9F.js";
12
12
  import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
13
13
  import path from "node:path";
14
14
  import process$1 from "node:process";
@@ -17,7 +17,7 @@ import { collectCssImportRequestsRoot, compileCssMacroConditionalComments, conta
17
17
  import { LRUCache } from "lru-cache";
18
18
  import { readFile } from "node:fs/promises";
19
19
  import micromatch from "micromatch";
20
- import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
20
+ import { cleanUrl as cleanUrl$1, ensurePosix } from "@weapp-tailwindcss/shared";
21
21
  import { logger } from "@weapp-tailwindcss/logger";
22
22
  import { fileURLToPath } from "node:url";
23
23
  import { Buffer } from "node:buffer";
@@ -498,6 +498,18 @@ const APP_JS_RE$1 = /(?:^|\/)App\.js$/;
498
498
  const COMPONENT_JS_RE = /(?:^|\/)components\/.+\.js$/;
499
499
  const STYLE_DECL_RE = /const\s+(_style_\d+)\s*=\s*\{/g;
500
500
  const EXPORT_SFC_RE = /_export_sfc\(_sfc_main\s*,\s*\[/;
501
+ function resolveSfcSourceId(code) {
502
+ const match = code.match(/\[\s*["']__file["']\s*,\s*(["'])(.*?)\1\s*\]/);
503
+ return match?.[2] ? normalizeUniAppXLocalStyleId(match[2]) : void 0;
504
+ }
505
+ function shouldExcludeComponent(file, code, options) {
506
+ if (!options.excludeComponents) return false;
507
+ const sourceId = resolveSfcSourceId(code);
508
+ if (sourceId) return shouldEnableComponentLocalStyle(sourceId, options.componentMatcher);
509
+ const normalizedFile = normalizeUniAppXLocalStyleId(file);
510
+ if (options.componentMatcher?.(normalizedFile)) return true;
511
+ return COMPONENT_JS_RE.test(normalizedFile);
512
+ }
501
513
  function resolveStyleAssetFile(file) {
502
514
  if (!UVUE_TS_RE.test(file)) return;
503
515
  return file.replace(/\.uvue\.ts$/, ".uvue");
@@ -601,7 +613,7 @@ function injectStyleOption(code, styleVarName) {
601
613
  }
602
614
  function injectUniAppXHarmonyGlobalStyles(file, code, getBundleSource, options = {}) {
603
615
  if (!JS_RE.test(file) || APP_JS_RE$1.test(file)) return code;
604
- if (options.excludeComponents && COMPONENT_JS_RE.test(file)) return code;
616
+ if (shouldExcludeComponent(file, code, options)) return code;
605
617
  const appSource = getBundleSource?.("assets/App.js") ?? getBundleSource?.("App.js");
606
618
  const appStyle = appSource ? mergeStyleValues(...findStyleObjectDecls(appSource).map((decl) => parseStyleObject(decl.objectText))) : void 0;
607
619
  const parseableLocalStyles = findStyleObjectDecls(code).flatMap((decl) => {
@@ -1784,7 +1796,7 @@ function isWeappViteSidecarRequest(request) {
1784
1796
  return new URLSearchParams(query).has("weapp-vite-sidecar");
1785
1797
  }
1786
1798
  function resolveViteCssPipelineRequestFile(request) {
1787
- return isWeappViteSidecarRequest(request) ? cleanUrl(request) : request;
1799
+ return isWeappViteSidecarRequest(request) ? cleanUrl$1(request) : request;
1788
1800
  }
1789
1801
  function isHTMLRequest(request) {
1790
1802
  return htmlLangRE.test(request);
@@ -1795,7 +1807,7 @@ function normalizePath(id) {
1795
1807
  async function formatPostcssSourceMap(rawMap, file) {
1796
1808
  const inputFileDir = path.dirname(file);
1797
1809
  const sources = rawMap.sources.map((source) => {
1798
- const cleanSource = cleanUrl(decodeURIComponent(source));
1810
+ const cleanSource = cleanUrl$1(decodeURIComponent(source));
1799
1811
  if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
1800
1812
  return normalizePath(path.resolve(inputFileDir, cleanSource));
1801
1813
  });
@@ -2080,17 +2092,17 @@ function extractSfcStyleSources(source) {
2080
2092
  function hasSfcStyleSources(source) {
2081
2093
  return extractSfcStyleSources(source).length > 0;
2082
2094
  }
2095
+ function resolveSfcStyleBlockLang(attrs) {
2096
+ const match = SFC_LANG_STYLE_ATTR_RE.exec(attrs);
2097
+ return match?.[1] ?? match?.[2] ?? match?.[3];
2098
+ }
2083
2099
  function resolveSfcStyleHandlerSourceFile(sourceFile, styleBlocks) {
2084
2100
  const scopedStyleBlock = styleBlocks.find((style) => style.scoped);
2085
- return scopedStyleBlock ? `${sourceFile}?vue&type=style&index=${scopedStyleBlock.index}&scoped=true` : sourceFile;
2101
+ return scopedStyleBlock ? [`${sourceFile}?vue&type=style&index=${scopedStyleBlock.index}&scoped=true`, ...resolveSfcStyleBlockLang(scopedStyleBlock.attrs) ? [`lang=${encodeURIComponent(resolveSfcStyleBlockLang(scopedStyleBlock.attrs))}`] : []].join("&") : sourceFile;
2086
2102
  }
2087
2103
  function normalizeSfcStyleSourceForCompare(source) {
2088
2104
  return source.replace(/\r\n?/g, "\n").trim();
2089
2105
  }
2090
- function resolveSfcStyleBlockLang(attrs) {
2091
- const match = SFC_LANG_STYLE_ATTR_RE.exec(attrs);
2092
- return match?.[1] ?? match?.[2] ?? match?.[3];
2093
- }
2094
2106
  function createSfcStyleRequest(sourceFile, styleBlock) {
2095
2107
  const params = new URLSearchParams();
2096
2108
  params.set("vue", "");
@@ -3304,7 +3316,7 @@ function toArray(value) {
3304
3316
  return Array.isArray(value) ? value : value === void 0 ? [] : [value];
3305
3317
  }
3306
3318
  function normalizeSourceId(id) {
3307
- const file = cleanUrl(id);
3319
+ const file = cleanUrl$1(id);
3308
3320
  return path.isAbsolute(file) ? path.resolve(file) : void 0;
3309
3321
  }
3310
3322
  function collectChunkModuleIds(chunk) {
@@ -3325,7 +3337,7 @@ function collectAssetSourceIds(asset, fallbackFile, rootDir) {
3325
3337
  const candidates = sourceCandidates.length > 0 ? sourceCandidates : [fallbackFile];
3326
3338
  for (const candidate of candidates) {
3327
3339
  if (typeof candidate !== "string" || candidate.length === 0) continue;
3328
- const cleanCandidate = cleanUrl(candidate);
3340
+ const cleanCandidate = cleanUrl$1(candidate);
3329
3341
  const resolved = path.isAbsolute(cleanCandidate) ? path.resolve(cleanCandidate) : path.resolve(rootDir, cleanCandidate);
3330
3342
  ids.add(resolved);
3331
3343
  }
@@ -5833,7 +5845,7 @@ function createUniAppXHarmonyApplyExpander(options) {
5833
5845
  const utilities = /* @__PURE__ */ new Set();
5834
5846
  function rememberSource(code, id, authoritative = false) {
5835
5847
  const sources = collectUniAppXHarmonyApplyStyleSourcesFromSource(code, id);
5836
- const sourceKey = normalizePath(cleanUrl(id));
5848
+ const sourceKey = normalizePath(cleanUrl$1(id));
5837
5849
  const references = authoritative ? /* @__PURE__ */ new Set() : new Set(referenceBySourceId.get(sourceKey));
5838
5850
  for (const source of sources) {
5839
5851
  styleSources.add(source);
@@ -5850,7 +5862,7 @@ function createUniAppXHarmonyApplyExpander(options) {
5850
5862
  }
5851
5863
  function prepareStyles(code, id) {
5852
5864
  if (!code.includes("@apply") || code.includes("@reference")) return code;
5853
- const references = referenceBySourceId.get(normalizePath(cleanUrl(id)));
5865
+ const references = referenceBySourceId.get(normalizePath(cleanUrl$1(id)));
5854
5866
  if (references?.size !== 1) return code;
5855
5867
  return `${references.values().next().value}\n${code}`;
5856
5868
  }
@@ -5859,7 +5871,7 @@ function createUniAppXHarmonyApplyExpander(options) {
5859
5871
  const sources = collectUniAppXHarmonyApplyStyleSourcesFromSource(prepareStyles(code, id), id);
5860
5872
  const sourceUtilities = collectUniAppXHarmonyApplyUtilitiesFromSources(sources);
5861
5873
  if (sources.length === 0 || sourceUtilities.size === 0) return code;
5862
- const cssFile = path.resolve(options.getResolvedConfig()?.root ?? process$1.cwd(), `uni-app-x-harmony-apply-${createStableHash(normalizePath(cleanUrl(id)))}.css`);
5874
+ const cssFile = path.resolve(options.getResolvedConfig()?.root ?? process$1.cwd(), `uni-app-x-harmony-apply-${createStableHash(normalizePath(cleanUrl$1(id)))}.css`);
5863
5875
  const generatorSource = createUniAppXHarmonyApplyGeneratorSource(sources, sourceUtilities);
5864
5876
  const generatedCss = await options.generateCss?.(cssFile, generatorSource, {
5865
5877
  addWatchFile: hookContext.addWatchFile?.bind(hookContext),
@@ -5946,8 +5958,8 @@ function normalizeIdentityKey(file) {
5946
5958
  * 将 Vite URL、文件路径和 Windows 的等价路径收敛为同一个模块身份。
5947
5959
  */
5948
5960
  function resolveViteModuleIdentity(id, root = process$1.cwd()) {
5949
- const cleanId = decodeFileId(cleanUrl(id));
5950
- const decodedRoot = decodeFileId(cleanUrl(root));
5961
+ const cleanId = decodeFileId(cleanUrl$1(id));
5962
+ const decodedRoot = decodeFileId(cleanUrl$1(root));
5951
5963
  const normalizedRoot = isWindowsFile(decodedRoot) ? normalizeWindowsFile(decodedRoot) : slash(path.resolve(decodedRoot));
5952
5964
  const unwrappedId = stripFileProtocol(stripViteFsPrefix(cleanId));
5953
5965
  const file = unwrappedId.startsWith("\0") ? void 0 : normalizeFile(unwrappedId, normalizedRoot);
@@ -6008,7 +6020,7 @@ async function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
6008
6020
  const outDir = ctx.server.config?.build?.outDir ? resolveViteModuleIdentity(ctx.server.config.build.outDir, root) : void 0;
6009
6021
  const isHotSourceStyleModule = (id) => {
6010
6022
  if (!isSourceStyleRequest(id)) return false;
6011
- const file = cleanUrl(id);
6023
+ const file = cleanUrl$1(id);
6012
6024
  if (isRootMiniProgramStyleUrl(file) || !isAbsoluteFilePath(file) && !file.startsWith("/")) return false;
6013
6025
  if (outDir) {
6014
6026
  const identity = resolveViteModuleIdentity(file, root);
@@ -6037,7 +6049,7 @@ async function resolveHotSourceModulesByIds(ctx, ids) {
6037
6049
  for (const id of ids) {
6038
6050
  if (typeof id !== "string" || !/\.(?:uvue|nvue|vue|tsx?|jsx?)(?:$|[?#])/i.test(id)) continue;
6039
6051
  const identity = resolveViteModuleIdentity(id, root);
6040
- for (const lookupId of identity.lookupIds) if (!/[?&]import(?:[=&]|$)/.test(lookupId)) sourceIds.add(`${cleanUrl(lookupId)}?import`);
6052
+ for (const lookupId of identity.lookupIds) if (!/[?&]import(?:[=&]|$)/.test(lookupId)) sourceIds.add(`${cleanUrl$1(lookupId)}?import`);
6041
6053
  }
6042
6054
  return resolveHotModulesByIds(ctx, sourceIds, (mod) => {
6043
6055
  const modId = mod.id ?? mod.url;
@@ -6094,7 +6106,7 @@ function isRootMiniProgramStyleUrl(file) {
6094
6106
  }
6095
6107
  function resolveCssHotUrl(id, root) {
6096
6108
  const suffix = /[?#]/.test(id) ? id.slice(id.search(/[?#]/)) : "";
6097
- const cleanId = cleanUrl(id);
6109
+ const cleanId = cleanUrl$1(id);
6098
6110
  if (/^\/(?!@fs\/|[A-Z]:)/i.test(cleanId) && !cleanId.startsWith(slash(root))) {
6099
6111
  if (isRootMiniProgramStyleUrl(cleanId)) return;
6100
6112
  return `${cleanId}${suffix}`;
@@ -6230,35 +6242,22 @@ function createUniAppXNativeBuildTargetResolver(getResolvedConfig) {
6230
6242
  }
6231
6243
  //#endregion
6232
6244
  //#region src/uni-app-x/vite/style-request.ts
6233
- const preprocessorLangs = /* @__PURE__ */ new Set([
6234
- "scss",
6235
- "sass",
6236
- "less",
6237
- "styl",
6238
- "stylus"
6239
- ]);
6240
- const INLINE_LANG_RE = /lang\.([a-z]+)/i;
6241
- const PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)(?:\?|$)/i;
6242
6245
  const UVUE_NVUE_RE$1 = /\.(?:uvue|nvue)$/;
6243
6246
  const CSS_MODULE_EXPORT_RE = /^\s*export\s+default\s+(?:\{|\w|\[\])/;
6244
6247
  const RELATIVE_REFERENCE_RE = /@reference\s+(["'])(\.\.?[\\/][^"']+)\1\s*;?/g;
6245
6248
  const WINDOWS_ABSOLUTE_PATH_RE = /^[a-z]:[\\/]/i;
6246
6249
  function isPreprocessorRequest(id, lang) {
6247
- const normalizedLang = lang?.toLowerCase();
6248
- if (normalizedLang && preprocessorLangs.has(normalizedLang)) return true;
6249
- const inlineLang = id.match(INLINE_LANG_RE)?.[1];
6250
- if (inlineLang && preprocessorLangs.has(inlineLang.toLowerCase())) return true;
6251
- return PREPROCESSOR_EXT_RE.test(id);
6250
+ return isSourcePreprocessorRequest(id, lang);
6252
6251
  }
6253
6252
  function resolveUniAppXCssTarget(id) {
6254
- return UVUE_NVUE_RE$1.test(cleanUrl(id)) ? "uvue" : void 0;
6253
+ return UVUE_NVUE_RE$1.test(cleanUrl$1(id)) ? "uvue" : void 0;
6255
6254
  }
6256
6255
  function isCssModuleExport(code) {
6257
6256
  return CSS_MODULE_EXPORT_RE.test(code);
6258
6257
  }
6259
6258
  function normalizeRelativeTailwindReferences(code, id) {
6260
6259
  if (!code.includes("@reference")) return code;
6261
- const sourceFile = cleanUrl(id);
6260
+ const sourceFile = cleanUrl$1(id);
6262
6261
  const pathApi = WINDOWS_ABSOLUTE_PATH_RE.test(sourceFile) ? path.win32 : path;
6263
6262
  const sourceDir = pathApi.dirname(sourceFile);
6264
6263
  return code.replace(RELATIVE_REFERENCE_RE, (_full, quote, request) => {
@@ -6274,7 +6273,7 @@ function resolvePreprocessorTransform(code, id, lang, options) {
6274
6273
  map: null
6275
6274
  } };
6276
6275
  }
6277
- if (options.isWebGeneratorTarget && !options.isNativeAppStyleTarget) return { result: void 0 };
6276
+ if (!options.isNativeAppStyleTarget) return { result: void 0 };
6278
6277
  }
6279
6278
  //#endregion
6280
6279
  //#region src/uni-app-x/vite/web-local-style.ts
@@ -6287,18 +6286,18 @@ function createUniAppXWebLocalStyleBridge(isEnabled) {
6287
6286
  return {
6288
6287
  appendToStyle(code, id) {
6289
6288
  if (!isEnabled()) return code;
6290
- const rules = rulesByFile.get(cleanUrl(id));
6289
+ const rules = rulesByFile.get(cleanUrl$1(id));
6291
6290
  return rules ? `${code}\n${rules}` : code;
6292
6291
  },
6293
6292
  handleHotUpdate(ctx) {
6294
- if (!isEnabled() || !/\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file))) return;
6293
+ if (!isEnabled() || !/\.(?:uvue|nvue)$/i.test(cleanUrl$1(ctx.file))) return;
6295
6294
  const styleModules = [...ctx.server.moduleGraph.getModulesByFile?.(ctx.file) ?? []].filter(isStyleModule);
6296
6295
  if (styleModules.length === 0) return;
6297
6296
  for (const mod of styleModules) ctx.server.moduleGraph.invalidateModule(mod);
6298
6297
  return [.../* @__PURE__ */ new Set([...ctx.modules, ...styleModules])];
6299
6298
  },
6300
6299
  remember(id, rules) {
6301
- rulesByFile.set(cleanUrl(id), rules);
6300
+ rulesByFile.set(cleanUrl$1(id), rules);
6302
6301
  }
6303
6302
  };
6304
6303
  }
@@ -6306,7 +6305,7 @@ function createUniAppXWebLocalStyleBridge(isEnabled) {
6306
6305
  //#region src/uni-app-x/vite.ts
6307
6306
  let transformUVuePromise;
6308
6307
  function loadTransformUVue() {
6309
- transformUVuePromise ?? (transformUVuePromise = import("./transform-DSRPiBWz.js").then((mod) => mod.transformUVue));
6308
+ transformUVuePromise ?? (transformUVuePromise = import("./transform-Cp4KybBy.js").then((mod) => mod.transformUVue));
6310
6309
  return transformUVuePromise;
6311
6310
  }
6312
6311
  const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
@@ -6315,7 +6314,7 @@ function resolveUniAppXJsTransformEnabled(uniAppX) {
6315
6314
  return uniAppX === void 0 ? true : isUniAppXEnabled(uniAppX);
6316
6315
  }
6317
6316
  function createUniAppXPlugins(options) {
6318
- const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, runtimeState, styleHandler, syncSourceCandidatesForHotUpdate, tailwindRootCssModuleIds = [], generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, isNativeAppStyleTarget = () => false, isWebGeneratorTarget = () => resolveUniUtsPlatform().isWeb, uniAppX, viteProcessedCssSourceFiles = [] } = options;
6317
+ const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, registerModuleGraphCandidates, runtimeState, styleHandler, syncSourceCandidatesForHotUpdate, tailwindRootCssModuleIds = [], generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, isNativeAppStyleTarget = () => false, isWebGeneratorTarget = () => resolveUniUtsPlatform().isWeb, uniAppX, viteProcessedCssSourceFiles = [] } = options;
6319
6318
  const resolvedUniAppXOptions = resolveUniAppXOptions(uniAppX);
6320
6319
  const utsPlatform = resolveUniUtsPlatform();
6321
6320
  const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
@@ -6347,7 +6346,7 @@ function createUniAppXPlugins(options) {
6347
6346
  return componentLocalStyleEnabled;
6348
6347
  }
6349
6348
  function shouldEnablePageLocalStyleForFile(id) {
6350
- return resolvedUniAppXOptions.componentLocalStyles.enabled && (isNativeAppBuildTarget(id) || shouldEnablePageLocalStyle(id));
6349
+ return resolvedUniAppXOptions.componentLocalStyles.enabled && (isNativeAppBuildTarget(id) || shouldEnablePageLocalStyle(id, resolvedUniAppXOptions.componentLocalStyles.pageMatcher));
6351
6350
  }
6352
6351
  function isHarmonyBuildTarget() {
6353
6352
  if (resolveUniUtsPlatform().isAppHarmony) return true;
@@ -6402,7 +6401,7 @@ function createUniAppXPlugins(options) {
6402
6401
  const styleHandlerOptions = getStyleHandlerOptions(id, isNativeStyle && hasTailwindRoot ? "tailwind-root" : isNativeStyle ? "author-apply" : void 0);
6403
6402
  const postcssResult = await styleHandler(styleCode, styleHandlerOptions);
6404
6403
  reportStyleWarnings(postcssResult);
6405
- const postcssMap = await formatPostcssSourceMap(postcssResult.map.toJSON(), normalizePath(cleanUrl(id)));
6404
+ const postcssMap = await formatPostcssSourceMap(postcssResult.map.toJSON(), normalizePath(cleanUrl$1(id)));
6406
6405
  return {
6407
6406
  code: postcssResult.css,
6408
6407
  map: postcssMap
@@ -6436,8 +6435,7 @@ function createUniAppXPlugins(options) {
6436
6435
  const styleCode = query.vue && query.type === "style" ? webLocalStyle.appendToStyle(code, id) : code;
6437
6436
  const preprocessor = resolvePreprocessorTransform(styleCode, id, query.lang, {
6438
6437
  isIosPlatform,
6439
- isNativeAppStyleTarget: isNativeAppStyleTarget(),
6440
- isWebGeneratorTarget: isWebGeneratorTarget()
6438
+ isNativeAppStyleTarget: isNativeAppStyleTarget()
6441
6439
  });
6442
6440
  if (preprocessor) return preprocessor.result ?? (styleCode !== code ? {
6443
6441
  code: styleCode,
@@ -6449,21 +6447,25 @@ function createUniAppXPlugins(options) {
6449
6447
  async function transformSfc(code, id, context) {
6450
6448
  if (isNativeAppBuildTarget(id)) {
6451
6449
  nativeLocalStyleModuleIds.add(id);
6452
- nativeLocalStyleModuleIds.add(cleanUrl(id));
6450
+ nativeLocalStyleModuleIds.add(cleanUrl$1(id));
6453
6451
  }
6454
6452
  harmonyApply.rememberSource(code, id, true);
6453
+ const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
6454
+ const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
6455
6455
  const resolvedConfig = getResolvedConfig();
6456
6456
  const shouldForceRefresh = resolvedConfig?.command === "serve" || resolvedConfig?.command === "build";
6457
- const currentRuntimeSet = await ensureRuntimeClassSet(shouldForceRefresh);
6457
+ const moduleGraphCandidates = enableComponentLocalStyle || enablePageLocalStyle ? await registerModuleGraphCandidates?.(id, code) : void 0;
6458
+ const runtimeSet = await ensureRuntimeClassSet(shouldForceRefresh);
6459
+ const currentRuntimeSet = moduleGraphCandidates?.size ? /* @__PURE__ */ new Set([...runtimeSet, ...moduleGraphCandidates]) : runtimeSet;
6458
6460
  nativeHmrReloader.remember(currentRuntimeSet);
6459
6461
  const transformUVue = await loadTransformUVue();
6460
- const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
6461
- const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
6462
6462
  const transformOptions = omitUndefined({
6463
+ componentMatcher: resolvedUniAppXOptions.componentLocalStyles.componentMatcher,
6463
6464
  ...customAttributesEntities.length > 0 ? { customAttributesEntities } : {},
6464
6465
  ...disabledDefaultTemplateHandler ? { disabledDefaultTemplateHandler } : {},
6465
6466
  ...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
6466
6467
  ...enablePageLocalStyle ? { enablePageLocalStyle } : {},
6468
+ pageMatcher: resolvedUniAppXOptions.componentLocalStyles.pageMatcher,
6467
6469
  ...isWebGeneratorTarget() && customAttributesEntities.length > 0 ? { webCustomAttributeDeep: true } : {},
6468
6470
  ...isWebGeneratorTarget() ? { onWebLocalStyleRules: (rules) => webLocalStyle.remember(id, rules) } : {}
6469
6471
  });
@@ -6536,6 +6538,7 @@ function createUniAppXPlugins(options) {
6536
6538
  }
6537
6539
  injectUniAppXHarmonyBundleStyles(bundle, {
6538
6540
  cssSources,
6541
+ componentMatcher: resolvedUniAppXOptions.componentLocalStyles.componentMatcher,
6539
6542
  excludeComponents: shouldEnableComponentLocalStyle()
6540
6543
  });
6541
6544
  }
@@ -6731,7 +6734,7 @@ function logBundleProcessPlan(options) {
6731
6734
  //#region src/bundlers/vite/generate-bundle/remembered-css-replay.ts
6732
6735
  function shouldSkipRawRememberedCssSource(rawSource, sourceFile) {
6733
6736
  const cleanSourceFile = sourceFile.replace(/[?#].*$/, "");
6734
- return SOURCE_STYLE_OUTPUT_EXT_RE.test(cleanSourceFile) && !canProcessViteSourceStyleAsCss(rawSource, sourceFile);
6737
+ return (SOURCE_STYLE_OUTPUT_EXT_RE.test(cleanSourceFile) || isSourcePreprocessorRequest(sourceFile)) && !canProcessViteSourceStyleAsCss(rawSource, sourceFile);
6735
6738
  }
6736
6739
  function resolveRememberedCssReplayOutputFile(outputFile, targetByFile) {
6737
6740
  const outputKey = normalizeOutputPathKey(outputFile);
@@ -8748,12 +8751,12 @@ function extractSfcStyleSource(source, index) {
8748
8751
  return styleSources.length > 0 ? styleSources.join("\n") : void 0;
8749
8752
  }
8750
8753
  function normalizeKnownSfcSourceKey(file) {
8751
- return normalizeOutputPathKey(path.resolve(cleanUrl(file)));
8754
+ return normalizeOutputPathKey(path.resolve(cleanUrl$1(file)));
8752
8755
  }
8753
8756
  function shouldCollectTransformedSourceCandidates(id) {
8754
8757
  if (isWeappViteSidecarRequest(id)) return false;
8755
8758
  if (id.search(/[?#]/) < 0) return true;
8756
- const file = cleanUrl(id);
8759
+ const file = cleanUrl$1(id);
8757
8760
  return !SFC_COMPONENT_FILE_RE.test(file);
8758
8761
  }
8759
8762
  function createViteCssMemory(options) {
@@ -8763,7 +8766,7 @@ function createViteCssMemory(options) {
8763
8766
  const knownSfcSources = /* @__PURE__ */ new Map();
8764
8767
  const rememberKnownSfcSource = (id, code) => {
8765
8768
  if (id.search(/[?#]/) >= 0) return;
8766
- const file = cleanUrl(id);
8769
+ const file = cleanUrl$1(id);
8767
8770
  if (!SFC_COMPONENT_FILE_RE.test(file)) return;
8768
8771
  if (!hasSfcStyleBlocks(code)) return;
8769
8772
  touchMapEntry(knownSfcSources, normalizeKnownSfcSourceKey(file), code);
@@ -8824,23 +8827,23 @@ function createViteCssMemory(options) {
8824
8827
  for (const [rememberedKey, remembered] of relatedRememberedEntries) refreshRememberedCssSourceEntry(rememberedKey, remembered, sourceFile, rawSource);
8825
8828
  };
8826
8829
  const resolveCachedStyleSource = (sourceFile) => {
8827
- const file = cleanUrl(stripRequestQuery(sourceFile));
8830
+ const file = cleanUrl$1(stripRequestQuery(sourceFile));
8828
8831
  if (SFC_COMPONENT_FILE_RE.test(file)) return getKnownSfcSource(file);
8829
8832
  if (isSourceStyleRequest(file)) return options.getSourceCandidateSource(file);
8830
8833
  };
8831
8834
  const resolveCurrentStyleSource = (sourceFile) => {
8832
8835
  const cached = resolveCachedStyleSource(sourceFile);
8833
8836
  if (cached != null) return cached;
8834
- const file = cleanUrl(stripRequestQuery(sourceFile));
8837
+ const file = cleanUrl$1(stripRequestQuery(sourceFile));
8835
8838
  const knownSource = knownCssSources.get(normalizeCssSourceIdentity(sourceFile));
8836
8839
  if (knownSource != null) return knownSource;
8837
8840
  const candidateSource = options.getSourceCandidateSource(file);
8838
8841
  if (candidateSource != null) return candidateSource;
8839
8842
  };
8840
8843
  const refreshRememberedCssSourceByCurrentFile = async (sourceFile) => {
8841
- const file = cleanUrl(sourceFile);
8844
+ const file = cleanUrl$1(sourceFile);
8842
8845
  const normalizedSourceFile = normalizeOutputPathKey(file);
8843
- const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => normalizeOutputPathKey(stripRequestQuery(cleanUrl(remembered.sourceFile))) === normalizedSourceFile);
8846
+ const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => normalizeOutputPathKey(stripRequestQuery(cleanUrl$1(remembered.sourceFile))) === normalizedSourceFile);
8844
8847
  if (matchedRememberedSources.length === 0) return;
8845
8848
  const source = await resolveCurrentStyleSource(file);
8846
8849
  if (source == null) {
@@ -8967,7 +8970,7 @@ function joinPosixPath(base, subpath) {
8967
8970
  }
8968
8971
  function isCssLikeImporter(importer) {
8969
8972
  if (!importer) return false;
8970
- const normalized = cleanUrl(importer);
8973
+ const normalized = cleanUrl$1(importer);
8971
8974
  return isSourceStyleRequest(importer) || isCSSRequest(normalized) || normalized.endsWith("/*");
8972
8975
  }
8973
8976
  function stripTailwindConfigDirectives(code) {
@@ -8993,7 +8996,7 @@ function createRewriteCssImportsPlugins(options) {
8993
8996
  },
8994
8997
  async transform(code, id) {
8995
8998
  if (!isCSSRequest(id)) return null;
8996
- const file = cleanUrl(id);
8999
+ const file = cleanUrl$1(id);
8997
9000
  const normalizedCode = hasTailwindRootDirectives(code) || code.includes("@config") ? normalizeTailwindConfigDirectives(code, path.dirname(file)) : code;
8998
9001
  await options.onCssSourceTransform?.(id, normalizedCode);
8999
9002
  const hasTailwindRoot = hasTailwindRootDirectives(normalizedCode, { importFallback: true });
@@ -9361,7 +9364,7 @@ function createViteHmrCandidateState(options) {
9361
9364
  let pendingCssTargetFiles;
9362
9365
  let pendingTargetsArmed = false;
9363
9366
  let pendingFullRegeneration = false;
9364
- const normalizeCssTargetFile = (file) => normalizeVitePersistentCacheKey(cleanUrl(file));
9367
+ const normalizeCssTargetFile = (file) => normalizeVitePersistentCacheKey(cleanUrl$1(file));
9365
9368
  const clear = () => {
9366
9369
  pendingChange = void 0;
9367
9370
  pendingCssTargetFiles = void 0;
@@ -9495,6 +9498,29 @@ function createViteHmrCandidateState(options) {
9495
9498
  };
9496
9499
  }
9497
9500
  //#endregion
9501
+ //#region src/bundlers/vite/shared/framework-module-candidates.ts
9502
+ function createFrameworkModuleCandidateRegistrar(options) {
9503
+ return async (id, source) => {
9504
+ await options.runtimeState.readyPromise;
9505
+ const candidates = await options.sourceCandidateCollector.syncModuleSource(id, source);
9506
+ options.invalidateRecordedGeneratorCandidates();
9507
+ options.cacheCurrent();
9508
+ const cssHandlerOptions = options.getCssHandlerOptions(id);
9509
+ return validateCandidatesByGenerator({
9510
+ candidates,
9511
+ cssHandlerOptions,
9512
+ cssUserHandlerOptions: cssHandlerOptions,
9513
+ debug: options.debug,
9514
+ file: cleanUrl$1(id),
9515
+ generatorPlatform: options.getGeneratorPlatform(),
9516
+ opts: options.opts,
9517
+ rawSource: "",
9518
+ runtimeState: options.runtimeState,
9519
+ styleHandler: options.styleHandler
9520
+ });
9521
+ };
9522
+ }
9523
+ //#endregion
9498
9524
  //#region src/bundlers/vite/shared/framework-plugin-order.ts
9499
9525
  function orderFrameworkSourceCandidatePlugins(extraPlugins, rewritePlugins, sourceCandidatesPlugin, beforeExtraPlugin) {
9500
9526
  const anchor = beforeExtraPlugin ? extraPlugins.findIndex(beforeExtraPlugin) : -1;
@@ -9665,7 +9691,7 @@ function createFrameworkProcessedCssRegistry() {
9665
9691
  const results = /* @__PURE__ */ new Map();
9666
9692
  const sourceFiles = /* @__PURE__ */ new Set();
9667
9693
  const markSource = (file) => {
9668
- sourceFiles.add(path.resolve(cleanUrl(file)));
9694
+ sourceFiles.add(path.resolve(cleanUrl$1(file)));
9669
9695
  };
9670
9696
  const record = (file, css, options = {}) => {
9671
9697
  const key = normalizeVitePersistentCacheKey(file);
@@ -9679,7 +9705,7 @@ function createFrameworkProcessedCssRegistry() {
9679
9705
  };
9680
9706
  const get = (file) => results.get(normalizeVitePersistentCacheKey(file));
9681
9707
  const matchesIdentity = (candidate) => {
9682
- return sourceFiles.has(path.resolve(cleanUrl(candidate)));
9708
+ return sourceFiles.has(path.resolve(cleanUrl$1(candidate)));
9683
9709
  };
9684
9710
  const prune = (activeFiles) => {
9685
9711
  for (const [key, result] of results) {
@@ -9744,7 +9770,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9744
9770
  enforce: "pre",
9745
9771
  async load(id) {
9746
9772
  if (!options.shouldOwnTailwindGeneration || options.isWebOrNativeAppPlatform(options.resolveViteStylePlatform()) || !isCSSRequest(id) || !shouldCollectTransformedSourceCandidates(id)) return;
9747
- const file = cleanUrl(id);
9773
+ const file = cleanUrl$1(id);
9748
9774
  const rawCode = await readFile(file, "utf8").catch(() => void 0);
9749
9775
  if (typeof rawCode !== "string") return;
9750
9776
  options.rememberOriginalCssLayerSource(id, rawCode);
@@ -9770,7 +9796,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9770
9796
  } : void 0;
9771
9797
  return options.hmrTimingRecorder.measure("sourceCandidates.transform", async () => {
9772
9798
  options.invalidateRecordedGeneratorCandidates();
9773
- const file = cleanUrl(id);
9799
+ const file = cleanUrl$1(id);
9774
9800
  if (!options.sourceScanSession.matches(file)) {
9775
9801
  options.sourceCandidateCollector.remove(file);
9776
9802
  options.sourceScanSession.cacheCurrent();
@@ -9789,18 +9815,18 @@ function createFrameworkSourceCandidatesPlugin(options) {
9789
9815
  }
9790
9816
  },
9791
9817
  async watchChange(id, change) {
9792
- recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl(id))]));
9818
+ recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl$1(id))]));
9793
9819
  await options.hmrTimingRecorder.measure("sourceCandidates.watchChange", async () => {
9794
9820
  if (options.shouldOwnTailwindGeneration && isSourceCandidateRequest(id)) options.invalidateRecordedGeneratorCandidates();
9795
9821
  if (options.sourceScanSession.isDependency(id)) options.sourceScanSession.invalidate();
9796
9822
  if (change.event === "delete") {
9797
- const file = cleanUrl(id);
9823
+ const file = cleanUrl$1(id);
9798
9824
  const sourceCandidateChange = options.sourceCandidateCollector.remove(file);
9799
9825
  options.sourceScanSession.cacheCurrent();
9800
9826
  options.hmrCandidateState.apply(options.hmrCandidateState.createChange(file, sourceCandidateChange, { runtimeAffecting: options.sourceScanSession.isDependency(file) }));
9801
9827
  return;
9802
9828
  }
9803
- const changedSource = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(id) && isCSSRequest(id) ? await readFile(cleanUrl(id), "utf8").catch(() => void 0) : void 0;
9829
+ const changedSource = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(id) && isCSSRequest(id) ? await readFile(cleanUrl$1(id), "utf8").catch(() => void 0) : void 0;
9804
9830
  if (typeof changedSource === "string") {
9805
9831
  options.rememberOriginalCssLayerSource(id, changedSource);
9806
9832
  await options.refreshTailwindRootCssSource(id, changedSource);
@@ -9811,7 +9837,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9811
9837
  handleHotUpdate: {
9812
9838
  order: "post",
9813
9839
  async handler(ctx) {
9814
- recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl(ctx.file))]));
9840
+ recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl$1(ctx.file))]));
9815
9841
  return options.hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
9816
9842
  const isSourceCandidateHotUpdate = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(ctx.file);
9817
9843
  if (isSourceCandidateHotUpdate && isSourceStyleRequest(ctx.file)) {
@@ -9851,7 +9877,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9851
9877
  const hotRoot = ctx.server.config?.root ?? process$1.cwd();
9852
9878
  const sourceModules = isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) ? await resolveHotSourceModules(ctx) : ctx.modules;
9853
9879
  if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file)) {
9854
- if (!/\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file))) sendSupplementalSourceHotUpdates(ctx, sourceModules);
9880
+ if (!/\.(?:uvue|nvue)$/i.test(cleanUrl$1(ctx.file))) sendSupplementalSourceHotUpdates(ctx, sourceModules);
9855
9881
  if (sourceModules.some((mod) => {
9856
9882
  const id = mod.id ?? mod.url;
9857
9883
  return typeof id === "string" && /[?&]macro=true(?:&|$)/.test(id) === false && typeof mod.url === "string" && mod.url.startsWith("/pages/") && /\.vue(?:$|[?#])/i.test(id);
@@ -9869,7 +9895,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9869
9895
  sendFullReloadForUnresolvedHotUpdate(ctx);
9870
9896
  return [];
9871
9897
  }
9872
- if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && /\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file)) && !hasTemplateHotSourceModule(sourceModules)) {
9898
+ if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && /\.(?:uvue|nvue)$/i.test(cleanUrl$1(ctx.file)) && !hasTemplateHotSourceModule(sourceModules)) {
9873
9899
  sendFullReloadForUnresolvedHotUpdate(ctx);
9874
9900
  return [];
9875
9901
  }
@@ -9894,7 +9920,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9894
9920
  const WEB_HMR_RUNTIME_AFFECTING_DIRECTIVE_RE = /@(?:theme|source|config|plugin|apply)\b/;
9895
9921
  function createFrameworkHmrRuntimeSignature(file, source) {
9896
9922
  if (!source || !WEB_HMR_RUNTIME_AFFECTING_DIRECTIVE_RE.test(source)) return "";
9897
- return (isSfcStyleSourceFile(cleanUrl(file)) ? extractSfcStyleSources(source).filter((styleSource) => WEB_HMR_RUNTIME_AFFECTING_DIRECTIVE_RE.test(styleSource)) : [source]).map((styleSource) => createRuntimeAffectingSourceSignature(styleSource, "css")).join("\0");
9923
+ return (isSfcStyleSourceFile(cleanUrl$1(file)) ? extractSfcStyleSources(source).filter((styleSource) => WEB_HMR_RUNTIME_AFFECTING_DIRECTIVE_RE.test(styleSource)) : [source]).map((styleSource) => createRuntimeAffectingSourceSignature(styleSource, "css")).join("\0");
9898
9924
  }
9899
9925
  function hasFrameworkHmrRuntimeSourceChange(file, previousSource, nextSource) {
9900
9926
  return createFrameworkHmrRuntimeSignature(file, previousSource) !== createFrameworkHmrRuntimeSignature(file, nextSource);
@@ -9925,7 +9951,7 @@ function createFrameworkSourceScanSession(options) {
9925
9951
  const pendingSourceCandidateSyncs = /* @__PURE__ */ new Set();
9926
9952
  const pendingSourceCandidateSyncByFile = /* @__PURE__ */ new Map();
9927
9953
  const pendingHotUpdateChangeByFile = /* @__PURE__ */ new Map();
9928
- const normalizeDependency = (file) => path.normalize(path.resolve(cleanUrl(file)));
9954
+ const normalizeDependency = (file) => path.normalize(path.resolve(cleanUrl$1(file)));
9929
9955
  const isDependency = (file) => sourceScanDependencies.has(normalizeDependency(file));
9930
9956
  const invalidate = () => {
9931
9957
  sourceCandidateScanInvalidated = true;
@@ -10075,7 +10101,7 @@ function createFrameworkSourceScanSession(options) {
10075
10101
  };
10076
10102
  const syncChangedFile = async (id, sourceOverride) => {
10077
10103
  if (!options.shouldOwnTailwindGeneration || !options.isCandidateRequest(id)) return;
10078
- const file = cleanUrl(id);
10104
+ const file = cleanUrl$1(id);
10079
10105
  const runtimeAffectingByDependency = isDependency(file);
10080
10106
  if (runtimeAffectingByDependency) invalidate();
10081
10107
  const resolvedFile = resolveSourceScanPath(file);
@@ -10116,7 +10142,7 @@ function createFrameworkSourceScanSession(options) {
10116
10142
  };
10117
10143
  return {
10118
10144
  cacheCurrent,
10119
- consumeHotUpdateChange: (id) => pendingHotUpdateChangeByFile.delete(cleanUrl(id)),
10145
+ consumeHotUpdateChange: (id) => pendingHotUpdateChangeByFile.delete(cleanUrl$1(id)),
10120
10146
  getStats: () => ({
10121
10147
  pendingSourceCandidateSyncByFile: pendingSourceCandidateSyncByFile.size,
10122
10148
  pendingSourceCandidateSyncs: pendingSourceCandidateSyncs.size,
@@ -10150,7 +10176,7 @@ function createFrameworkTailwindRootCss(options) {
10150
10176
  await options.registerAutoCssSource(id, hotSource ?? code);
10151
10177
  };
10152
10178
  const refreshSource = async (id, code) => {
10153
- const file = cleanUrl(id);
10179
+ const file = cleanUrl$1(id);
10154
10180
  if (!moduleIds.has(id) && !moduleIds.has(file) && !hasTailwindRootDirectives(code, { importFallback: options.getImportFallback() })) return;
10155
10181
  hotSourceByFile.set(normalizeSourceFile(id), code);
10156
10182
  await register(id, code);
@@ -10291,13 +10317,13 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10291
10317
  let autoCssSourcesRefresh;
10292
10318
  let autoCssSourcesDiscovered = false;
10293
10319
  const syncTailwindCssSourceCandidates = async (id, css) => {
10294
- if (tailwindcssMajorVersion === 4 && isMissingInternalCssSource(cleanUrl(id), weappTailwindcssPackageDir)) return;
10320
+ if (tailwindcssMajorVersion === 4 && isMissingInternalCssSource(cleanUrl$1(id), weappTailwindcssPackageDir)) return;
10295
10321
  await sourceCandidateCollector.syncCss(id, css);
10296
10322
  sourceScanSession.cacheCurrent();
10297
10323
  };
10298
10324
  const registerAutoCssSource = async (id, css, options2 = {}) => {
10299
10325
  if (!shouldOwnTailwindGeneration) return;
10300
- const file = cleanUrl(id);
10326
+ const file = cleanUrl$1(id);
10301
10327
  if (!path.isAbsolute(file)) return;
10302
10328
  if (!isTailwindV4CssEntry(file)) return;
10303
10329
  if (isMissingInternalCssSource(file, weappTailwindcssPackageDir)) return;
@@ -10369,7 +10395,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10369
10395
  });
10370
10396
  const originalCssLayerSourceByFile = new LRUCache({ max: 128 });
10371
10397
  const rememberOriginalCssLayerSource = (id, code) => {
10372
- const file = cleanUrl(id);
10398
+ const file = cleanUrl$1(id);
10373
10399
  if (!isCSSRequest(file)) return;
10374
10400
  if (!hasUserCssLayerBlocks(code)) {
10375
10401
  originalCssLayerSourceByFile.delete(file);
@@ -10434,18 +10460,18 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10434
10460
  };
10435
10461
  const isNuxtPageHotModule = (id) => {
10436
10462
  if (typeof id !== "string") return false;
10437
- const cleanId = cleanUrl(id).replace(/%2F/gi, "/");
10463
+ const cleanId = cleanUrl$1(id).replace(/%2F/gi, "/");
10438
10464
  if (cleanId.includes("virtual:nuxt:") && /(?:^|\/)routes\.mjs$/.test(cleanId)) return true;
10439
10465
  if (!/[?&]macro=true(?:&|$)/.test(id)) return false;
10440
10466
  return cleanId.includes("/pages/") && /\.(?:vue|tsx?|jsx?)$/.test(cleanId);
10441
10467
  };
10442
- const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey(cleanUrl(file));
10468
+ const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey(cleanUrl$1(file));
10443
10469
  const hmrCandidateState = createViteHmrCandidateState({
10444
10470
  cleanGeneratedCssByFile,
10445
10471
  generatedClassSetByFile,
10446
10472
  getCommand: () => resolvedConfig?.command,
10447
10473
  getGeneratorOptions: resolveCurrentGeneratorOptions,
10448
- isRuntimeAffectingSource: (file) => uniAppXEnabled && !resolveCurrentGeneratorBranch().isWeb && /\.(?:uvue|nvue)$/i.test(cleanUrl(file))
10474
+ isRuntimeAffectingSource: (file) => uniAppXEnabled && !resolveCurrentGeneratorBranch().isWeb && /\.(?:uvue|nvue)$/i.test(cleanUrl$1(file))
10449
10475
  });
10450
10476
  const sourceScanSession = createFrameworkSourceScanSession({
10451
10477
  cssMemory,
@@ -10490,7 +10516,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10490
10516
  processedCssRegistry.prune(activeFiles);
10491
10517
  cssMemory.prune(options2);
10492
10518
  };
10493
- const normalizeViteProcessedCssFile = (file) => path.resolve(cleanUrl(file));
10519
+ const normalizeViteProcessedCssFile = (file) => path.resolve(cleanUrl$1(file));
10494
10520
  const markViteProcessedCssSource = processedCssRegistry.markSource;
10495
10521
  const isUniViteProject = () => {
10496
10522
  return resolvedConfig?.plugins?.some((plugin) => plugin.name.includes("uni")) ?? false;
@@ -10533,7 +10559,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10533
10559
  if (!shouldOwnTailwindGeneration) return;
10534
10560
  await runtimeState.readyPromise;
10535
10561
  await sourceScanSession.waitForPendingSyncs();
10536
- const file = cleanUrl(id);
10562
+ const file = cleanUrl$1(id);
10537
10563
  const inferredSfcStyleRequest = isSfcStyleSourceFile(file) ? resolveSfcStyleRequestFromKnownSource(file, cssMemory.getKnownSfcSource(file), code) : file;
10538
10564
  const requestFile = isCSSRequest(id) ? inferredSfcStyleRequest === file ? resolveViteCssPipelineRequestFile(id) : inferredSfcStyleRequest : inferredSfcStyleRequest;
10539
10565
  if (!isCSSRequest(requestFile) || opts.htmlMatcher(file) || isHTMLRequest(file)) return;
@@ -10731,7 +10757,7 @@ ${tracedCss}`;
10731
10757
  getSourceCandidates,
10732
10758
  getSourceCandidateSource: (file) => sourceCandidateCollector.source(file),
10733
10759
  getSourceCandidateSources: () => sourceCandidateCollector.sources(),
10734
- extractSourceCandidates: (file, source) => extractCandidatesFromSource(source, path.extname(cleanUrl(file)).slice(1) || "html", {
10760
+ extractSourceCandidates: (file, source) => extractCandidatesFromSource(source, path.extname(cleanUrl$1(file)).slice(1) || "html", {
10735
10761
  bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
10736
10762
  customAttributesEntities,
10737
10763
  disabledDefaultTemplateHandler
@@ -10745,7 +10771,7 @@ ${tracedCss}`;
10745
10771
  setRememberedCssSignature: cssMemory.setRememberedCssSignature,
10746
10772
  getKnownCssSource: cssMemory.getKnownCssSource,
10747
10773
  getKnownSfcSource: cssMemory.getKnownSfcSource,
10748
- getOriginalCssLayerSource: (file) => originalCssLayerSourceByFile.get(cleanUrl(file)),
10774
+ getOriginalCssLayerSource: (file) => originalCssLayerSourceByFile.get(cleanUrl$1(file)),
10749
10775
  recordGeneratorCandidates,
10750
10776
  pruneViteCssCaches,
10751
10777
  getViteCssCacheStats,
@@ -10802,6 +10828,17 @@ ${tracedCss}`;
10802
10828
  });
10803
10829
  const extraPluginPlatform = frameworkBranch.getExtraPluginPlatform?.() ?? {};
10804
10830
  const syncSourceCandidatesForHotUpdate = (ctx) => syncFrameworkSourceCandidatesForHotUpdate(sourceScanSession, ctx);
10831
+ const registerModuleGraphCandidates = createFrameworkModuleCandidateRegistrar({
10832
+ cacheCurrent: sourceScanSession.cacheCurrent,
10833
+ debug,
10834
+ getCssHandlerOptions: transformCssHandlerOptions.getCssHandlerOptions,
10835
+ getGeneratorPlatform: resolveGeneratorPlatform,
10836
+ invalidateRecordedGeneratorCandidates,
10837
+ opts,
10838
+ runtimeState,
10839
+ sourceCandidateCollector,
10840
+ styleHandler
10841
+ });
10805
10842
  const prepareTailwindGeneration = async () => {
10806
10843
  if (sourceScanSession.shouldDiscoverAutoCssSources(autoCssSourcesDiscovered)) await discoverAndRegisterAutoCssSources();
10807
10844
  await sourceScanSession.sync();
@@ -10818,6 +10855,7 @@ ${tracedCss}`;
10818
10855
  isWebGeneratorTarget: () => resolveCurrentGeneratorBranch().isWeb,
10819
10856
  jsHandler,
10820
10857
  mainCssChunkMatcher,
10858
+ registerModuleGraphCandidates,
10821
10859
  runtimeState,
10822
10860
  styleHandler,
10823
10861
  syncSourceCandidatesForHotUpdate,
@@ -10833,7 +10871,7 @@ ${tracedCss}`;
10833
10871
  debug("preserve adapted generated css before uni-app watch cache: %s", id);
10834
10872
  return css;
10835
10873
  }
10836
- const file = cleanUrl(id);
10874
+ const file = cleanUrl$1(id);
10837
10875
  const styleRequest = isSfcStyleSourceFile(file) ? resolveSfcStyleRequestFromKnownSource(file, cssMemory.getKnownSfcSource(file), css, id) : id;
10838
10876
  const transformedCss = (await styleHandler(css, transformCssHandlerOptions.getCssHandlerOptions(styleRequest))).css;
10839
10877
  debug("adapt css before uni-app watch cache: %s inputRaw=%s outputRaw=%s", id, css.includes("\\[") || css.includes("\\:"), transformedCss.includes("\\[") || transformedCss.includes("\\:"));
@@ -11239,6 +11277,7 @@ function createUniAppXVitePlugins(options = {}) {
11239
11277
  isWebGeneratorTarget: context.isWebGeneratorTarget,
11240
11278
  jsHandler: context.jsHandler,
11241
11279
  mainCssChunkMatcher: context.mainCssChunkMatcher,
11280
+ registerModuleGraphCandidates: context.registerModuleGraphCandidates,
11242
11281
  runtimeState: context.runtimeState,
11243
11282
  styleHandler: context.styleHandler,
11244
11283
  syncSourceCandidatesForHotUpdate: context.syncSourceCandidatesForHotUpdate,