weapp-tailwindcss 5.0.0-next.31 → 5.0.0-next.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/auto-DEHRmEAx.mjs +200 -0
  2. package/dist/auto-dPpsm6FB.js +238 -0
  3. package/dist/{bundle-state-Ct_8GcSR.js → bundle-state-Co_ksa-C.js} +3 -3
  4. package/dist/{bundle-state-Bi-cQua6.mjs → bundle-state-DUIidcox.mjs} +2 -2
  5. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
  6. package/dist/bundlers/vite/generate-bundle.d.ts +1 -0
  7. package/dist/bundlers/vite/runtime-class-set.d.ts +1 -0
  8. package/dist/cli.js +3 -6
  9. package/dist/cli.mjs +4 -7
  10. package/dist/core.js +1 -1
  11. package/dist/core.mjs +1 -1
  12. package/dist/css-macro/auto.d.ts +2 -1
  13. package/dist/css-macro.js +1 -1
  14. package/dist/css-macro.mjs +1 -1
  15. package/dist/{generator-CrU-Ghc1.js → generator-BEXaaUzP.js} +1 -1
  16. package/dist/{generator-Qw-tZ0Z2.mjs → generator-CpsHA4Wd.mjs} +1 -1
  17. package/dist/generator.js +2 -2
  18. package/dist/generator.mjs +2 -2
  19. package/dist/gulp.js +7 -7
  20. package/dist/gulp.mjs +6 -6
  21. package/dist/{incremental-runtime-class-set-FAOHZmzh.js → incremental-runtime-class-set-BE8RVbuz.js} +71 -9
  22. package/dist/{incremental-runtime-class-set-Boqi1QlB.mjs → incremental-runtime-class-set-BXYUYjCd.mjs} +70 -8
  23. package/dist/index.js +4 -4
  24. package/dist/index.mjs +4 -4
  25. package/dist/{postcss-C6zOQqlL.mjs → postcss-BvkdIZr8.mjs} +3 -3
  26. package/dist/{postcss-DAWf9D3C.js → postcss-DN7IQzYb.js} +4 -4
  27. package/dist/postcss.js +1 -1
  28. package/dist/postcss.mjs +1 -1
  29. package/dist/{precheck-D7gJSmJz.js → precheck-D_KT1pis.js} +8 -10
  30. package/dist/{precheck-D7K12zeX.mjs → precheck-mM9IVd1f.mjs} +8 -10
  31. package/dist/presets.js +4 -4
  32. package/dist/presets.mjs +3 -3
  33. package/dist/{source-candidates-DNM8iwXW.js → source-candidates-7Q-kTOSb.js} +1 -1
  34. package/dist/{source-candidates-CX2ozpKM.mjs → source-candidates-_x8bq0Mz.mjs} +1 -1
  35. package/dist/{tailwindcss-B-e2RiXr.js → tailwindcss-Cl7hUlYV.js} +3 -3
  36. package/dist/{tailwindcss-C7dJHZ0G.mjs → tailwindcss-udhXxMX9.mjs} +2 -2
  37. package/dist/{v3-engine-DcvCCHfs.mjs → v3-engine-C_KeUQG3.mjs} +6 -6
  38. package/dist/{v3-engine-CHItlVq5.js → v3-engine-DwY4Fixu.js} +7 -7
  39. package/dist/{vite-BgTPSkQS.js → vite-BVbIr2vs.js} +105 -44
  40. package/dist/{vite-fFRpSvyz.mjs → vite-C8vSTuBQ.mjs} +104 -43
  41. package/dist/vite.js +1 -1
  42. package/dist/vite.mjs +1 -1
  43. package/dist/weapp-tw-css-import-rewrite-loader.js +127 -7
  44. package/dist/{webpack-BXSWVdXh.js → webpack-DlHo84RT.js} +8 -8
  45. package/dist/{webpack-Dx2AZpGU.mjs → webpack-dva53gYi.mjs} +7 -7
  46. package/dist/webpack.js +1 -1
  47. package/dist/webpack.mjs +1 -1
  48. package/package.json +5 -5
  49. package/dist/auto-TH1jG2UW.js +0 -115
  50. package/dist/auto-XyKTOP7B.mjs +0 -78
@@ -0,0 +1,200 @@
1
+ import { n as creator } from "./postcss-C7BMYpEF.mjs";
2
+ import postcss from "postcss";
3
+ import process from "node:process";
4
+ //#region src/css-macro/auto.ts
5
+ const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
6
+ const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
7
+ const PLATFORM_ENV_KEYS = [
8
+ "WEAPP_TW_TARGET",
9
+ "WEAPP_TAILWINDCSS_TARGET",
10
+ "UNI_PLATFORM",
11
+ "UNI_UTS_PLATFORM",
12
+ "TARO_ENV",
13
+ "MPX_CLI_MODE",
14
+ "MPX_CURRENT_TARGET_MODE"
15
+ ];
16
+ const CONDITIONAL_END_RE = /^\s*#endif\s*$/;
17
+ function readEnvValue(key) {
18
+ return typeof process === "undefined" ? void 0 : process.env[key];
19
+ }
20
+ function normalizePlatformToken(value) {
21
+ return value?.trim().replaceAll("_", "-").toUpperCase() || void 0;
22
+ }
23
+ function resolveCssMacroPlatform(options) {
24
+ const explicit = normalizePlatformToken(options?.platform);
25
+ if (explicit) return explicit;
26
+ for (const key of PLATFORM_ENV_KEYS) {
27
+ const value = normalizePlatformToken(readEnvValue(key));
28
+ if (value) return value;
29
+ }
30
+ }
31
+ function createPlatformTokenSet(platform) {
32
+ const normalized = normalizePlatformToken(platform);
33
+ const tokens = /* @__PURE__ */ new Set();
34
+ if (!normalized) return tokens;
35
+ tokens.add(normalized);
36
+ if (normalized.startsWith("MP-")) tokens.add("MP");
37
+ if (normalized === "WEAPP" || normalized === "WEIXIN" || normalized === "WX") {
38
+ tokens.add("MP");
39
+ tokens.add("MP-WEIXIN");
40
+ }
41
+ if (normalized === "MP-WEIXIN") {
42
+ tokens.add("WEAPP");
43
+ tokens.add("WEIXIN");
44
+ tokens.add("WX");
45
+ }
46
+ if (normalized === "H5") tokens.add("WEB");
47
+ if (normalized === "WEB") tokens.add("H5");
48
+ if (normalized === "APP") tokens.add("APP-PLUS");
49
+ if (normalized.startsWith("APP-")) tokens.add("APP");
50
+ if (normalized.startsWith("QUICKAPP-WEBVIEW")) tokens.add("QUICKAPP-WEBVIEW");
51
+ return tokens;
52
+ }
53
+ function combineAnd(values) {
54
+ if (values.includes(false)) return false;
55
+ return values.every((value) => value === true) ? true : void 0;
56
+ }
57
+ function combineOr(values) {
58
+ if (values.includes(true)) return true;
59
+ return values.every((value) => value === false) ? false : void 0;
60
+ }
61
+ function evaluatePlatformExpression(expression, platformTokens) {
62
+ return combineOr(expression.split(/\s*\|\|\s*/).map((orPart) => {
63
+ return combineAnd(orPart.split(/\s*&&\s*/).map((part) => {
64
+ const token = normalizePlatformToken(part);
65
+ if (!token || /[<>=!()]/.test(token)) return;
66
+ return platformTokens.has(token);
67
+ }));
68
+ }));
69
+ }
70
+ function negateConditionalValue(value) {
71
+ return value === void 0 ? void 0 : !value;
72
+ }
73
+ function getActiveConditionalValue(stack) {
74
+ if (stack.includes(false)) return false;
75
+ return stack.includes(void 0) ? void 0 : true;
76
+ }
77
+ function parseConditionalStart(text) {
78
+ const normalized = text.trim();
79
+ if (!normalized.startsWith("#")) return;
80
+ const body = normalized.slice(1).trimStart();
81
+ for (const directive of ["ifndef", "ifdef"]) {
82
+ if (!body.startsWith(directive)) continue;
83
+ const expression = body.slice(directive.length).trim();
84
+ if (expression.length === 0) return;
85
+ return {
86
+ directive,
87
+ expression
88
+ };
89
+ }
90
+ }
91
+ function compileCssMacroConditionalComments(css, options) {
92
+ const platformTokens = createPlatformTokenSet(resolveCssMacroPlatform(options));
93
+ if (platformTokens.size === 0 || !css.includes("#if")) return css;
94
+ try {
95
+ const root = postcss.parse(css);
96
+ const transformContainer = (container) => {
97
+ const stack = [];
98
+ for (const node of [...container.nodes ?? []]) {
99
+ if (node.type === "comment") {
100
+ const start = parseConditionalStart(node.text);
101
+ if (start) {
102
+ const value = start.directive === "ifndef" ? negateConditionalValue(evaluatePlatformExpression(start.expression, platformTokens)) : evaluatePlatformExpression(start.expression, platformTokens);
103
+ const parentActive = getActiveConditionalValue(stack);
104
+ stack.push(value);
105
+ if (parentActive !== void 0 && value !== void 0) node.remove();
106
+ continue;
107
+ }
108
+ if (CONDITIONAL_END_RE.test(node.text)) {
109
+ const value = stack.pop();
110
+ if (getActiveConditionalValue(stack) !== void 0 && value !== void 0) node.remove();
111
+ continue;
112
+ }
113
+ }
114
+ if (getActiveConditionalValue(stack) === false) {
115
+ node.remove();
116
+ continue;
117
+ }
118
+ if ("nodes" in node && node.nodes) transformContainer(node);
119
+ }
120
+ };
121
+ transformContainer(root);
122
+ return root.toString();
123
+ } catch {
124
+ return css;
125
+ }
126
+ }
127
+ function markCssMacroPlugin(value) {
128
+ Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
129
+ configurable: false,
130
+ enumerable: false,
131
+ value: true
132
+ });
133
+ return value;
134
+ }
135
+ function isCssMacroTailwindPlugin(value) {
136
+ return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
137
+ }
138
+ function hasCssMacroTailwindPlugin(plugins) {
139
+ if (!plugins) return false;
140
+ if (Array.isArray(plugins)) return plugins.some(isCssMacroTailwindPlugin);
141
+ if (typeof plugins === "object") return Object.values(plugins).some(isCssMacroTailwindPlugin);
142
+ return false;
143
+ }
144
+ function parseCssPluginRequest(params) {
145
+ const value = params.trim();
146
+ const quoted = /^(['"])(.*?)\1/.exec(value);
147
+ if (quoted) return quoted[2];
148
+ const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
149
+ return url?.[2] ?? url?.[3];
150
+ }
151
+ function isCssMacroPluginRequest(request) {
152
+ return request === "weapp-tailwindcss/css-macro";
153
+ }
154
+ function hasCssMacroTailwindV4Directive(css) {
155
+ if (!css?.includes("css-macro")) return false;
156
+ try {
157
+ let found = false;
158
+ postcss.parse(css).walkAtRules("plugin", (rule) => {
159
+ if (isCssMacroPluginRequest(parseCssPluginRequest(rule.params))) found = true;
160
+ });
161
+ return found;
162
+ } catch {
163
+ return /@plugin\s+(?:url\(\s*)?["']weapp-tailwindcss\/css-macro["']/.test(css);
164
+ }
165
+ }
166
+ function isCssMacroPostcssPlugin(plugin) {
167
+ if (plugin === creator) return true;
168
+ return Boolean(plugin && (typeof plugin === "function" || typeof plugin === "object") && plugin.postcssPlugin === "postcss-weapp-tw-css-macro-plugin");
169
+ }
170
+ function withCssMacroPostcssPlugins(plugins) {
171
+ const macroPlugin = creator();
172
+ if (!plugins) return [macroPlugin];
173
+ if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
174
+ if (typeof plugins === "object") {
175
+ const values = Object.values(plugins).filter(Boolean);
176
+ if (values.some(isCssMacroPostcssPlugin)) return values;
177
+ return [...values, macroPlugin];
178
+ }
179
+ return [macroPlugin];
180
+ }
181
+ function withCssMacroStyleOptions(options) {
182
+ const postcssOptions = options?.postcssOptions;
183
+ return {
184
+ ...options,
185
+ [CSS_MACRO_STYLE_OPTIONS_MARKER]: true,
186
+ postcssOptions: {
187
+ ...postcssOptions,
188
+ plugins: withCssMacroPostcssPlugins(postcssOptions?.plugins)
189
+ }
190
+ };
191
+ }
192
+ function hasCssMacroStyleOptions(options) {
193
+ return Boolean(options?.[CSS_MACRO_STYLE_OPTIONS_MARKER]);
194
+ }
195
+ async function transformCssMacroCss(css, options) {
196
+ const result = (await postcss([creator()]).process(css, { from: void 0 })).css;
197
+ return compileCssMacroConditionalComments(result, options);
198
+ }
199
+ //#endregion
200
+ export { transformCssMacroCss as a, markCssMacroPlugin as i, hasCssMacroTailwindPlugin as n, withCssMacroStyleOptions as o, hasCssMacroTailwindV4Directive as r, hasCssMacroStyleOptions as t };
@@ -0,0 +1,238 @@
1
+ const require_chunk = require("./chunk-C5U5_Hdc.js");
2
+ const require_postcss = require("./postcss-CiYLsqZn.js");
3
+ let postcss = require("postcss");
4
+ postcss = require_chunk.__toESM(postcss);
5
+ let node_process = require("node:process");
6
+ node_process = require_chunk.__toESM(node_process);
7
+ //#region src/css-macro/auto.ts
8
+ const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
9
+ const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
10
+ const PLATFORM_ENV_KEYS = [
11
+ "WEAPP_TW_TARGET",
12
+ "WEAPP_TAILWINDCSS_TARGET",
13
+ "UNI_PLATFORM",
14
+ "UNI_UTS_PLATFORM",
15
+ "TARO_ENV",
16
+ "MPX_CLI_MODE",
17
+ "MPX_CURRENT_TARGET_MODE"
18
+ ];
19
+ const CONDITIONAL_END_RE = /^\s*#endif\s*$/;
20
+ function readEnvValue(key) {
21
+ return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
22
+ }
23
+ function normalizePlatformToken(value) {
24
+ return value?.trim().replaceAll("_", "-").toUpperCase() || void 0;
25
+ }
26
+ function resolveCssMacroPlatform(options) {
27
+ const explicit = normalizePlatformToken(options?.platform);
28
+ if (explicit) return explicit;
29
+ for (const key of PLATFORM_ENV_KEYS) {
30
+ const value = normalizePlatformToken(readEnvValue(key));
31
+ if (value) return value;
32
+ }
33
+ }
34
+ function createPlatformTokenSet(platform) {
35
+ const normalized = normalizePlatformToken(platform);
36
+ const tokens = /* @__PURE__ */ new Set();
37
+ if (!normalized) return tokens;
38
+ tokens.add(normalized);
39
+ if (normalized.startsWith("MP-")) tokens.add("MP");
40
+ if (normalized === "WEAPP" || normalized === "WEIXIN" || normalized === "WX") {
41
+ tokens.add("MP");
42
+ tokens.add("MP-WEIXIN");
43
+ }
44
+ if (normalized === "MP-WEIXIN") {
45
+ tokens.add("WEAPP");
46
+ tokens.add("WEIXIN");
47
+ tokens.add("WX");
48
+ }
49
+ if (normalized === "H5") tokens.add("WEB");
50
+ if (normalized === "WEB") tokens.add("H5");
51
+ if (normalized === "APP") tokens.add("APP-PLUS");
52
+ if (normalized.startsWith("APP-")) tokens.add("APP");
53
+ if (normalized.startsWith("QUICKAPP-WEBVIEW")) tokens.add("QUICKAPP-WEBVIEW");
54
+ return tokens;
55
+ }
56
+ function combineAnd(values) {
57
+ if (values.includes(false)) return false;
58
+ return values.every((value) => value === true) ? true : void 0;
59
+ }
60
+ function combineOr(values) {
61
+ if (values.includes(true)) return true;
62
+ return values.every((value) => value === false) ? false : void 0;
63
+ }
64
+ function evaluatePlatformExpression(expression, platformTokens) {
65
+ return combineOr(expression.split(/\s*\|\|\s*/).map((orPart) => {
66
+ return combineAnd(orPart.split(/\s*&&\s*/).map((part) => {
67
+ const token = normalizePlatformToken(part);
68
+ if (!token || /[<>=!()]/.test(token)) return;
69
+ return platformTokens.has(token);
70
+ }));
71
+ }));
72
+ }
73
+ function negateConditionalValue(value) {
74
+ return value === void 0 ? void 0 : !value;
75
+ }
76
+ function getActiveConditionalValue(stack) {
77
+ if (stack.includes(false)) return false;
78
+ return stack.includes(void 0) ? void 0 : true;
79
+ }
80
+ function parseConditionalStart(text) {
81
+ const normalized = text.trim();
82
+ if (!normalized.startsWith("#")) return;
83
+ const body = normalized.slice(1).trimStart();
84
+ for (const directive of ["ifndef", "ifdef"]) {
85
+ if (!body.startsWith(directive)) continue;
86
+ const expression = body.slice(directive.length).trim();
87
+ if (expression.length === 0) return;
88
+ return {
89
+ directive,
90
+ expression
91
+ };
92
+ }
93
+ }
94
+ function compileCssMacroConditionalComments(css, options) {
95
+ const platformTokens = createPlatformTokenSet(resolveCssMacroPlatform(options));
96
+ if (platformTokens.size === 0 || !css.includes("#if")) return css;
97
+ try {
98
+ const root = postcss.default.parse(css);
99
+ const transformContainer = (container) => {
100
+ const stack = [];
101
+ for (const node of [...container.nodes ?? []]) {
102
+ if (node.type === "comment") {
103
+ const start = parseConditionalStart(node.text);
104
+ if (start) {
105
+ const value = start.directive === "ifndef" ? negateConditionalValue(evaluatePlatformExpression(start.expression, platformTokens)) : evaluatePlatformExpression(start.expression, platformTokens);
106
+ const parentActive = getActiveConditionalValue(stack);
107
+ stack.push(value);
108
+ if (parentActive !== void 0 && value !== void 0) node.remove();
109
+ continue;
110
+ }
111
+ if (CONDITIONAL_END_RE.test(node.text)) {
112
+ const value = stack.pop();
113
+ if (getActiveConditionalValue(stack) !== void 0 && value !== void 0) node.remove();
114
+ continue;
115
+ }
116
+ }
117
+ if (getActiveConditionalValue(stack) === false) {
118
+ node.remove();
119
+ continue;
120
+ }
121
+ if ("nodes" in node && node.nodes) transformContainer(node);
122
+ }
123
+ };
124
+ transformContainer(root);
125
+ return root.toString();
126
+ } catch {
127
+ return css;
128
+ }
129
+ }
130
+ function markCssMacroPlugin(value) {
131
+ Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
132
+ configurable: false,
133
+ enumerable: false,
134
+ value: true
135
+ });
136
+ return value;
137
+ }
138
+ function isCssMacroTailwindPlugin(value) {
139
+ return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
140
+ }
141
+ function hasCssMacroTailwindPlugin(plugins) {
142
+ if (!plugins) return false;
143
+ if (Array.isArray(plugins)) return plugins.some(isCssMacroTailwindPlugin);
144
+ if (typeof plugins === "object") return Object.values(plugins).some(isCssMacroTailwindPlugin);
145
+ return false;
146
+ }
147
+ function parseCssPluginRequest(params) {
148
+ const value = params.trim();
149
+ const quoted = /^(['"])(.*?)\1/.exec(value);
150
+ if (quoted) return quoted[2];
151
+ const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
152
+ return url?.[2] ?? url?.[3];
153
+ }
154
+ function isCssMacroPluginRequest(request) {
155
+ return request === "weapp-tailwindcss/css-macro";
156
+ }
157
+ function hasCssMacroTailwindV4Directive(css) {
158
+ if (!css?.includes("css-macro")) return false;
159
+ try {
160
+ let found = false;
161
+ postcss.default.parse(css).walkAtRules("plugin", (rule) => {
162
+ if (isCssMacroPluginRequest(parseCssPluginRequest(rule.params))) found = true;
163
+ });
164
+ return found;
165
+ } catch {
166
+ return /@plugin\s+(?:url\(\s*)?["']weapp-tailwindcss\/css-macro["']/.test(css);
167
+ }
168
+ }
169
+ function isCssMacroPostcssPlugin(plugin) {
170
+ if (plugin === require_postcss.creator) return true;
171
+ return Boolean(plugin && (typeof plugin === "function" || typeof plugin === "object") && plugin.postcssPlugin === "postcss-weapp-tw-css-macro-plugin");
172
+ }
173
+ function withCssMacroPostcssPlugins(plugins) {
174
+ const macroPlugin = require_postcss.creator();
175
+ if (!plugins) return [macroPlugin];
176
+ if (Array.isArray(plugins)) return plugins.some(isCssMacroPostcssPlugin) ? plugins : [...plugins, macroPlugin];
177
+ if (typeof plugins === "object") {
178
+ const values = Object.values(plugins).filter(Boolean);
179
+ if (values.some(isCssMacroPostcssPlugin)) return values;
180
+ return [...values, macroPlugin];
181
+ }
182
+ return [macroPlugin];
183
+ }
184
+ function withCssMacroStyleOptions(options) {
185
+ const postcssOptions = options?.postcssOptions;
186
+ return {
187
+ ...options,
188
+ [CSS_MACRO_STYLE_OPTIONS_MARKER]: true,
189
+ postcssOptions: {
190
+ ...postcssOptions,
191
+ plugins: withCssMacroPostcssPlugins(postcssOptions?.plugins)
192
+ }
193
+ };
194
+ }
195
+ function hasCssMacroStyleOptions(options) {
196
+ return Boolean(options?.[CSS_MACRO_STYLE_OPTIONS_MARKER]);
197
+ }
198
+ async function transformCssMacroCss(css, options) {
199
+ const result = (await (0, postcss.default)([require_postcss.creator()]).process(css, { from: void 0 })).css;
200
+ return compileCssMacroConditionalComments(result, options);
201
+ }
202
+ //#endregion
203
+ Object.defineProperty(exports, "hasCssMacroStyleOptions", {
204
+ enumerable: true,
205
+ get: function() {
206
+ return hasCssMacroStyleOptions;
207
+ }
208
+ });
209
+ Object.defineProperty(exports, "hasCssMacroTailwindPlugin", {
210
+ enumerable: true,
211
+ get: function() {
212
+ return hasCssMacroTailwindPlugin;
213
+ }
214
+ });
215
+ Object.defineProperty(exports, "hasCssMacroTailwindV4Directive", {
216
+ enumerable: true,
217
+ get: function() {
218
+ return hasCssMacroTailwindV4Directive;
219
+ }
220
+ });
221
+ Object.defineProperty(exports, "markCssMacroPlugin", {
222
+ enumerable: true,
223
+ get: function() {
224
+ return markCssMacroPlugin;
225
+ }
226
+ });
227
+ Object.defineProperty(exports, "transformCssMacroCss", {
228
+ enumerable: true,
229
+ get: function() {
230
+ return transformCssMacroCss;
231
+ }
232
+ });
233
+ Object.defineProperty(exports, "withCssMacroStyleOptions", {
234
+ enumerable: true,
235
+ get: function() {
236
+ return withCssMacroStyleOptions;
237
+ }
238
+ });
@@ -1,10 +1,10 @@
1
1
  const require_chunk = require("./chunk-C5U5_Hdc.js");
2
- const require_precheck = require("./precheck-D7gJSmJz.js");
2
+ const require_precheck = require("./precheck-D_KT1pis.js");
3
3
  let node_module = require("node:module");
4
- let node_path = require("node:path");
5
- node_path = require_chunk.__toESM(node_path);
6
4
  let node_process = require("node:process");
7
5
  node_process = require_chunk.__toESM(node_process);
6
+ let node_path = require("node:path");
7
+ node_path = require_chunk.__toESM(node_path);
8
8
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
9
9
  let node_buffer = require("node:buffer");
10
10
  //#region src/bundlers/shared/module-graph.ts
@@ -1,7 +1,7 @@
1
- import { g as traverse, h as babelParse, o as Parser } from "./precheck-D7K12zeX.mjs";
1
+ import { g as traverse, h as babelParse, o as Parser } from "./precheck-mM9IVd1f.mjs";
2
2
  import { createRequire } from "node:module";
3
- import path from "node:path";
4
3
  import process from "node:process";
4
+ import path from "node:path";
5
5
  import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
6
6
  import { Buffer } from "node:buffer";
7
7
  //#region src/bundlers/shared/module-graph.ts
@@ -1,2 +1,2 @@
1
- export declare function collectUnescapedDynamicCandidates(source: string): string[];
1
+ export declare function collectUnescapedDynamicCandidates(source: string, allowedCandidates?: Set<string>): string[];
2
2
  export declare function collectLegacyContainerCompatCandidates(sourceCandidates: Set<string>, candidates: Set<string>): Set<string>;
@@ -14,6 +14,7 @@ interface GenerateBundleContext {
14
14
  ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
15
15
  allowBaselineOnlyInitialSync?: boolean | undefined;
16
16
  baseClassSet?: Set<string> | undefined;
17
+ transformOnly?: boolean | undefined;
17
18
  }) => Promise<Set<string>>;
18
19
  debug: (format: string, ...args: unknown[]) => void;
19
20
  getResolvedConfig: () => ResolvedConfig | undefined;
@@ -20,6 +20,7 @@ export declare function createViteRuntimeClassSet(options: CreateViteRuntimeClas
20
20
  ensureBundleRuntimeClassSet: (snapshot: BundleSnapshot, forceRefresh?: boolean, options?: {
21
21
  allowBaselineOnlyInitialSync?: boolean | undefined;
22
22
  baseClassSet?: Set<string> | undefined;
23
+ transformOnly?: boolean | undefined;
23
24
  }) => Promise<Set<string>>;
24
25
  };
25
26
  export {};
package/dist/cli.js CHANGED
@@ -49,7 +49,6 @@ let _babel_parser = require("@babel/parser");
49
49
  let magic_string = require("magic-string");
50
50
  magic_string = __toESM(magic_string);
51
51
  let _ast_core_escape = require("@ast-core/escape");
52
- let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
53
52
  require("@babel/types");
54
53
  //#region src/js/babel/cache-options.ts
55
54
  const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
@@ -1039,8 +1038,7 @@ function hasIgnoreComment(node) {
1039
1038
  }
1040
1039
  return false;
1041
1040
  }
1042
- function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1043
- const allowDoubleQuotes = arbitraryValues?.allowDoubleQuotes;
1041
+ function extractLiteralValue(path, { unescapeUnicode }) {
1044
1042
  const { node } = path;
1045
1043
  let offset = 0;
1046
1044
  let original;
@@ -1052,7 +1050,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1052
1050
  let literal = original;
1053
1051
  if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
1054
1052
  return {
1055
- allowDoubleQuotes,
1056
1053
  literal,
1057
1054
  offset,
1058
1055
  original
@@ -1106,8 +1103,8 @@ function replaceHandleValue(path, options) {
1106
1103
  const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
1107
1104
  if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
1108
1105
  if (hasIgnoreComment(path.node)) return;
1109
- const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path, options);
1110
- const candidates = (0, _weapp_tailwindcss_shared_extractors.splitCode)(literal, allowDoubleQuotes);
1106
+ const { literal, original, offset } = extractLiteralValue(path, options);
1107
+ const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
1111
1108
  if (candidates.length === 0) return;
1112
1109
  const debugEnabled = debug$1.enabled;
1113
1110
  const classContext = options.wrapExpression || isClassContextLiteralPath(path);
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import process from "node:process";
3
3
  import semver from "semver";
4
- import { createTailwindcssPatchCli } from "tailwindcss-patch";
4
+ import { createTailwindcssPatchCli, splitCandidateTokens } from "tailwindcss-patch";
5
5
  import path from "node:path";
6
6
  import { access, mkdir, writeFile } from "node:fs/promises";
7
7
  import { logger } from "@weapp-tailwindcss/logger";
@@ -20,7 +20,6 @@ import _babelTraverse from "@babel/traverse";
20
20
  import { parse } from "@babel/parser";
21
21
  import MagicString from "magic-string";
22
22
  import { jsStringEscape } from "@ast-core/escape";
23
- import { splitCode } from "@weapp-tailwindcss/shared/extractors";
24
23
  import "@babel/types";
25
24
  //#region src/js/babel/cache-options.ts
26
25
  const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
@@ -1010,8 +1009,7 @@ function hasIgnoreComment(node) {
1010
1009
  }
1011
1010
  return false;
1012
1011
  }
1013
- function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1014
- const allowDoubleQuotes = arbitraryValues?.allowDoubleQuotes;
1012
+ function extractLiteralValue(path, { unescapeUnicode }) {
1015
1013
  const { node } = path;
1016
1014
  let offset = 0;
1017
1015
  let original;
@@ -1023,7 +1021,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
1023
1021
  let literal = original;
1024
1022
  if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
1025
1023
  return {
1026
- allowDoubleQuotes,
1027
1024
  literal,
1028
1025
  offset,
1029
1026
  original
@@ -1077,8 +1074,8 @@ function replaceHandleValue(path, options) {
1077
1074
  const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
1078
1075
  if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
1079
1076
  if (hasIgnoreComment(path.node)) return;
1080
- const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path, options);
1081
- const candidates = splitCode(literal, allowDoubleQuotes);
1077
+ const { literal, original, offset } = extractLiteralValue(path, options);
1078
+ const candidates = splitCandidateTokens(literal);
1082
1079
  if (candidates.length === 0) return;
1083
1080
  const debugEnabled = debug.enabled;
1084
1081
  const classContext = options.wrapExpression || isClassContextLiteralPath(path);
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_precheck = require("./precheck-D7gJSmJz.js");
2
+ const require_precheck = require("./precheck-D_KT1pis.js");
3
3
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
4
4
  //#region src/core.ts
5
5
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
package/dist/core.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-D7K12zeX.mjs";
1
+ import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-mM9IVd1f.mjs";
2
2
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
3
3
  //#region src/core.ts
4
4
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
@@ -1,10 +1,11 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  export declare const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
3
3
  export declare const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
4
+ export declare function compileCssMacroConditionalComments(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): string;
4
5
  export declare function markCssMacroPlugin<T extends object>(value: T): T;
5
6
  export declare function isCssMacroTailwindPlugin(value: unknown): boolean;
6
7
  export declare function hasCssMacroTailwindPlugin(plugins: unknown): boolean;
7
8
  export declare function hasCssMacroTailwindV4Directive(css: string | undefined): boolean;
8
9
  export declare function withCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
9
10
  export declare function hasCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): boolean;
10
- export declare function transformCssMacroCss(css: string): Promise<string>;
11
+ export declare function transformCssMacroCss(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): Promise<string>;
package/dist/css-macro.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-C5U5_Hdc.js");
2
2
  const require_postcss = require("./postcss-CiYLsqZn.js");
3
- const require_auto = require("./auto-TH1jG2UW.js");
3
+ const require_auto = require("./auto-dPpsm6FB.js");
4
4
  require("./utils-D7Ygohep.js");
5
5
  let tailwindcss_plugin = require("tailwindcss/plugin");
6
6
  tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
@@ -1,5 +1,5 @@
1
1
  import { i as createNegativeConditionalAtRule, r as createConditionalAtRule } from "./postcss-C7BMYpEF.mjs";
2
- import { i as markCssMacroPlugin } from "./auto-XyKTOP7B.mjs";
2
+ import { i as markCssMacroPlugin } from "./auto-DEHRmEAx.mjs";
3
3
  import { t as defu } from "./utils-DsaS975I.mjs";
4
4
  import plugin from "tailwindcss/plugin";
5
5
  //#region src/css-macro/index.ts
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-C5U5_Hdc.js");
2
- const require_v3_engine = require("./v3-engine-CHItlVq5.js");
2
+ const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
3
3
  let node_process = require("node:process");
4
4
  node_process = require_chunk.__toESM(node_process);
5
5
  //#region src/generator/options.ts
@@ -1,4 +1,4 @@
1
- import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-DcvCCHfs.mjs";
1
+ import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-C_KeUQG3.mjs";
2
2
  import process from "node:process";
3
3
  //#region src/generator/options.ts
4
4
  const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
package/dist/generator.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_v3_engine = require("./v3-engine-CHItlVq5.js");
3
- const require_generator = require("./generator-CrU-Ghc1.js");
2
+ const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
3
+ const require_generator = require("./generator-BEXaaUzP.js");
4
4
  let tailwindcss_patch = require("tailwindcss-patch");
5
5
  exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
6
6
  exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
@@ -1,3 +1,3 @@
1
- import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-DcvCCHfs.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-Qw-tZ0Z2.mjs";
1
+ import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-C_KeUQG3.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-CpsHA4Wd.mjs";
3
3
  export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };