weapp-tailwindcss 5.3.2 → 5.3.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 (50) hide show
  1. package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +3 -0
  2. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
  3. package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +15 -0
  4. package/dist/{context-Kvr3lLEC.js → context-4ittVpgt.js} +1 -1
  5. package/dist/{context-CB4Ef9U0.cjs → context-Ulhcd5lF.cjs} +3 -3
  6. package/dist/core.cjs +1 -1
  7. package/dist/core.js +1 -1
  8. package/dist/{gulp-vz36-uQP.js → gulp-8V2aiU52.js} +3 -3
  9. package/dist/{gulp-QJ_oz-06.cjs → gulp-CsssU4xB.cjs} +6 -6
  10. package/dist/gulp.cjs +1 -1
  11. package/dist/gulp.js +1 -1
  12. package/dist/{hmr-timing-HGlM4hX3.js → hmr-timing-CTpjCpQh.js} +42 -13
  13. package/dist/{hmr-timing-W3kro20F.cjs → hmr-timing-DyiiYupC.cjs} +2 -2
  14. package/dist/index.cjs +3 -3
  15. package/dist/index.js +3 -3
  16. package/dist/local-style-matcher-DRpFEu1s.cjs +34 -0
  17. package/dist/local-style-matcher-DsiI2wIc.js +17 -0
  18. package/dist/{options-CKZW99r4.cjs → options-BJrtIQbH.cjs} +3 -1
  19. package/dist/{pipeline-helpers-t95KPu4O.cjs → pipeline-helpers-Cda0Ox3K.cjs} +2 -2
  20. package/dist/presets.cjs +2 -2
  21. package/dist/presets.js +1 -1
  22. package/dist/rspack.cjs +2 -2
  23. package/dist/rspack.js +2 -2
  24. package/dist/{source-candidate-scan-signature-BHCPQVoD.js → source-candidate-scan-signature--r31NK5J.js} +2 -2
  25. package/dist/{source-candidate-scan-signature-BSad7bMQ.cjs → source-candidate-scan-signature-bJFr7L8T.cjs} +2 -2
  26. package/dist/{style-options-PCgz2ywM.cjs → style-options-DW30H5PV.cjs} +1 -1
  27. package/dist/{tailwindcss-jKzY37Sk.cjs → tailwindcss-CexDJBhx.cjs} +1 -1
  28. package/dist/{tailwindcss-BSEdWieh.js → tailwindcss-ChnpCv25.js} +3 -1
  29. package/dist/{component-local-style-CNhEhd2B.cjs → transform-BQjg2T2T.cjs} +201 -27
  30. package/dist/{component-local-style-C2wC8o9F.js → transform-Cp4KybBy.js} +207 -16
  31. package/dist/types/user-defined-options/important.d.ts +2 -0
  32. package/dist/uni-app-x/component-local-style.d.ts +6 -4
  33. package/dist/uni-app-x/local-style-matcher.d.ts +4 -0
  34. package/dist/uni-app-x/options.d.ts +2 -0
  35. package/dist/uni-app-x/style-asset/harmony-global.d.ts +2 -0
  36. package/dist/uni-app-x/transform.d.ts +2 -0
  37. package/dist/uni-app-x/vite/plugin-options.d.ts +1 -0
  38. package/dist/{v4-generation-core-BfeXEc6R.cjs → v4-generation-core-8YMXikPd.cjs} +42 -13
  39. package/dist/{vite-Dy6THt54.cjs → vite-CeyMHgzQ.cjs} +68 -15
  40. package/dist/{vite-CVr0vIgh.js → vite-kY-WXrd6.js} +121 -68
  41. package/dist/vite.cjs +1 -1
  42. package/dist/vite.js +1 -1
  43. package/dist/weapp-tw-css-import-rewrite-loader.cjs +4 -4
  44. package/dist/{webpack-DwtdWqwr.js → webpack-BN2kLWW_.js} +4 -4
  45. package/dist/{webpack-Cf5RnhXt.cjs → webpack-Bfj63Wt1.cjs} +8 -8
  46. package/dist/webpack.cjs +1 -1
  47. package/dist/webpack.js +1 -1
  48. package/package.json +3 -3
  49. package/dist/transform-CgohToUV.cjs +0 -200
  50. 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 { 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-CTpjCpQh.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--r31NK5J.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
  });
@@ -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}`;
@@ -6251,14 +6263,14 @@ function isPreprocessorRequest(id, lang) {
6251
6263
  return PREPROCESSOR_EXT_RE.test(id);
6252
6264
  }
6253
6265
  function resolveUniAppXCssTarget(id) {
6254
- return UVUE_NVUE_RE$1.test(cleanUrl(id)) ? "uvue" : void 0;
6266
+ return UVUE_NVUE_RE$1.test(cleanUrl$1(id)) ? "uvue" : void 0;
6255
6267
  }
6256
6268
  function isCssModuleExport(code) {
6257
6269
  return CSS_MODULE_EXPORT_RE.test(code);
6258
6270
  }
6259
6271
  function normalizeRelativeTailwindReferences(code, id) {
6260
6272
  if (!code.includes("@reference")) return code;
6261
- const sourceFile = cleanUrl(id);
6273
+ const sourceFile = cleanUrl$1(id);
6262
6274
  const pathApi = WINDOWS_ABSOLUTE_PATH_RE.test(sourceFile) ? path.win32 : path;
6263
6275
  const sourceDir = pathApi.dirname(sourceFile);
6264
6276
  return code.replace(RELATIVE_REFERENCE_RE, (_full, quote, request) => {
@@ -6287,18 +6299,18 @@ function createUniAppXWebLocalStyleBridge(isEnabled) {
6287
6299
  return {
6288
6300
  appendToStyle(code, id) {
6289
6301
  if (!isEnabled()) return code;
6290
- const rules = rulesByFile.get(cleanUrl(id));
6302
+ const rules = rulesByFile.get(cleanUrl$1(id));
6291
6303
  return rules ? `${code}\n${rules}` : code;
6292
6304
  },
6293
6305
  handleHotUpdate(ctx) {
6294
- if (!isEnabled() || !/\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file))) return;
6306
+ if (!isEnabled() || !/\.(?:uvue|nvue)$/i.test(cleanUrl$1(ctx.file))) return;
6295
6307
  const styleModules = [...ctx.server.moduleGraph.getModulesByFile?.(ctx.file) ?? []].filter(isStyleModule);
6296
6308
  if (styleModules.length === 0) return;
6297
6309
  for (const mod of styleModules) ctx.server.moduleGraph.invalidateModule(mod);
6298
6310
  return [.../* @__PURE__ */ new Set([...ctx.modules, ...styleModules])];
6299
6311
  },
6300
6312
  remember(id, rules) {
6301
- rulesByFile.set(cleanUrl(id), rules);
6313
+ rulesByFile.set(cleanUrl$1(id), rules);
6302
6314
  }
6303
6315
  };
6304
6316
  }
@@ -6306,7 +6318,7 @@ function createUniAppXWebLocalStyleBridge(isEnabled) {
6306
6318
  //#region src/uni-app-x/vite.ts
6307
6319
  let transformUVuePromise;
6308
6320
  function loadTransformUVue() {
6309
- transformUVuePromise ?? (transformUVuePromise = import("./transform-DSRPiBWz.js").then((mod) => mod.transformUVue));
6321
+ transformUVuePromise ?? (transformUVuePromise = import("./transform-Cp4KybBy.js").then((mod) => mod.transformUVue));
6310
6322
  return transformUVuePromise;
6311
6323
  }
6312
6324
  const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
@@ -6315,7 +6327,7 @@ function resolveUniAppXJsTransformEnabled(uniAppX) {
6315
6327
  return uniAppX === void 0 ? true : isUniAppXEnabled(uniAppX);
6316
6328
  }
6317
6329
  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;
6330
+ 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
6331
  const resolvedUniAppXOptions = resolveUniAppXOptions(uniAppX);
6320
6332
  const utsPlatform = resolveUniUtsPlatform();
6321
6333
  const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
@@ -6347,7 +6359,7 @@ function createUniAppXPlugins(options) {
6347
6359
  return componentLocalStyleEnabled;
6348
6360
  }
6349
6361
  function shouldEnablePageLocalStyleForFile(id) {
6350
- return resolvedUniAppXOptions.componentLocalStyles.enabled && (isNativeAppBuildTarget(id) || shouldEnablePageLocalStyle(id));
6362
+ return resolvedUniAppXOptions.componentLocalStyles.enabled && (isNativeAppBuildTarget(id) || shouldEnablePageLocalStyle(id, resolvedUniAppXOptions.componentLocalStyles.pageMatcher));
6351
6363
  }
6352
6364
  function isHarmonyBuildTarget() {
6353
6365
  if (resolveUniUtsPlatform().isAppHarmony) return true;
@@ -6402,7 +6414,7 @@ function createUniAppXPlugins(options) {
6402
6414
  const styleHandlerOptions = getStyleHandlerOptions(id, isNativeStyle && hasTailwindRoot ? "tailwind-root" : isNativeStyle ? "author-apply" : void 0);
6403
6415
  const postcssResult = await styleHandler(styleCode, styleHandlerOptions);
6404
6416
  reportStyleWarnings(postcssResult);
6405
- const postcssMap = await formatPostcssSourceMap(postcssResult.map.toJSON(), normalizePath(cleanUrl(id)));
6417
+ const postcssMap = await formatPostcssSourceMap(postcssResult.map.toJSON(), normalizePath(cleanUrl$1(id)));
6406
6418
  return {
6407
6419
  code: postcssResult.css,
6408
6420
  map: postcssMap
@@ -6449,21 +6461,25 @@ function createUniAppXPlugins(options) {
6449
6461
  async function transformSfc(code, id, context) {
6450
6462
  if (isNativeAppBuildTarget(id)) {
6451
6463
  nativeLocalStyleModuleIds.add(id);
6452
- nativeLocalStyleModuleIds.add(cleanUrl(id));
6464
+ nativeLocalStyleModuleIds.add(cleanUrl$1(id));
6453
6465
  }
6454
6466
  harmonyApply.rememberSource(code, id, true);
6467
+ const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
6468
+ const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
6455
6469
  const resolvedConfig = getResolvedConfig();
6456
6470
  const shouldForceRefresh = resolvedConfig?.command === "serve" || resolvedConfig?.command === "build";
6457
- const currentRuntimeSet = await ensureRuntimeClassSet(shouldForceRefresh);
6471
+ const moduleGraphCandidates = enableComponentLocalStyle || enablePageLocalStyle ? await registerModuleGraphCandidates?.(id, code) : void 0;
6472
+ const runtimeSet = await ensureRuntimeClassSet(shouldForceRefresh);
6473
+ const currentRuntimeSet = moduleGraphCandidates?.size ? /* @__PURE__ */ new Set([...runtimeSet, ...moduleGraphCandidates]) : runtimeSet;
6458
6474
  nativeHmrReloader.remember(currentRuntimeSet);
6459
6475
  const transformUVue = await loadTransformUVue();
6460
- const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
6461
- const enablePageLocalStyle = shouldEnablePageLocalStyleForFile(id);
6462
6476
  const transformOptions = omitUndefined({
6477
+ componentMatcher: resolvedUniAppXOptions.componentLocalStyles.componentMatcher,
6463
6478
  ...customAttributesEntities.length > 0 ? { customAttributesEntities } : {},
6464
6479
  ...disabledDefaultTemplateHandler ? { disabledDefaultTemplateHandler } : {},
6465
6480
  ...enableComponentLocalStyle ? { enableComponentLocalStyle } : {},
6466
6481
  ...enablePageLocalStyle ? { enablePageLocalStyle } : {},
6482
+ pageMatcher: resolvedUniAppXOptions.componentLocalStyles.pageMatcher,
6467
6483
  ...isWebGeneratorTarget() && customAttributesEntities.length > 0 ? { webCustomAttributeDeep: true } : {},
6468
6484
  ...isWebGeneratorTarget() ? { onWebLocalStyleRules: (rules) => webLocalStyle.remember(id, rules) } : {}
6469
6485
  });
@@ -6536,6 +6552,7 @@ function createUniAppXPlugins(options) {
6536
6552
  }
6537
6553
  injectUniAppXHarmonyBundleStyles(bundle, {
6538
6554
  cssSources,
6555
+ componentMatcher: resolvedUniAppXOptions.componentLocalStyles.componentMatcher,
6539
6556
  excludeComponents: shouldEnableComponentLocalStyle()
6540
6557
  });
6541
6558
  }
@@ -8748,12 +8765,12 @@ function extractSfcStyleSource(source, index) {
8748
8765
  return styleSources.length > 0 ? styleSources.join("\n") : void 0;
8749
8766
  }
8750
8767
  function normalizeKnownSfcSourceKey(file) {
8751
- return normalizeOutputPathKey(path.resolve(cleanUrl(file)));
8768
+ return normalizeOutputPathKey(path.resolve(cleanUrl$1(file)));
8752
8769
  }
8753
8770
  function shouldCollectTransformedSourceCandidates(id) {
8754
8771
  if (isWeappViteSidecarRequest(id)) return false;
8755
8772
  if (id.search(/[?#]/) < 0) return true;
8756
- const file = cleanUrl(id);
8773
+ const file = cleanUrl$1(id);
8757
8774
  return !SFC_COMPONENT_FILE_RE.test(file);
8758
8775
  }
8759
8776
  function createViteCssMemory(options) {
@@ -8763,7 +8780,7 @@ function createViteCssMemory(options) {
8763
8780
  const knownSfcSources = /* @__PURE__ */ new Map();
8764
8781
  const rememberKnownSfcSource = (id, code) => {
8765
8782
  if (id.search(/[?#]/) >= 0) return;
8766
- const file = cleanUrl(id);
8783
+ const file = cleanUrl$1(id);
8767
8784
  if (!SFC_COMPONENT_FILE_RE.test(file)) return;
8768
8785
  if (!hasSfcStyleBlocks(code)) return;
8769
8786
  touchMapEntry(knownSfcSources, normalizeKnownSfcSourceKey(file), code);
@@ -8824,23 +8841,23 @@ function createViteCssMemory(options) {
8824
8841
  for (const [rememberedKey, remembered] of relatedRememberedEntries) refreshRememberedCssSourceEntry(rememberedKey, remembered, sourceFile, rawSource);
8825
8842
  };
8826
8843
  const resolveCachedStyleSource = (sourceFile) => {
8827
- const file = cleanUrl(stripRequestQuery(sourceFile));
8844
+ const file = cleanUrl$1(stripRequestQuery(sourceFile));
8828
8845
  if (SFC_COMPONENT_FILE_RE.test(file)) return getKnownSfcSource(file);
8829
8846
  if (isSourceStyleRequest(file)) return options.getSourceCandidateSource(file);
8830
8847
  };
8831
8848
  const resolveCurrentStyleSource = (sourceFile) => {
8832
8849
  const cached = resolveCachedStyleSource(sourceFile);
8833
8850
  if (cached != null) return cached;
8834
- const file = cleanUrl(stripRequestQuery(sourceFile));
8851
+ const file = cleanUrl$1(stripRequestQuery(sourceFile));
8835
8852
  const knownSource = knownCssSources.get(normalizeCssSourceIdentity(sourceFile));
8836
8853
  if (knownSource != null) return knownSource;
8837
8854
  const candidateSource = options.getSourceCandidateSource(file);
8838
8855
  if (candidateSource != null) return candidateSource;
8839
8856
  };
8840
8857
  const refreshRememberedCssSourceByCurrentFile = async (sourceFile) => {
8841
- const file = cleanUrl(sourceFile);
8858
+ const file = cleanUrl$1(sourceFile);
8842
8859
  const normalizedSourceFile = normalizeOutputPathKey(file);
8843
- const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => normalizeOutputPathKey(stripRequestQuery(cleanUrl(remembered.sourceFile))) === normalizedSourceFile);
8860
+ const matchedRememberedSources = [...rememberedCssSources.values()].filter((remembered) => normalizeOutputPathKey(stripRequestQuery(cleanUrl$1(remembered.sourceFile))) === normalizedSourceFile);
8844
8861
  if (matchedRememberedSources.length === 0) return;
8845
8862
  const source = await resolveCurrentStyleSource(file);
8846
8863
  if (source == null) {
@@ -8967,7 +8984,7 @@ function joinPosixPath(base, subpath) {
8967
8984
  }
8968
8985
  function isCssLikeImporter(importer) {
8969
8986
  if (!importer) return false;
8970
- const normalized = cleanUrl(importer);
8987
+ const normalized = cleanUrl$1(importer);
8971
8988
  return isSourceStyleRequest(importer) || isCSSRequest(normalized) || normalized.endsWith("/*");
8972
8989
  }
8973
8990
  function stripTailwindConfigDirectives(code) {
@@ -8993,7 +9010,7 @@ function createRewriteCssImportsPlugins(options) {
8993
9010
  },
8994
9011
  async transform(code, id) {
8995
9012
  if (!isCSSRequest(id)) return null;
8996
- const file = cleanUrl(id);
9013
+ const file = cleanUrl$1(id);
8997
9014
  const normalizedCode = hasTailwindRootDirectives(code) || code.includes("@config") ? normalizeTailwindConfigDirectives(code, path.dirname(file)) : code;
8998
9015
  await options.onCssSourceTransform?.(id, normalizedCode);
8999
9016
  const hasTailwindRoot = hasTailwindRootDirectives(normalizedCode, { importFallback: true });
@@ -9361,7 +9378,7 @@ function createViteHmrCandidateState(options) {
9361
9378
  let pendingCssTargetFiles;
9362
9379
  let pendingTargetsArmed = false;
9363
9380
  let pendingFullRegeneration = false;
9364
- const normalizeCssTargetFile = (file) => normalizeVitePersistentCacheKey(cleanUrl(file));
9381
+ const normalizeCssTargetFile = (file) => normalizeVitePersistentCacheKey(cleanUrl$1(file));
9365
9382
  const clear = () => {
9366
9383
  pendingChange = void 0;
9367
9384
  pendingCssTargetFiles = void 0;
@@ -9495,6 +9512,29 @@ function createViteHmrCandidateState(options) {
9495
9512
  };
9496
9513
  }
9497
9514
  //#endregion
9515
+ //#region src/bundlers/vite/shared/framework-module-candidates.ts
9516
+ function createFrameworkModuleCandidateRegistrar(options) {
9517
+ return async (id, source) => {
9518
+ await options.runtimeState.readyPromise;
9519
+ const candidates = await options.sourceCandidateCollector.syncModuleSource(id, source);
9520
+ options.invalidateRecordedGeneratorCandidates();
9521
+ options.cacheCurrent();
9522
+ const cssHandlerOptions = options.getCssHandlerOptions(id);
9523
+ return validateCandidatesByGenerator({
9524
+ candidates,
9525
+ cssHandlerOptions,
9526
+ cssUserHandlerOptions: cssHandlerOptions,
9527
+ debug: options.debug,
9528
+ file: cleanUrl$1(id),
9529
+ generatorPlatform: options.getGeneratorPlatform(),
9530
+ opts: options.opts,
9531
+ rawSource: "",
9532
+ runtimeState: options.runtimeState,
9533
+ styleHandler: options.styleHandler
9534
+ });
9535
+ };
9536
+ }
9537
+ //#endregion
9498
9538
  //#region src/bundlers/vite/shared/framework-plugin-order.ts
9499
9539
  function orderFrameworkSourceCandidatePlugins(extraPlugins, rewritePlugins, sourceCandidatesPlugin, beforeExtraPlugin) {
9500
9540
  const anchor = beforeExtraPlugin ? extraPlugins.findIndex(beforeExtraPlugin) : -1;
@@ -9665,7 +9705,7 @@ function createFrameworkProcessedCssRegistry() {
9665
9705
  const results = /* @__PURE__ */ new Map();
9666
9706
  const sourceFiles = /* @__PURE__ */ new Set();
9667
9707
  const markSource = (file) => {
9668
- sourceFiles.add(path.resolve(cleanUrl(file)));
9708
+ sourceFiles.add(path.resolve(cleanUrl$1(file)));
9669
9709
  };
9670
9710
  const record = (file, css, options = {}) => {
9671
9711
  const key = normalizeVitePersistentCacheKey(file);
@@ -9679,7 +9719,7 @@ function createFrameworkProcessedCssRegistry() {
9679
9719
  };
9680
9720
  const get = (file) => results.get(normalizeVitePersistentCacheKey(file));
9681
9721
  const matchesIdentity = (candidate) => {
9682
- return sourceFiles.has(path.resolve(cleanUrl(candidate)));
9722
+ return sourceFiles.has(path.resolve(cleanUrl$1(candidate)));
9683
9723
  };
9684
9724
  const prune = (activeFiles) => {
9685
9725
  for (const [key, result] of results) {
@@ -9744,7 +9784,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9744
9784
  enforce: "pre",
9745
9785
  async load(id) {
9746
9786
  if (!options.shouldOwnTailwindGeneration || options.isWebOrNativeAppPlatform(options.resolveViteStylePlatform()) || !isCSSRequest(id) || !shouldCollectTransformedSourceCandidates(id)) return;
9747
- const file = cleanUrl(id);
9787
+ const file = cleanUrl$1(id);
9748
9788
  const rawCode = await readFile(file, "utf8").catch(() => void 0);
9749
9789
  if (typeof rawCode !== "string") return;
9750
9790
  options.rememberOriginalCssLayerSource(id, rawCode);
@@ -9770,7 +9810,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9770
9810
  } : void 0;
9771
9811
  return options.hmrTimingRecorder.measure("sourceCandidates.transform", async () => {
9772
9812
  options.invalidateRecordedGeneratorCandidates();
9773
- const file = cleanUrl(id);
9813
+ const file = cleanUrl$1(id);
9774
9814
  if (!options.sourceScanSession.matches(file)) {
9775
9815
  options.sourceCandidateCollector.remove(file);
9776
9816
  options.sourceScanSession.cacheCurrent();
@@ -9789,18 +9829,18 @@ function createFrameworkSourceCandidatesPlugin(options) {
9789
9829
  }
9790
9830
  },
9791
9831
  async watchChange(id, change) {
9792
- recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl(id))]));
9832
+ recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl$1(id))]));
9793
9833
  await options.hmrTimingRecorder.measure("sourceCandidates.watchChange", async () => {
9794
9834
  if (options.shouldOwnTailwindGeneration && isSourceCandidateRequest(id)) options.invalidateRecordedGeneratorCandidates();
9795
9835
  if (options.sourceScanSession.isDependency(id)) options.sourceScanSession.invalidate();
9796
9836
  if (change.event === "delete") {
9797
- const file = cleanUrl(id);
9837
+ const file = cleanUrl$1(id);
9798
9838
  const sourceCandidateChange = options.sourceCandidateCollector.remove(file);
9799
9839
  options.sourceScanSession.cacheCurrent();
9800
9840
  options.hmrCandidateState.apply(options.hmrCandidateState.createChange(file, sourceCandidateChange, { runtimeAffecting: options.sourceScanSession.isDependency(file) }));
9801
9841
  return;
9802
9842
  }
9803
- const changedSource = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(id) && isCSSRequest(id) ? await readFile(cleanUrl(id), "utf8").catch(() => void 0) : void 0;
9843
+ const changedSource = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(id) && isCSSRequest(id) ? await readFile(cleanUrl$1(id), "utf8").catch(() => void 0) : void 0;
9804
9844
  if (typeof changedSource === "string") {
9805
9845
  options.rememberOriginalCssLayerSource(id, changedSource);
9806
9846
  await options.refreshTailwindRootCssSource(id, changedSource);
@@ -9811,7 +9851,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9811
9851
  handleHotUpdate: {
9812
9852
  order: "post",
9813
9853
  async handler(ctx) {
9814
- recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl(ctx.file))]));
9854
+ recordCompilationDependencyChanges(options.runtimeState, createCompilationDependencyChanges([path.resolve(cleanUrl$1(ctx.file))]));
9815
9855
  return options.hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
9816
9856
  const isSourceCandidateHotUpdate = options.shouldOwnTailwindGeneration && isSourceCandidateRequest(ctx.file);
9817
9857
  if (isSourceCandidateHotUpdate && isSourceStyleRequest(ctx.file)) {
@@ -9851,7 +9891,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9851
9891
  const hotRoot = ctx.server.config?.root ?? process$1.cwd();
9852
9892
  const sourceModules = isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) ? await resolveHotSourceModules(ctx) : ctx.modules;
9853
9893
  if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file)) {
9854
- if (!/\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file))) sendSupplementalSourceHotUpdates(ctx, sourceModules);
9894
+ if (!/\.(?:uvue|nvue)$/i.test(cleanUrl$1(ctx.file))) sendSupplementalSourceHotUpdates(ctx, sourceModules);
9855
9895
  if (sourceModules.some((mod) => {
9856
9896
  const id = mod.id ?? mod.url;
9857
9897
  return typeof id === "string" && /[?&]macro=true(?:&|$)/.test(id) === false && typeof mod.url === "string" && mod.url.startsWith("/pages/") && /\.vue(?:$|[?#])/i.test(id);
@@ -9869,7 +9909,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9869
9909
  sendFullReloadForUnresolvedHotUpdate(ctx);
9870
9910
  return [];
9871
9911
  }
9872
- if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && /\.(?:uvue|nvue)$/i.test(cleanUrl(ctx.file)) && !hasTemplateHotSourceModule(sourceModules)) {
9912
+ if (isWebLikeHotUpdate && isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && /\.(?:uvue|nvue)$/i.test(cleanUrl$1(ctx.file)) && !hasTemplateHotSourceModule(sourceModules)) {
9873
9913
  sendFullReloadForUnresolvedHotUpdate(ctx);
9874
9914
  return [];
9875
9915
  }
@@ -9894,7 +9934,7 @@ function createFrameworkSourceCandidatesPlugin(options) {
9894
9934
  const WEB_HMR_RUNTIME_AFFECTING_DIRECTIVE_RE = /@(?:theme|source|config|plugin|apply)\b/;
9895
9935
  function createFrameworkHmrRuntimeSignature(file, source) {
9896
9936
  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");
9937
+ 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
9938
  }
9899
9939
  function hasFrameworkHmrRuntimeSourceChange(file, previousSource, nextSource) {
9900
9940
  return createFrameworkHmrRuntimeSignature(file, previousSource) !== createFrameworkHmrRuntimeSignature(file, nextSource);
@@ -9925,7 +9965,7 @@ function createFrameworkSourceScanSession(options) {
9925
9965
  const pendingSourceCandidateSyncs = /* @__PURE__ */ new Set();
9926
9966
  const pendingSourceCandidateSyncByFile = /* @__PURE__ */ new Map();
9927
9967
  const pendingHotUpdateChangeByFile = /* @__PURE__ */ new Map();
9928
- const normalizeDependency = (file) => path.normalize(path.resolve(cleanUrl(file)));
9968
+ const normalizeDependency = (file) => path.normalize(path.resolve(cleanUrl$1(file)));
9929
9969
  const isDependency = (file) => sourceScanDependencies.has(normalizeDependency(file));
9930
9970
  const invalidate = () => {
9931
9971
  sourceCandidateScanInvalidated = true;
@@ -10075,7 +10115,7 @@ function createFrameworkSourceScanSession(options) {
10075
10115
  };
10076
10116
  const syncChangedFile = async (id, sourceOverride) => {
10077
10117
  if (!options.shouldOwnTailwindGeneration || !options.isCandidateRequest(id)) return;
10078
- const file = cleanUrl(id);
10118
+ const file = cleanUrl$1(id);
10079
10119
  const runtimeAffectingByDependency = isDependency(file);
10080
10120
  if (runtimeAffectingByDependency) invalidate();
10081
10121
  const resolvedFile = resolveSourceScanPath(file);
@@ -10116,7 +10156,7 @@ function createFrameworkSourceScanSession(options) {
10116
10156
  };
10117
10157
  return {
10118
10158
  cacheCurrent,
10119
- consumeHotUpdateChange: (id) => pendingHotUpdateChangeByFile.delete(cleanUrl(id)),
10159
+ consumeHotUpdateChange: (id) => pendingHotUpdateChangeByFile.delete(cleanUrl$1(id)),
10120
10160
  getStats: () => ({
10121
10161
  pendingSourceCandidateSyncByFile: pendingSourceCandidateSyncByFile.size,
10122
10162
  pendingSourceCandidateSyncs: pendingSourceCandidateSyncs.size,
@@ -10150,7 +10190,7 @@ function createFrameworkTailwindRootCss(options) {
10150
10190
  await options.registerAutoCssSource(id, hotSource ?? code);
10151
10191
  };
10152
10192
  const refreshSource = async (id, code) => {
10153
- const file = cleanUrl(id);
10193
+ const file = cleanUrl$1(id);
10154
10194
  if (!moduleIds.has(id) && !moduleIds.has(file) && !hasTailwindRootDirectives(code, { importFallback: options.getImportFallback() })) return;
10155
10195
  hotSourceByFile.set(normalizeSourceFile(id), code);
10156
10196
  await register(id, code);
@@ -10291,13 +10331,13 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10291
10331
  let autoCssSourcesRefresh;
10292
10332
  let autoCssSourcesDiscovered = false;
10293
10333
  const syncTailwindCssSourceCandidates = async (id, css) => {
10294
- if (tailwindcssMajorVersion === 4 && isMissingInternalCssSource(cleanUrl(id), weappTailwindcssPackageDir)) return;
10334
+ if (tailwindcssMajorVersion === 4 && isMissingInternalCssSource(cleanUrl$1(id), weappTailwindcssPackageDir)) return;
10295
10335
  await sourceCandidateCollector.syncCss(id, css);
10296
10336
  sourceScanSession.cacheCurrent();
10297
10337
  };
10298
10338
  const registerAutoCssSource = async (id, css, options2 = {}) => {
10299
10339
  if (!shouldOwnTailwindGeneration) return;
10300
- const file = cleanUrl(id);
10340
+ const file = cleanUrl$1(id);
10301
10341
  if (!path.isAbsolute(file)) return;
10302
10342
  if (!isTailwindV4CssEntry(file)) return;
10303
10343
  if (isMissingInternalCssSource(file, weappTailwindcssPackageDir)) return;
@@ -10369,7 +10409,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10369
10409
  });
10370
10410
  const originalCssLayerSourceByFile = new LRUCache({ max: 128 });
10371
10411
  const rememberOriginalCssLayerSource = (id, code) => {
10372
- const file = cleanUrl(id);
10412
+ const file = cleanUrl$1(id);
10373
10413
  if (!isCSSRequest(file)) return;
10374
10414
  if (!hasUserCssLayerBlocks(code)) {
10375
10415
  originalCssLayerSourceByFile.delete(file);
@@ -10434,18 +10474,18 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10434
10474
  };
10435
10475
  const isNuxtPageHotModule = (id) => {
10436
10476
  if (typeof id !== "string") return false;
10437
- const cleanId = cleanUrl(id).replace(/%2F/gi, "/");
10477
+ const cleanId = cleanUrl$1(id).replace(/%2F/gi, "/");
10438
10478
  if (cleanId.includes("virtual:nuxt:") && /(?:^|\/)routes\.mjs$/.test(cleanId)) return true;
10439
10479
  if (!/[?&]macro=true(?:&|$)/.test(id)) return false;
10440
10480
  return cleanId.includes("/pages/") && /\.(?:vue|tsx?|jsx?)$/.test(cleanId);
10441
10481
  };
10442
- const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey(cleanUrl(file));
10482
+ const normalizeGeneratedCssCacheFile = (file) => normalizeVitePersistentCacheKey(cleanUrl$1(file));
10443
10483
  const hmrCandidateState = createViteHmrCandidateState({
10444
10484
  cleanGeneratedCssByFile,
10445
10485
  generatedClassSetByFile,
10446
10486
  getCommand: () => resolvedConfig?.command,
10447
10487
  getGeneratorOptions: resolveCurrentGeneratorOptions,
10448
- isRuntimeAffectingSource: (file) => uniAppXEnabled && !resolveCurrentGeneratorBranch().isWeb && /\.(?:uvue|nvue)$/i.test(cleanUrl(file))
10488
+ isRuntimeAffectingSource: (file) => uniAppXEnabled && !resolveCurrentGeneratorBranch().isWeb && /\.(?:uvue|nvue)$/i.test(cleanUrl$1(file))
10449
10489
  });
10450
10490
  const sourceScanSession = createFrameworkSourceScanSession({
10451
10491
  cssMemory,
@@ -10490,7 +10530,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10490
10530
  processedCssRegistry.prune(activeFiles);
10491
10531
  cssMemory.prune(options2);
10492
10532
  };
10493
- const normalizeViteProcessedCssFile = (file) => path.resolve(cleanUrl(file));
10533
+ const normalizeViteProcessedCssFile = (file) => path.resolve(cleanUrl$1(file));
10494
10534
  const markViteProcessedCssSource = processedCssRegistry.markSource;
10495
10535
  const isUniViteProject = () => {
10496
10536
  return resolvedConfig?.plugins?.some((plugin) => plugin.name.includes("uni")) ?? false;
@@ -10533,7 +10573,7 @@ function createViteFrameworkPlugins$1(options = {}, frameworkBranch) {
10533
10573
  if (!shouldOwnTailwindGeneration) return;
10534
10574
  await runtimeState.readyPromise;
10535
10575
  await sourceScanSession.waitForPendingSyncs();
10536
- const file = cleanUrl(id);
10576
+ const file = cleanUrl$1(id);
10537
10577
  const inferredSfcStyleRequest = isSfcStyleSourceFile(file) ? resolveSfcStyleRequestFromKnownSource(file, cssMemory.getKnownSfcSource(file), code) : file;
10538
10578
  const requestFile = isCSSRequest(id) ? inferredSfcStyleRequest === file ? resolveViteCssPipelineRequestFile(id) : inferredSfcStyleRequest : inferredSfcStyleRequest;
10539
10579
  if (!isCSSRequest(requestFile) || opts.htmlMatcher(file) || isHTMLRequest(file)) return;
@@ -10731,7 +10771,7 @@ ${tracedCss}`;
10731
10771
  getSourceCandidates,
10732
10772
  getSourceCandidateSource: (file) => sourceCandidateCollector.source(file),
10733
10773
  getSourceCandidateSources: () => sourceCandidateCollector.sources(),
10734
- extractSourceCandidates: (file, source) => extractCandidatesFromSource(source, path.extname(cleanUrl(file)).slice(1) || "html", {
10774
+ extractSourceCandidates: (file, source) => extractCandidatesFromSource(source, path.extname(cleanUrl$1(file)).slice(1) || "html", {
10735
10775
  bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues,
10736
10776
  customAttributesEntities,
10737
10777
  disabledDefaultTemplateHandler
@@ -10745,7 +10785,7 @@ ${tracedCss}`;
10745
10785
  setRememberedCssSignature: cssMemory.setRememberedCssSignature,
10746
10786
  getKnownCssSource: cssMemory.getKnownCssSource,
10747
10787
  getKnownSfcSource: cssMemory.getKnownSfcSource,
10748
- getOriginalCssLayerSource: (file) => originalCssLayerSourceByFile.get(cleanUrl(file)),
10788
+ getOriginalCssLayerSource: (file) => originalCssLayerSourceByFile.get(cleanUrl$1(file)),
10749
10789
  recordGeneratorCandidates,
10750
10790
  pruneViteCssCaches,
10751
10791
  getViteCssCacheStats,
@@ -10802,6 +10842,17 @@ ${tracedCss}`;
10802
10842
  });
10803
10843
  const extraPluginPlatform = frameworkBranch.getExtraPluginPlatform?.() ?? {};
10804
10844
  const syncSourceCandidatesForHotUpdate = (ctx) => syncFrameworkSourceCandidatesForHotUpdate(sourceScanSession, ctx);
10845
+ const registerModuleGraphCandidates = createFrameworkModuleCandidateRegistrar({
10846
+ cacheCurrent: sourceScanSession.cacheCurrent,
10847
+ debug,
10848
+ getCssHandlerOptions: transformCssHandlerOptions.getCssHandlerOptions,
10849
+ getGeneratorPlatform: resolveGeneratorPlatform,
10850
+ invalidateRecordedGeneratorCandidates,
10851
+ opts,
10852
+ runtimeState,
10853
+ sourceCandidateCollector,
10854
+ styleHandler
10855
+ });
10805
10856
  const prepareTailwindGeneration = async () => {
10806
10857
  if (sourceScanSession.shouldDiscoverAutoCssSources(autoCssSourcesDiscovered)) await discoverAndRegisterAutoCssSources();
10807
10858
  await sourceScanSession.sync();
@@ -10818,6 +10869,7 @@ ${tracedCss}`;
10818
10869
  isWebGeneratorTarget: () => resolveCurrentGeneratorBranch().isWeb,
10819
10870
  jsHandler,
10820
10871
  mainCssChunkMatcher,
10872
+ registerModuleGraphCandidates,
10821
10873
  runtimeState,
10822
10874
  styleHandler,
10823
10875
  syncSourceCandidatesForHotUpdate,
@@ -10833,7 +10885,7 @@ ${tracedCss}`;
10833
10885
  debug("preserve adapted generated css before uni-app watch cache: %s", id);
10834
10886
  return css;
10835
10887
  }
10836
- const file = cleanUrl(id);
10888
+ const file = cleanUrl$1(id);
10837
10889
  const styleRequest = isSfcStyleSourceFile(file) ? resolveSfcStyleRequestFromKnownSource(file, cssMemory.getKnownSfcSource(file), css, id) : id;
10838
10890
  const transformedCss = (await styleHandler(css, transformCssHandlerOptions.getCssHandlerOptions(styleRequest))).css;
10839
10891
  debug("adapt css before uni-app watch cache: %s inputRaw=%s outputRaw=%s", id, css.includes("\\[") || css.includes("\\:"), transformedCss.includes("\\[") || transformedCss.includes("\\:"));
@@ -11239,6 +11291,7 @@ function createUniAppXVitePlugins(options = {}) {
11239
11291
  isWebGeneratorTarget: context.isWebGeneratorTarget,
11240
11292
  jsHandler: context.jsHandler,
11241
11293
  mainCssChunkMatcher: context.mainCssChunkMatcher,
11294
+ registerModuleGraphCandidates: context.registerModuleGraphCandidates,
11242
11295
  runtimeState: context.runtimeState,
11243
11296
  styleHandler: context.styleHandler,
11244
11297
  syncSourceCandidatesForHotUpdate: context.syncSourceCandidatesForHotUpdate,
package/dist/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_vite = require("./vite-Dy6THt54.cjs");
2
+ const require_vite = require("./vite-CeyMHgzQ.cjs");
3
3
  exports.WeappTailwindcss = require_vite.WeappTailwindcss;
4
4
  exports.weappTailwindcss = require_vite.WeappTailwindcss;
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as WeappTailwindcss } from "./vite-CVr0vIgh.js";
1
+ import { t as WeappTailwindcss } from "./vite-kY-WXrd6.js";
2
2
  export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };