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
@@ -1,169 +0,0 @@
1
- //#region src/css-macro/constants.ts
2
- const queryKey = "weapp-tw-platform";
3
- const ifdefAtRule = "weapp-tw-ifdef";
4
- const ifndefAtRule = "weapp-tw-ifndef";
5
- function quoteAtRuleParam(value) {
6
- return `"${value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
7
- }
8
- function createConditionalAtRule(value) {
9
- return `@${ifdefAtRule} ${quoteAtRuleParam(value)}{&}`;
10
- }
11
- function createNegativeConditionalAtRule(value) {
12
- return `@${ifndefAtRule} ${quoteAtRuleParam(value)}{&}`;
13
- }
14
- const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
15
- const WHITESPACE_RE = /\s+/g;
16
- const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
17
- function normalComment(text) {
18
- if (typeof text === "string") {
19
- const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
20
- if (normalized.includes("\\")) return normalized;
21
- return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
22
- }
23
- return text;
24
- }
25
- function ifdef(text) {
26
- return {
27
- start: `#ifdef ${normalComment(text)}`,
28
- end: `#endif`
29
- };
30
- }
31
- function ifndef(text) {
32
- return {
33
- start: `#ifndef ${normalComment(text)}`,
34
- end: `#endif`
35
- };
36
- }
37
- const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
38
- function matchCustomPropertyFromValue(str, cb) {
39
- let index = 0;
40
- QUERY_KEY_REGEX.lastIndex = 0;
41
- let arr = QUERY_KEY_REGEX.exec(str);
42
- while (arr !== null) {
43
- cb(arr, index);
44
- index++;
45
- arr = QUERY_KEY_REGEX.exec(str);
46
- }
47
- }
48
- function parseConditionalAtRuleParam(params) {
49
- const value = params.trim();
50
- const quoted = /^(['"])((?:\\.|(?!\1).)*)\1/.exec(value);
51
- if (!quoted) return value;
52
- return quoted[2]?.replaceAll(/\\(["'\\])/g, "$1") ?? "";
53
- }
54
- //#endregion
55
- //#region src/css-macro/postcss.ts
56
- const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
57
- const CONDITIONAL_COMMENT_SPACING = " ";
58
- const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
59
- const creator = () => {
60
- return {
61
- postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
62
- prepare() {
63
- function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
64
- const hasPreviousNode = Boolean(atRule.prev());
65
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
66
- const startComment = helper.comment({
67
- raws: {
68
- left: CONDITIONAL_COMMENT_SPACING,
69
- right: CONDITIONAL_COMMENT_SPACING
70
- },
71
- text: comment.start
72
- });
73
- const endComment = helper.comment({
74
- raws: {
75
- left: CONDITIONAL_COMMENT_SPACING,
76
- right: CONDITIONAL_COMMENT_SPACING
77
- },
78
- text: comment.end
79
- });
80
- const nextNodes = [
81
- startComment,
82
- ...clonedNodes,
83
- endComment
84
- ];
85
- atRule.replaceWith(nextNodes);
86
- startComment.raws.before = hasPreviousNode ? "\n" : "";
87
- startComment.raws["after"] = "\n";
88
- if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
89
- endComment.raws.before = "\n";
90
- endComment.raws["after"] = "\n";
91
- const nextNode = endComment?.next();
92
- if (nextNode) nextNode.raws.before = "\n";
93
- }
94
- function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
95
- if (atRule.parent?.type !== "rule") return false;
96
- const parentRule = atRule.parent;
97
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
98
- const conditionalRule = parentRule.clone();
99
- conditionalRule.removeAll();
100
- conditionalRule.append(...clonedNodes);
101
- const startComment = helper.comment({
102
- raws: {
103
- left: CONDITIONAL_COMMENT_SPACING,
104
- right: CONDITIONAL_COMMENT_SPACING
105
- },
106
- text: comment.start
107
- });
108
- const endComment = helper.comment({
109
- raws: {
110
- left: CONDITIONAL_COMMENT_SPACING,
111
- right: CONDITIONAL_COMMENT_SPACING
112
- },
113
- text: comment.end
114
- });
115
- const nextNodes = [
116
- startComment,
117
- conditionalRule,
118
- endComment
119
- ];
120
- const hasPreviousNode = Boolean(parentRule.prev());
121
- atRule.remove();
122
- if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
123
- else parentRule.after(nextNodes);
124
- startComment.raws.before = hasPreviousNode ? "\n" : "";
125
- startComment.raws["after"] = "\n";
126
- conditionalRule.raws.before = "\n";
127
- endComment.raws.before = "\n";
128
- endComment.raws["after"] = "\n";
129
- const nextNode = endComment.next();
130
- if (nextNode) nextNode.raws.before = "\n";
131
- return true;
132
- }
133
- return {
134
- AtRule(atRule, helper) {
135
- if (atRule.name === "weapp-tw-ifdef" || atRule.name === "weapp-tw-ifndef") {
136
- const text = parseConditionalAtRuleParam(atRule.params);
137
- const comment = atRule.name === "weapp-tw-ifndef" ? ifndef(text) : ifdef(text);
138
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
139
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
140
- return;
141
- }
142
- if (atRule.name === "media") {
143
- const values = [];
144
- matchCustomPropertyFromValue(atRule.params, (arr) => {
145
- const value = arr[1];
146
- if (value) values.push(value);
147
- });
148
- if (values.length > 0) {
149
- const isNegative = atRule.params.includes("not");
150
- const text = values.join(" ");
151
- const comment = isNegative ? ifndef(text) : ifdef(text);
152
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
153
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
154
- }
155
- }
156
- },
157
- CommentExit(comment) {
158
- if (IFDEF_ENDIF_RE.test(comment.text)) {
159
- comment.raws.left = CONDITIONAL_COMMENT_SPACING;
160
- comment.raws.right = CONDITIONAL_COMMENT_SPACING;
161
- }
162
- }
163
- };
164
- }
165
- };
166
- };
167
- creator.postcss = true;
168
- //#endregion
169
- export { createNegativeConditionalAtRule as i, creator as n, createConditionalAtRule as r, CSS_MACRO_POSTCSS_PLUGIN_NAME as t };
@@ -1,192 +0,0 @@
1
- //#region src/css-macro/constants.ts
2
- const queryKey = "weapp-tw-platform";
3
- const ifdefAtRule = "weapp-tw-ifdef";
4
- const ifndefAtRule = "weapp-tw-ifndef";
5
- function quoteAtRuleParam(value) {
6
- return `"${value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
7
- }
8
- function createConditionalAtRule(value) {
9
- return `@${ifdefAtRule} ${quoteAtRuleParam(value)}{&}`;
10
- }
11
- function createNegativeConditionalAtRule(value) {
12
- return `@${ifndefAtRule} ${quoteAtRuleParam(value)}{&}`;
13
- }
14
- const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
15
- const WHITESPACE_RE = /\s+/g;
16
- const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
17
- function normalComment(text) {
18
- if (typeof text === "string") {
19
- const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
20
- if (normalized.includes("\\")) return normalized;
21
- return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
22
- }
23
- return text;
24
- }
25
- function ifdef(text) {
26
- return {
27
- start: `#ifdef ${normalComment(text)}`,
28
- end: `#endif`
29
- };
30
- }
31
- function ifndef(text) {
32
- return {
33
- start: `#ifndef ${normalComment(text)}`,
34
- end: `#endif`
35
- };
36
- }
37
- const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
38
- function matchCustomPropertyFromValue(str, cb) {
39
- let index = 0;
40
- QUERY_KEY_REGEX.lastIndex = 0;
41
- let arr = QUERY_KEY_REGEX.exec(str);
42
- while (arr !== null) {
43
- cb(arr, index);
44
- index++;
45
- arr = QUERY_KEY_REGEX.exec(str);
46
- }
47
- }
48
- function parseConditionalAtRuleParam(params) {
49
- const value = params.trim();
50
- const quoted = /^(['"])((?:\\.|(?!\1).)*)\1/.exec(value);
51
- if (!quoted) return value;
52
- return quoted[2]?.replaceAll(/\\(["'\\])/g, "$1") ?? "";
53
- }
54
- //#endregion
55
- //#region src/css-macro/postcss.ts
56
- const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
57
- const CONDITIONAL_COMMENT_SPACING = " ";
58
- const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
59
- const creator = () => {
60
- return {
61
- postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
62
- prepare() {
63
- function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
64
- const hasPreviousNode = Boolean(atRule.prev());
65
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
66
- const startComment = helper.comment({
67
- raws: {
68
- left: CONDITIONAL_COMMENT_SPACING,
69
- right: CONDITIONAL_COMMENT_SPACING
70
- },
71
- text: comment.start
72
- });
73
- const endComment = helper.comment({
74
- raws: {
75
- left: CONDITIONAL_COMMENT_SPACING,
76
- right: CONDITIONAL_COMMENT_SPACING
77
- },
78
- text: comment.end
79
- });
80
- const nextNodes = [
81
- startComment,
82
- ...clonedNodes,
83
- endComment
84
- ];
85
- atRule.replaceWith(nextNodes);
86
- startComment.raws.before = hasPreviousNode ? "\n" : "";
87
- startComment.raws["after"] = "\n";
88
- if (clonedNodes[0]) clonedNodes[0].raws.before = "\n";
89
- endComment.raws.before = "\n";
90
- endComment.raws["after"] = "\n";
91
- const nextNode = endComment?.next();
92
- if (nextNode) nextNode.raws.before = "\n";
93
- }
94
- function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
95
- if (atRule.parent?.type !== "rule") return false;
96
- const parentRule = atRule.parent;
97
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
98
- const conditionalRule = parentRule.clone();
99
- conditionalRule.removeAll();
100
- conditionalRule.append(...clonedNodes);
101
- const startComment = helper.comment({
102
- raws: {
103
- left: CONDITIONAL_COMMENT_SPACING,
104
- right: CONDITIONAL_COMMENT_SPACING
105
- },
106
- text: comment.start
107
- });
108
- const endComment = helper.comment({
109
- raws: {
110
- left: CONDITIONAL_COMMENT_SPACING,
111
- right: CONDITIONAL_COMMENT_SPACING
112
- },
113
- text: comment.end
114
- });
115
- const nextNodes = [
116
- startComment,
117
- conditionalRule,
118
- endComment
119
- ];
120
- const hasPreviousNode = Boolean(parentRule.prev());
121
- atRule.remove();
122
- if ((parentRule.nodes?.length ?? 0) === 0) parentRule.replaceWith(nextNodes);
123
- else parentRule.after(nextNodes);
124
- startComment.raws.before = hasPreviousNode ? "\n" : "";
125
- startComment.raws["after"] = "\n";
126
- conditionalRule.raws.before = "\n";
127
- endComment.raws.before = "\n";
128
- endComment.raws["after"] = "\n";
129
- const nextNode = endComment.next();
130
- if (nextNode) nextNode.raws.before = "\n";
131
- return true;
132
- }
133
- return {
134
- AtRule(atRule, helper) {
135
- if (atRule.name === "weapp-tw-ifdef" || atRule.name === "weapp-tw-ifndef") {
136
- const text = parseConditionalAtRuleParam(atRule.params);
137
- const comment = atRule.name === "weapp-tw-ifndef" ? ifndef(text) : ifdef(text);
138
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
139
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
140
- return;
141
- }
142
- if (atRule.name === "media") {
143
- const values = [];
144
- matchCustomPropertyFromValue(atRule.params, (arr) => {
145
- const value = arr[1];
146
- if (value) values.push(value);
147
- });
148
- if (values.length > 0) {
149
- const isNegative = atRule.params.includes("not");
150
- const text = values.join(" ");
151
- const comment = isNegative ? ifndef(text) : ifdef(text);
152
- if (replaceNestedAtRuleWithConditionalRule(atRule, helper, comment)) return;
153
- replaceAtRuleWithConditionalComments(atRule, helper, comment);
154
- }
155
- }
156
- },
157
- CommentExit(comment) {
158
- if (IFDEF_ENDIF_RE.test(comment.text)) {
159
- comment.raws.left = CONDITIONAL_COMMENT_SPACING;
160
- comment.raws.right = CONDITIONAL_COMMENT_SPACING;
161
- }
162
- }
163
- };
164
- }
165
- };
166
- };
167
- creator.postcss = true;
168
- //#endregion
169
- Object.defineProperty(exports, "CSS_MACRO_POSTCSS_PLUGIN_NAME", {
170
- enumerable: true,
171
- get: function() {
172
- return CSS_MACRO_POSTCSS_PLUGIN_NAME;
173
- }
174
- });
175
- Object.defineProperty(exports, "createConditionalAtRule", {
176
- enumerable: true,
177
- get: function() {
178
- return createConditionalAtRule;
179
- }
180
- });
181
- Object.defineProperty(exports, "createNegativeConditionalAtRule", {
182
- enumerable: true,
183
- get: function() {
184
- return createNegativeConditionalAtRule;
185
- }
186
- });
187
- Object.defineProperty(exports, "creator", {
188
- enumerable: true,
189
- get: function() {
190
- return creator;
191
- }
192
- });