weapp-tailwindcss 5.0.0-next.8 → 5.0.0
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.
- package/README.md +2 -2
- package/dist/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/bundle-state-CnaJxkFY.mjs +413 -0
- package/dist/bundle-state-DgGEhk_z.js +529 -0
- package/dist/bundlers/shared/cache.d.ts +9 -7
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
- package/dist/bundlers/shared/css-imports.d.ts +3 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +12 -3
- package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +6 -2
- package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
- package/dist/bundlers/shared/style-requests.d.ts +2 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
- package/dist/bundlers/vite/index.d.ts +5 -2
- package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/bundlers/vite/source-candidates.d.ts +24 -2
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
- package/dist/cli/context.d.ts +1 -11
- package/dist/cli/doctor/types.d.ts +11 -11
- package/dist/cli/vscode-entry.d.ts +3 -3
- package/dist/cli.js +684 -41
- package/dist/cli.mjs +682 -40
- package/dist/context/runtime-package-replacements.d.ts +2 -0
- package/dist/context/style-options.d.ts +3 -0
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +1 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +11 -0
- package/dist/css-macro/constants.d.ts +5 -2
- package/dist/css-macro/postcss.d.ts +1 -0
- package/dist/css-macro/postcss.js +7 -46
- package/dist/css-macro/postcss.mjs +2 -46
- package/dist/css-macro.js +16 -7
- package/dist/css-macro.mjs +15 -6
- package/dist/defaults-8xrgzxFY.mjs +151 -0
- package/dist/defaults-zKUH2mDe.js +193 -0
- package/dist/defaults.js +6 -150
- package/dist/defaults.mjs +1 -143
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/options.d.ts +11 -6
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator--0-ekuVO.js +92 -0
- package/dist/generator-B76ovqsv.mjs +67 -0
- package/dist/generator.js +12 -12
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +163 -40
- package/dist/gulp.mjs +155 -32
- package/dist/incremental-runtime-class-set-CN6K_97P.js +2366 -0
- package/dist/incremental-runtime-class-set-x10M9bn_.mjs +2291 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -5
- package/dist/index.mjs +6 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/precheck.d.ts +2 -2
- package/dist/js/replacement-cache.d.ts +5 -0
- package/dist/postcss-C7BMYpEF.mjs +169 -0
- package/dist/{postcss-w48mGIhe.mjs → postcss-CR9UCaIK.mjs} +54 -114
- package/dist/postcss-CiYLsqZn.js +192 -0
- package/dist/{postcss-QIXwT40c.js → postcss-hYimKoN_.js} +60 -121
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/precheck-BrNwLG2e.mjs +4716 -0
- package/dist/precheck-DPtJjZmV.js +4842 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +27 -13
- package/dist/presets.mjs +25 -13
- package/dist/reset.js +1 -1
- package/dist/runtime-registry-DpcR3IHI.js +5496 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-DN1mihlU.mjs +322 -0
- package/dist/source-candidates-DSxme_O2.js +335 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -5
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/tailwindcss/runtime/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime.d.ts +9 -9
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/patcher.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
- package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-DWtPieNE.mjs} +72 -60
- package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-glCm_d3H.js} +81 -69
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +51 -41
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
- package/dist/types/user-defined-options/general.d.ts +25 -22
- package/dist/types/user-defined-options/important.d.ts +32 -27
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/unocss/index.d.ts +2 -0
- package/dist/utils/object.d.ts +9 -0
- package/dist/utils/options.d.ts +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
- package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
- package/dist/v3-engine-D3BMLVAN.js +3712 -0
- package/dist/v3-engine-DCxNPBVs.mjs +3417 -0
- package/dist/vite-DOprpdH-.mjs +24493 -0
- package/dist/vite-Ec0uX6kF.js +24507 -0
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5444 -22
- package/dist/weapp-tw-runtime-classset-loader.js +32 -9
- package/dist/{webpack-CNV2dx3Q.js → webpack-Ccohlg3A.js} +341 -96
- package/dist/{webpack-CT6EEENx.mjs → webpack-DFlZcqAU.mjs} +323 -79
- package/dist/webpack.d.ts +1 -3
- package/dist/webpack.js +3 -4
- package/dist/webpack.mjs +2 -2
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
- package/package.json +22 -20
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
- package/dist/cache-BVAiJV3J.js +0 -502
- package/dist/cache-CHs4DXui.mjs +0 -434
- package/dist/constants-BoB_6lFw.js +0 -73
- package/dist/constants-E_loJC49.mjs +0 -44
- package/dist/generator-DKkhJbOg.js +0 -1531
- package/dist/generator-UBmfduYg.mjs +0 -1432
- package/dist/generator-css-BIapP56i.mjs +0 -1323
- package/dist/generator-css-Mksw8PgB.js +0 -1362
- package/dist/lightningcss/index.d.ts +0 -8
- package/dist/lightningcss/style-handler/options.d.ts +0 -3
- package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
- package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
- package/dist/lightningcss/style-handler.d.ts +0 -17
- package/dist/precheck-B32p-gLI.js +0 -2736
- package/dist/precheck-B4RH6ZNN.mjs +0 -2622
- package/dist/run-tasks-B50A3pxt.js +0 -128
- package/dist/run-tasks-DdNi-hkk.mjs +0 -91
- package/dist/runtime-patch-CwN5ya72.mjs +0 -71
- package/dist/runtime-patch-D6mBo_KB.js +0 -85
- package/dist/vite-BwgRVgxH.mjs +0 -2405
- package/dist/vite-DyZuiyap.js +0 -2418
- /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
- /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
package/dist/cli.js
CHANGED
|
@@ -30,24 +30,30 @@ node_path = __toESM(node_path);
|
|
|
30
30
|
let node_fs_promises = require("node:fs/promises");
|
|
31
31
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
32
32
|
let lru_cache = require("lru-cache");
|
|
33
|
-
require("@weapp-tailwindcss/shared/node");
|
|
33
|
+
let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
|
|
34
34
|
let _weapp_core_escape = require("@weapp-core/escape");
|
|
35
35
|
require("@weapp-tailwindcss/shared");
|
|
36
36
|
let debug = require("debug");
|
|
37
37
|
debug = __toESM(debug);
|
|
38
|
-
let node_module = require("node:module");
|
|
39
38
|
let node_fs = require("node:fs");
|
|
40
|
-
|
|
39
|
+
node_fs = __toESM(node_fs);
|
|
40
|
+
require("postcss");
|
|
41
|
+
require("micromatch");
|
|
42
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
43
|
+
let node_module = require("node:module");
|
|
44
|
+
require("fast-glob");
|
|
45
|
+
require("tailwindcss-config");
|
|
41
46
|
let _babel_traverse = require("@babel/traverse");
|
|
42
47
|
_babel_traverse = __toESM(_babel_traverse);
|
|
43
48
|
let _babel_parser = require("@babel/parser");
|
|
44
|
-
let _weapp_core_regex = require("@weapp-core/regex");
|
|
45
49
|
let magic_string = require("magic-string");
|
|
46
50
|
magic_string = __toESM(magic_string);
|
|
47
51
|
let _ast_core_escape = require("@ast-core/escape");
|
|
48
|
-
let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
|
|
49
52
|
require("@babel/types");
|
|
50
|
-
|
|
53
|
+
//#region src/js/babel/cache-options.ts
|
|
54
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
55
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
56
|
+
//#endregion
|
|
51
57
|
//#region src/debug/index.ts
|
|
52
58
|
const _debug = (0, debug.default)("weapp-tw");
|
|
53
59
|
function createDebug(prefix) {
|
|
@@ -63,6 +69,612 @@ function createDebug(prefix) {
|
|
|
63
69
|
});
|
|
64
70
|
return debug$4;
|
|
65
71
|
}
|
|
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
|
+
//#region src/tailwindcss/source-scan.ts
|
|
231
|
+
const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
|
|
232
|
+
"html",
|
|
233
|
+
"wxml",
|
|
234
|
+
"axml",
|
|
235
|
+
"jxml",
|
|
236
|
+
"ksml",
|
|
237
|
+
"ttml",
|
|
238
|
+
"qml",
|
|
239
|
+
"tyml",
|
|
240
|
+
"xhsml",
|
|
241
|
+
"swan",
|
|
242
|
+
"vue",
|
|
243
|
+
"mpx",
|
|
244
|
+
"js",
|
|
245
|
+
"jsx",
|
|
246
|
+
"ts",
|
|
247
|
+
"tsx"
|
|
248
|
+
];
|
|
249
|
+
const FULL_SOURCE_SCAN_EXTENSIONS = [
|
|
250
|
+
"js",
|
|
251
|
+
"jsx",
|
|
252
|
+
"mjs",
|
|
253
|
+
"cjs",
|
|
254
|
+
"ts",
|
|
255
|
+
"tsx",
|
|
256
|
+
"mts",
|
|
257
|
+
"cts",
|
|
258
|
+
"vue",
|
|
259
|
+
"uvue",
|
|
260
|
+
"nvue",
|
|
261
|
+
"svelte",
|
|
262
|
+
"mpx",
|
|
263
|
+
"html",
|
|
264
|
+
"wxml",
|
|
265
|
+
"axml",
|
|
266
|
+
"jxml",
|
|
267
|
+
"ksml",
|
|
268
|
+
"ttml",
|
|
269
|
+
"qml",
|
|
270
|
+
"tyml",
|
|
271
|
+
"xhsml",
|
|
272
|
+
"swan",
|
|
273
|
+
"css",
|
|
274
|
+
"wxss",
|
|
275
|
+
"acss",
|
|
276
|
+
"jxss",
|
|
277
|
+
"ttss",
|
|
278
|
+
"qss",
|
|
279
|
+
"tyss",
|
|
280
|
+
"scss",
|
|
281
|
+
"sass",
|
|
282
|
+
"less",
|
|
283
|
+
"styl",
|
|
284
|
+
"stylus"
|
|
285
|
+
];
|
|
286
|
+
function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
|
|
287
|
+
return `**/*.{${extensions.join(",")}}`;
|
|
288
|
+
}
|
|
289
|
+
createSourceScanPattern(FULL_SOURCE_SCAN_EXTENSIONS);
|
|
290
|
+
new RegExp(`\\.(?:${FULL_SOURCE_SCAN_EXTENSIONS.map((extension) => extension.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/utils/object.ts
|
|
293
|
+
function definedEntries(value) {
|
|
294
|
+
return Object.entries(value).filter(([, item]) => item !== void 0);
|
|
295
|
+
}
|
|
296
|
+
function omitUndefined(value) {
|
|
297
|
+
return Object.fromEntries(definedEntries(value));
|
|
298
|
+
}
|
|
299
|
+
(0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
300
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
301
|
+
cssRemoveHoverPseudoClass: true,
|
|
302
|
+
isMainChunk: true,
|
|
303
|
+
majorVersion: 4
|
|
304
|
+
});
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
|
|
307
|
+
const TAILWIND_V3_COLOR_STEPS = [
|
|
308
|
+
"50",
|
|
309
|
+
"100",
|
|
310
|
+
"200",
|
|
311
|
+
"300",
|
|
312
|
+
"400",
|
|
313
|
+
"500",
|
|
314
|
+
"600",
|
|
315
|
+
"700",
|
|
316
|
+
"800",
|
|
317
|
+
"900",
|
|
318
|
+
"950"
|
|
319
|
+
];
|
|
320
|
+
const TAILWIND_V3_COLOR_PALETTE = {
|
|
321
|
+
slate: [
|
|
322
|
+
"#f8fafc",
|
|
323
|
+
"#f1f5f9",
|
|
324
|
+
"#e2e8f0",
|
|
325
|
+
"#cbd5e1",
|
|
326
|
+
"#94a3b8",
|
|
327
|
+
"#64748b",
|
|
328
|
+
"#475569",
|
|
329
|
+
"#334155",
|
|
330
|
+
"#1e293b",
|
|
331
|
+
"#0f172a",
|
|
332
|
+
"#020617"
|
|
333
|
+
],
|
|
334
|
+
gray: [
|
|
335
|
+
"#f9fafb",
|
|
336
|
+
"#f3f4f6",
|
|
337
|
+
"#e5e7eb",
|
|
338
|
+
"#d1d5db",
|
|
339
|
+
"#9ca3af",
|
|
340
|
+
"#6b7280",
|
|
341
|
+
"#4b5563",
|
|
342
|
+
"#374151",
|
|
343
|
+
"#1f2937",
|
|
344
|
+
"#111827",
|
|
345
|
+
"#030712"
|
|
346
|
+
],
|
|
347
|
+
zinc: [
|
|
348
|
+
"#fafafa",
|
|
349
|
+
"#f4f4f5",
|
|
350
|
+
"#e4e4e7",
|
|
351
|
+
"#d4d4d8",
|
|
352
|
+
"#a1a1aa",
|
|
353
|
+
"#71717a",
|
|
354
|
+
"#52525b",
|
|
355
|
+
"#3f3f46",
|
|
356
|
+
"#27272a",
|
|
357
|
+
"#18181b",
|
|
358
|
+
"#09090b"
|
|
359
|
+
],
|
|
360
|
+
neutral: [
|
|
361
|
+
"#fafafa",
|
|
362
|
+
"#f5f5f5",
|
|
363
|
+
"#e5e5e5",
|
|
364
|
+
"#d4d4d4",
|
|
365
|
+
"#a3a3a3",
|
|
366
|
+
"#737373",
|
|
367
|
+
"#525252",
|
|
368
|
+
"#404040",
|
|
369
|
+
"#262626",
|
|
370
|
+
"#171717",
|
|
371
|
+
"#0a0a0a"
|
|
372
|
+
],
|
|
373
|
+
stone: [
|
|
374
|
+
"#fafaf9",
|
|
375
|
+
"#f5f5f4",
|
|
376
|
+
"#e7e5e4",
|
|
377
|
+
"#d6d3d1",
|
|
378
|
+
"#a8a29e",
|
|
379
|
+
"#78716c",
|
|
380
|
+
"#57534e",
|
|
381
|
+
"#44403c",
|
|
382
|
+
"#292524",
|
|
383
|
+
"#1c1917",
|
|
384
|
+
"#0c0a09"
|
|
385
|
+
],
|
|
386
|
+
red: [
|
|
387
|
+
"#fef2f2",
|
|
388
|
+
"#fee2e2",
|
|
389
|
+
"#fecaca",
|
|
390
|
+
"#fca5a5",
|
|
391
|
+
"#f87171",
|
|
392
|
+
"#ef4444",
|
|
393
|
+
"#dc2626",
|
|
394
|
+
"#b91c1c",
|
|
395
|
+
"#991b1b",
|
|
396
|
+
"#7f1d1d",
|
|
397
|
+
"#450a0a"
|
|
398
|
+
],
|
|
399
|
+
orange: [
|
|
400
|
+
"#fff7ed",
|
|
401
|
+
"#ffedd5",
|
|
402
|
+
"#fed7aa",
|
|
403
|
+
"#fdba74",
|
|
404
|
+
"#fb923c",
|
|
405
|
+
"#f97316",
|
|
406
|
+
"#ea580c",
|
|
407
|
+
"#c2410c",
|
|
408
|
+
"#9a3412",
|
|
409
|
+
"#7c2d12",
|
|
410
|
+
"#431407"
|
|
411
|
+
],
|
|
412
|
+
amber: [
|
|
413
|
+
"#fffbeb",
|
|
414
|
+
"#fef3c7",
|
|
415
|
+
"#fde68a",
|
|
416
|
+
"#fcd34d",
|
|
417
|
+
"#fbbf24",
|
|
418
|
+
"#f59e0b",
|
|
419
|
+
"#d97706",
|
|
420
|
+
"#b45309",
|
|
421
|
+
"#92400e",
|
|
422
|
+
"#78350f",
|
|
423
|
+
"#451a03"
|
|
424
|
+
],
|
|
425
|
+
yellow: [
|
|
426
|
+
"#fefce8",
|
|
427
|
+
"#fef9c3",
|
|
428
|
+
"#fef08a",
|
|
429
|
+
"#fde047",
|
|
430
|
+
"#facc15",
|
|
431
|
+
"#eab308",
|
|
432
|
+
"#ca8a04",
|
|
433
|
+
"#a16207",
|
|
434
|
+
"#854d0e",
|
|
435
|
+
"#713f12",
|
|
436
|
+
"#422006"
|
|
437
|
+
],
|
|
438
|
+
lime: [
|
|
439
|
+
"#f7fee7",
|
|
440
|
+
"#ecfccb",
|
|
441
|
+
"#d9f99d",
|
|
442
|
+
"#bef264",
|
|
443
|
+
"#a3e635",
|
|
444
|
+
"#84cc16",
|
|
445
|
+
"#65a30d",
|
|
446
|
+
"#4d7c0f",
|
|
447
|
+
"#3f6212",
|
|
448
|
+
"#365314",
|
|
449
|
+
"#1a2e05"
|
|
450
|
+
],
|
|
451
|
+
green: [
|
|
452
|
+
"#f0fdf4",
|
|
453
|
+
"#dcfce7",
|
|
454
|
+
"#bbf7d0",
|
|
455
|
+
"#86efac",
|
|
456
|
+
"#4ade80",
|
|
457
|
+
"#22c55e",
|
|
458
|
+
"#16a34a",
|
|
459
|
+
"#15803d",
|
|
460
|
+
"#166534",
|
|
461
|
+
"#14532d",
|
|
462
|
+
"#052e16"
|
|
463
|
+
],
|
|
464
|
+
emerald: [
|
|
465
|
+
"#ecfdf5",
|
|
466
|
+
"#d1fae5",
|
|
467
|
+
"#a7f3d0",
|
|
468
|
+
"#6ee7b7",
|
|
469
|
+
"#34d399",
|
|
470
|
+
"#10b981",
|
|
471
|
+
"#059669",
|
|
472
|
+
"#047857",
|
|
473
|
+
"#065f46",
|
|
474
|
+
"#064e3b",
|
|
475
|
+
"#022c22"
|
|
476
|
+
],
|
|
477
|
+
teal: [
|
|
478
|
+
"#f0fdfa",
|
|
479
|
+
"#ccfbf1",
|
|
480
|
+
"#99f6e4",
|
|
481
|
+
"#5eead4",
|
|
482
|
+
"#2dd4bf",
|
|
483
|
+
"#14b8a6",
|
|
484
|
+
"#0d9488",
|
|
485
|
+
"#0f766e",
|
|
486
|
+
"#115e59",
|
|
487
|
+
"#134e4a",
|
|
488
|
+
"#042f2e"
|
|
489
|
+
],
|
|
490
|
+
cyan: [
|
|
491
|
+
"#ecfeff",
|
|
492
|
+
"#cffafe",
|
|
493
|
+
"#a5f3fc",
|
|
494
|
+
"#67e8f9",
|
|
495
|
+
"#22d3ee",
|
|
496
|
+
"#06b6d4",
|
|
497
|
+
"#0891b2",
|
|
498
|
+
"#0e7490",
|
|
499
|
+
"#155e75",
|
|
500
|
+
"#164e63",
|
|
501
|
+
"#083344"
|
|
502
|
+
],
|
|
503
|
+
sky: [
|
|
504
|
+
"#f0f9ff",
|
|
505
|
+
"#e0f2fe",
|
|
506
|
+
"#bae6fd",
|
|
507
|
+
"#7dd3fc",
|
|
508
|
+
"#38bdf8",
|
|
509
|
+
"#0ea5e9",
|
|
510
|
+
"#0284c7",
|
|
511
|
+
"#0369a1",
|
|
512
|
+
"#075985",
|
|
513
|
+
"#0c4a6e",
|
|
514
|
+
"#082f49"
|
|
515
|
+
],
|
|
516
|
+
blue: [
|
|
517
|
+
"#eff6ff",
|
|
518
|
+
"#dbeafe",
|
|
519
|
+
"#bfdbfe",
|
|
520
|
+
"#93c5fd",
|
|
521
|
+
"#60a5fa",
|
|
522
|
+
"#3b82f6",
|
|
523
|
+
"#2563eb",
|
|
524
|
+
"#1d4ed8",
|
|
525
|
+
"#1e40af",
|
|
526
|
+
"#1e3a8a",
|
|
527
|
+
"#172554"
|
|
528
|
+
],
|
|
529
|
+
indigo: [
|
|
530
|
+
"#eef2ff",
|
|
531
|
+
"#e0e7ff",
|
|
532
|
+
"#c7d2fe",
|
|
533
|
+
"#a5b4fc",
|
|
534
|
+
"#818cf8",
|
|
535
|
+
"#6366f1",
|
|
536
|
+
"#4f46e5",
|
|
537
|
+
"#4338ca",
|
|
538
|
+
"#3730a3",
|
|
539
|
+
"#312e81",
|
|
540
|
+
"#1e1b4b"
|
|
541
|
+
],
|
|
542
|
+
violet: [
|
|
543
|
+
"#f5f3ff",
|
|
544
|
+
"#ede9fe",
|
|
545
|
+
"#ddd6fe",
|
|
546
|
+
"#c4b5fd",
|
|
547
|
+
"#a78bfa",
|
|
548
|
+
"#8b5cf6",
|
|
549
|
+
"#7c3aed",
|
|
550
|
+
"#6d28d9",
|
|
551
|
+
"#5b21b6",
|
|
552
|
+
"#4c1d95",
|
|
553
|
+
"#2e1065"
|
|
554
|
+
],
|
|
555
|
+
purple: [
|
|
556
|
+
"#faf5ff",
|
|
557
|
+
"#f3e8ff",
|
|
558
|
+
"#e9d5ff",
|
|
559
|
+
"#d8b4fe",
|
|
560
|
+
"#c084fc",
|
|
561
|
+
"#a855f7",
|
|
562
|
+
"#9333ea",
|
|
563
|
+
"#7e22ce",
|
|
564
|
+
"#6b21a8",
|
|
565
|
+
"#581c87",
|
|
566
|
+
"#3b0764"
|
|
567
|
+
],
|
|
568
|
+
fuchsia: [
|
|
569
|
+
"#fdf4ff",
|
|
570
|
+
"#fae8ff",
|
|
571
|
+
"#f5d0fe",
|
|
572
|
+
"#f0abfc",
|
|
573
|
+
"#e879f9",
|
|
574
|
+
"#d946ef",
|
|
575
|
+
"#c026d3",
|
|
576
|
+
"#a21caf",
|
|
577
|
+
"#86198f",
|
|
578
|
+
"#701a75",
|
|
579
|
+
"#4a044e"
|
|
580
|
+
],
|
|
581
|
+
pink: [
|
|
582
|
+
"#fdf2f8",
|
|
583
|
+
"#fce7f3",
|
|
584
|
+
"#fbcfe8",
|
|
585
|
+
"#f9a8d4",
|
|
586
|
+
"#f472b6",
|
|
587
|
+
"#ec4899",
|
|
588
|
+
"#db2777",
|
|
589
|
+
"#be185d",
|
|
590
|
+
"#9d174d",
|
|
591
|
+
"#831843",
|
|
592
|
+
"#500724"
|
|
593
|
+
],
|
|
594
|
+
rose: [
|
|
595
|
+
"#fff1f2",
|
|
596
|
+
"#ffe4e6",
|
|
597
|
+
"#fecdd3",
|
|
598
|
+
"#fda4af",
|
|
599
|
+
"#fb7185",
|
|
600
|
+
"#f43f5e",
|
|
601
|
+
"#e11d48",
|
|
602
|
+
"#be123c",
|
|
603
|
+
"#9f1239",
|
|
604
|
+
"#881337",
|
|
605
|
+
"#4c0519"
|
|
606
|
+
]
|
|
607
|
+
};
|
|
608
|
+
function createTailwindV3DefaultColorThemeCss() {
|
|
609
|
+
const declarations = [" --color-black: #000;", " --color-white: #fff;"];
|
|
610
|
+
for (const [color, values] of Object.entries(TAILWIND_V3_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V3_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V3_COLOR_STEPS[index]}: ${values[index]};`);
|
|
611
|
+
return [
|
|
612
|
+
"@theme {",
|
|
613
|
+
...declarations,
|
|
614
|
+
"}"
|
|
615
|
+
].join("\n");
|
|
616
|
+
}
|
|
617
|
+
[
|
|
618
|
+
"@theme {",
|
|
619
|
+
" --default-ring-width: 3px;",
|
|
620
|
+
" --default-ring-color: var(--color-blue-500, #3b82f6);",
|
|
621
|
+
" --default-outline-width: 3px;",
|
|
622
|
+
"",
|
|
623
|
+
" --shadow-xs: 0 1px rgb(0 0 0 / 0.05);",
|
|
624
|
+
" --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);",
|
|
625
|
+
" --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
|
|
626
|
+
" --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);",
|
|
627
|
+
" --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);",
|
|
628
|
+
" --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);",
|
|
629
|
+
"",
|
|
630
|
+
" --blur-xs: 4px;",
|
|
631
|
+
" --blur-sm: 4px;",
|
|
632
|
+
" --blur: 8px;",
|
|
633
|
+
" --backdrop-blur-xs: 4px;",
|
|
634
|
+
" --backdrop-blur-sm: 4px;",
|
|
635
|
+
" --backdrop-blur: 8px;",
|
|
636
|
+
"",
|
|
637
|
+
" --radius-xs: 0.125rem;",
|
|
638
|
+
" --radius-sm: 0.125rem;",
|
|
639
|
+
" --radius: 0.25rem;",
|
|
640
|
+
"}",
|
|
641
|
+
createTailwindV3DefaultColorThemeCss()
|
|
642
|
+
].join("\n");
|
|
643
|
+
[
|
|
644
|
+
"*,",
|
|
645
|
+
"::after,",
|
|
646
|
+
"::before,",
|
|
647
|
+
"::backdrop,",
|
|
648
|
+
"::file-selector-button {",
|
|
649
|
+
" border-color: var(--color-gray-200, currentcolor);",
|
|
650
|
+
"}",
|
|
651
|
+
"",
|
|
652
|
+
"input::placeholder,",
|
|
653
|
+
"textarea::placeholder {",
|
|
654
|
+
" opacity: 1;",
|
|
655
|
+
" color: var(--color-gray-400, currentcolor);",
|
|
656
|
+
"}",
|
|
657
|
+
"",
|
|
658
|
+
"button:not(:disabled),",
|
|
659
|
+
"[role=\"button\"]:not(:disabled) {",
|
|
660
|
+
" cursor: pointer;",
|
|
661
|
+
"}",
|
|
662
|
+
"",
|
|
663
|
+
"dialog {",
|
|
664
|
+
" margin: auto;",
|
|
665
|
+
"}"
|
|
666
|
+
].join("\n");
|
|
667
|
+
(0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
668
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
669
|
+
cssRemoveHoverPseudoClass: true,
|
|
670
|
+
isMainChunk: true,
|
|
671
|
+
majorVersion: 3
|
|
672
|
+
});
|
|
673
|
+
[
|
|
674
|
+
"@tailwind base;",
|
|
675
|
+
"@tailwind components;",
|
|
676
|
+
"@tailwind utilities;"
|
|
677
|
+
].join("\n");
|
|
66
678
|
createDebug("[tailwindcss:runtime-patch] ");
|
|
67
679
|
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
68
680
|
createDebug("[tailwindcss:runtime] ");
|
|
@@ -75,15 +687,18 @@ runtimeLogDedupeHolder.__WEAPP_TW_RUNTIME_LOG_DEDUPE__ ?? (runtimeLogDedupeHolde
|
|
|
75
687
|
const globalCacheHolder = globalThis;
|
|
76
688
|
globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ ?? (globalCacheHolder.__WEAPP_TW_COMPILER_CONTEXT_CACHE__ = /* @__PURE__ */ new Map());
|
|
77
689
|
//#endregion
|
|
78
|
-
//#region src/constants.ts
|
|
79
|
-
const WEAPP_TW_REQUIRED_NODE_VERSION_RANGE = "^20.19.0 || >=22.12.0";
|
|
80
|
-
//#endregion
|
|
81
690
|
//#region src/babel/index.ts
|
|
82
691
|
function _interopDefaultCompat(e) {
|
|
83
692
|
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
84
693
|
}
|
|
85
694
|
const traverse = _interopDefaultCompat(_babel_traverse.default);
|
|
86
695
|
//#endregion
|
|
696
|
+
//#region src/utils/regex.ts
|
|
697
|
+
function escapeStringRegexp(str) {
|
|
698
|
+
if (typeof str !== "string") throw new TypeError("Expected a string");
|
|
699
|
+
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
|
|
700
|
+
}
|
|
701
|
+
//#endregion
|
|
87
702
|
//#region src/utils/nameMatcher.ts
|
|
88
703
|
const NEVER_MATCH_NAME$1 = () => false;
|
|
89
704
|
const GLOBAL_FLAG_REGEXP = /g/g;
|
|
@@ -91,10 +706,11 @@ function buildFuzzyMatcher(fuzzyStrings) {
|
|
|
91
706
|
if (fuzzyStrings.length === 0) return;
|
|
92
707
|
if (fuzzyStrings.length === 1) {
|
|
93
708
|
const [needle] = fuzzyStrings;
|
|
709
|
+
if (needle === void 0) return;
|
|
94
710
|
return (value) => value.includes(needle);
|
|
95
711
|
}
|
|
96
712
|
const unique = [...new Set(fuzzyStrings)];
|
|
97
|
-
const pattern = new RegExp(unique.map(
|
|
713
|
+
const pattern = new RegExp(unique.map(escapeStringRegexp).join("|"));
|
|
98
714
|
return (value) => pattern.test(value);
|
|
99
715
|
}
|
|
100
716
|
function normaliseRegex(regex) {
|
|
@@ -114,11 +730,13 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
114
730
|
const exactStringCount = exactStrings?.size ?? 0;
|
|
115
731
|
if (exactStringCount === 1 && regexList.length === 0) {
|
|
116
732
|
const [needle] = exactStrings;
|
|
733
|
+
if (needle === void 0) return NEVER_MATCH_NAME$1;
|
|
117
734
|
return (value) => value === needle;
|
|
118
735
|
}
|
|
119
736
|
if (regexList.length === 0) return (value) => exactStrings.has(value);
|
|
120
737
|
if (exactStringCount === 0 && regexList.length === 1) {
|
|
121
738
|
const [regex] = regexList;
|
|
739
|
+
if (!regex) return NEVER_MATCH_NAME$1;
|
|
122
740
|
return (value) => regex.test(value);
|
|
123
741
|
}
|
|
124
742
|
return (value) => {
|
|
@@ -131,6 +749,7 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
131
749
|
if (fuzzyMatcher && !hasRegex) return fuzzyMatcher;
|
|
132
750
|
if (!fuzzyMatcher && regexList.length === 1) {
|
|
133
751
|
const [regex] = regexList;
|
|
752
|
+
if (!regex) return NEVER_MATCH_NAME$1;
|
|
134
753
|
return (value) => regex.test(value);
|
|
135
754
|
}
|
|
136
755
|
return (value) => {
|
|
@@ -141,20 +760,40 @@ function createNameMatcher(list, { exact = false } = {}) {
|
|
|
141
760
|
}
|
|
142
761
|
//#endregion
|
|
143
762
|
//#region src/js/babel/parse.ts
|
|
144
|
-
const parseCache = new lru_cache.LRUCache({ max:
|
|
763
|
+
const parseCache = new lru_cache.LRUCache({ max: HARD_PARSE_CACHE_MAX_ENTRIES });
|
|
145
764
|
function genCacheKey(source, options) {
|
|
146
|
-
if (typeof options === "string") return source
|
|
147
|
-
return source
|
|
765
|
+
if (typeof options === "string") return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${options}`;
|
|
766
|
+
return `${(0, _weapp_tailwindcss_shared_node.md5)(source)}:${JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val)}`;
|
|
767
|
+
}
|
|
768
|
+
function normalizeCacheMaxEntries(value) {
|
|
769
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 128;
|
|
770
|
+
return Math.min(Math.max(Math.floor(value), 0), HARD_PARSE_CACHE_MAX_ENTRIES);
|
|
771
|
+
}
|
|
772
|
+
function normalizeCacheMaxSourceLength(value) {
|
|
773
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
|
|
774
|
+
return Math.max(Math.floor(value), 0);
|
|
775
|
+
}
|
|
776
|
+
function trimParseCache(maxEntries) {
|
|
777
|
+
while (parseCache.size > maxEntries) parseCache.pop();
|
|
148
778
|
}
|
|
149
779
|
function babelParse(code, opts = {}) {
|
|
150
|
-
const { cache, cacheKey, ...rest } = opts;
|
|
151
|
-
const
|
|
780
|
+
const { cache, cacheKey, cacheMaxEntries, cacheMaxSourceLength, ...rest } = opts;
|
|
781
|
+
const maxEntries = normalizeCacheMaxEntries(cacheMaxEntries);
|
|
782
|
+
const maxSourceLength = normalizeCacheMaxSourceLength(cacheMaxSourceLength);
|
|
783
|
+
const shouldCache = cache === true && maxEntries > 0 && code.length <= maxSourceLength;
|
|
784
|
+
const cacheKeyString = shouldCache ? genCacheKey(code, cacheKey ?? rest) : void 0;
|
|
152
785
|
let result;
|
|
153
|
-
if (
|
|
786
|
+
if (shouldCache) {
|
|
787
|
+
trimParseCache(maxEntries);
|
|
788
|
+
result = parseCache.get(cacheKeyString);
|
|
789
|
+
}
|
|
154
790
|
if (!result) {
|
|
155
|
-
const { cache: _cache, cacheKey: _cacheKey, ...parseOptions } = opts;
|
|
791
|
+
const { cache: _cache, cacheKey: _cacheKey, cacheMaxEntries: _cacheMaxEntries, cacheMaxSourceLength: _cacheMaxSourceLength, ...parseOptions } = opts;
|
|
156
792
|
result = (0, _babel_parser.parse)(code, parseOptions);
|
|
157
|
-
if (
|
|
793
|
+
if (shouldCache) {
|
|
794
|
+
parseCache.set(cacheKeyString, result);
|
|
795
|
+
trimParseCache(maxEntries);
|
|
796
|
+
}
|
|
158
797
|
}
|
|
159
798
|
return result;
|
|
160
799
|
}
|
|
@@ -168,10 +807,10 @@ function replaceWxml(original, options = {
|
|
|
168
807
|
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
169
808
|
let res = original;
|
|
170
809
|
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
|
|
171
|
-
res = (0, _weapp_core_escape.escape)(res, {
|
|
810
|
+
res = (0, _weapp_core_escape.escape)(res, omitUndefined({
|
|
172
811
|
map: escapeMap,
|
|
173
812
|
ignoreHead
|
|
174
|
-
});
|
|
813
|
+
}));
|
|
175
814
|
return res;
|
|
176
815
|
}
|
|
177
816
|
//#endregion
|
|
@@ -367,12 +1006,9 @@ function isClassContextLiteralPath(path) {
|
|
|
367
1006
|
return false;
|
|
368
1007
|
}
|
|
369
1008
|
//#endregion
|
|
370
|
-
//#region src/js/
|
|
371
|
-
const debug$1 = createDebug("[js:handlers] ");
|
|
1009
|
+
//#region src/js/replacement-cache.ts
|
|
372
1010
|
const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
|
|
373
1011
|
const defaultReplacementCache = /* @__PURE__ */ new Map();
|
|
374
|
-
const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
|
|
375
|
-
const IGNORE_MARKER = "ignore";
|
|
376
1012
|
function getReplacementCacheStore(escapeMap) {
|
|
377
1013
|
if (!escapeMap) return defaultReplacementCache;
|
|
378
1014
|
let store = replacementCacheByEscapeMap.get(escapeMap);
|
|
@@ -390,6 +1026,11 @@ function getReplacement(candidate, escapeMap, store = getReplacementCacheStore(e
|
|
|
390
1026
|
}
|
|
391
1027
|
return cached;
|
|
392
1028
|
}
|
|
1029
|
+
//#endregion
|
|
1030
|
+
//#region src/js/handlers.ts
|
|
1031
|
+
const debug$1 = createDebug("[js:handlers] ");
|
|
1032
|
+
const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
|
|
1033
|
+
const IGNORE_MARKER = "ignore";
|
|
393
1034
|
function hasIgnoreComment(node) {
|
|
394
1035
|
const { leadingComments } = node;
|
|
395
1036
|
if (!Array.isArray(leadingComments) || leadingComments.length === 0) return false;
|
|
@@ -399,8 +1040,7 @@ function hasIgnoreComment(node) {
|
|
|
399
1040
|
}
|
|
400
1041
|
return false;
|
|
401
1042
|
}
|
|
402
|
-
function extractLiteralValue(path, { unescapeUnicode
|
|
403
|
-
const allowDoubleQuotes = arbitraryValues?.allowDoubleQuotes;
|
|
1043
|
+
function extractLiteralValue(path, { unescapeUnicode }) {
|
|
404
1044
|
const { node } = path;
|
|
405
1045
|
let offset = 0;
|
|
406
1046
|
let original;
|
|
@@ -412,7 +1052,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
|
|
|
412
1052
|
let literal = original;
|
|
413
1053
|
if (unescapeUnicode && original.includes("\\u")) literal = decodeUnicode2(original);
|
|
414
1054
|
return {
|
|
415
|
-
allowDoubleQuotes,
|
|
416
1055
|
literal,
|
|
417
1056
|
offset,
|
|
418
1057
|
original
|
|
@@ -466,8 +1105,8 @@ function replaceHandleValue(path, options) {
|
|
|
466
1105
|
const fallbackEnabled = shouldEnableArbitraryValueFallback(options);
|
|
467
1106
|
if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
|
|
468
1107
|
if (hasIgnoreComment(path.node)) return;
|
|
469
|
-
const { literal, original,
|
|
470
|
-
const candidates = (0,
|
|
1108
|
+
const { literal, original, offset } = extractLiteralValue(path, options);
|
|
1109
|
+
const candidates = (0, tailwindcss_patch.splitCandidateTokens)(literal);
|
|
471
1110
|
if (candidates.length === 0) return;
|
|
472
1111
|
const debugEnabled = debug$1.enabled;
|
|
473
1112
|
const classContext = options.wrapExpression || isClassContextLiteralPath(path);
|
|
@@ -709,7 +1348,7 @@ function walkEvalExpression(path, options, updater, handler) {
|
|
|
709
1348
|
}
|
|
710
1349
|
}
|
|
711
1350
|
//#endregion
|
|
712
|
-
//#region \0@oxc-project+runtime@0.
|
|
1351
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
|
|
713
1352
|
function _typeof(o) {
|
|
714
1353
|
"@babel/helpers - typeof";
|
|
715
1354
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -719,7 +1358,7 @@ function _typeof(o) {
|
|
|
719
1358
|
}, _typeof(o);
|
|
720
1359
|
}
|
|
721
1360
|
//#endregion
|
|
722
|
-
//#region \0@oxc-project+runtime@0.
|
|
1361
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
|
|
723
1362
|
function toPrimitive(t, r) {
|
|
724
1363
|
if ("object" != _typeof(t) || !t) return t;
|
|
725
1364
|
var e = t[Symbol.toPrimitive];
|
|
@@ -731,13 +1370,13 @@ function toPrimitive(t, r) {
|
|
|
731
1370
|
return ("string" === r ? String : Number)(t);
|
|
732
1371
|
}
|
|
733
1372
|
//#endregion
|
|
734
|
-
//#region \0@oxc-project+runtime@0.
|
|
1373
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
|
|
735
1374
|
function toPropertyKey(t) {
|
|
736
1375
|
var i = toPrimitive(t, "string");
|
|
737
1376
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
738
1377
|
}
|
|
739
1378
|
//#endregion
|
|
740
|
-
//#region \0@oxc-project+runtime@0.
|
|
1379
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
|
|
741
1380
|
function _defineProperty(e, r, t) {
|
|
742
1381
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
743
1382
|
value: t,
|
|
@@ -1357,7 +1996,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
|
1357
1996
|
const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
|
|
1358
1997
|
const ignoredPaths = needScope ? /* @__PURE__ */ new WeakSet() : EMPTY_IGNORED_PATHS;
|
|
1359
1998
|
const walker = needScope ? new NodePathWalker({
|
|
1360
|
-
ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers,
|
|
1999
|
+
...options.ignoreCallExpressionIdentifiers === void 0 ? {} : { ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers },
|
|
1361
2000
|
callback(path) {
|
|
1362
2001
|
ignoredPaths.add(path);
|
|
1363
2002
|
}
|
|
@@ -1367,7 +2006,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
|
1367
2006
|
function getTaggedTemplateIgnore() {
|
|
1368
2007
|
if (!taggedTemplateIgnore) taggedTemplateIgnore = createTaggedTemplateIgnore({
|
|
1369
2008
|
matcher: getIgnoredTaggedTemplateMatcher(options),
|
|
1370
|
-
names: options.ignoreTaggedTemplateExpressionIdentifiers
|
|
2009
|
+
...options.ignoreTaggedTemplateExpressionIdentifiers === void 0 ? {} : { names: options.ignoreTaggedTemplateExpressionIdentifiers }
|
|
1371
2010
|
});
|
|
1372
2011
|
return taggedTemplateIgnore;
|
|
1373
2012
|
}
|
|
@@ -1456,9 +2095,8 @@ function jsHandler(rawSource, options) {
|
|
|
1456
2095
|
if (shouldWrapExpression) {
|
|
1457
2096
|
const start = 0;
|
|
1458
2097
|
const end = source.length;
|
|
1459
|
-
const prefixLength = 2;
|
|
1460
2098
|
const suffixLength = 2;
|
|
1461
|
-
ms.remove(start,
|
|
2099
|
+
ms.remove(start, 2);
|
|
1462
2100
|
ms.remove(end - suffixLength, end);
|
|
1463
2101
|
}
|
|
1464
2102
|
const result = { code: ms.toString() };
|
|
@@ -1599,6 +2237,7 @@ var Tokenizer = class {
|
|
|
1599
2237
|
this.reset();
|
|
1600
2238
|
for (let i = 0; i < input.length; i++) {
|
|
1601
2239
|
const char = input[i];
|
|
2240
|
+
if (char === void 0) continue;
|
|
1602
2241
|
this.processChar(char, i);
|
|
1603
2242
|
}
|
|
1604
2243
|
if (this.buffer.length > 0) this.tokens.push({
|
|
@@ -1623,6 +2262,9 @@ var Tokenizer = class {
|
|
|
1623
2262
|
};
|
|
1624
2263
|
new Tokenizer();
|
|
1625
2264
|
//#endregion
|
|
2265
|
+
//#region src/constants.ts
|
|
2266
|
+
const WEAPP_TW_REQUIRED_NODE_VERSION_RANGE = "^20.19.0 || >=22.12.0";
|
|
2267
|
+
//#endregion
|
|
1626
2268
|
//#region src/cli/context.ts
|
|
1627
2269
|
function formatOutputPath(target, baseDir) {
|
|
1628
2270
|
const root = baseDir ?? node_process.default.cwd();
|
|
@@ -1931,7 +2573,7 @@ async function ensureDir(dir) {
|
|
|
1931
2573
|
function handleCliError$1(error) {
|
|
1932
2574
|
if (error instanceof Error) {
|
|
1933
2575
|
_weapp_tailwindcss_logger.logger.error(error.message);
|
|
1934
|
-
if (error.stack && node_process.default.env
|
|
2576
|
+
if (error.stack && node_process.default.env["WEAPP_TW_DEBUG"] === "1") _weapp_tailwindcss_logger.logger.error(error.stack);
|
|
1935
2577
|
} else _weapp_tailwindcss_logger.logger.error(String(error));
|
|
1936
2578
|
}
|
|
1937
2579
|
function commandAction(handler) {
|
|
@@ -1953,7 +2595,7 @@ function logPatchCommandObsoleteNotice() {
|
|
|
1953
2595
|
function handleCliError(error) {
|
|
1954
2596
|
if (error instanceof Error) {
|
|
1955
2597
|
_weapp_tailwindcss_logger.logger.error(error.message);
|
|
1956
|
-
if (error.stack && node_process.default.env
|
|
2598
|
+
if (error.stack && node_process.default.env["WEAPP_TW_DEBUG"] === "1") _weapp_tailwindcss_logger.logger.error(error.stack);
|
|
1957
2599
|
} else _weapp_tailwindcss_logger.logger.error(String(error));
|
|
1958
2600
|
}
|
|
1959
2601
|
function withCommandErrorHandling(handler) {
|
|
@@ -1975,9 +2617,10 @@ const forwardedCommands = [
|
|
|
1975
2617
|
"restore",
|
|
1976
2618
|
"validate"
|
|
1977
2619
|
];
|
|
2620
|
+
const commandHandlers = Object.fromEntries(forwardedCommands.map((command) => [command, withCommandErrorHandling(async (_ctx, next) => next())]));
|
|
1978
2621
|
const mountOptions = {
|
|
1979
2622
|
commands: [...forwardedCommands],
|
|
1980
|
-
commandHandlers
|
|
2623
|
+
commandHandlers
|
|
1981
2624
|
};
|
|
1982
2625
|
//#endregion
|
|
1983
2626
|
//#region src/cli/vscode-entry.ts
|
|
@@ -2123,6 +2766,6 @@ cli.command("doctor", "Check project setup for weapp-tailwindcss").option("--cwd
|
|
|
2123
2766
|
if (hasDoctorFailure(report, toBoolean(options.strict, false))) node_process.default.exitCode = 1;
|
|
2124
2767
|
}));
|
|
2125
2768
|
cli.help();
|
|
2126
|
-
cli.version(node_process.default.env
|
|
2769
|
+
cli.version(node_process.default.env["npm_package_version"] ?? "0.0.0");
|
|
2127
2770
|
cli.parse();
|
|
2128
2771
|
//#endregion
|