weapp-tailwindcss 5.0.7 → 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-BzwPS-UI.js → bundle-state-BwtEqxvU.js} +3 -3
  4. package/dist/{bundle-state-ChcOKb9w.mjs → bundle-state-CXzPknlT.mjs} +2 -2
  5. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +0 -2
  6. package/dist/cli.js +3 -159
  7. package/dist/cli.mjs +3 -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-6yF8wjxR.js → generator-ChgOWNOj.js} +1 -1
  17. package/dist/{generator-BON6M1bL.mjs → generator-h2XRiJ9-.mjs} +1 -1
  18. package/dist/generator.js +2 -2
  19. package/dist/generator.mjs +2 -2
  20. package/dist/{gulp-oE-Byqk6.mjs → gulp-Be88jhoY.mjs} +5 -5
  21. package/dist/{gulp-_7p1Z2vc.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-BKQNRxHr.js → hmr-timing-BkivBZvN.js} +41 -43
  25. package/dist/{hmr-timing-BVTGf5ch.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-CZjr87m_.mjs → precheck-BpHxsWRd.mjs} +4 -4
  32. package/dist/{precheck-fhIkzCSU.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-bbQUg25J.mjs → tailwindcss-Bfy2egdX.mjs} +2 -2
  37. package/dist/{tailwindcss-vswd1gc3.js → tailwindcss-DbbAKAZP.js} +3 -3
  38. package/dist/{transform-CReJxxh_.js → transform-Cd634UZV.js} +1 -1
  39. package/dist/{transform-DEsFlG9k.mjs → transform-r5evL6Hn.mjs} +1 -1
  40. package/dist/types/index.d.ts +1 -2
  41. package/dist/{v3-engine-CdIwmHuc.mjs → v3-engine-CFkP6dWF.mjs} +55 -19
  42. package/dist/{v3-engine-CEMXFegG.js → v3-engine-D0yA9ZkF.js} +86 -87
  43. package/dist/{vite-C7BGAlCE.mjs → vite-BM_iIFmS.mjs} +10 -411
  44. package/dist/{vite-0jFbh9hx.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 +111 -407
  49. package/dist/weapp-tw-runtime-classset-loader.js +2 -2
  50. package/dist/{webpack-aEuDoYfQ.js → webpack-CJAOcYEO.js} +16 -9
  51. package/dist/{webpack-Dx6_eg5k.mjs → webpack-DPdrcC2X.mjs} +15 -8
  52. package/dist/webpack.js +1 -1
  53. package/dist/webpack.mjs +1 -1
  54. package/package.json +5 -7
  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-BTIunhWl.js +0 -284
  64. package/dist/postcss-BtmrrZ31.mjs +0 -275
  65. package/dist/postcss-C7BMYpEF.mjs +0 -169
  66. package/dist/postcss-CiYLsqZn.js +0 -192
  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-fhIkzCSU.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-CZjr87m_.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
@@ -25,6 +25,7 @@ node_process = __toESM(node_process);
25
25
  let semver = require("semver");
26
26
  semver = __toESM(semver);
27
27
  let tailwindcss_patch = require("tailwindcss-patch");
28
+ tailwindcss_patch = __toESM(tailwindcss_patch);
28
29
  let node_path = require("node:path");
29
30
  node_path = __toESM(node_path);
30
31
  let node_fs_promises = require("node:fs/promises");
@@ -37,9 +38,8 @@ let debug = require("debug");
37
38
  debug = __toESM(debug);
38
39
  let node_fs = require("node:fs");
39
40
  node_fs = __toESM(node_fs);
40
- require("postcss");
41
- require("micromatch");
42
41
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
42
+ require("micromatch");
43
43
  let node_module = require("node:module");
44
44
  require("tailwindcss-config");
45
45
  require("fast-glob");
@@ -70,163 +70,6 @@ function createDebug(prefix) {
70
70
  return debug$4;
71
71
  }
72
72
  //#endregion
73
- //#region src/css-macro/constants.ts
74
- const queryKey = "weapp-tw-platform";
75
- const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
76
- const WHITESPACE_RE = /\s+/g;
77
- const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
78
- function normalComment(text) {
79
- if (typeof text === "string") {
80
- const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
81
- if (normalized.includes("\\")) return normalized;
82
- return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
83
- }
84
- return text;
85
- }
86
- function ifdef(text) {
87
- return {
88
- start: `#ifdef ${normalComment(text)}`,
89
- end: `#endif`
90
- };
91
- }
92
- function ifndef(text) {
93
- return {
94
- start: `#ifndef ${normalComment(text)}`,
95
- end: `#endif`
96
- };
97
- }
98
- const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
99
- function matchCustomPropertyFromValue(str, cb) {
100
- let index = 0;
101
- QUERY_KEY_REGEX.lastIndex = 0;
102
- let arr = QUERY_KEY_REGEX.exec(str);
103
- while (arr !== null) {
104
- cb(arr, index);
105
- index++;
106
- arr = QUERY_KEY_REGEX.exec(str);
107
- }
108
- }
109
- function parseConditionalAtRuleParam(params) {
110
- const value = params.trim();
111
- const quoted = /^(['"])((?:\\.|(?!\1).)*)\1/.exec(value);
112
- if (!quoted) return value;
113
- return quoted[2]?.replaceAll(/\\(["'\\])/g, "$1") ?? "";
114
- }
115
- //#endregion
116
- //#region src/css-macro/postcss.ts
117
- const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
118
- const CONDITIONAL_COMMENT_SPACING = " ";
119
- const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
120
- const creator = () => {
121
- return {
122
- postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
123
- prepare() {
124
- function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
125
- const hasPreviousNode = Boolean(atRule.prev());
126
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
127
- const startComment = helper.comment({
128
- raws: {
129
- left: CONDITIONAL_COMMENT_SPACING,
130
- right: CONDITIONAL_COMMENT_SPACING
131
- },
132
- text: comment.start
133
- });
134
- const endComment = helper.comment({
135
- raws: {
136
- left: CONDITIONAL_COMMENT_SPACING,
137
- right: CONDITIONAL_COMMENT_SPACING
138
- },
139
- text: comment.end
140
- });
141
- const nextNodes = [
142
- startComment,
143
- ...clonedNodes,
144
- endComment
145
- ];
146
- atRule.replaceWith(nextNodes);
147
- startComment.raws.before = hasPreviousNode ? "\n" : "";
148
- startComment.raws["after"] = "\n";
149
- if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
150
- endComment.raws.before = "\n";
151
- endComment.raws["after"] = "\n";
152
- const nextNode = endComment?.next();
153
- if (nextNode) nextNode.raws.before = "\n";
154
- }
155
- function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
156
- if (atRule.parent?.type !== "rule") return false;
157
- const parentRule = atRule.parent;
158
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
159
- const conditionalRule = parentRule.clone();
160
- conditionalRule.removeAll();
161
- conditionalRule.append(...clonedNodes);
162
- const startComment = helper.comment({
163
- raws: {
164
- left: CONDITIONAL_COMMENT_SPACING,
165
- right: CONDITIONAL_COMMENT_SPACING
166
- },
167
- text: comment.start
168
- });
169
- const endComment = helper.comment({
170
- raws: {
171
- left: CONDITIONAL_COMMENT_SPACING,
172
- right: CONDITIONAL_COMMENT_SPACING
173
- },
174
- text: comment.end
175
- });
176
- const nextNodes = [
177
- startComment,
178
- conditionalRule,
179
- endComment
180
- ];
181
- const hasPreviousNode = Boolean(parentRule.prev());
182
- atRule.remove();
183
- if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
184
- else parentRule.after(nextNodes);
185
- startComment.raws.before = hasPreviousNode ? "\n" : "";
186
- startComment.raws["after"] = "\n";
187
- conditionalRule.raws.before = "\n";
188
- endComment.raws.before = "\n";
189
- endComment.raws["after"] = "\n";
190
- const nextNode = endComment.next();
191
- if (nextNode) nextNode.raws.before = "\n";
192
- return true;
193
- }
194
- return {
195
- AtRule(atRule, helper) {
196
- if (atRule.name === "weapp-tw-ifdef" || atRule.name === "weapp-tw-ifndef") {
197
- const text = parseConditionalAtRuleParam(atRule.params);
198
- const comment = atRule.name === "weapp-tw-ifndef" ? ifndef(text) : ifdef(text);
199
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
200
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
201
- return;
202
- }
203
- if (atRule.name === "media") {
204
- const values = [];
205
- matchCustomPropertyFromValue(atRule.params, (arr) => {
206
- const value = arr[1];
207
- if (value) values.push(value);
208
- });
209
- if (values.length > 0) {
210
- const isNegative = atRule.params.includes("not");
211
- const text = values.join(" ");
212
- const comment = isNegative ? ifndef(text) : ifdef(text);
213
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
214
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
215
- }
216
- }
217
- },
218
- CommentExit(comment) {
219
- if (IFDEF_ENDIF_RE.test(comment.text)) {
220
- comment.raws.left = CONDITIONAL_COMMENT_SPACING;
221
- comment.raws.right = CONDITIONAL_COMMENT_SPACING;
222
- }
223
- }
224
- };
225
- }
226
- };
227
- };
228
- creator.postcss = true;
229
- //#endregion
230
73
  //#region src/utils/object.ts
231
74
  function definedEntries(value) {
232
75
  return Object.entries(value).filter(([, item]) => item !== void 0);
@@ -671,6 +514,7 @@ new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.rep
671
514
  isMainChunk: true,
672
515
  majorVersion: 3
673
516
  });
517
+ typeof tailwindcss_patch.generateTailwindV3RawStyle === "function" && tailwindcss_patch.generateTailwindV3RawStyle;
674
518
  [
675
519
  "@tailwind base;",
676
520
  "@tailwind components;",
package/dist/cli.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import process from "node:process";
3
3
  import semver from "semver";
4
+ import * as tailwindcssPatch from "tailwindcss-patch";
4
5
  import { createTailwindcssPatchCli, splitCandidateTokens } from "tailwindcss-patch";
5
6
  import path from "node:path";
6
7
  import { access, mkdir, writeFile } from "node:fs/promises";
@@ -11,9 +12,8 @@ import { MappingChars2String, escape } from "@weapp-core/escape";
11
12
  import "@weapp-tailwindcss/shared";
12
13
  import _createDebug from "debug";
13
14
  import { constants, existsSync, readFileSync } from "node:fs";
14
- import "postcss";
15
- import "micromatch";
16
15
  import { createStyleHandler } from "@weapp-tailwindcss/postcss";
16
+ import "micromatch";
17
17
  import "tailwindcss-config";
18
18
  import "fast-glob";
19
19
  import _babelTraverse from "@babel/traverse";
@@ -41,163 +41,6 @@ function createDebug(prefix) {
41
41
  return debug;
42
42
  }
43
43
  //#endregion
44
- //#region src/css-macro/constants.ts
45
- const queryKey = "weapp-tw-platform";
46
- const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
47
- const WHITESPACE_RE = /\s+/g;
48
- const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
49
- function normalComment(text) {
50
- if (typeof text === "string") {
51
- const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
52
- if (normalized.includes("\\")) return normalized;
53
- return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
54
- }
55
- return text;
56
- }
57
- function ifdef(text) {
58
- return {
59
- start: `#ifdef ${normalComment(text)}`,
60
- end: `#endif`
61
- };
62
- }
63
- function ifndef(text) {
64
- return {
65
- start: `#ifndef ${normalComment(text)}`,
66
- end: `#endif`
67
- };
68
- }
69
- const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
70
- function matchCustomPropertyFromValue(str, cb) {
71
- let index = 0;
72
- QUERY_KEY_REGEX.lastIndex = 0;
73
- let arr = QUERY_KEY_REGEX.exec(str);
74
- while (arr !== null) {
75
- cb(arr, index);
76
- index++;
77
- arr = QUERY_KEY_REGEX.exec(str);
78
- }
79
- }
80
- function parseConditionalAtRuleParam(params) {
81
- const value = params.trim();
82
- const quoted = /^(['"])((?:\\.|(?!\1).)*)\1/.exec(value);
83
- if (!quoted) return value;
84
- return quoted[2]?.replaceAll(/\\(["'\\])/g, "$1") ?? "";
85
- }
86
- //#endregion
87
- //#region src/css-macro/postcss.ts
88
- const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
89
- const CONDITIONAL_COMMENT_SPACING = " ";
90
- const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
91
- const creator = () => {
92
- return {
93
- postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
94
- prepare() {
95
- function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
96
- const hasPreviousNode = Boolean(atRule.prev());
97
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
98
- const startComment = helper.comment({
99
- raws: {
100
- left: CONDITIONAL_COMMENT_SPACING,
101
- right: CONDITIONAL_COMMENT_SPACING
102
- },
103
- text: comment.start
104
- });
105
- const endComment = helper.comment({
106
- raws: {
107
- left: CONDITIONAL_COMMENT_SPACING,
108
- right: CONDITIONAL_COMMENT_SPACING
109
- },
110
- text: comment.end
111
- });
112
- const nextNodes = [
113
- startComment,
114
- ...clonedNodes,
115
- endComment
116
- ];
117
- atRule.replaceWith(nextNodes);
118
- startComment.raws.before = hasPreviousNode ? "\n" : "";
119
- startComment.raws["after"] = "\n";
120
- if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
121
- endComment.raws.before = "\n";
122
- endComment.raws["after"] = "\n";
123
- const nextNode = endComment?.next();
124
- if (nextNode) nextNode.raws.before = "\n";
125
- }
126
- function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
127
- if (atRule.parent?.type !== "rule") return false;
128
- const parentRule = atRule.parent;
129
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
130
- const conditionalRule = parentRule.clone();
131
- conditionalRule.removeAll();
132
- conditionalRule.append(...clonedNodes);
133
- const startComment = helper.comment({
134
- raws: {
135
- left: CONDITIONAL_COMMENT_SPACING,
136
- right: CONDITIONAL_COMMENT_SPACING
137
- },
138
- text: comment.start
139
- });
140
- const endComment = helper.comment({
141
- raws: {
142
- left: CONDITIONAL_COMMENT_SPACING,
143
- right: CONDITIONAL_COMMENT_SPACING
144
- },
145
- text: comment.end
146
- });
147
- const nextNodes = [
148
- startComment,
149
- conditionalRule,
150
- endComment
151
- ];
152
- const hasPreviousNode = Boolean(parentRule.prev());
153
- atRule.remove();
154
- if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
155
- else parentRule.after(nextNodes);
156
- startComment.raws.before = hasPreviousNode ? "\n" : "";
157
- startComment.raws["after"] = "\n";
158
- conditionalRule.raws.before = "\n";
159
- endComment.raws.before = "\n";
160
- endComment.raws["after"] = "\n";
161
- const nextNode = endComment.next();
162
- if (nextNode) nextNode.raws.before = "\n";
163
- return true;
164
- }
165
- return {
166
- AtRule(atRule, helper) {
167
- if (atRule.name === "weapp-tw-ifdef" || atRule.name === "weapp-tw-ifndef") {
168
- const text = parseConditionalAtRuleParam(atRule.params);
169
- const comment = atRule.name === "weapp-tw-ifndef" ? ifndef(text) : ifdef(text);
170
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
171
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
172
- return;
173
- }
174
- if (atRule.name === "media") {
175
- const values = [];
176
- matchCustomPropertyFromValue(atRule.params, (arr) => {
177
- const value = arr[1];
178
- if (value) values.push(value);
179
- });
180
- if (values.length > 0) {
181
- const isNegative = atRule.params.includes("not");
182
- const text = values.join(" ");
183
- const comment = isNegative ? ifndef(text) : ifdef(text);
184
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
185
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
186
- }
187
- }
188
- },
189
- CommentExit(comment) {
190
- if (IFDEF_ENDIF_RE.test(comment.text)) {
191
- comment.raws.left = CONDITIONAL_COMMENT_SPACING;
192
- comment.raws.right = CONDITIONAL_COMMENT_SPACING;
193
- }
194
- }
195
- };
196
- }
197
- };
198
- };
199
- creator.postcss = true;
200
- //#endregion
201
44
  //#region src/utils/object.ts
202
45
  function definedEntries(value) {
203
46
  return Object.entries(value).filter(([, item]) => item !== void 0);
@@ -642,6 +485,7 @@ createStyleHandler({
642
485
  isMainChunk: true,
643
486
  majorVersion: 3
644
487
  });
488
+ typeof tailwindcssPatch.generateTailwindV3RawStyle === "function" && tailwindcssPatch.generateTailwindV3RawStyle;
645
489
  [
646
490
  "@tailwind base;",
647
491
  "@tailwind components;",
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_precheck = require("./precheck-fhIkzCSU.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-CZjr87m_.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-CEMXFegG.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-CdIwmHuc.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-CEMXFegG.js");
3
- const require_generator = require("./generator-6yF8wjxR.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-CdIwmHuc.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-BON6M1bL.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-CdIwmHuc.mjs";
2
- import { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-CZjr87m_.mjs";
3
- import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-bbQUg25J.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-BVTGf5ch.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