weapp-tailwindcss 5.1.3 → 5.1.5

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 (71) hide show
  1. package/dist/auto-CrJJc5rK.mjs +13 -0
  2. package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +8 -2
  3. package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -10
  4. package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +5 -1
  5. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
  6. package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +6 -3
  7. package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +1 -1
  8. package/dist/bundlers/vite/hot-css-modules.d.ts +1 -0
  9. package/dist/bundlers/vite/processed-css-assets.d.ts +1 -0
  10. package/dist/bundlers/vite/source-scan/css-entries.d.ts +1 -0
  11. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -1
  12. package/dist/cli.js +18 -3
  13. package/dist/cli.mjs +16 -1
  14. package/dist/{context-D75pwtBW.js → context-BziwyWy1.js} +56 -9
  15. package/dist/{context-B07Vf584.mjs → context-rrYZuUBU.mjs} +48 -7
  16. package/dist/core.js +1 -1
  17. package/dist/core.mjs +1 -1
  18. package/dist/css-macro/auto.d.ts +1 -1
  19. package/dist/css-macro/index.d.ts +2 -1
  20. package/dist/css-macro.mjs +1 -1
  21. package/dist/{defaults-BhE26nSw.mjs → defaults-9B6aMyZb.mjs} +2 -2
  22. package/dist/{defaults-DQhgnnn-.js → defaults-nsf4VNMX.js} +2 -2
  23. package/dist/defaults.d.ts +1 -1
  24. package/dist/defaults.js +1 -1
  25. package/dist/defaults.mjs +1 -1
  26. package/dist/framework/platform.d.ts +2 -0
  27. package/dist/{generator-DNs6ekoC.mjs → generator-24-HgU9F.mjs} +5 -3
  28. package/dist/{generator-CV_0irKO.js → generator-CilgHtxb.js} +5 -3
  29. package/dist/generator.js +2 -2
  30. package/dist/generator.mjs +2 -2
  31. package/dist/{gulp-B_u8NjQL.js → gulp-CuVsZdO9.js} +7 -6
  32. package/dist/{gulp-aQMZ0M7c.mjs → gulp-ygWfmOqh.mjs} +4 -4
  33. package/dist/gulp.js +1 -1
  34. package/dist/gulp.mjs +1 -1
  35. package/dist/{hmr-timing-DOoHun3i.js → hmr-timing-BKdCeIrn.js} +244 -229
  36. package/dist/{hmr-timing-DLYQTCDb.mjs → hmr-timing-Dh_nn3w5.mjs} +244 -211
  37. package/dist/index.js +4 -4
  38. package/dist/index.mjs +4 -4
  39. package/dist/js/js-string-escape.d.ts +1 -0
  40. package/dist/postcss.js +2 -2
  41. package/dist/postcss.mjs +2 -2
  42. package/dist/presets.js +2 -2
  43. package/dist/presets.mjs +2 -2
  44. package/dist/rspack.js +1 -1
  45. package/dist/rspack.mjs +1 -1
  46. package/dist/{source-candidate-scan-signature-pS87mdHZ.mjs → source-candidate-scan-signature-DATRnS1X.mjs} +165 -8
  47. package/dist/{source-candidate-scan-signature-DzwebZrf.js → source-candidate-scan-signature-DIj9m4wB.js} +177 -7
  48. package/dist/style-injector/internal.d.ts +7 -0
  49. package/dist/style-injector/options.d.ts +25 -0
  50. package/dist/tailwindcss/v4/preflight.d.ts +4 -0
  51. package/dist/tailwindcss/v4-engine/css-macro-source.d.ts +2 -0
  52. package/dist/{tailwindcss-BSCvrs1p.js → tailwindcss-BwoNQ3t8.js} +56 -16
  53. package/dist/{tailwindcss-BwV3_Ryc.mjs → tailwindcss-C-uM4rB8.mjs} +51 -17
  54. package/dist/{transform-Clj7R818.mjs → transform-DHLemtaX.mjs} +1 -1
  55. package/dist/{transform-fin-OTVD.js → transform-KLD1tJdb.js} +1 -1
  56. package/dist/typedoc.export.d.ts +1 -0
  57. package/dist/types/index.d.ts +2 -1
  58. package/dist/types/user-defined-options/general.d.ts +2 -0
  59. package/dist/{v4-engine-BklH3CpJ.mjs → v4-engine-BuuYDXt1.mjs} +54 -114
  60. package/dist/{v4-engine-CKbS27-o.js → v4-engine-CKtsdKxK.js} +57 -111
  61. package/dist/{vite-CkVMSDDp.js → vite-Yp14HNyS.js} +310 -78
  62. package/dist/{vite-5Wn0PIzJ.mjs → vite-cH0tTMHc.mjs} +308 -76
  63. package/dist/vite.js +1 -1
  64. package/dist/vite.mjs +1 -1
  65. package/dist/weapp-tw-css-import-rewrite-loader.js +363 -272
  66. package/dist/{webpack-DEag6ueE.mjs → webpack-DBhmJ-_P.mjs} +107 -20
  67. package/dist/{webpack-hvSFaicc.js → webpack-DN3tgLbF.js} +107 -20
  68. package/dist/webpack.js +1 -1
  69. package/dist/webpack.mjs +1 -1
  70. package/package.json +16 -5
  71. package/dist/auto-Ba6hDrse.mjs +0 -13
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_framework = require("./framework.js");
3
- const require_generator = require("./generator-CV_0irKO.js");
4
- const require_gulp = require("./gulp-B_u8NjQL.js");
3
+ const require_generator = require("./generator-CilgHtxb.js");
4
+ const require_gulp = require("./gulp-CuVsZdO9.js");
5
5
  const require_postcss = require("./postcss.js");
6
- const require_vite = require("./vite-CkVMSDDp.js");
7
- const require_webpack = require("./webpack-hvSFaicc.js");
6
+ const require_vite = require("./vite-Yp14HNyS.js");
7
+ const require_webpack = require("./webpack-DN3tgLbF.js");
8
8
  require("./webpack.js");
9
9
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
10
10
  exports.WeappTailwindcss = require_vite.WeappTailwindcss;
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.mjs";
2
- import { t as createWeappTailwindcssGenerator } from "./generator-DNs6ekoC.mjs";
3
- import { t as createPlugins } from "./gulp-aQMZ0M7c.mjs";
2
+ import { t as createWeappTailwindcssGenerator } from "./generator-24-HgU9F.mjs";
3
+ import { t as createPlugins } from "./gulp-ygWfmOqh.mjs";
4
4
  import weappTailwindcssPostcssPlugin from "./postcss.mjs";
5
- import { t as WeappTailwindcss } from "./vite-5Wn0PIzJ.mjs";
6
- import { n as weappTailwindcssPackageDir } from "./webpack-DEag6ueE.mjs";
5
+ import { t as WeappTailwindcss } from "./vite-cH0tTMHc.mjs";
6
+ import { n as weappTailwindcssPackageDir } from "./webpack-DBhmJ-_P.mjs";
7
7
  import "./webpack.mjs";
8
8
  import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
9
9
  export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
@@ -0,0 +1 @@
1
+ export declare function jsStringEscape(value: unknown): string;
package/dist/postcss.js CHANGED
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_v4_engine = require("./v4-engine-CKbS27-o.js");
6
- const require_generator = require("./generator-CV_0irKO.js");
5
+ const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
6
+ const require_generator = require("./generator-CilgHtxb.js");
7
7
  const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss").createWeappTailwindcssPostcssPlugin)({
8
8
  createGenerator: (source) => {
9
9
  return require_generator.createWeappTailwindcssGenerator(source);
package/dist/postcss.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { t as resolveTailwindV4Source } from "./v4-engine-BklH3CpJ.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-DNs6ekoC.mjs";
1
+ import { t as resolveTailwindV4Source } from "./v4-engine-BuuYDXt1.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-24-HgU9F.mjs";
3
3
  import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
4
4
  const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
5
5
  createGenerator: (source) => {
package/dist/presets.js CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
3
3
  const require_framework = require("./framework.js");
4
- const require_v4_engine = require("./v4-engine-CKbS27-o.js");
4
+ const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
5
5
  require("./utils-D3h8j7Mk.js");
6
- const require_tailwindcss = require("./tailwindcss-BSCvrs1p.js");
6
+ const require_tailwindcss = require("./tailwindcss-BwoNQ3t8.js");
7
7
  require("./logger-TlKT3xmR.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_rolldown_runtime.__toESM(node_path);
package/dist/presets.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { resolveTaroPlatform, resolveUniPlatformsFromEnv } from "./framework.mjs";
2
- import { st as omitUndefined } from "./v4-engine-BklH3CpJ.mjs";
2
+ import { ct as omitUndefined } from "./v4-engine-BuuYDXt1.mjs";
3
3
  import { n as defuOverrideArray } from "./utils-DodxWHGz.mjs";
4
- import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-BwV3_Ryc.mjs";
4
+ import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-C-uM4rB8.mjs";
5
5
  import { t as logger } from "./logger-BNzxZbZj.mjs";
6
6
  import path from "node:path";
7
7
  import process from "node:process";
package/dist/rspack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
3
- const require_webpack = require("./webpack-hvSFaicc.js");
3
+ const require_webpack = require("./webpack-DN3tgLbF.js");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_rolldown_runtime.__toESM(node_path);
6
6
  //#region src/bundlers/rspack/index.ts
package/dist/rspack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-DEag6ueE.mjs";
1
+ import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-DBhmJ-_P.mjs";
2
2
  import path from "node:path";
3
3
  //#region src/bundlers/rspack/index.ts
4
4
  const CSS_IMPORT_REWRITE_LOADER_NAME = "weapp-tw-css-import-rewrite-loader";
@@ -1,11 +1,153 @@
1
- import { g as traverse, h as babelParse, o as Parser } from "./context-B07Vf584.mjs";
2
- import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-BwV3_Ryc.mjs";
3
- import { u as generateCssByGenerator } from "./hmr-timing-DLYQTCDb.mjs";
1
+ import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-CrJJc5rK.mjs";
2
+ import { g as traverse, h as babelParse, o as Parser } from "./context-rrYZuUBU.mjs";
3
+ import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-C-uM4rB8.mjs";
4
+ import { u as generateCssByGenerator } from "./hmr-timing-Dh_nn3w5.mjs";
4
5
  import { createRequire } from "node:module";
5
6
  import path from "node:path";
6
7
  import process from "node:process";
7
8
  import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
8
9
  import { Buffer } from "node:buffer";
10
+ import { weappStyleInjector } from "weapp-style-injector/vite";
11
+ import { StyleInjector } from "weapp-style-injector/vite/taro";
12
+ import { StyleInjector as StyleInjector$1 } from "weapp-style-injector/vite/uni-app";
13
+ import { weappStyleInjectorWebpack } from "weapp-style-injector/webpack";
14
+ import { StyleInjector as StyleInjector$2 } from "weapp-style-injector/webpack/mpx";
15
+ import { StyleInjector as StyleInjector$3 } from "weapp-style-injector/webpack/taro";
16
+ import { StyleInjector as StyleInjector$4 } from "weapp-style-injector/webpack/uni-app";
17
+ //#region src/style-injector/options.ts
18
+ function normalizeStyleInjectorOptions(options) {
19
+ if (options === true) return {};
20
+ if (!options) return;
21
+ return options;
22
+ }
23
+ //#endregion
24
+ //#region src/style-injector/internal.ts
25
+ function toPluginArray(pluginOrPlugins) {
26
+ return Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
27
+ }
28
+ function isUniAppViteStyleInjectorApp(appType) {
29
+ return appType === "uni-app-vite" || appType === "uni-app-x";
30
+ }
31
+ function isUniAppWebpackStyleInjectorApp(appType) {
32
+ return appType === "uni-app" || appType === "uni-app-vite" || appType === "uni-app-x";
33
+ }
34
+ function normalizeWebpackStyleInjectorOptions(options) {
35
+ const normalized = normalizeStyleInjectorOptions(options);
36
+ if (!normalized) return;
37
+ const { generateSubpackageStyle, loadSubpackageTargetStyle, ...rest } = normalized;
38
+ const webpackOptions = { ...rest };
39
+ if (generateSubpackageStyle) webpackOptions.generateSubpackageStyle = (context) => {
40
+ const generated = generateSubpackageStyle(context);
41
+ if (generated && typeof generated.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage style generators must return synchronously.");
42
+ return generated;
43
+ };
44
+ if (loadSubpackageTargetStyle) webpackOptions.loadSubpackageTargetStyle = (fileName, sourceAbsolutePath) => {
45
+ const loaded = loadSubpackageTargetStyle(fileName, sourceAbsolutePath);
46
+ if (loaded && typeof loaded.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage target style loaders must return synchronously.");
47
+ return loaded;
48
+ };
49
+ return webpackOptions;
50
+ }
51
+ function getTransformHandler(hook) {
52
+ if (typeof hook === "function") return hook;
53
+ if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
54
+ }
55
+ function getGenerateBundleHandler(hook) {
56
+ if (typeof hook === "function") return hook;
57
+ if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
58
+ }
59
+ function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
60
+ const normalized = normalizeStyleInjectorOptions(options);
61
+ if (!normalized) return [];
62
+ let config;
63
+ let delegates;
64
+ let delegatesConfigured = false;
65
+ let delegatesBuildStarted = false;
66
+ const resolveDelegates = () => {
67
+ if (delegates) return delegates;
68
+ const appType = getAppType();
69
+ if (isUniAppViteStyleInjectorApp(appType)) delegates = toPluginArray(StyleInjector$1(normalized));
70
+ else if (appType === "taro") delegates = toPluginArray(StyleInjector(normalized));
71
+ else delegates = [weappStyleInjector(normalized)];
72
+ return delegates;
73
+ };
74
+ const configureDelegates = async () => {
75
+ if (delegatesConfigured || !config) return;
76
+ delegatesConfigured = true;
77
+ for (const plugin of resolveDelegates()) if (typeof plugin.configResolved === "function") await plugin.configResolved(config);
78
+ };
79
+ const startDelegates = async (context) => {
80
+ if (delegatesBuildStarted) return;
81
+ await configureDelegates();
82
+ delegatesBuildStarted = true;
83
+ for (const plugin of resolveDelegates()) if (typeof plugin.buildStart === "function") await plugin.buildStart.call(context, {});
84
+ };
85
+ return [{
86
+ name: "weapp-tailwindcss:style-injector-pre",
87
+ apply: "build",
88
+ enforce: "pre",
89
+ configResolved(resolvedConfig) {
90
+ config = resolvedConfig;
91
+ },
92
+ async buildStart() {
93
+ await startDelegates(this);
94
+ },
95
+ async load(id, options) {
96
+ await configureDelegates();
97
+ for (const plugin of resolveDelegates()) {
98
+ if (typeof plugin.load !== "function") continue;
99
+ const result = await plugin.load.call(this, id, options);
100
+ if (result != null) return result;
101
+ }
102
+ },
103
+ async transform(code, id, options) {
104
+ await configureDelegates();
105
+ let currentCode = code;
106
+ let changed = false;
107
+ for (const plugin of resolveDelegates()) {
108
+ const handler = getTransformHandler(plugin.transform);
109
+ if (!handler) continue;
110
+ const result = await handler.call(this, currentCode, id, options);
111
+ if (!result) continue;
112
+ if (typeof result === "string") {
113
+ currentCode = result;
114
+ changed = true;
115
+ } else if (typeof result === "object" && typeof result.code === "string") {
116
+ currentCode = result.code;
117
+ changed = true;
118
+ }
119
+ }
120
+ if (changed) return {
121
+ code: currentCode,
122
+ map: null
123
+ };
124
+ }
125
+ }, {
126
+ name: "weapp-tailwindcss:style-injector",
127
+ apply: "build",
128
+ enforce: "post",
129
+ configResolved(resolvedConfig) {
130
+ config = resolvedConfig;
131
+ },
132
+ async generateBundle(outputOptions, bundle, isWrite) {
133
+ await configureDelegates();
134
+ for (const plugin of resolveDelegates()) {
135
+ const handler = getGenerateBundleHandler(plugin.generateBundle);
136
+ if (!handler) continue;
137
+ await handler.call(this, outputOptions, bundle, isWrite);
138
+ }
139
+ }
140
+ }];
141
+ }
142
+ function createBuiltinWebpackStyleInjectorPlugin(options, appType) {
143
+ const normalized = normalizeWebpackStyleInjectorOptions(options);
144
+ if (!normalized) return;
145
+ if (isUniAppWebpackStyleInjectorApp(appType)) return StyleInjector$4(normalized);
146
+ if (appType === "taro") return StyleInjector$3(normalized);
147
+ if (appType === "mpx") return StyleInjector$2(normalized);
148
+ return weappStyleInjectorWebpack(normalized);
149
+ }
150
+ //#endregion
9
151
  //#region src/bundlers/shared/module-graph.ts
10
152
  const QUERY_HASH_RE = /[?#].*$/u;
11
153
  const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
@@ -501,6 +643,17 @@ function intersectCandidates(first, second) {
501
643
  for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
502
644
  return scoped;
503
645
  }
646
+ function mergeCandidates(first, second) {
647
+ return /* @__PURE__ */ new Set([...first, ...second]);
648
+ }
649
+ function intersectExplicitSourceCandidates(scopedCandidates, localCandidates) {
650
+ if (localCandidates.size === 0 && scopedCandidates.size > 0) return scopedCandidates;
651
+ return intersectCandidates(scopedCandidates, localCandidates);
652
+ }
653
+ function resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates) {
654
+ if (scopedCandidates.size === 0 && localCandidates.size === 0 && fallbackCandidates?.size) return fallbackCandidates;
655
+ return intersectExplicitSourceCandidates(scopedCandidates, localCandidates);
656
+ }
504
657
  function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
505
658
  if (!hasOwnSourceDirectives(rawSource)) return {
506
659
  entries: resolvedEntries,
@@ -521,7 +674,7 @@ async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fa
521
674
  const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
522
675
  if (entries === void 0) return fallbackSignature;
523
676
  const scopedCandidates = getSourceCandidatesForEntries(entries);
524
- const scopedSignature = createCandidateSignature(localEntries ? intersectCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries)) : scopedCandidates);
677
+ const scopedSignature = createCandidateSignature(localEntries ? resolveExplicitSourceCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries), getSourceCandidatesForEntries(void 0)) : scopedCandidates);
525
678
  return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
526
679
  }
527
680
  async function createScopedGeneratorRuntime(options) {
@@ -530,12 +683,16 @@ async function createScopedGeneratorRuntime(options) {
530
683
  const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await resolveTailwindV4EntriesFromCssCached(rawSource, path.dirname(path.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
531
684
  if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
532
685
  const scopedCandidates = scopedSourceCandidateGetter?.(entries) ?? getSourceCandidatesForEntries(entries);
533
- if (!localEntries) return scopedCandidates;
534
- return intersectCandidates(scopedCandidates, scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries));
686
+ const shouldMergeFallbackRuntime = hasCssMacroTailwindV4CustomVariantConditionalComments(rawSource);
687
+ if (!localEntries) return shouldMergeFallbackRuntime ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
688
+ const localCandidates = scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries);
689
+ const fallbackCandidates = scopedSourceCandidateGetter?.(void 0);
690
+ const scopedLocalCandidates = resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates);
691
+ return shouldMergeFallbackRuntime ? mergeCandidates(scopedLocalCandidates, fallbackRuntime) : scopedLocalCandidates;
535
692
  }
536
693
  }
537
694
  const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
538
- if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return scopedCandidates;
695
+ if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions) ? scopedCandidates : mergeCandidates(scopedCandidates, fallbackRuntime);
539
696
  if (!shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions)) return fallbackRuntime;
540
697
  return fallbackRuntime;
541
698
  }
@@ -569,4 +726,4 @@ function createSourceCandidateScanSignature(input) {
569
726
  });
570
727
  }
571
728
  //#endregion
572
- export { isSourceStyleRequest as A, resolvePluginDisabledState as C, isHTMLRequest as D, isCSSRequest as E, normalizeOutputPathKey as M, resolveOutputSpecifier as N, normalizePath as O, toAbsoluteOutputPath as P, resolvePackageDir as S, formatPostcssSourceMap as T, generateTailwindV4Css as _, createJsHashSalt as a, parseBundlerGeneratedCssMarkerBlocks as b, hasRuntimeAffectingSourceChanges as c, classifyBundleEntry as d, createBundleBuildState as f, createBundleModuleGraphOptions as g, applyLinkedResults as h, createCandidateSignature as i, stripRequestQuery as j, slash as k, summarizeStringDiff as l, createRuntimeAffectingSourceSignature as m, createScopedGeneratorCandidateSignature as n, createLinkedImpactSignature as o, updateBundleBuildState as p, createScopedGeneratorRuntime as r, getSnapshotHash as s, createSourceCandidateScanSignature as t, buildBundleSnapshot as u, createBundlerGeneratedCssMarker as v, cleanUrl as w, stripBundlerGeneratedCssMarkers as x, hasBundlerGeneratedCssMarker as y };
729
+ export { isSourceStyleRequest as A, resolvePluginDisabledState as C, isHTMLRequest as D, isCSSRequest as E, createBuiltinViteStyleInjectorPlugins as F, createBuiltinWebpackStyleInjectorPlugin as I, normalizeOutputPathKey as M, resolveOutputSpecifier as N, normalizePath as O, toAbsoluteOutputPath as P, resolvePackageDir as S, formatPostcssSourceMap as T, generateTailwindV4Css as _, createJsHashSalt as a, parseBundlerGeneratedCssMarkerBlocks as b, hasRuntimeAffectingSourceChanges as c, classifyBundleEntry as d, createBundleBuildState as f, createBundleModuleGraphOptions as g, applyLinkedResults as h, createCandidateSignature as i, stripRequestQuery as j, slash as k, summarizeStringDiff as l, createRuntimeAffectingSourceSignature as m, createScopedGeneratorCandidateSignature as n, createLinkedImpactSignature as o, updateBundleBuildState as p, createScopedGeneratorRuntime as r, getSnapshotHash as s, createSourceCandidateScanSignature as t, buildBundleSnapshot as u, createBundlerGeneratedCssMarker as v, cleanUrl as w, stripBundlerGeneratedCssMarkers as x, hasBundlerGeneratedCssMarker as y };
@@ -1,7 +1,8 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
- const require_context = require("./context-D75pwtBW.js");
3
- const require_tailwindcss = require("./tailwindcss-BSCvrs1p.js");
4
- const require_hmr_timing = require("./hmr-timing-DOoHun3i.js");
2
+ require("./auto-DtU6f3X6.js");
3
+ const require_context = require("./context-BziwyWy1.js");
4
+ const require_tailwindcss = require("./tailwindcss-BwoNQ3t8.js");
5
+ const require_hmr_timing = require("./hmr-timing-BKdCeIrn.js");
5
6
  let node_path = require("node:path");
6
7
  node_path = require_rolldown_runtime.__toESM(node_path);
7
8
  let node_process = require("node:process");
@@ -9,6 +10,148 @@ node_process = require_rolldown_runtime.__toESM(node_process);
9
10
  let node_module = require("node:module");
10
11
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
11
12
  let node_buffer = require("node:buffer");
13
+ let weapp_style_injector_vite = require("weapp-style-injector/vite");
14
+ let weapp_style_injector_vite_taro = require("weapp-style-injector/vite/taro");
15
+ let weapp_style_injector_vite_uni_app = require("weapp-style-injector/vite/uni-app");
16
+ let weapp_style_injector_webpack = require("weapp-style-injector/webpack");
17
+ let weapp_style_injector_webpack_mpx = require("weapp-style-injector/webpack/mpx");
18
+ let weapp_style_injector_webpack_taro = require("weapp-style-injector/webpack/taro");
19
+ let weapp_style_injector_webpack_uni_app = require("weapp-style-injector/webpack/uni-app");
20
+ let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
21
+ //#region src/style-injector/options.ts
22
+ function normalizeStyleInjectorOptions(options) {
23
+ if (options === true) return {};
24
+ if (!options) return;
25
+ return options;
26
+ }
27
+ //#endregion
28
+ //#region src/style-injector/internal.ts
29
+ function toPluginArray(pluginOrPlugins) {
30
+ return Array.isArray(pluginOrPlugins) ? pluginOrPlugins : [pluginOrPlugins];
31
+ }
32
+ function isUniAppViteStyleInjectorApp(appType) {
33
+ return appType === "uni-app-vite" || appType === "uni-app-x";
34
+ }
35
+ function isUniAppWebpackStyleInjectorApp(appType) {
36
+ return appType === "uni-app" || appType === "uni-app-vite" || appType === "uni-app-x";
37
+ }
38
+ function normalizeWebpackStyleInjectorOptions(options) {
39
+ const normalized = normalizeStyleInjectorOptions(options);
40
+ if (!normalized) return;
41
+ const { generateSubpackageStyle, loadSubpackageTargetStyle, ...rest } = normalized;
42
+ const webpackOptions = { ...rest };
43
+ if (generateSubpackageStyle) webpackOptions.generateSubpackageStyle = (context) => {
44
+ const generated = generateSubpackageStyle(context);
45
+ if (generated && typeof generated.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage style generators must return synchronously.");
46
+ return generated;
47
+ };
48
+ if (loadSubpackageTargetStyle) webpackOptions.loadSubpackageTargetStyle = (fileName, sourceAbsolutePath) => {
49
+ const loaded = loadSubpackageTargetStyle(fileName, sourceAbsolutePath);
50
+ if (loaded && typeof loaded.then === "function") throw new TypeError("[weapp-style-injector] Webpack subpackage target style loaders must return synchronously.");
51
+ return loaded;
52
+ };
53
+ return webpackOptions;
54
+ }
55
+ function getTransformHandler(hook) {
56
+ if (typeof hook === "function") return hook;
57
+ if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
58
+ }
59
+ function getGenerateBundleHandler(hook) {
60
+ if (typeof hook === "function") return hook;
61
+ if (hook && typeof hook === "object" && typeof hook.handler === "function") return hook.handler;
62
+ }
63
+ function createBuiltinViteStyleInjectorPlugins(options, getAppType) {
64
+ const normalized = normalizeStyleInjectorOptions(options);
65
+ if (!normalized) return [];
66
+ let config;
67
+ let delegates;
68
+ let delegatesConfigured = false;
69
+ let delegatesBuildStarted = false;
70
+ const resolveDelegates = () => {
71
+ if (delegates) return delegates;
72
+ const appType = getAppType();
73
+ if (isUniAppViteStyleInjectorApp(appType)) delegates = toPluginArray((0, weapp_style_injector_vite_uni_app.StyleInjector)(normalized));
74
+ else if (appType === "taro") delegates = toPluginArray((0, weapp_style_injector_vite_taro.StyleInjector)(normalized));
75
+ else delegates = [(0, weapp_style_injector_vite.weappStyleInjector)(normalized)];
76
+ return delegates;
77
+ };
78
+ const configureDelegates = async () => {
79
+ if (delegatesConfigured || !config) return;
80
+ delegatesConfigured = true;
81
+ for (const plugin of resolveDelegates()) if (typeof plugin.configResolved === "function") await plugin.configResolved(config);
82
+ };
83
+ const startDelegates = async (context) => {
84
+ if (delegatesBuildStarted) return;
85
+ await configureDelegates();
86
+ delegatesBuildStarted = true;
87
+ for (const plugin of resolveDelegates()) if (typeof plugin.buildStart === "function") await plugin.buildStart.call(context, {});
88
+ };
89
+ return [{
90
+ name: "weapp-tailwindcss:style-injector-pre",
91
+ apply: "build",
92
+ enforce: "pre",
93
+ configResolved(resolvedConfig) {
94
+ config = resolvedConfig;
95
+ },
96
+ async buildStart() {
97
+ await startDelegates(this);
98
+ },
99
+ async load(id, options) {
100
+ await configureDelegates();
101
+ for (const plugin of resolveDelegates()) {
102
+ if (typeof plugin.load !== "function") continue;
103
+ const result = await plugin.load.call(this, id, options);
104
+ if (result != null) return result;
105
+ }
106
+ },
107
+ async transform(code, id, options) {
108
+ await configureDelegates();
109
+ let currentCode = code;
110
+ let changed = false;
111
+ for (const plugin of resolveDelegates()) {
112
+ const handler = getTransformHandler(plugin.transform);
113
+ if (!handler) continue;
114
+ const result = await handler.call(this, currentCode, id, options);
115
+ if (!result) continue;
116
+ if (typeof result === "string") {
117
+ currentCode = result;
118
+ changed = true;
119
+ } else if (typeof result === "object" && typeof result.code === "string") {
120
+ currentCode = result.code;
121
+ changed = true;
122
+ }
123
+ }
124
+ if (changed) return {
125
+ code: currentCode,
126
+ map: null
127
+ };
128
+ }
129
+ }, {
130
+ name: "weapp-tailwindcss:style-injector",
131
+ apply: "build",
132
+ enforce: "post",
133
+ configResolved(resolvedConfig) {
134
+ config = resolvedConfig;
135
+ },
136
+ async generateBundle(outputOptions, bundle, isWrite) {
137
+ await configureDelegates();
138
+ for (const plugin of resolveDelegates()) {
139
+ const handler = getGenerateBundleHandler(plugin.generateBundle);
140
+ if (!handler) continue;
141
+ await handler.call(this, outputOptions, bundle, isWrite);
142
+ }
143
+ }
144
+ }];
145
+ }
146
+ function createBuiltinWebpackStyleInjectorPlugin(options, appType) {
147
+ const normalized = normalizeWebpackStyleInjectorOptions(options);
148
+ if (!normalized) return;
149
+ if (isUniAppWebpackStyleInjectorApp(appType)) return (0, weapp_style_injector_webpack_uni_app.StyleInjector)(normalized);
150
+ if (appType === "taro") return (0, weapp_style_injector_webpack_taro.StyleInjector)(normalized);
151
+ if (appType === "mpx") return (0, weapp_style_injector_webpack_mpx.StyleInjector)(normalized);
152
+ return (0, weapp_style_injector_webpack.weappStyleInjectorWebpack)(normalized);
153
+ }
154
+ //#endregion
12
155
  //#region src/bundlers/shared/module-graph.ts
13
156
  const QUERY_HASH_RE = /[?#].*$/u;
14
157
  const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
@@ -504,6 +647,17 @@ function intersectCandidates(first, second) {
504
647
  for (const candidate of small) if (large.has(candidate)) scoped.add(candidate);
505
648
  return scoped;
506
649
  }
650
+ function mergeCandidates(first, second) {
651
+ return /* @__PURE__ */ new Set([...first, ...second]);
652
+ }
653
+ function intersectExplicitSourceCandidates(scopedCandidates, localCandidates) {
654
+ if (localCandidates.size === 0 && scopedCandidates.size > 0) return scopedCandidates;
655
+ return intersectCandidates(scopedCandidates, localCandidates);
656
+ }
657
+ function resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates) {
658
+ if (scopedCandidates.size === 0 && localCandidates.size === 0 && fallbackCandidates?.size) return fallbackCandidates;
659
+ return intersectExplicitSourceCandidates(scopedCandidates, localCandidates);
660
+ }
507
661
  function resolveScopedSourceEntries(rawSource, sourceFile, resolvedEntries) {
508
662
  if (!hasOwnSourceDirectives(rawSource)) return {
509
663
  entries: resolvedEntries,
@@ -524,7 +678,7 @@ async function createScopedGeneratorCandidateSignature(rawSource, sourceFile, fa
524
678
  const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
525
679
  if (entries === void 0) return fallbackSignature;
526
680
  const scopedCandidates = getSourceCandidatesForEntries(entries);
527
- const scopedSignature = createCandidateSignature(localEntries ? intersectCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries)) : scopedCandidates);
681
+ const scopedSignature = createCandidateSignature(localEntries ? resolveExplicitSourceCandidates(scopedCandidates, getSourceCandidatesForEntries(localEntries), getSourceCandidatesForEntries(void 0)) : scopedCandidates);
528
682
  return options.includeFallbackSignature === true ? `${scopedSignature}:${fallbackSignature}` : scopedSignature;
529
683
  }
530
684
  async function createScopedGeneratorRuntime(options) {
@@ -533,12 +687,16 @@ async function createScopedGeneratorRuntime(options) {
533
687
  const { entries, localEntries } = resolveScopedSourceEntries(rawSource, sourceFile, (await require_tailwindcss.resolveTailwindV4EntriesFromCssCached(rawSource, node_path.default.dirname(node_path.default.resolve(sourceFile.replace(/[?#].*$/, "")))))?.entries);
534
688
  if (entries !== void 0 && (entries.length > 0 || hasOwnSourceDirectives(rawSource))) {
535
689
  const scopedCandidates = scopedSourceCandidateGetter?.(entries) ?? getSourceCandidatesForEntries(entries);
536
- if (!localEntries) return scopedCandidates;
537
- return intersectCandidates(scopedCandidates, scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries));
690
+ const shouldMergeFallbackRuntime = (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4CustomVariantConditionalComments)(rawSource);
691
+ if (!localEntries) return shouldMergeFallbackRuntime ? mergeCandidates(scopedCandidates, fallbackRuntime) : scopedCandidates;
692
+ const localCandidates = scopedSourceCandidateGetter?.(localEntries) ?? getSourceCandidatesForEntries(localEntries);
693
+ const fallbackCandidates = scopedSourceCandidateGetter?.(void 0);
694
+ const scopedLocalCandidates = resolveExplicitSourceCandidates(scopedCandidates, localCandidates, fallbackCandidates);
695
+ return shouldMergeFallbackRuntime ? mergeCandidates(scopedLocalCandidates, fallbackRuntime) : scopedLocalCandidates;
538
696
  }
539
697
  }
540
698
  const scopedCandidates = scopedSourceCandidateGetter?.(void 0);
541
- if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return scopedCandidates;
699
+ if (scopedCandidates && (scopedCandidates.size > 0 || shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions))) return shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions) ? scopedCandidates : mergeCandidates(scopedCandidates, fallbackRuntime);
542
700
  if (!shouldExcludeSubpackageSourceCandidates(outputFile, cssHandlerOptions)) return fallbackRuntime;
543
701
  return fallbackRuntime;
544
702
  }
@@ -590,6 +748,18 @@ Object.defineProperty(exports, "classifyBundleEntry", {
590
748
  return classifyBundleEntry;
591
749
  }
592
750
  });
751
+ Object.defineProperty(exports, "createBuiltinViteStyleInjectorPlugins", {
752
+ enumerable: true,
753
+ get: function() {
754
+ return createBuiltinViteStyleInjectorPlugins;
755
+ }
756
+ });
757
+ Object.defineProperty(exports, "createBuiltinWebpackStyleInjectorPlugin", {
758
+ enumerable: true,
759
+ get: function() {
760
+ return createBuiltinWebpackStyleInjectorPlugin;
761
+ }
762
+ });
593
763
  Object.defineProperty(exports, "createBundleBuildState", {
594
764
  enumerable: true,
595
765
  get: function() {
@@ -0,0 +1,7 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { WebpackObjectPluginInstance } from 'weapp-style-injector/webpack';
3
+ import type { WeappTailwindcssStyleInjectorUserOptions } from './options';
4
+ import type { AppType } from '../types/shared';
5
+ export declare function createBuiltinViteStyleInjectorPlugins(options: WeappTailwindcssStyleInjectorUserOptions | undefined, getAppType: () => AppType | undefined): Plugin[];
6
+ export declare function createBuiltinWebpackStyleInjectorPlugin(options: WeappTailwindcssStyleInjectorUserOptions | undefined, appType: AppType | undefined): WebpackObjectPluginInstance | undefined;
7
+ export type { WeappTailwindcssStyleInjectorOptions, WeappTailwindcssStyleInjectorUserOptions } from './options';
@@ -0,0 +1,25 @@
1
+ import type { MpxSubPackageConfig, ResolvedSubpackageStyleScope, SubpackageStyleGenerateContext, SubpackageStyleGenerator, SubpackageStyleRules, TaroSubPackageConfig, UniAppManualStyleConfig, UniAppStyleScopeInput, UniAppSubPackageConfig, WeappStyleInjectorOptions } from 'weapp-style-injector';
2
+ export type WeappTailwindcssStyleInjectorUserOptions = boolean | WeappTailwindcssStyleInjectorOptions;
3
+ export interface WeappTailwindcssStyleInjectorOptions extends WeappStyleInjectorOptions {
4
+ pagesJsonPath?: string | string[] | undefined;
5
+ appConfigPath?: string | string[] | undefined;
6
+ appPath?: string | string[] | undefined;
7
+ sourceRoot?: string | undefined;
8
+ subPackages?: UniAppSubPackageConfig | UniAppSubPackageConfig[] | TaroSubPackageConfig | TaroSubPackageConfig[] | MpxSubPackageConfig | MpxSubPackageConfig[] | undefined;
9
+ uniAppSubPackages?: UniAppSubPackageConfig | UniAppSubPackageConfig[] | undefined;
10
+ uniAppStyleScopes?: UniAppManualStyleConfig | UniAppManualStyleConfig[] | undefined;
11
+ subpackageStyleScopes?: ResolvedSubpackageStyleScope[] | undefined;
12
+ generateSubpackageStyle?: SubpackageStyleGenerator | ((context: SubpackageStyleGenerateContext) => string | Uint8Array | null | undefined | Promise<string | Uint8Array | null | undefined>) | undefined;
13
+ loadSubpackageTargetStyle?: ((fileName: string, sourceAbsolutePath: string) => string | Uint8Array | null | undefined | Promise<string | Uint8Array | null | undefined>) | undefined;
14
+ sourceFileName?: string | string[] | undefined;
15
+ outputName?: string | undefined;
16
+ files?: string | string[] | undefined;
17
+ include?: WeappStyleInjectorOptions['include'];
18
+ exclude?: WeappStyleInjectorOptions['exclude'];
19
+ indexFileName?: string | string[] | undefined;
20
+ indexFileNames?: string | string[] | undefined;
21
+ styleScopes?: UniAppStyleScopeInput | UniAppStyleScopeInput[] | undefined;
22
+ rules?: SubpackageStyleRules | undefined;
23
+ preprocess?: boolean | undefined;
24
+ }
25
+ export declare function normalizeStyleInjectorOptions(options: WeappTailwindcssStyleInjectorUserOptions | undefined): WeappTailwindcssStyleInjectorOptions | undefined;
@@ -0,0 +1,4 @@
1
+ export declare function parseCssImportSpecifier(params: string): string | undefined;
2
+ export declare function isTailwindV4CssImportParam(params: string): boolean;
3
+ export declare function isTailwindV4PreflightImportParam(params: string): boolean;
4
+ export declare function includesTailwindV4PreflightDirective(css: string): boolean;
@@ -0,0 +1,2 @@
1
+ import type { TailwindV4ResolvedSource } from './types';
2
+ export declare function resolveCssMacroTailwindV4Source(source: TailwindV4ResolvedSource): TailwindV4ResolvedSource;