weapp-tailwindcss 5.0.8 → 5.0.10

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 (67) hide show
  1. package/dist/auto-CTp6wE5a.js +33 -0
  2. package/dist/auto-Cl8_hsG6.mjs +22 -0
  3. package/dist/{bundle-state-cHwTyrOS.js → bundle-state-BwtEqxvU.js} +3 -3
  4. package/dist/{bundle-state-5FtFktJr.mjs → bundle-state-CXzPknlT.mjs} +2 -2
  5. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +0 -2
  6. package/dist/cli.js +1 -159
  7. package/dist/cli.mjs +1 -159
  8. package/dist/core.js +1 -1
  9. package/dist/core.mjs +1 -1
  10. package/dist/css-macro/auto.d.ts +1 -7
  11. package/dist/css-macro/postcss.d.ts +1 -6
  12. package/dist/css-macro/postcss.js +15 -3
  13. package/dist/css-macro/postcss.mjs +2 -2
  14. package/dist/css-macro.js +19 -5
  15. package/dist/css-macro.mjs +16 -2
  16. package/dist/{generator-C--TrAod.js → generator-ChgOWNOj.js} +1 -1
  17. package/dist/{generator-DnwUQOXB.mjs → generator-h2XRiJ9-.mjs} +1 -1
  18. package/dist/generator.js +2 -2
  19. package/dist/generator.mjs +2 -2
  20. package/dist/{gulp-B22YSGU_.mjs → gulp-Be88jhoY.mjs} +5 -5
  21. package/dist/{gulp-5Tan5bHG.js → gulp-CHtZF-oT.js} +6 -6
  22. package/dist/gulp.js +1 -1
  23. package/dist/gulp.mjs +1 -1
  24. package/dist/{hmr-timing-CscCNKb9.js → hmr-timing-BkivBZvN.js} +41 -43
  25. package/dist/{hmr-timing-DK-mine6.mjs → hmr-timing-Ct5w4hdM.mjs} +6 -7
  26. package/dist/index.js +6 -6
  27. package/dist/index.mjs +5 -5
  28. package/dist/postcss.d.ts +2 -13
  29. package/dist/postcss.js +14 -3
  30. package/dist/postcss.mjs +10 -1
  31. package/dist/{precheck-CcxTR7E_.mjs → precheck-BpHxsWRd.mjs} +4 -4
  32. package/dist/{precheck-B8y6tDvG.js → precheck-CY9oaH49.js} +5 -5
  33. package/dist/presets.js +4 -4
  34. package/dist/presets.mjs +3 -3
  35. package/dist/tailwindcss/source-scan/inline-source.d.ts +1 -1
  36. package/dist/{tailwindcss-0DaftXcU.mjs → tailwindcss-Bfy2egdX.mjs} +2 -2
  37. package/dist/{tailwindcss-DbZ4o4m_.js → tailwindcss-DbbAKAZP.js} +3 -3
  38. package/dist/{transform-DiW_u3eD.js → transform-Cd634UZV.js} +1 -1
  39. package/dist/{transform-DRyWUN5X.mjs → transform-r5evL6Hn.mjs} +1 -1
  40. package/dist/types/index.d.ts +1 -2
  41. package/dist/{v3-engine-ArQVHEau.mjs → v3-engine-CFkP6dWF.mjs} +4 -5
  42. package/dist/{v3-engine-DdlvXpID.js → v3-engine-D0yA9ZkF.js} +35 -73
  43. package/dist/{vite-_iUhzc4t.mjs → vite-BM_iIFmS.mjs} +10 -411
  44. package/dist/{vite-C_IUnDBy.js → vite-Bh-BNp5g.js} +27 -431
  45. package/dist/vite.js +1 -1
  46. package/dist/vite.mjs +1 -1
  47. package/dist/watch-dependencies-bpG6kmAf.js +80 -0
  48. package/dist/weapp-tw-css-import-rewrite-loader.js +60 -393
  49. package/dist/weapp-tw-runtime-classset-loader.js +2 -2
  50. package/dist/{webpack-KLoTb5Dr.js → webpack-CJAOcYEO.js} +8 -8
  51. package/dist/{webpack-CqnI4Ymw.mjs → webpack-DPdrcC2X.mjs} +7 -7
  52. package/dist/webpack.js +1 -1
  53. package/dist/webpack.mjs +1 -1
  54. package/package.json +2 -4
  55. package/dist/auto-Cvy0zWpS.js +0 -238
  56. package/dist/auto-DEHRmEAx.mjs +0 -200
  57. package/dist/bundlers/vite/postcss-config.d.ts +0 -6
  58. package/dist/bundlers/vite/processed-css-assets/css-rules.d.ts +0 -17
  59. package/dist/postcss/config-directive.d.ts +0 -1
  60. package/dist/postcss/context.d.ts +0 -9
  61. package/dist/postcss/source-files.d.ts +0 -8
  62. package/dist/postcss/tailwind-version.d.ts +0 -3
  63. package/dist/postcss-C7BMYpEF.mjs +0 -169
  64. package/dist/postcss-CiYLsqZn.js +0 -192
  65. package/dist/postcss-CjWuDZwL.mjs +0 -275
  66. package/dist/postcss-R5pDVHUy.js +0 -284
  67. package/dist/watch-dependencies-zwx4EhBn.js +0 -5535
@@ -0,0 +1,33 @@
1
+ require("@weapp-tailwindcss/postcss");
2
+ //#region src/css-macro/auto.ts
3
+ const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
4
+ function markCssMacroPlugin(value) {
5
+ Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
6
+ configurable: false,
7
+ enumerable: false,
8
+ value: true
9
+ });
10
+ return value;
11
+ }
12
+ function isCssMacroTailwindPlugin(value) {
13
+ return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
14
+ }
15
+ function hasCssMacroTailwindPlugin(plugins) {
16
+ if (!plugins) return false;
17
+ if (Array.isArray(plugins)) return plugins.some(isCssMacroTailwindPlugin);
18
+ if (typeof plugins === "object") return Object.values(plugins).some(isCssMacroTailwindPlugin);
19
+ return false;
20
+ }
21
+ //#endregion
22
+ Object.defineProperty(exports, "hasCssMacroTailwindPlugin", {
23
+ enumerable: true,
24
+ get: function() {
25
+ return hasCssMacroTailwindPlugin;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, "markCssMacroPlugin", {
29
+ enumerable: true,
30
+ get: function() {
31
+ return markCssMacroPlugin;
32
+ }
33
+ });
@@ -0,0 +1,22 @@
1
+ import { hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, transformCssMacroCss, withCssMacroStyleOptions } from "@weapp-tailwindcss/postcss";
2
+ //#region src/css-macro/auto.ts
3
+ const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
4
+ function markCssMacroPlugin(value) {
5
+ Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
6
+ configurable: false,
7
+ enumerable: false,
8
+ value: true
9
+ });
10
+ return value;
11
+ }
12
+ function isCssMacroTailwindPlugin(value) {
13
+ return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
14
+ }
15
+ function hasCssMacroTailwindPlugin(plugins) {
16
+ if (!plugins) return false;
17
+ if (Array.isArray(plugins)) return plugins.some(isCssMacroTailwindPlugin);
18
+ if (typeof plugins === "object") return Object.values(plugins).some(isCssMacroTailwindPlugin);
19
+ return false;
20
+ }
21
+ //#endregion
22
+ export { transformCssMacroCss as a, markCssMacroPlugin as i, hasCssMacroTailwindPlugin as n, withCssMacroStyleOptions as o, hasCssMacroTailwindV4Directive as r, hasCssMacroStyleOptions as t };
@@ -1,10 +1,10 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_precheck = require("./precheck-B8y6tDvG.js");
2
+ const require_precheck = require("./precheck-CY9oaH49.js");
3
3
  let node_module = require("node:module");
4
- let node_process = require("node:process");
5
- node_process = require_chunk.__toESM(node_process);
6
4
  let node_path = require("node:path");
7
5
  node_path = require_chunk.__toESM(node_path);
6
+ let node_process = require("node:process");
7
+ node_process = require_chunk.__toESM(node_process);
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 { h as traverse, m as babelParse, o as Parser } from "./precheck-CcxTR7E_.mjs";
1
+ import { h as traverse, m as babelParse, o as Parser } from "./precheck-BpHxsWRd.mjs";
2
2
  import { createRequire } from "node:module";
3
- import process from "node:process";
4
3
  import path from "node:path";
4
+ import process from "node:process";
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,5 +1,3 @@
1
1
  import type { Plugin } from 'vite';
2
- export declare function getPostcssPluginName(plugin: unknown): string | undefined;
3
- export declare function removeTailwindPostcssPlugins(plugins: unknown[]): number;
4
2
  export declare function removeTailwindVitePlugins(plugins: Plugin[]): number;
5
3
  export declare function disableAndRemoveTailwindVitePlugins(plugins: unknown[]): number;
package/dist/cli.js CHANGED
@@ -38,9 +38,8 @@ let debug = require("debug");
38
38
  debug = __toESM(debug);
39
39
  let node_fs = require("node:fs");
40
40
  node_fs = __toESM(node_fs);
41
- require("postcss");
42
- require("micromatch");
43
41
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
42
+ require("micromatch");
44
43
  let node_module = require("node:module");
45
44
  require("tailwindcss-config");
46
45
  require("fast-glob");
@@ -71,163 +70,6 @@ function createDebug(prefix) {
71
70
  return debug$4;
72
71
  }
73
72
  //#endregion
74
- //#region src/css-macro/constants.ts
75
- const queryKey = "weapp-tw-platform";
76
- const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
77
- const WHITESPACE_RE = /\s+/g;
78
- const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
79
- function normalComment(text) {
80
- if (typeof text === "string") {
81
- const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
82
- if (normalized.includes("\\")) return normalized;
83
- return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
84
- }
85
- return text;
86
- }
87
- function ifdef(text) {
88
- return {
89
- start: `#ifdef ${normalComment(text)}`,
90
- end: `#endif`
91
- };
92
- }
93
- function ifndef(text) {
94
- return {
95
- start: `#ifndef ${normalComment(text)}`,
96
- end: `#endif`
97
- };
98
- }
99
- const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
100
- function matchCustomPropertyFromValue(str, cb) {
101
- let index = 0;
102
- QUERY_KEY_REGEX.lastIndex = 0;
103
- let arr = QUERY_KEY_REGEX.exec(str);
104
- while (arr !== null) {
105
- cb(arr, index);
106
- index++;
107
- arr = QUERY_KEY_REGEX.exec(str);
108
- }
109
- }
110
- function parseConditionalAtRuleParam(params) {
111
- const value = params.trim();
112
- const quoted = /^(['"])((?:\\.|(?!\1).)*)\1/.exec(value);
113
- if (!quoted) return value;
114
- return quoted[2]?.replaceAll(/\\(["'\\])/g, "$1") ?? "";
115
- }
116
- //#endregion
117
- //#region src/css-macro/postcss.ts
118
- const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
119
- const CONDITIONAL_COMMENT_SPACING = " ";
120
- const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
121
- const creator = () => {
122
- return {
123
- postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
124
- prepare() {
125
- function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
126
- const hasPreviousNode = Boolean(atRule.prev());
127
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
128
- const startComment = helper.comment({
129
- raws: {
130
- left: CONDITIONAL_COMMENT_SPACING,
131
- right: CONDITIONAL_COMMENT_SPACING
132
- },
133
- text: comment.start
134
- });
135
- const endComment = helper.comment({
136
- raws: {
137
- left: CONDITIONAL_COMMENT_SPACING,
138
- right: CONDITIONAL_COMMENT_SPACING
139
- },
140
- text: comment.end
141
- });
142
- const nextNodes = [
143
- startComment,
144
- ...clonedNodes,
145
- endComment
146
- ];
147
- atRule.replaceWith(nextNodes);
148
- startComment.raws.before = hasPreviousNode ? "\n" : "";
149
- startComment.raws["after"] = "\n";
150
- if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
151
- endComment.raws.before = "\n";
152
- endComment.raws["after"] = "\n";
153
- const nextNode = endComment?.next();
154
- if (nextNode) nextNode.raws.before = "\n";
155
- }
156
- function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
157
- if (atRule.parent?.type !== "rule") return false;
158
- const parentRule = atRule.parent;
159
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
160
- const conditionalRule = parentRule.clone();
161
- conditionalRule.removeAll();
162
- conditionalRule.append(...clonedNodes);
163
- const startComment = helper.comment({
164
- raws: {
165
- left: CONDITIONAL_COMMENT_SPACING,
166
- right: CONDITIONAL_COMMENT_SPACING
167
- },
168
- text: comment.start
169
- });
170
- const endComment = helper.comment({
171
- raws: {
172
- left: CONDITIONAL_COMMENT_SPACING,
173
- right: CONDITIONAL_COMMENT_SPACING
174
- },
175
- text: comment.end
176
- });
177
- const nextNodes = [
178
- startComment,
179
- conditionalRule,
180
- endComment
181
- ];
182
- const hasPreviousNode = Boolean(parentRule.prev());
183
- atRule.remove();
184
- if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
185
- else parentRule.after(nextNodes);
186
- startComment.raws.before = hasPreviousNode ? "\n" : "";
187
- startComment.raws["after"] = "\n";
188
- conditionalRule.raws.before = "\n";
189
- endComment.raws.before = "\n";
190
- endComment.raws["after"] = "\n";
191
- const nextNode = endComment.next();
192
- if (nextNode) nextNode.raws.before = "\n";
193
- return true;
194
- }
195
- return {
196
- AtRule(atRule, helper) {
197
- if (atRule.name === "weapp-tw-ifdef" || atRule.name === "weapp-tw-ifndef") {
198
- const text = parseConditionalAtRuleParam(atRule.params);
199
- const comment = atRule.name === "weapp-tw-ifndef" ? ifndef(text) : ifdef(text);
200
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
201
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
202
- return;
203
- }
204
- if (atRule.name === "media") {
205
- const values = [];
206
- matchCustomPropertyFromValue(atRule.params, (arr) => {
207
- const value = arr[1];
208
- if (value) values.push(value);
209
- });
210
- if (values.length > 0) {
211
- const isNegative = atRule.params.includes("not");
212
- const text = values.join(" ");
213
- const comment = isNegative ? ifndef(text) : ifdef(text);
214
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
215
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
216
- }
217
- }
218
- },
219
- CommentExit(comment) {
220
- if (IFDEF_ENDIF_RE.test(comment.text)) {
221
- comment.raws.left = CONDITIONAL_COMMENT_SPACING;
222
- comment.raws.right = CONDITIONAL_COMMENT_SPACING;
223
- }
224
- }
225
- };
226
- }
227
- };
228
- };
229
- creator.postcss = true;
230
- //#endregion
231
73
  //#region src/utils/object.ts
232
74
  function definedEntries(value) {
233
75
  return Object.entries(value).filter(([, item]) => item !== void 0);
package/dist/cli.mjs CHANGED
@@ -12,9 +12,8 @@ import { MappingChars2String, escape } from "@weapp-core/escape";
12
12
  import "@weapp-tailwindcss/shared";
13
13
  import _createDebug from "debug";
14
14
  import { constants, existsSync, readFileSync } from "node:fs";
15
- import "postcss";
16
- import "micromatch";
17
15
  import { createStyleHandler } from "@weapp-tailwindcss/postcss";
16
+ import "micromatch";
18
17
  import "tailwindcss-config";
19
18
  import "fast-glob";
20
19
  import _babelTraverse from "@babel/traverse";
@@ -42,163 +41,6 @@ function createDebug(prefix) {
42
41
  return debug;
43
42
  }
44
43
  //#endregion
45
- //#region src/css-macro/constants.ts
46
- const queryKey = "weapp-tw-platform";
47
- const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
48
- const WHITESPACE_RE = /\s+/g;
49
- const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
50
- function normalComment(text) {
51
- if (typeof text === "string") {
52
- const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
53
- if (normalized.includes("\\")) return normalized;
54
- return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
55
- }
56
- return text;
57
- }
58
- function ifdef(text) {
59
- return {
60
- start: `#ifdef ${normalComment(text)}`,
61
- end: `#endif`
62
- };
63
- }
64
- function ifndef(text) {
65
- return {
66
- start: `#ifndef ${normalComment(text)}`,
67
- end: `#endif`
68
- };
69
- }
70
- const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
71
- function matchCustomPropertyFromValue(str, cb) {
72
- let index = 0;
73
- QUERY_KEY_REGEX.lastIndex = 0;
74
- let arr = QUERY_KEY_REGEX.exec(str);
75
- while (arr !== null) {
76
- cb(arr, index);
77
- index++;
78
- arr = QUERY_KEY_REGEX.exec(str);
79
- }
80
- }
81
- function parseConditionalAtRuleParam(params) {
82
- const value = params.trim();
83
- const quoted = /^(['"])((?:\\.|(?!\1).)*)\1/.exec(value);
84
- if (!quoted) return value;
85
- return quoted[2]?.replaceAll(/\\(["'\\])/g, "$1") ?? "";
86
- }
87
- //#endregion
88
- //#region src/css-macro/postcss.ts
89
- const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
90
- const CONDITIONAL_COMMENT_SPACING = " ";
91
- const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
92
- const creator = () => {
93
- return {
94
- postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
95
- prepare() {
96
- function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
97
- const hasPreviousNode = Boolean(atRule.prev());
98
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
99
- const startComment = helper.comment({
100
- raws: {
101
- left: CONDITIONAL_COMMENT_SPACING,
102
- right: CONDITIONAL_COMMENT_SPACING
103
- },
104
- text: comment.start
105
- });
106
- const endComment = helper.comment({
107
- raws: {
108
- left: CONDITIONAL_COMMENT_SPACING,
109
- right: CONDITIONAL_COMMENT_SPACING
110
- },
111
- text: comment.end
112
- });
113
- const nextNodes = [
114
- startComment,
115
- ...clonedNodes,
116
- endComment
117
- ];
118
- atRule.replaceWith(nextNodes);
119
- startComment.raws.before = hasPreviousNode ? "\n" : "";
120
- startComment.raws["after"] = "\n";
121
- if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
122
- endComment.raws.before = "\n";
123
- endComment.raws["after"] = "\n";
124
- const nextNode = endComment?.next();
125
- if (nextNode) nextNode.raws.before = "\n";
126
- }
127
- function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
128
- if (atRule.parent?.type !== "rule") return false;
129
- const parentRule = atRule.parent;
130
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
131
- const conditionalRule = parentRule.clone();
132
- conditionalRule.removeAll();
133
- conditionalRule.append(...clonedNodes);
134
- const startComment = helper.comment({
135
- raws: {
136
- left: CONDITIONAL_COMMENT_SPACING,
137
- right: CONDITIONAL_COMMENT_SPACING
138
- },
139
- text: comment.start
140
- });
141
- const endComment = helper.comment({
142
- raws: {
143
- left: CONDITIONAL_COMMENT_SPACING,
144
- right: CONDITIONAL_COMMENT_SPACING
145
- },
146
- text: comment.end
147
- });
148
- const nextNodes = [
149
- startComment,
150
- conditionalRule,
151
- endComment
152
- ];
153
- const hasPreviousNode = Boolean(parentRule.prev());
154
- atRule.remove();
155
- if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
156
- else parentRule.after(nextNodes);
157
- startComment.raws.before = hasPreviousNode ? "\n" : "";
158
- startComment.raws["after"] = "\n";
159
- conditionalRule.raws.before = "\n";
160
- endComment.raws.before = "\n";
161
- endComment.raws["after"] = "\n";
162
- const nextNode = endComment.next();
163
- if (nextNode) nextNode.raws.before = "\n";
164
- return true;
165
- }
166
- return {
167
- AtRule(atRule, helper) {
168
- if (atRule.name === "weapp-tw-ifdef" || atRule.name === "weapp-tw-ifndef") {
169
- const text = parseConditionalAtRuleParam(atRule.params);
170
- const comment = atRule.name === "weapp-tw-ifndef" ? ifndef(text) : ifdef(text);
171
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
172
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
173
- return;
174
- }
175
- if (atRule.name === "media") {
176
- const values = [];
177
- matchCustomPropertyFromValue(atRule.params, (arr) => {
178
- const value = arr[1];
179
- if (value) values.push(value);
180
- });
181
- if (values.length > 0) {
182
- const isNegative = atRule.params.includes("not");
183
- const text = values.join(" ");
184
- const comment = isNegative ? ifndef(text) : ifdef(text);
185
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
186
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
187
- }
188
- }
189
- },
190
- CommentExit(comment) {
191
- if (IFDEF_ENDIF_RE.test(comment.text)) {
192
- comment.raws.left = CONDITIONAL_COMMENT_SPACING;
193
- comment.raws.right = CONDITIONAL_COMMENT_SPACING;
194
- }
195
- }
196
- };
197
- }
198
- };
199
- };
200
- creator.postcss = true;
201
- //#endregion
202
44
  //#region src/utils/object.ts
203
45
  function definedEntries(value) {
204
46
  return Object.entries(value).filter(([, item]) => item !== void 0);
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_precheck = require("./precheck-B8y6tDvG.js");
2
+ const require_precheck = require("./precheck-CY9oaH49.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 { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-CcxTR7E_.mjs";
1
+ import { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-BpHxsWRd.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,11 +1,5 @@
1
- import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
1
+ export { compileCssMacroConditionalComments, CSS_MACRO_STYLE_OPTIONS_MARKER, hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, transformCssMacroCss, withCssMacroStyleOptions, } from '@weapp-tailwindcss/postcss';
2
2
  export declare const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
3
- export declare const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
4
- export declare function compileCssMacroConditionalComments(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): string;
5
3
  export declare function markCssMacroPlugin<T extends object>(value: T): T;
6
4
  export declare function isCssMacroTailwindPlugin(value: unknown): boolean;
7
5
  export declare function hasCssMacroTailwindPlugin(plugins: unknown): boolean;
8
- export declare function hasCssMacroTailwindV4Directive(css: string | undefined): boolean;
9
- export declare function withCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
10
- export declare function hasCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): boolean;
11
- export declare function transformCssMacroCss(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): Promise<string>;
@@ -1,6 +1 @@
1
- import type { PluginCreator } from 'postcss';
2
- export declare const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
3
- export interface Options {
4
- }
5
- declare const creator: PluginCreator<Options>;
6
- export default creator;
1
+ export { CSS_MACRO_POSTCSS_PLUGIN_NAME, default, type Options, } from '@weapp-tailwindcss/postcss/css-macro/postcss';
@@ -2,6 +2,18 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_postcss = require("../postcss-CiYLsqZn.js");
6
- exports.CSS_MACRO_POSTCSS_PLUGIN_NAME = require_postcss.CSS_MACRO_POSTCSS_PLUGIN_NAME;
7
- exports.default = require_postcss.creator;
5
+ const require_chunk = require("../chunk-emK7D4bc.js");
6
+ let _weapp_tailwindcss_postcss_css_macro_postcss = require("@weapp-tailwindcss/postcss/css-macro/postcss");
7
+ _weapp_tailwindcss_postcss_css_macro_postcss = require_chunk.__toESM(_weapp_tailwindcss_postcss_css_macro_postcss);
8
+ Object.defineProperty(exports, "CSS_MACRO_POSTCSS_PLUGIN_NAME", {
9
+ enumerable: true,
10
+ get: function() {
11
+ return _weapp_tailwindcss_postcss_css_macro_postcss.CSS_MACRO_POSTCSS_PLUGIN_NAME;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "default", {
15
+ enumerable: true,
16
+ get: function() {
17
+ return _weapp_tailwindcss_postcss_css_macro_postcss.default;
18
+ }
19
+ });
@@ -1,2 +1,2 @@
1
- import { n as creator, t as CSS_MACRO_POSTCSS_PLUGIN_NAME } from "../postcss-C7BMYpEF.mjs";
2
- export { CSS_MACRO_POSTCSS_PLUGIN_NAME, creator as default };
1
+ import postcss_default, { CSS_MACRO_POSTCSS_PLUGIN_NAME } from "@weapp-tailwindcss/postcss/css-macro/postcss";
2
+ export { CSS_MACRO_POSTCSS_PLUGIN_NAME, postcss_default as default };
package/dist/css-macro.js CHANGED
@@ -1,10 +1,24 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_postcss = require("./postcss-CiYLsqZn.js");
3
- const require_auto = require("./auto-Cvy0zWpS.js");
2
+ const require_auto = require("./auto-CTp6wE5a.js");
4
3
  require("./utils-Dolmt8EO.js");
5
4
  let tailwindcss_plugin = require("tailwindcss/plugin");
6
5
  tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
7
6
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
7
+ //#region src/css-macro/constants.ts
8
+ const queryKey = "weapp-tw-platform";
9
+ const ifdefAtRule = "weapp-tw-ifdef";
10
+ const ifndefAtRule = "weapp-tw-ifndef";
11
+ function quoteAtRuleParam(value) {
12
+ return `"${value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
13
+ }
14
+ function createConditionalAtRule(value) {
15
+ return `@${ifdefAtRule} ${quoteAtRuleParam(value)}{&}`;
16
+ }
17
+ function createNegativeConditionalAtRule(value) {
18
+ return `@${ifndefAtRule} ${quoteAtRuleParam(value)}{&}`;
19
+ }
20
+ new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
21
+ //#endregion
8
22
  //#region src/css-macro/index.ts
9
23
  const defaultOptions = {
10
24
  dynamic: true,
@@ -27,11 +41,11 @@ const cssMacroFactory = tailwindcss_plugin.default.withOptions((options) => {
27
41
  return (api) => {
28
42
  const { matchVariant, addVariant } = api;
29
43
  if (dynamic && typeof matchVariant === "function") {
30
- matchVariant("ifdef", (value) => require_postcss.createConditionalAtRule(value));
31
- matchVariant("ifndef", (value) => require_postcss.createNegativeConditionalAtRule(value));
44
+ matchVariant("ifdef", (value) => createConditionalAtRule(value));
45
+ matchVariant("ifndef", (value) => createNegativeConditionalAtRule(value));
32
46
  }
33
47
  if (typeof addVariant === "function") for (const variant of staticVariants) {
34
- const query = variant.negative ? require_postcss.createNegativeConditionalAtRule(variant.value) : require_postcss.createConditionalAtRule(variant.value);
48
+ const query = variant.negative ? createNegativeConditionalAtRule(variant.value) : createConditionalAtRule(variant.value);
35
49
  addVariant(variant.name, query);
36
50
  }
37
51
  };
@@ -1,7 +1,21 @@
1
- import { i as createNegativeConditionalAtRule, r as createConditionalAtRule } from "./postcss-C7BMYpEF.mjs";
2
- import { i as markCssMacroPlugin } from "./auto-DEHRmEAx.mjs";
1
+ import { i as markCssMacroPlugin } from "./auto-Cl8_hsG6.mjs";
3
2
  import { t as defu } from "./utils-DsaS975I.mjs";
4
3
  import plugin from "tailwindcss/plugin";
4
+ //#region src/css-macro/constants.ts
5
+ const queryKey = "weapp-tw-platform";
6
+ const ifdefAtRule = "weapp-tw-ifdef";
7
+ const ifndefAtRule = "weapp-tw-ifndef";
8
+ function quoteAtRuleParam(value) {
9
+ return `"${value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
10
+ }
11
+ function createConditionalAtRule(value) {
12
+ return `@${ifdefAtRule} ${quoteAtRuleParam(value)}{&}`;
13
+ }
14
+ function createNegativeConditionalAtRule(value) {
15
+ return `@${ifndefAtRule} ${quoteAtRuleParam(value)}{&}`;
16
+ }
17
+ new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
18
+ //#endregion
5
19
  //#region src/css-macro/index.ts
6
20
  const defaultOptions = {
7
21
  dynamic: true,
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_v3_engine = require("./v3-engine-DdlvXpID.js");
2
+ const require_v3_engine = require("./v3-engine-D0yA9ZkF.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 { K as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-ArQVHEau.mjs";
1
+ import { K as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-CFkP6dWF.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-DdlvXpID.js");
3
- const require_generator = require("./generator-C--TrAod.js");
2
+ const require_v3_engine = require("./v3-engine-D0yA9ZkF.js");
3
+ const require_generator = require("./generator-ChgOWNOj.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 { J as transformTailwindV4CssToWeapp, S as resolveTailwindV4SourceOptionsFromPatcher, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, q as transformTailwindV4CssByTarget, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-ArQVHEau.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-DnwUQOXB.mjs";
1
+ import { J as transformTailwindV4CssToWeapp, S as resolveTailwindV4SourceOptionsFromPatcher, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, q as transformTailwindV4CssByTarget, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-CFkP6dWF.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-h2XRiJ9-.mjs";
3
3
  export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
@@ -1,10 +1,10 @@
1
- import { D as normalizeTailwindConfigDirectives, T as hasTailwindRootDirectives, k as normalizeTailwindSourceForGenerator, l as getRuntimeClassSetSignature, lt as createDebug, m as resolveViteSourceScanEntries } from "./v3-engine-ArQVHEau.mjs";
2
- import { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-CcxTR7E_.mjs";
3
- import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-0DaftXcU.mjs";
4
- import { a as createTailwindV3DefaultExtractor, g as createCssTokenSourceMap, h as createCssSourceTraceCacheSignature, m as annotateCssSourceTrace, n as emitHmrTiming, o as createBundleRuntimeClassSetManager, r as createSourceCandidateCollector, s as generateCssByGenerator, v as processCachedTask } from "./hmr-timing-DK-mine6.mjs";
5
- import process from "node:process";
1
+ import { D as normalizeTailwindConfigDirectives, T as hasTailwindRootDirectives, k as normalizeTailwindSourceForGenerator, l as getRuntimeClassSetSignature, m as resolveViteSourceScanEntries, rt as createDebug } from "./v3-engine-CFkP6dWF.mjs";
2
+ import { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-BpHxsWRd.mjs";
3
+ import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-Bfy2egdX.mjs";
4
+ import { a as createTailwindV3DefaultExtractor, g as createCssTokenSourceMap, h as createCssSourceTraceCacheSignature, m as annotateCssSourceTrace, n as emitHmrTiming, o as createBundleRuntimeClassSetManager, r as createSourceCandidateCollector, s as generateCssByGenerator, v as processCachedTask } from "./hmr-timing-Ct5w4hdM.mjs";
6
5
  import fs from "node:fs";
7
6
  import path from "node:path";
7
+ import process from "node:process";
8
8
  import { Buffer } from "node:buffer";
9
9
  import stream from "node:stream";
10
10
  //#region src/bundlers/gulp/module-graph.ts
@@ -1,14 +1,14 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_v3_engine = require("./v3-engine-DdlvXpID.js");
3
- const require_precheck = require("./precheck-B8y6tDvG.js");
4
- const require_tailwindcss = require("./tailwindcss-DbZ4o4m_.js");
5
- const require_hmr_timing = require("./hmr-timing-CscCNKb9.js");
6
- let node_process = require("node:process");
7
- node_process = require_chunk.__toESM(node_process);
2
+ const require_v3_engine = require("./v3-engine-D0yA9ZkF.js");
3
+ const require_precheck = require("./precheck-CY9oaH49.js");
4
+ const require_tailwindcss = require("./tailwindcss-DbbAKAZP.js");
5
+ const require_hmr_timing = require("./hmr-timing-BkivBZvN.js");
8
6
  let node_fs = require("node:fs");
9
7
  node_fs = require_chunk.__toESM(node_fs);
10
8
  let node_path = require("node:path");
11
9
  node_path = require_chunk.__toESM(node_path);
10
+ let node_process = require("node:process");
11
+ node_process = require_chunk.__toESM(node_process);
12
12
  let node_buffer = require("node:buffer");
13
13
  let node_stream = require("node:stream");
14
14
  node_stream = require_chunk.__toESM(node_stream);
package/dist/gulp.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_gulp = require("./gulp-5Tan5bHG.js");
2
+ const require_gulp = require("./gulp-CHtZF-oT.js");
3
3
  exports.WeappTailwindcss = require_gulp.createPlugins;
4
4
  exports.createPlugins = require_gulp.createPlugins;
5
5
  exports.weappTailwindcss = require_gulp.createPlugins;