weapp-tailwindcss 5.1.2 → 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 (66) hide show
  1. package/README.md +1 -1
  2. package/dist/bundlers/gulp/index.d.ts +3 -3
  3. package/dist/bundlers/rspack/index.d.ts +20 -0
  4. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
  5. package/dist/bundlers/vite/css-memory.d.ts +1 -0
  6. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -1
  7. package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +12 -0
  8. package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
  9. package/dist/bundlers/vite/serve-js-transform.d.ts +11 -0
  10. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +4 -1
  11. package/dist/cli.js +8 -8
  12. package/dist/cli.mjs +8 -8
  13. package/dist/{context-C-r8ki7x.mjs → context-B07Vf584.mjs} +34 -34
  14. package/dist/{context-CH4HFZP2.js → context-D75pwtBW.js} +43 -43
  15. package/dist/core.js +1 -1
  16. package/dist/core.mjs +1 -1
  17. package/dist/css-macro/postcss.js +2 -2
  18. package/dist/css-macro.js +3 -3
  19. package/dist/{defaults-CmFBmxsr.js → defaults-DQhgnnn-.js} +1 -1
  20. package/dist/defaults.js +1 -1
  21. package/dist/framework/index.d.ts +7 -2
  22. package/dist/framework.js +39 -8
  23. package/dist/framework.mjs +33 -6
  24. package/dist/{generator-B6pUjNdD.js → generator-CV_0irKO.js} +2 -2
  25. package/dist/{generator-BsPIaLtV.mjs → generator-DNs6ekoC.mjs} +1 -1
  26. package/dist/generator.js +2 -2
  27. package/dist/generator.mjs +2 -2
  28. package/dist/{gulp-BBCeA7ky.js → gulp-B_u8NjQL.js} +9 -9
  29. package/dist/{gulp-CTdcASq8.mjs → gulp-aQMZ0M7c.mjs} +4 -4
  30. package/dist/gulp.js +1 -1
  31. package/dist/gulp.mjs +1 -1
  32. package/dist/{hmr-timing-BRx-KnBh.mjs → hmr-timing-DLYQTCDb.mjs} +25 -22
  33. package/dist/{hmr-timing-Da1eI8S0.js → hmr-timing-DOoHun3i.js} +28 -25
  34. package/dist/index.js +9 -4
  35. package/dist/index.mjs +7 -6
  36. package/dist/postcss-html-transform.js +2 -2
  37. package/dist/postcss.js +2 -2
  38. package/dist/postcss.mjs +2 -2
  39. package/dist/presets/shared.d.ts +4 -0
  40. package/dist/presets.js +32 -16
  41. package/dist/presets.mjs +28 -14
  42. package/dist/reset.js +2 -2
  43. package/dist/rspack.d.ts +3 -0
  44. package/dist/rspack.js +68 -0
  45. package/dist/rspack.mjs +62 -0
  46. package/dist/{source-candidate-scan-signature-BO6JSskQ.js → source-candidate-scan-signature-DzwebZrf.js} +6 -6
  47. package/dist/{source-candidate-scan-signature-Dugfplms.mjs → source-candidate-scan-signature-pS87mdHZ.mjs} +3 -3
  48. package/dist/{tailwindcss-dbrbY4cd.js → tailwindcss-BSCvrs1p.js} +8 -8
  49. package/dist/{tailwindcss-B5mRo0-M.mjs → tailwindcss-BwV3_Ryc.mjs} +3 -3
  50. package/dist/{transform-DeqFRp1D.mjs → transform-Clj7R818.mjs} +19 -19
  51. package/dist/{transform-BLleu_bA.js → transform-fin-OTVD.js} +47 -47
  52. package/dist/{utils-BCa37Wqj.js → utils-D3h8j7Mk.js} +2 -2
  53. package/dist/{v4-engine-C3qSwQ-e.mjs → v4-engine-BklH3CpJ.mjs} +5 -5
  54. package/dist/{v4-engine-ON_oSLfO.js → v4-engine-CKbS27-o.js} +10 -10
  55. package/dist/{vite-CXmUiI9f.mjs → vite-5Wn0PIzJ.mjs} +237 -42
  56. package/dist/{vite-Da4uEG_u.js → vite-CkVMSDDp.js} +242 -47
  57. package/dist/vite.js +1 -1
  58. package/dist/vite.mjs +1 -1
  59. package/dist/weapp-tw-css-import-rewrite-loader.js +55 -26
  60. package/dist/weapp-tw-runtime-classset-loader.js +2 -2
  61. package/dist/{webpack-CrFZmdo7.mjs → webpack-DEag6ueE.mjs} +66 -18
  62. package/dist/{webpack-Cwqnznng.js → webpack-hvSFaicc.js} +71 -23
  63. package/dist/webpack.js +1 -1
  64. package/dist/webpack.mjs +1 -1
  65. package/package.json +8 -3
  66. /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"]) {
@@ -2416,11 +2442,11 @@ function shouldInjectMiniProgramPreflightForGeneratorCss(opts, options) {
2416
2442
  }
2417
2443
  function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
2418
2444
  if (options.isolateCssSource) {
2419
- if (options.matchedCssSourceFile) return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
2420
- 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 ?? []]);
2421
2447
  }
2422
2448
  if (runtime.size === 0 || !options.cssHandlerOptions.isMainChunk) return scopedRuntime;
2423
- return new Set([...scopedRuntime, ...runtime]);
2449
+ return /* @__PURE__ */ new Set([...scopedRuntime, ...runtime]);
2424
2450
  }
2425
2451
  function shouldIsolateScopedCssSource(_majorVersion, source, sourceEntries, options) {
2426
2452
  if (options.target !== "weapp") return false;
@@ -2482,7 +2508,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
2482
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;
2483
2509
  }
2484
2510
  function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
2485
- 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;
2486
2512
  }
2487
2513
  function mergeGeneratorResults(generatedResults) {
2488
2514
  const firstGenerated = generatedResults[0];
@@ -2657,14 +2683,14 @@ function decodeUnicode2(input) {
2657
2683
  }
2658
2684
  //#endregion
2659
2685
  //#region src/js/class-context.ts
2660
- const CLASS_LIKE_KEYWORDS = new Set([
2686
+ const CLASS_LIKE_KEYWORDS = /* @__PURE__ */ new Set([
2661
2687
  "class",
2662
2688
  "classname",
2663
2689
  "hoverclass",
2664
2690
  "virtualhostclass",
2665
2691
  "rootclass"
2666
2692
  ]);
2667
- const CLASS_HELPER_IDENTIFIERS = new Set([
2693
+ const CLASS_HELPER_IDENTIFIERS = /* @__PURE__ */ new Set([
2668
2694
  "cn",
2669
2695
  "clsx",
2670
2696
  "classnames",
@@ -2920,7 +2946,7 @@ function replaceHandleValue(path, options) {
2920
2946
  Object.freeze({ wrapExpression: true });
2921
2947
  //#endregion
2922
2948
  //#region src/wxml/whitespace.ts
2923
- const WHITESPACE_CODES = new Set([
2949
+ const WHITESPACE_CODES = /* @__PURE__ */ new Set([
2924
2950
  9,
2925
2951
  10,
2926
2952
  11,
@@ -3062,7 +3088,7 @@ new Tokenizer();
3062
3088
  //#endregion
3063
3089
  //#region src/bundlers/shared/generator-css/legacy-selectors.ts
3064
3090
  const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
3065
- const MINI_PROGRAM_THEME_SCOPE_SELECTORS = new Set([
3091
+ const MINI_PROGRAM_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
3066
3092
  ":host",
3067
3093
  "page",
3068
3094
  ".tw-root",
@@ -3125,7 +3151,7 @@ function escapeCompatSelectorClasses(selector) {
3125
3151
  function normalizeCompatSelectors(selector) {
3126
3152
  const normalized = normalizeCompatSelector(selector);
3127
3153
  if (!normalized) return [];
3128
- const selectors = new Set([normalized]);
3154
+ const selectors = /* @__PURE__ */ new Set([normalized]);
3129
3155
  const escaped = normalizeCompatSelector(escapeCompatSelectorClasses(normalized));
3130
3156
  if (escaped) selectors.add(escaped);
3131
3157
  return [...selectors];
@@ -3806,7 +3832,7 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
3806
3832
  for (const sourceFile of createSourceStylePathCandidates(file, sourceOptions)) try {
3807
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;
3808
3834
  if (source === void 0) continue;
3809
- 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)]));
3810
3836
  for (const styleSource of directiveSources) {
3811
3837
  const cssEntrySource = resolveCssEntrySource(styleSource.source, node_path.default.dirname(styleSource.file), resolveOptions);
3812
3838
  if (cssEntrySource) return {
@@ -4013,7 +4039,8 @@ function createSingleTailwindV4SourceOptions(sourceOptions, options) {
4013
4039
  baseFallbacks: sourceOptions.baseFallbacks,
4014
4040
  packageName: sourceOptions.packageName,
4015
4041
  base: options.base,
4016
- css: options.css
4042
+ css: options.css,
4043
+ cssEntries: options.cssEntries
4017
4044
  });
4018
4045
  }
4019
4046
  async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions) {
@@ -4104,7 +4131,7 @@ function hydrateTailwindV4CssSource(cssSource) {
4104
4131
  file,
4105
4132
  base: cssSource.base ?? node_path.default.dirname(file),
4106
4133
  css: (0, node_fs.readFileSync)(file, "utf8"),
4107
- dependencies: [...new Set([...cssSource.dependencies ?? [], file])]
4134
+ dependencies: [.../* @__PURE__ */ new Set([...cssSource.dependencies ?? [], file])]
4108
4135
  };
4109
4136
  }
4110
4137
  function normalizeTailwindV4CssSourceConfigs(sourceOptions) {
@@ -4220,7 +4247,8 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
4220
4247
  const css = createTailwindV4SourceReferenceSource(normalizeConfigDirective(prependConfigDirective(resolvedEntrySource.css, generatorOptions?.config), config), resolvedSourceOptions);
4221
4248
  return withMatchedSourceSideMetadata(await resolveTailwindV4Source(createSingleTailwindV4SourceOptions(resolvedSourceOptions, {
4222
4249
  base: resolvedEntrySource.base,
4223
- css
4250
+ css,
4251
+ cssEntries: [resolvedEntrySource.file]
4224
4252
  })), resolvedEntrySource);
4225
4253
  }
4226
4254
  async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
@@ -4251,6 +4279,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
4251
4279
  }
4252
4280
  const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
4253
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;
4254
4284
  const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
4255
4285
  const matchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOptions, normalizedSourceOptions) : void 0;
4256
4286
  const candidateMatchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveCandidateMatchedTailwindV4CssSource(rawSource, cssHandlerOptions, normalizedSourceOptions, selectionOptions) : void 0;
@@ -4274,7 +4304,6 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
4274
4304
  css: prependConfigDirective(source.css, generatorOptions.config)
4275
4305
  } : source;
4276
4306
  }
4277
- if (sourceSideEntrySource && normalizedSourceOptions) return resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file);
4278
4307
  const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, omitUndefined({
4279
4308
  ...resolvedSourceOptions ?? {},
4280
4309
  sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
@@ -4374,7 +4403,7 @@ async function resolveGeneratorSourceEntries(source, runtimeState) {
4374
4403
  }
4375
4404
  //#endregion
4376
4405
  //#region src/bundlers/shared/generator-css/user-css.ts
4377
- const TAILWIND_V4_GENERATOR_AT_RULES = new Set([
4406
+ const TAILWIND_V4_GENERATOR_AT_RULES = /* @__PURE__ */ new Set([
4378
4407
  "config",
4379
4408
  "custom-variant",
4380
4409
  "plugin",
@@ -6455,7 +6484,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
6455
6484
  }
6456
6485
  if (item === singleCanonicalIgnoreName) continue;
6457
6486
  if (!canonicalIgnoreNames) {
6458
- canonicalIgnoreNames = new Set([singleCanonicalIgnoreName, item]);
6487
+ canonicalIgnoreNames = /* @__PURE__ */ new Set([singleCanonicalIgnoreName, item]);
6459
6488
  continue;
6460
6489
  }
6461
6490
  canonicalIgnoreNames.add(item);
@@ -6726,7 +6755,7 @@ function jsHandler(rawSource, options) {
6726
6755
  defaultEvalHandler = jsHandler;
6727
6756
  //#endregion
6728
6757
  //#region src/tailwindcss/candidates.ts
6729
- const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = new Set([
6758
+ const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
6730
6759
  "js",
6731
6760
  "jsx",
6732
6761
  "mjs",
@@ -7018,7 +7047,7 @@ function createSourceCandidateStore(options = {}) {
7018
7047
  }
7019
7048
  function recompute(id) {
7020
7049
  const normalizedId = cleanUrl(id);
7021
- replaceFinal(normalizedId, new Set([
7050
+ replaceFinal(normalizedId, /* @__PURE__ */ new Set([
7022
7051
  ...scanCandidatesById.get(normalizedId) ?? [],
7023
7052
  ...transformCandidatesById.get(normalizedId) ?? [],
7024
7053
  ...cssCandidatesById.get(normalizedId) ?? []
@@ -7049,7 +7078,7 @@ function createSourceCandidateStore(options = {}) {
7049
7078
  return mergeSourcesByPriority().entries();
7050
7079
  }
7051
7080
  function values() {
7052
- const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
7081
+ const values = /* @__PURE__ */ new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
7053
7082
  for (const candidate of inlineExcludedCandidates) values.delete(candidate);
7054
7083
  return values;
7055
7084
  }
@@ -7153,7 +7182,7 @@ function createSourceCandidateStore(options = {}) {
7153
7182
  for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
7154
7183
  for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
7155
7184
  for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
7156
- const ids = new Set([
7185
+ const ids = /* @__PURE__ */ new Set([
7157
7186
  ...scanCandidatesById.keys(),
7158
7187
  ...transformCandidatesById.keys(),
7159
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-BsPIaLtV.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-C-r8ki7x.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-BRx-KnBh.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-Dugfplms.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 };