weapp-tailwindcss 5.1.1 → 5.1.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 (69) hide show
  1. package/README.en.md +2 -0
  2. package/README.md +2 -0
  3. package/dist/bundlers/gulp/index.d.ts +3 -3
  4. package/dist/bundlers/rspack/index.d.ts +20 -0
  5. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
  6. package/dist/bundlers/vite/css-memory.d.ts +1 -0
  7. package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +1 -1
  8. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -1
  9. package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +12 -0
  10. package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
  11. package/dist/bundlers/vite/serve-js-transform.d.ts +11 -0
  12. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +4 -1
  13. package/dist/cli.js +8 -8
  14. package/dist/cli.mjs +8 -8
  15. package/dist/{context-DlpKD7aN.mjs → context-B07Vf584.mjs} +34 -34
  16. package/dist/{context-B6hVF7dr.js → context-D75pwtBW.js} +43 -43
  17. package/dist/core.js +1 -1
  18. package/dist/core.mjs +1 -1
  19. package/dist/css-macro/postcss.js +2 -2
  20. package/dist/css-macro.js +3 -3
  21. package/dist/{defaults-CmFBmxsr.js → defaults-DQhgnnn-.js} +1 -1
  22. package/dist/defaults.js +1 -1
  23. package/dist/framework/index.d.ts +7 -2
  24. package/dist/framework.js +39 -8
  25. package/dist/framework.mjs +33 -6
  26. package/dist/generator/options.d.ts +3 -1
  27. package/dist/{generator-6oMJtTDO.js → generator-CV_0irKO.js} +4 -2
  28. package/dist/{generator-CjzBK7h-.mjs → generator-DNs6ekoC.mjs} +3 -1
  29. package/dist/generator.js +2 -2
  30. package/dist/generator.mjs +2 -2
  31. package/dist/{gulp-BtGq6LP9.js → gulp-B_u8NjQL.js} +9 -9
  32. package/dist/{gulp-DNU10Vtc.mjs → gulp-aQMZ0M7c.mjs} +4 -4
  33. package/dist/gulp.js +1 -1
  34. package/dist/gulp.mjs +1 -1
  35. package/dist/{hmr-timing-B0KuWDjV.mjs → hmr-timing-DLYQTCDb.mjs} +40 -31
  36. package/dist/{hmr-timing-CegXR9O4.js → hmr-timing-DOoHun3i.js} +42 -33
  37. package/dist/index.js +9 -4
  38. package/dist/index.mjs +7 -6
  39. package/dist/postcss-html-transform.js +2 -2
  40. package/dist/postcss.js +2 -2
  41. package/dist/postcss.mjs +2 -2
  42. package/dist/presets/shared.d.ts +4 -0
  43. package/dist/presets.js +32 -16
  44. package/dist/presets.mjs +28 -14
  45. package/dist/reset.js +2 -2
  46. package/dist/rspack.d.ts +3 -0
  47. package/dist/rspack.js +68 -0
  48. package/dist/rspack.mjs +62 -0
  49. package/dist/{source-candidate-scan-signature-BKYb9jxa.js → source-candidate-scan-signature-DzwebZrf.js} +6 -6
  50. package/dist/{source-candidate-scan-signature-B5af2Ahe.mjs → source-candidate-scan-signature-pS87mdHZ.mjs} +3 -3
  51. package/dist/{tailwindcss-dbrbY4cd.js → tailwindcss-BSCvrs1p.js} +8 -8
  52. package/dist/{tailwindcss-B5mRo0-M.mjs → tailwindcss-BwV3_Ryc.mjs} +3 -3
  53. package/dist/{transform-fRBeuuK-.mjs → transform-Clj7R818.mjs} +19 -19
  54. package/dist/{transform-vLwZpiTE.js → transform-fin-OTVD.js} +47 -47
  55. package/dist/{utils-BCa37Wqj.js → utils-D3h8j7Mk.js} +2 -2
  56. package/dist/{v4-engine-C3qSwQ-e.mjs → v4-engine-BklH3CpJ.mjs} +5 -5
  57. package/dist/{v4-engine-ON_oSLfO.js → v4-engine-CKbS27-o.js} +10 -10
  58. package/dist/{vite-CWRooooa.mjs → vite-5Wn0PIzJ.mjs} +244 -45
  59. package/dist/{vite-w-RkgaTY.js → vite-CkVMSDDp.js} +249 -50
  60. package/dist/vite.js +1 -1
  61. package/dist/vite.mjs +1 -1
  62. package/dist/weapp-tw-css-import-rewrite-loader.js +71 -34
  63. package/dist/weapp-tw-runtime-classset-loader.js +2 -2
  64. package/dist/{webpack-8PaV1gG3.mjs → webpack-DEag6ueE.mjs} +66 -18
  65. package/dist/{webpack-CGgBOx9l.js → webpack-hvSFaicc.js} +71 -23
  66. package/dist/webpack.js +1 -1
  67. package/dist/webpack.mjs +1 -1
  68. package/package.json +10 -5
  69. /package/dist/{chunk-emK7D4bc.js → rolldown-runtime-emK7D4bc.js} +0 -0
@@ -298,7 +298,7 @@ function extractConfigRequestFromSource(rawSource) {
298
298
  }
299
299
  //#endregion
300
300
  //#region src/bundlers/shared/generator-css/directives.ts
301
- const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
301
+ const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = /* @__PURE__ */ new Set([
302
302
  "config",
303
303
  "custom-variant",
304
304
  "layer",
@@ -310,7 +310,7 @@ const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
310
310
  "utility",
311
311
  "variant"
312
312
  ]);
313
- const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
313
+ const TAILWIND_ROOT_DIRECTIVE_NAMES = /* @__PURE__ */ new Set([
314
314
  "config",
315
315
  "custom-variant",
316
316
  "plugin",
@@ -1719,7 +1719,7 @@ function createTailwindV4Engine(source) {
1719
1719
  const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
1720
1720
  const delegateSourceScan = shouldDelegateWebSourceScanToTailwind(target, resolvedScanSources);
1721
1721
  const filesystemCandidates = !delegateSourceScan && Array.isArray(resolvedScanSources) ? new Set(await (0, _tailwindcss_mangle_engine.extractRawCandidates)(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
1722
- const normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target), target, resolvedStyleOptions);
1722
+ const normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(/* @__PURE__ */ new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target), target, resolvedStyleOptions);
1723
1723
  const result = await engine.generate(omitUndefined({
1724
1724
  scanSources: delegateSourceScan ? resolvedScanSources : false,
1725
1725
  ...patchOptions,
@@ -1967,7 +1967,7 @@ function quoteCssImportSpecifier(specifier, quote = "\"") {
1967
1967
  return `${quote}${specifier.replaceAll("\\", "\\\\").replaceAll(quote, `\\${quote}`)}${quote}`;
1968
1968
  }
1969
1969
  function createTailwindV4CssImportSpecifierSet(packageName) {
1970
- const specifiers = new Set(["tailwindcss"]);
1970
+ const specifiers = /* @__PURE__ */ new Set(["tailwindcss"]);
1971
1971
  if (packageName && isBarePackageSpecifier(packageName)) specifiers.add(packageName);
1972
1972
  return specifiers;
1973
1973
  }
@@ -2140,6 +2140,29 @@ function createMiniProgramRuntimeBranch(base) {
2140
2140
  }
2141
2141
  //#endregion
2142
2142
  //#region src/framework/index.ts
2143
+ const MINI_PROGRAM_PLATFORMS = /* @__PURE__ */ new Set([
2144
+ "alipay",
2145
+ "baidu",
2146
+ "jd",
2147
+ "qq",
2148
+ "swan",
2149
+ "tt",
2150
+ "weapp",
2151
+ "wechat",
2152
+ "wx"
2153
+ ]);
2154
+ function getProcessEnv() {
2155
+ return {
2156
+ MPX_CLI_MODE: node_process.default.env["MPX_CLI_MODE"],
2157
+ MPX_CURRENT_TARGET_MODE: node_process.default.env["MPX_CURRENT_TARGET_MODE"],
2158
+ NODE_PATH: node_process.default.env["NODE_PATH"],
2159
+ TARO_ENV: node_process.default.env["TARO_ENV"],
2160
+ UNI_PLATFORM: node_process.default.env["UNI_PLATFORM"],
2161
+ UNI_UTS_PLATFORM: node_process.default.env["UNI_UTS_PLATFORM"],
2162
+ WEAPP_TAILWINDCSS_TARGET: node_process.default.env["WEAPP_TAILWINDCSS_TARGET"],
2163
+ WEAPP_TW_TARGET: node_process.default.env["WEAPP_TW_TARGET"]
2164
+ };
2165
+ }
2143
2166
  function normalizePlatform(value) {
2144
2167
  return value?.trim().toLowerCase() || void 0;
2145
2168
  }
@@ -2155,13 +2178,16 @@ function resolvePlatformInfo(value) {
2155
2178
  isAppAndroid,
2156
2179
  isAppHarmony,
2157
2180
  isAppIos,
2158
- isMp: normalized?.startsWith("mp-") === true,
2181
+ isMp: normalized?.startsWith("mp-") === true || (normalized ? MINI_PROGRAM_PLATFORMS.has(normalized) : false),
2159
2182
  isWeb: normalized?.startsWith("web") === true || normalized === "h5"
2160
2183
  };
2161
2184
  }
2162
- function resolveUniUtsPlatform$1(value) {
2185
+ function resolvePlatform(value) {
2163
2186
  return resolvePlatformInfo(value);
2164
2187
  }
2188
+ function resolveUniUtsPlatform$1(value = getProcessEnv().UNI_UTS_PLATFORM) {
2189
+ return resolvePlatform(value);
2190
+ }
2165
2191
  //#endregion
2166
2192
  //#region src/utils/uni-platform.ts
2167
2193
  function resolveUniUtsPlatform(value = node_process.default.env["UNI_UTS_PLATFORM"]) {
@@ -2239,6 +2265,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
2239
2265
  if (options == null) return {
2240
2266
  target,
2241
2267
  branch,
2268
+ webCompat: void 0,
2242
2269
  importFallback: false,
2243
2270
  bareArbitraryValues: void 0
2244
2271
  };
@@ -2247,6 +2274,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
2247
2274
  branch,
2248
2275
  config: options.config,
2249
2276
  styleOptions: options.styleOptions,
2277
+ webCompat: options.webCompat,
2250
2278
  importFallback: options.importFallback ?? false,
2251
2279
  bareArbitraryValues: options.bareArbitraryValues
2252
2280
  };
@@ -2414,11 +2442,11 @@ function shouldInjectMiniProgramPreflightForGeneratorCss(opts, options) {
2414
2442
  }
2415
2443
  function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
2416
2444
  if (options.isolateCssSource) {
2417
- if (options.matchedCssSourceFile) return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
2418
- return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
2445
+ if (options.matchedCssSourceFile) return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
2446
+ return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
2419
2447
  }
2420
2448
  if (runtime.size === 0 || !options.cssHandlerOptions.isMainChunk) return scopedRuntime;
2421
- return new Set([...scopedRuntime, ...runtime]);
2449
+ return /* @__PURE__ */ new Set([...scopedRuntime, ...runtime]);
2422
2450
  }
2423
2451
  function shouldIsolateScopedCssSource(_majorVersion, source, sourceEntries, options) {
2424
2452
  if (options.target !== "weapp") return false;
@@ -2480,7 +2508,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
2480
2508
  return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives || cssHandlerOptions.isMainChunk && (options.configuredCssSourceCount ?? 0) > 0 || cssHandlerOptions.isMainChunk && options.rawSource.includes("weapp-tailwindcss") || options.target === "web" && cssHandlerOptions.isMainChunk && (options.runtimeCandidateCount ?? 0) > 0;
2481
2509
  }
2482
2510
  function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
2483
- return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
2511
+ return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? /* @__PURE__ */ new Set([...runtime, ...currentCssCandidates]) : runtime;
2484
2512
  }
2485
2513
  function mergeGeneratorResults(generatedResults) {
2486
2514
  const firstGenerated = generatedResults[0];
@@ -2655,14 +2683,14 @@ function decodeUnicode2(input) {
2655
2683
  }
2656
2684
  //#endregion
2657
2685
  //#region src/js/class-context.ts
2658
- const CLASS_LIKE_KEYWORDS = new Set([
2686
+ const CLASS_LIKE_KEYWORDS = /* @__PURE__ */ new Set([
2659
2687
  "class",
2660
2688
  "classname",
2661
2689
  "hoverclass",
2662
2690
  "virtualhostclass",
2663
2691
  "rootclass"
2664
2692
  ]);
2665
- const CLASS_HELPER_IDENTIFIERS = new Set([
2693
+ const CLASS_HELPER_IDENTIFIERS = /* @__PURE__ */ new Set([
2666
2694
  "cn",
2667
2695
  "clsx",
2668
2696
  "classnames",
@@ -2918,7 +2946,7 @@ function replaceHandleValue(path, options) {
2918
2946
  Object.freeze({ wrapExpression: true });
2919
2947
  //#endregion
2920
2948
  //#region src/wxml/whitespace.ts
2921
- const WHITESPACE_CODES = new Set([
2949
+ const WHITESPACE_CODES = /* @__PURE__ */ new Set([
2922
2950
  9,
2923
2951
  10,
2924
2952
  11,
@@ -3060,7 +3088,7 @@ new Tokenizer();
3060
3088
  //#endregion
3061
3089
  //#region src/bundlers/shared/generator-css/legacy-selectors.ts
3062
3090
  const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
3063
- const MINI_PROGRAM_THEME_SCOPE_SELECTORS = new Set([
3091
+ const MINI_PROGRAM_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
3064
3092
  ":host",
3065
3093
  "page",
3066
3094
  ".tw-root",
@@ -3123,7 +3151,7 @@ function escapeCompatSelectorClasses(selector) {
3123
3151
  function normalizeCompatSelectors(selector) {
3124
3152
  const normalized = normalizeCompatSelector(selector);
3125
3153
  if (!normalized) return [];
3126
- const selectors = new Set([normalized]);
3154
+ const selectors = /* @__PURE__ */ new Set([normalized]);
3127
3155
  const escaped = normalizeCompatSelector(escapeCompatSelectorClasses(normalized));
3128
3156
  if (escaped) selectors.add(escaped);
3129
3157
  return [...selectors];
@@ -3804,7 +3832,7 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
3804
3832
  for (const sourceFile of createSourceStylePathCandidates(file, sourceOptions)) try {
3805
3833
  const source = sourceOptions.sourceFile && node_path.default.resolve(sourceOptions.sourceFile) === node_path.default.resolve(sourceFile) && typeof sourceOptions.sourceCss === "string" ? sourceOptions.sourceCss : (0, node_fs.existsSync)(sourceFile) ? (0, node_fs.readFileSync)(sourceFile, "utf8") : void 0;
3806
3834
  if (source === void 0) continue;
3807
- const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, new Set([node_path.default.resolve(sourceFile)]));
3835
+ const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, /* @__PURE__ */ new Set([node_path.default.resolve(sourceFile)]));
3808
3836
  for (const styleSource of directiveSources) {
3809
3837
  const cssEntrySource = resolveCssEntrySource(styleSource.source, node_path.default.dirname(styleSource.file), resolveOptions);
3810
3838
  if (cssEntrySource) return {
@@ -4011,7 +4039,8 @@ function createSingleTailwindV4SourceOptions(sourceOptions, options) {
4011
4039
  baseFallbacks: sourceOptions.baseFallbacks,
4012
4040
  packageName: sourceOptions.packageName,
4013
4041
  base: options.base,
4014
- css: options.css
4042
+ css: options.css,
4043
+ cssEntries: options.cssEntries
4015
4044
  });
4016
4045
  }
4017
4046
  async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions) {
@@ -4102,7 +4131,7 @@ function hydrateTailwindV4CssSource(cssSource) {
4102
4131
  file,
4103
4132
  base: cssSource.base ?? node_path.default.dirname(file),
4104
4133
  css: (0, node_fs.readFileSync)(file, "utf8"),
4105
- dependencies: [...new Set([...cssSource.dependencies ?? [], file])]
4134
+ dependencies: [.../* @__PURE__ */ new Set([...cssSource.dependencies ?? [], file])]
4106
4135
  };
4107
4136
  }
4108
4137
  function normalizeTailwindV4CssSourceConfigs(sourceOptions) {
@@ -4218,7 +4247,8 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
4218
4247
  const css = createTailwindV4SourceReferenceSource(normalizeConfigDirective(prependConfigDirective(resolvedEntrySource.css, generatorOptions?.config), config), resolvedSourceOptions);
4219
4248
  return withMatchedSourceSideMetadata(await resolveTailwindV4Source(createSingleTailwindV4SourceOptions(resolvedSourceOptions, {
4220
4249
  base: resolvedEntrySource.base,
4221
- css
4250
+ css,
4251
+ cssEntries: [resolvedEntrySource.file]
4222
4252
  })), resolvedEntrySource);
4223
4253
  }
4224
4254
  async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
@@ -4249,6 +4279,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
4249
4279
  }
4250
4280
  const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
4251
4281
  const sourceSideEntrySource = normalizedSourceOptions && (shouldPreferSourceSideEntry || normalizedSourceOptions.sourceFile !== void 0) && canResolveSourceSideCssEntry(file, cssHandlerOptions, normalizedSourceOptions) ? resolveSourceSideCssEntrySource(file, normalizedSourceOptions, { removeConfig: false }) : void 0;
4282
+ const sourceSideCssSource = sourceSideEntrySource?.file && normalizedSourceOptions.cssEntries?.some((cssEntry) => node_path.default.resolve(cssEntry.replace(/[?#].*$/, "")) === node_path.default.resolve(sourceSideEntrySource.file)) ? await resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file) : void 0;
4283
+ if (sourceSideCssSource) return sourceSideCssSource;
4252
4284
  const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
4253
4285
  const matchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOptions, normalizedSourceOptions) : void 0;
4254
4286
  const candidateMatchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveCandidateMatchedTailwindV4CssSource(rawSource, cssHandlerOptions, normalizedSourceOptions, selectionOptions) : void 0;
@@ -4272,7 +4304,6 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
4272
4304
  css: prependConfigDirective(source.css, generatorOptions.config)
4273
4305
  } : source;
4274
4306
  }
4275
- if (sourceSideEntrySource && normalizedSourceOptions) return resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file);
4276
4307
  const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, omitUndefined({
4277
4308
  ...resolvedSourceOptions ?? {},
4278
4309
  sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
@@ -4372,7 +4403,7 @@ async function resolveGeneratorSourceEntries(source, runtimeState) {
4372
4403
  }
4373
4404
  //#endregion
4374
4405
  //#region src/bundlers/shared/generator-css/user-css.ts
4375
- const TAILWIND_V4_GENERATOR_AT_RULES = new Set([
4406
+ const TAILWIND_V4_GENERATOR_AT_RULES = /* @__PURE__ */ new Set([
4376
4407
  "config",
4377
4408
  "custom-variant",
4378
4409
  "plugin",
@@ -5348,6 +5379,9 @@ function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
5348
5379
  for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
5349
5380
  return merged;
5350
5381
  }
5382
+ function finalizeWebGeneratorCss(css, target, webCompat) {
5383
+ return target === "web" ? (0, _weapp_tailwindcss_postcss.transformWebCssCompat)(css, webCompat) : css;
5384
+ }
5351
5385
  async function generateCssByGenerator(options) {
5352
5386
  const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
5353
5387
  const generatorOptions = {
@@ -5370,6 +5404,9 @@ async function generateCssByGenerator(options) {
5370
5404
  const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
5371
5405
  const localImportParts = splitLocalCssImports(effectiveRawSource);
5372
5406
  const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
5407
+ const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
5408
+ return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
5409
+ };
5373
5410
  const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
5374
5411
  const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
5375
5412
  const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
@@ -5458,10 +5495,10 @@ async function generateCssByGenerator(options) {
5458
5495
  debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
5459
5496
  if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
5460
5497
  const incrementalCss = stripTailwindBanner(generated.incrementalCss);
5461
- const finalCss = restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
5498
+ const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
5462
5499
  injectPreflight: false,
5463
5500
  styleOptions: generatorStyleOptions
5464
- })) : options.previousCss, localImports);
5501
+ })) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
5465
5502
  return {
5466
5503
  css: finalCss,
5467
5504
  classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
@@ -5529,14 +5566,14 @@ async function generateCssByGenerator(options) {
5529
5566
  if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
5530
5567
  }
5531
5568
  } else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
5532
- const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
5569
+ const finalCss = finalizeGeneratorCss(css, generated.target, {
5533
5570
  injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
5534
5571
  cssHandlerOptions,
5535
5572
  isolateCurrentCssCandidates,
5536
5573
  localImports
5537
5574
  }),
5538
5575
  styleOptions: generatorStyleOptions
5539
- }), localImports);
5576
+ });
5540
5577
  return {
5541
5578
  css: finalCss,
5542
5579
  classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
@@ -5637,14 +5674,14 @@ async function generateCssByGenerator(options) {
5637
5674
  const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
5638
5675
  css = createCssSourceOrderAppend$1(css, missingUserCss);
5639
5676
  }
5640
- const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
5677
+ const finalCss = finalizeGeneratorCss(css, generated.target, {
5641
5678
  injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
5642
5679
  cssHandlerOptions,
5643
5680
  isolateCurrentCssCandidates,
5644
5681
  localImports
5645
5682
  }),
5646
5683
  styleOptions: generatorStyleOptions
5647
- }), localImports);
5684
+ });
5648
5685
  return {
5649
5686
  css: finalCss,
5650
5687
  classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
@@ -5674,14 +5711,14 @@ async function generateCssByGenerator(options) {
5674
5711
  const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
5675
5712
  css = createCssSourceOrderAppend$1(css, missingUserCss);
5676
5713
  }
5677
- const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
5714
+ const finalCss = finalizeGeneratorCss(css, generated.target, {
5678
5715
  injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
5679
5716
  cssHandlerOptions,
5680
5717
  isolateCurrentCssCandidates,
5681
5718
  localImports
5682
5719
  }),
5683
5720
  styleOptions: generatorStyleOptions
5684
- }), localImports);
5721
+ });
5685
5722
  return {
5686
5723
  css: finalCss,
5687
5724
  classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
@@ -6447,7 +6484,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
6447
6484
  }
6448
6485
  if (item === singleCanonicalIgnoreName) continue;
6449
6486
  if (!canonicalIgnoreNames) {
6450
- canonicalIgnoreNames = new Set([singleCanonicalIgnoreName, item]);
6487
+ canonicalIgnoreNames = /* @__PURE__ */ new Set([singleCanonicalIgnoreName, item]);
6451
6488
  continue;
6452
6489
  }
6453
6490
  canonicalIgnoreNames.add(item);
@@ -6718,7 +6755,7 @@ function jsHandler(rawSource, options) {
6718
6755
  defaultEvalHandler = jsHandler;
6719
6756
  //#endregion
6720
6757
  //#region src/tailwindcss/candidates.ts
6721
- const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = new Set([
6758
+ const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
6722
6759
  "js",
6723
6760
  "jsx",
6724
6761
  "mjs",
@@ -7010,7 +7047,7 @@ function createSourceCandidateStore(options = {}) {
7010
7047
  }
7011
7048
  function recompute(id) {
7012
7049
  const normalizedId = cleanUrl(id);
7013
- replaceFinal(normalizedId, new Set([
7050
+ replaceFinal(normalizedId, /* @__PURE__ */ new Set([
7014
7051
  ...scanCandidatesById.get(normalizedId) ?? [],
7015
7052
  ...transformCandidatesById.get(normalizedId) ?? [],
7016
7053
  ...cssCandidatesById.get(normalizedId) ?? []
@@ -7041,7 +7078,7 @@ function createSourceCandidateStore(options = {}) {
7041
7078
  return mergeSourcesByPriority().entries();
7042
7079
  }
7043
7080
  function values() {
7044
- const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
7081
+ const values = /* @__PURE__ */ new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
7045
7082
  for (const candidate of inlineExcludedCandidates) values.delete(candidate);
7046
7083
  return values;
7047
7084
  }
@@ -7145,7 +7182,7 @@ function createSourceCandidateStore(options = {}) {
7145
7182
  for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
7146
7183
  for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
7147
7184
  for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
7148
- const ids = new Set([
7185
+ const ids = /* @__PURE__ */ new Set([
7149
7186
  ...scanCandidatesById.keys(),
7150
7187
  ...transformCandidatesById.keys(),
7151
7188
  ...cssCandidatesById.keys()
@@ -53,14 +53,14 @@ function resolveRegisteredCssSource(file, source) {
53
53
  }
54
54
  }
55
55
  function isPlainCssResource(file) {
56
- return new Set([
56
+ return (/* @__PURE__ */ new Set([
57
57
  ".acss",
58
58
  ".css",
59
59
  ".jxss",
60
60
  ".qss",
61
61
  ".ttss",
62
62
  ".wxss"
63
- ]).has(node_path.default.extname(file.replace(/[?#].*$/, "")).toLowerCase());
63
+ ])).has(node_path.default.extname(file.replace(/[?#].*$/, "")).toLowerCase());
64
64
  }
65
65
  const WeappTwRuntimeClassSetLoader = function(source) {
66
66
  if (node_process.default.env["WEAPP_TW_LOADER_DEBUG"]) node_process.default.stdout.write(`[weapp-tw-runtime-classset-loader] executing for ${this.resourcePath}\n`);
@@ -1,10 +1,10 @@
1
- import { C as hasTailwindRootDirectives, F as hasTailwindGeneratedCssMarkers, G as getTailwindV4IncrementalGenerateCacheStats, O as parseImportRequest, P as hasTailwindGeneratedCss, T as normalizeTailwindConfigDirectives, _ as resolveTailwindcssOptions, ct as inferGeneratorTargetFromEnv, k as removeTailwindSourceDirectives, nt as resolveSourceScanPath, o as hasConfiguredTailwindV4CssRoots, s as upsertTailwindV4CssSource, w as hasTailwindSourceDirectives, x as hasTailwindApplyDirective } from "./v4-engine-C3qSwQ-e.mjs";
2
- import { o as resolveRuntimeBranch } from "./generator-CjzBK7h-.mjs";
1
+ import { C as hasTailwindRootDirectives, F as hasTailwindGeneratedCssMarkers, G as getTailwindV4IncrementalGenerateCacheStats, O as parseImportRequest, P as hasTailwindGeneratedCss, T as normalizeTailwindConfigDirectives, _ as resolveTailwindcssOptions, ct as inferGeneratorTargetFromEnv, k as removeTailwindSourceDirectives, nt as resolveSourceScanPath, o as hasConfiguredTailwindV4CssRoots, s as upsertTailwindV4CssSource, w as hasTailwindSourceDirectives, x as hasTailwindApplyDirective } from "./v4-engine-BklH3CpJ.mjs";
2
+ import { o as resolveRuntimeBranch } from "./generator-DNs6ekoC.mjs";
3
3
  import { r as getGroupedEntries } from "./utils-DodxWHGz.mjs";
4
- import { C as md5Hash, S as createDebug, b as ensureRuntimeClassSet, f as _defineProperty, i as pluginName, l as shouldSkipJsTransform, n as normalizeStyleHandlerMajorVersion, r as resolveStyleOptionsFromContext, t as getCompilerContext, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./context-DlpKD7aN.mjs";
5
- import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-B5mRo0-M.mjs";
6
- import { C as stripTailwindSourceMediaFragments, D as createCssSourceOrderAppend, E as removeGeneratedSelectorCompatCss, F as createCssTokenSourceMap, I as isCssSourceTraceEnabled, L as processCachedTask, M as stripMiniProgramCssSpecificityPlaceholders, N as annotateCssSourceTrace, O as hasMiniProgramTailwindV4PreflightReset, P as createCssSourceTraceCacheSignature, S as removeTailwindV4GeneratorAtRules, T as scoreTailwindV4CssSourceFileMatch, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, b as removeMiniProgramHoverSelectors, c as collectStrictEscapedRuntimeCandidates, f as pushConcurrentTaskFactories, i as createSourceCandidateStore, j as pruneMiniProgramGeneratedCss, k as finalizeMiniProgramCss, l as createEscapeFragments, n as emitHmrTiming, o as resolveSourceCandidateScanFiles, p as resolveTaskConcurrency, s as createBundleRuntimeClassSetManager, w as stripUnmatchedTailwindSourceMediaCloseFragments, x as removeTailwindV4GeneratedUserCssArtifacts } from "./hmr-timing-B0KuWDjV.mjs";
7
- import { A as isSourceStyleRequest, C as resolvePluginDisabledState, N as resolveOutputSpecifier, P as toAbsoluteOutputPath, S as resolvePackageDir, _ as generateTailwindV4Css, d as classifyBundleEntry, f as createBundleBuildState, i as createCandidateSignature, j as stripRequestQuery, m as createRuntimeAffectingSourceSignature, p as updateBundleBuildState, r as createScopedGeneratorRuntime, t as createSourceCandidateScanSignature, x as stripBundlerGeneratedCssMarkers, y as hasBundlerGeneratedCssMarker } from "./source-candidate-scan-signature-B5af2Ahe.mjs";
4
+ import { C as md5Hash, S as createDebug, b as ensureRuntimeClassSet, f as _defineProperty, i as pluginName, l as shouldSkipJsTransform, n as normalizeStyleHandlerMajorVersion, r as resolveStyleOptionsFromContext, t as getCompilerContext, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./context-B07Vf584.mjs";
5
+ import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-BwV3_Ryc.mjs";
6
+ import { C as stripTailwindSourceMediaFragments, D as createCssSourceOrderAppend, E as removeGeneratedSelectorCompatCss, F as createCssTokenSourceMap, I as isCssSourceTraceEnabled, L as processCachedTask, M as stripMiniProgramCssSpecificityPlaceholders, N as annotateCssSourceTrace, O as hasMiniProgramTailwindV4PreflightReset, P as createCssSourceTraceCacheSignature, S as removeTailwindV4GeneratorAtRules, T as scoreTailwindV4CssSourceFileMatch, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, b as removeMiniProgramHoverSelectors, c as collectStrictEscapedRuntimeCandidates, f as pushConcurrentTaskFactories, i as createSourceCandidateStore, j as pruneMiniProgramGeneratedCss, k as finalizeMiniProgramCss, l as createEscapeFragments, n as emitHmrTiming, o as resolveSourceCandidateScanFiles, p as resolveTaskConcurrency, s as createBundleRuntimeClassSetManager, w as stripUnmatchedTailwindSourceMediaCloseFragments, x as removeTailwindV4GeneratedUserCssArtifacts } from "./hmr-timing-DLYQTCDb.mjs";
7
+ import { A as isSourceStyleRequest, C as resolvePluginDisabledState, N as resolveOutputSpecifier, P as toAbsoluteOutputPath, S as resolvePackageDir, _ as generateTailwindV4Css, d as classifyBundleEntry, f as createBundleBuildState, i as createCandidateSignature, j as stripRequestQuery, m as createRuntimeAffectingSourceSignature, p as updateBundleBuildState, r as createScopedGeneratorRuntime, t as createSourceCandidateScanSignature, x as stripBundlerGeneratedCssMarkers, y as hasBundlerGeneratedCssMarker } from "./source-candidate-scan-signature-pS87mdHZ.mjs";
8
8
  import Module, { createRequire } from "node:module";
9
9
  import fs from "node:fs";
10
10
  import path from "node:path";
@@ -21,7 +21,7 @@ function installTailwindcssCssRedirect(pkgDir) {
21
21
  const target = path.join(pkgDir, "index.css");
22
22
  const original = moduleWithMutableResolve._resolveFilename;
23
23
  if (patched.has(original)) return;
24
- const replacements = new Set(["tailwindcss", "tailwindcss$"]);
24
+ const replacements = /* @__PURE__ */ new Set(["tailwindcss", "tailwindcss$"]);
25
25
  const resolveTailwindcssCss = (request, parent, isMain, options) => {
26
26
  if (replacements.has(request)) return target;
27
27
  if (request.startsWith("tailwindcss/")) return path.join(pkgDir, request.slice(12));
@@ -398,6 +398,45 @@ function normalizeWebpackGeneratorCssSources(cssSources) {
398
398
  const normalized = cssSources.filter((source) => typeof source?.css === "string" && source.css.length > 0);
399
399
  return normalized.length > 0 ? normalized : void 0;
400
400
  }
401
+ function scopeWebpackGeneratorOptionsToCssSource(compilerOptions, sourceFile, options = {}) {
402
+ const withoutCssEntries = () => ({
403
+ ...compilerOptions,
404
+ ...compilerOptions.cssEntries?.length ? { cssEntries: [] } : {},
405
+ tailwindcss: {
406
+ ...compilerOptions.tailwindcss,
407
+ v4: {
408
+ ...compilerOptions.tailwindcss?.v4,
409
+ ...compilerOptions.tailwindcss?.v4?.cssEntries?.length || compilerOptions.cssEntries?.length ? { cssEntries: [] } : {}
410
+ }
411
+ }
412
+ });
413
+ if (!sourceFile) {
414
+ if (options.disableUnmatchedCssEntries !== true) return compilerOptions;
415
+ if (!compilerOptions.cssEntries?.length && !compilerOptions.tailwindcss?.v4?.cssEntries?.length) return compilerOptions;
416
+ return withoutCssEntries();
417
+ }
418
+ const resolvedSourceFile = path.resolve(sourceFile);
419
+ if (options.disableUnmatchedCssEntries === true) {
420
+ const configuredEntries = [...compilerOptions.cssEntries ?? [], ...compilerOptions.tailwindcss?.v4?.cssEntries ?? []];
421
+ if (configuredEntries.length > 0 && !configuredEntries.some((entry) => path.resolve(entry) === resolvedSourceFile)) return withoutCssEntries();
422
+ }
423
+ const cssEntries = compilerOptions.cssEntries?.filter((entry) => path.resolve(entry) === resolvedSourceFile);
424
+ const runtimeCssEntries = compilerOptions.tailwindcss?.v4?.cssEntries?.filter((entry) => path.resolve(entry) === resolvedSourceFile);
425
+ const hasScopedCssEntries = Boolean(cssEntries?.length);
426
+ const hasScopedRuntimeCssEntries = Boolean(runtimeCssEntries?.length);
427
+ if (!hasScopedCssEntries && !hasScopedRuntimeCssEntries) return compilerOptions;
428
+ return {
429
+ ...compilerOptions,
430
+ ...hasScopedCssEntries ? { cssEntries } : {},
431
+ tailwindcss: {
432
+ ...compilerOptions.tailwindcss,
433
+ v4: {
434
+ ...compilerOptions.tailwindcss?.v4,
435
+ ...hasScopedRuntimeCssEntries ? { cssEntries: runtimeCssEntries } : hasScopedCssEntries ? { cssEntries } : {}
436
+ }
437
+ }
438
+ };
439
+ }
401
440
  function hasProcessedCssAssetUrl(css) {
402
441
  return /url\(\s*["']?data:/i.test(css);
403
442
  }
@@ -424,7 +463,7 @@ function collectWebpackAssetUserCssMarkers(source) {
424
463
  } catch {}
425
464
  return markers;
426
465
  }
427
- const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = new Set([
466
+ const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = /* @__PURE__ */ new Set([
428
467
  "theme",
429
468
  "base",
430
469
  "utilities"
@@ -787,6 +826,7 @@ function createWebpackCssSourceResolvers(options) {
787
826
  const activeWebpackCssSourceFiles = /* @__PURE__ */ new Set();
788
827
  const resolveConfiguredMainCssSourceFile = (file) => {
789
828
  if (!isMainCssChunk(file)) return;
829
+ if (configuredMainCssEntryFiles.length !== 1) return;
790
830
  for (const sourceFile of configuredMainCssEntryFiles) if (cssSources.has(sourceFile)) {
791
831
  activeWebpackCssSourceFiles.add(sourceFile);
792
832
  return sourceFile;
@@ -1764,7 +1804,9 @@ function setupWebpackV5ProcessAssetsHook(options) {
1764
1804
  if (isPureLocalCssImportWrapper(currentRawSource)) return { result: new ConcatSource(removeTailwindSourceDirectives(stripBundlerGeneratedCssMarkers(currentRawSource), { importFallback: true })) };
1765
1805
  const fallbackGeneratorRuntimeSet = getGeneratorRuntimeSet();
1766
1806
  const hasExplicitTailwindV4SourceCss = sourceCss !== void 0 && (hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || sourceCss.includes("@config"));
1767
- const shouldForceTailwindV4Generation = cssHandlerOptions.isMainChunk && hasConfiguredTailwindV4SourceRoots() && (configuredMainCssEntryFiles.length > 0 || hasTailwindRootDirectives(generatorRawSource, { importFallback: true }) || hasTailwindSourceDirectives(generatorRawSource, { importFallback: true }) || hasTailwindApplyDirective(generatorRawSource) || hasExplicitTailwindV4SourceCss);
1807
+ const currentAssetHasTailwindDirectives = hasTailwindRootDirectives(generatorRawSource, { importFallback: true }) || hasTailwindSourceDirectives(generatorRawSource, { importFallback: true }) || hasTailwindApplyDirective(generatorRawSource);
1808
+ const shouldForceTailwindV4Generation = cssHandlerOptions.isMainChunk && hasConfiguredTailwindV4SourceRoots() && (configuredMainCssEntryFiles.length > 0 || currentAssetHasTailwindDirectives || hasExplicitTailwindV4SourceCss);
1809
+ const shouldSkipUnmatchedMainCssGeneration = !isWebGeneratorTarget && cssHandlerOptions.isMainChunk && sourceFile === void 0 && configuredMainCssEntryFiles.length > 0 && !currentAssetHasTailwindDirectives;
1768
1810
  const resolvedScopedGeneratorRuntimeSet = await createScopedGeneratorRuntime({
1769
1811
  cssHandlerOptions,
1770
1812
  fallbackRuntime: hasExplicitTailwindV4SourceCss ? /* @__PURE__ */ new Set() : fallbackGeneratorRuntimeSet,
@@ -1776,8 +1818,9 @@ function setupWebpackV5ProcessAssetsHook(options) {
1776
1818
  sourceFile: sourceFile ?? file,
1777
1819
  scopedSourceCandidateGetter: webpackSourceCandidates?.getSourceCandidatesForEntries
1778
1820
  });
1779
- const scopedGeneratorRuntimeSet = !hasExplicitTailwindV4SourceCss && resolvedScopedGeneratorRuntimeSet !== fallbackGeneratorRuntimeSet ? new Set([...fallbackGeneratorRuntimeSet, ...resolvedScopedGeneratorRuntimeSet]) : resolvedScopedGeneratorRuntimeSet;
1821
+ const scopedGeneratorRuntimeSet = !hasExplicitTailwindV4SourceCss && resolvedScopedGeneratorRuntimeSet !== fallbackGeneratorRuntimeSet ? /* @__PURE__ */ new Set([...fallbackGeneratorRuntimeSet, ...resolvedScopedGeneratorRuntimeSet]) : resolvedScopedGeneratorRuntimeSet;
1780
1822
  const generatorCssSources = normalizeWebpackGeneratorCssSources(cssHandlerOptions.sourceOptions?.cssSources);
1823
+ const scopedGeneratorCompilerOptions = scopeWebpackGeneratorOptionsToCssSource(compilerOptions, sourceFile, { disableUnmatchedCssEntries: !isWebGeneratorTarget && cssHandlerOptions.isMainChunk });
1781
1824
  const generatorCssHandlerOptions = generatorCssSources === void 0 ? cssHandlerOptions : {
1782
1825
  ...cssHandlerOptions,
1783
1826
  sourceOptions: {
@@ -1786,7 +1829,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
1786
1829
  }
1787
1830
  };
1788
1831
  const generatorOptions = {
1789
- opts: compilerOptions,
1832
+ opts: scopedGeneratorCompilerOptions,
1790
1833
  runtimeState,
1791
1834
  runtime: scopedGeneratorRuntimeSet,
1792
1835
  rawSource: generatorRawSource,
@@ -1804,7 +1847,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
1804
1847
  debug
1805
1848
  };
1806
1849
  let generated;
1807
- try {
1850
+ if (!shouldSkipUnmatchedMainCssGeneration) try {
1808
1851
  generated = await generateTailwindV4Css({
1809
1852
  ...generatorOptions,
1810
1853
  outputFile: file
@@ -1818,6 +1861,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
1818
1861
  debug("css generator skipped for plain webpack css asset: %s %O", file, error);
1819
1862
  generated = void 0;
1820
1863
  }
1864
+ else debug("css generator skipped for unmatched webpack main css asset: %s", file);
1821
1865
  const source = new ConcatSource(finalizeTracedCss(generated ? finalizeCssAssetSource(isWebGeneratorTarget && currentRawSource.includes("tailwindcss v4.") ? createWebpackGeneratorUserCssSourceAppend({
1822
1866
  css: generated.css,
1823
1867
  processed: true
@@ -1850,7 +1894,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
1850
1894
  });
1851
1895
  const activeCssFiles = new Set(groupedEntries.css.map(([file]) => file));
1852
1896
  pruneWebpackCssHandlerOptionCaches(cssHandlerOptionsCache, cssUserHandlerOptionsCache, activeCssFiles);
1853
- if (activeCssFiles.size > 0) pruneWebpackCssSources?.(new Set([
1897
+ if (activeCssFiles.size > 0) pruneWebpackCssSources?.(/* @__PURE__ */ new Set([
1854
1898
  ...registeredWebpackCssSourceFiles,
1855
1899
  ...activeWebpackCssSourceFiles,
1856
1900
  ...[...cssAssetResources.values()].flatMap((resources) => [...resources])
@@ -1872,7 +1916,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
1872
1916
  });
1873
1917
  }
1874
1918
  //#endregion
1875
- //#region ../../node_modules/.pnpm/tsdown@0.22.2_oxc-resolver@11.20.0_tsx@4.22.4_typescript@6.0.3_unrun@0.2.37_synckit@0.1_c2142480ddc0e0584f1991298dd762a0/node_modules/tsdown/esm-shims.js
1919
+ //#region ../../node_modules/.pnpm/tsdown@0.22.3_oxc-resolver@11.20.0_tsx@4.22.4_typescript@6.0.3_unrun@0.2.37_synckit@0.1_6cbb3bb94bab8b3379a6056ffc71c3e9/node_modules/tsdown/esm-shims.js
1876
1920
  const getFilename = () => fileURLToPath(import.meta.url);
1877
1921
  const getDirname = () => path.dirname(getFilename());
1878
1922
  const __dirname = /* @__PURE__ */ getDirname();
@@ -2001,7 +2045,11 @@ function setupWebpackV5Loaders(options) {
2001
2045
  };
2002
2046
  if (cssImportRewriteLoaderOptions && runtimeCssImportRewriteLoaderExists && runtimeCssImportRewriteLoader && isCssModule) {
2003
2047
  const existingIndex = loaderEntries.findIndex((entry) => entry.loader?.includes?.(runtimeCssImportRewriteLoader));
2004
- const rewriteLoaderEntry = existingIndex !== -1 ? loaderEntries.splice(existingIndex, 1)[0] : createCssImportRewriteLoaderEntry();
2048
+ const rewriteLoaderEntry = existingIndex !== -1 ? {
2049
+ ...loaderEntries.splice(existingIndex, 1)[0],
2050
+ loader: runtimeCssImportRewriteLoader,
2051
+ options: cssImportRewriteLoaderOptions
2052
+ } : createCssImportRewriteLoaderEntry();
2005
2053
  if (rewriteLoaderEntry) {
2006
2054
  const anchorIndex = findRewriteAnchor(loaderEntries);
2007
2055
  if (anchorIndex === -1) anchorlessInsert(rewriteLoaderEntry, "after");
@@ -2164,7 +2212,7 @@ var WeappTailwindcss = class {
2164
2212
  };
2165
2213
  const collectWatchChangedFiles = () => {
2166
2214
  const compilerLike = compiler;
2167
- return new Set([...compilerLike.modifiedFiles ?? [], ...compilerLike.removedFiles ?? []]);
2215
+ return /* @__PURE__ */ new Set([...compilerLike.modifiedFiles ?? [], ...compilerLike.removedFiles ?? []]);
2168
2216
  };
2169
2217
  const hasRuntimeDependencyChanges = (files) => {
2170
2218
  for (const file of files) if (isWatchFileInRuntimeDependencies(file, {
@@ -2234,7 +2282,7 @@ var WeappTailwindcss = class {
2234
2282
  const configuredSourceFiles = /* @__PURE__ */ new Set();
2235
2283
  for (const entry of tailwindOptions?.v4?.cssEntries ?? []) configuredSourceFiles.add(path.resolve(entry));
2236
2284
  for (const source of tailwindOptions?.v4?.cssSources ?? []) if (source.file) configuredSourceFiles.add(path.resolve(source.file));
2237
- const activeSourceFiles = new Set([
2285
+ const activeSourceFiles = /* @__PURE__ */ new Set([
2238
2286
  ...configuredSourceFiles,
2239
2287
  ...currentWebpackCssSourceModules,
2240
2288
  ...activeAssetResources,
@@ -2331,4 +2379,4 @@ var WeappTailwindcss = class {
2331
2379
  }
2332
2380
  };
2333
2381
  //#endregion
2334
- export { weappTailwindcssPackageDir as n, WeappTailwindcss as t };
2382
+ export { weappTailwindcssPackageDir as n, __dirname as r, WeappTailwindcss as t };