@styleframe/scanner 3.1.0 → 3.1.1
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +1 -829
- package/dist/index.js +401 -732
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
return `${
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
1
|
+
import { readFile as D } from "node:fs/promises";
|
|
2
|
+
import j from "fast-glob";
|
|
3
|
+
import { classNameToCssSelector as z, defaultUtilitySelectorFn as k } from "@styleframe/core";
|
|
4
|
+
function B(s) {
|
|
5
|
+
let e = 0;
|
|
6
|
+
for (let t = 0; t < s.length; t++) {
|
|
7
|
+
const n = s.charCodeAt(t);
|
|
8
|
+
e = (e << 5) - e + n, e = e & e;
|
|
9
|
+
}
|
|
10
|
+
return `${e.toString(16)}-${s.length}`;
|
|
11
|
+
}
|
|
12
|
+
function G() {
|
|
13
|
+
const s = /* @__PURE__ */ new Map();
|
|
14
14
|
return {
|
|
15
|
-
get(
|
|
16
|
-
|
|
17
|
-
return entry?.result ?? null;
|
|
15
|
+
get(e) {
|
|
16
|
+
return s.get(e)?.result ?? null;
|
|
18
17
|
},
|
|
19
|
-
set(
|
|
20
|
-
|
|
21
|
-
hash:
|
|
22
|
-
result,
|
|
18
|
+
set(e, t, n) {
|
|
19
|
+
s.set(e, {
|
|
20
|
+
hash: n,
|
|
21
|
+
result: t,
|
|
23
22
|
timestamp: Date.now()
|
|
24
23
|
});
|
|
25
24
|
},
|
|
26
|
-
isValid(
|
|
27
|
-
const
|
|
28
|
-
return
|
|
25
|
+
isValid(e, t) {
|
|
26
|
+
const n = s.get(e);
|
|
27
|
+
return n !== void 0 && n.hash === t;
|
|
29
28
|
},
|
|
30
|
-
getIfValid(
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
return entry.result;
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
29
|
+
getIfValid(e, t) {
|
|
30
|
+
const n = s.get(e);
|
|
31
|
+
return n && n.hash === t ? n.result : null;
|
|
36
32
|
},
|
|
37
|
-
invalidate(
|
|
38
|
-
|
|
33
|
+
invalidate(e) {
|
|
34
|
+
s.delete(e);
|
|
39
35
|
},
|
|
40
36
|
clear() {
|
|
41
|
-
|
|
37
|
+
s.clear();
|
|
42
38
|
}
|
|
43
39
|
};
|
|
44
40
|
}
|
|
45
|
-
const
|
|
46
|
-
const ARBITRARY_VALUE_PATTERN = /^\[(.+)\]$/;
|
|
47
|
-
const DEFAULT_EXTENSIONS = [
|
|
41
|
+
const X = /_[a-zA-Z][a-zA-Z0-9-]*(?::[a-zA-Z0-9._-]+|:\[[^\]]+\])*/g, Q = /^\[(.+)\]$/, he = [
|
|
48
42
|
"html",
|
|
49
43
|
"htm",
|
|
50
44
|
"vue",
|
|
@@ -59,8 +53,7 @@ const DEFAULT_EXTENSIONS = [
|
|
|
59
53
|
"erb",
|
|
60
54
|
"twig",
|
|
61
55
|
"blade.php"
|
|
62
|
-
]
|
|
63
|
-
const DEFAULT_IGNORE_PATTERNS = [
|
|
56
|
+
], H = [
|
|
64
57
|
"**/node_modules/**",
|
|
65
58
|
"**/.git/**",
|
|
66
59
|
"**/dist/**",
|
|
@@ -69,759 +62,435 @@ const DEFAULT_IGNORE_PATTERNS = [
|
|
|
69
62
|
"**/.nuxt/**",
|
|
70
63
|
"**/coverage/**"
|
|
71
64
|
];
|
|
72
|
-
function
|
|
73
|
-
if (!
|
|
65
|
+
function C(s) {
|
|
66
|
+
if (!s.startsWith("_"))
|
|
74
67
|
return null;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (!withoutPrefix) {
|
|
68
|
+
const e = s.slice(1);
|
|
69
|
+
if (!e)
|
|
78
70
|
return null;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (segments.length === 0) {
|
|
71
|
+
const t = K(e);
|
|
72
|
+
if (t.length === 0)
|
|
82
73
|
return null;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
let isArbitrary = false;
|
|
96
|
-
let arbitraryValue;
|
|
97
|
-
const arbitraryMatch = value.match(ARBITRARY_VALUE_PATTERN);
|
|
98
|
-
if (arbitraryMatch) {
|
|
99
|
-
isArbitrary = true;
|
|
100
|
-
arbitraryValue = arbitraryMatch[1];
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
raw: className,
|
|
104
|
-
name,
|
|
105
|
-
value,
|
|
106
|
-
modifiers,
|
|
107
|
-
isArbitrary,
|
|
108
|
-
arbitraryValue
|
|
74
|
+
let n, r, c = [];
|
|
75
|
+
t.length === 1 ? (n = t[0], r = "default") : (r = t[t.length - 1], n = t[t.length - 2], c = t.slice(0, -2));
|
|
76
|
+
let a = !1, l;
|
|
77
|
+
const u = r.match(Q);
|
|
78
|
+
return u && (a = !0, l = u[1]), {
|
|
79
|
+
raw: s,
|
|
80
|
+
name: n,
|
|
81
|
+
value: r,
|
|
82
|
+
modifiers: c,
|
|
83
|
+
isArbitrary: a,
|
|
84
|
+
arbitraryValue: l
|
|
109
85
|
};
|
|
110
86
|
}
|
|
111
|
-
function
|
|
112
|
-
const
|
|
113
|
-
let
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
function extractFromVue(content, pattern) {
|
|
230
|
-
const classes = [];
|
|
231
|
-
const templateMatch = content.match(/<template[^>]*>([\s\S]*?)<\/template>/i);
|
|
232
|
-
if (templateMatch?.[1]) {
|
|
233
|
-
classes.push(...extractFromHTML(templateMatch[1], pattern));
|
|
234
|
-
classes.push(...extractFromStringLiterals(templateMatch[1], pattern));
|
|
235
|
-
}
|
|
236
|
-
const scriptMatch = content.match(/<script[^>]*>([\s\S]*?)<\/script>/i);
|
|
237
|
-
if (scriptMatch?.[1]) {
|
|
238
|
-
classes.push(...extractFromStringLiterals(scriptMatch[1], pattern));
|
|
239
|
-
}
|
|
240
|
-
return [...new Set(classes)];
|
|
241
|
-
}
|
|
242
|
-
function extractFromSvelte(content, pattern) {
|
|
243
|
-
const classes = [];
|
|
244
|
-
classes.push(...extractFromHTML(content, pattern));
|
|
245
|
-
const expressions = extractClassExpressions(content);
|
|
246
|
-
for (const expr of expressions) {
|
|
247
|
-
classes.push(...extractFromStringLiterals(expr, pattern));
|
|
248
|
-
}
|
|
249
|
-
SVELTE_CLASS_DIRECTIVE_PATTERN.lastIndex = 0;
|
|
250
|
-
let match;
|
|
251
|
-
while ((match = SVELTE_CLASS_DIRECTIVE_PATTERN.exec(content)) !== null) {
|
|
252
|
-
if (match[1]) {
|
|
253
|
-
classes.push(match[1]);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
const scriptMatch = content.match(/<script[^>]*>([\s\S]*?)<\/script>/i);
|
|
257
|
-
if (scriptMatch?.[1]) {
|
|
258
|
-
classes.push(...extractFromStringLiterals(scriptMatch[1], pattern));
|
|
259
|
-
}
|
|
260
|
-
return [...new Set(classes)];
|
|
261
|
-
}
|
|
262
|
-
function extractFromAstro(content, pattern) {
|
|
263
|
-
const classes = [];
|
|
264
|
-
classes.push(...extractFromHTML(content, pattern));
|
|
265
|
-
classes.push(...extractFromJSX(content, pattern));
|
|
266
|
-
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
267
|
-
if (frontmatterMatch?.[1]) {
|
|
268
|
-
classes.push(...extractFromStringLiterals(frontmatterMatch[1], pattern));
|
|
269
|
-
}
|
|
270
|
-
return [...new Set(classes)];
|
|
271
|
-
}
|
|
272
|
-
function extractFromStringLiterals(content, pattern) {
|
|
273
|
-
const classes = [];
|
|
274
|
-
let match;
|
|
275
|
-
SINGLE_QUOTE_PATTERN.lastIndex = 0;
|
|
276
|
-
while ((match = SINGLE_QUOTE_PATTERN.exec(content)) !== null) {
|
|
277
|
-
if (match[1]) {
|
|
278
|
-
classes.push(...extractUtilityClasses(match[1], pattern));
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
DOUBLE_QUOTE_PATTERN.lastIndex = 0;
|
|
282
|
-
while ((match = DOUBLE_QUOTE_PATTERN.exec(content)) !== null) {
|
|
283
|
-
if (match[1]) {
|
|
284
|
-
classes.push(...extractUtilityClasses(match[1], pattern));
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
TEMPLATE_LITERAL_PATTERN.lastIndex = 0;
|
|
288
|
-
while ((match = TEMPLATE_LITERAL_PATTERN.exec(content)) !== null) {
|
|
289
|
-
if (match[1]) {
|
|
290
|
-
classes.push(...extractUtilityClasses(match[1], pattern));
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return classes;
|
|
294
|
-
}
|
|
295
|
-
function extractFromMDX(content, pattern) {
|
|
296
|
-
const classes = [];
|
|
297
|
-
classes.push(...extractFromHTML(content, pattern));
|
|
298
|
-
classes.push(...extractFromJSX(content, pattern));
|
|
299
|
-
return [...new Set(classes)];
|
|
300
|
-
}
|
|
301
|
-
const defaultExtractors = {
|
|
302
|
-
html: extractFromHTML,
|
|
303
|
-
htm: extractFromHTML,
|
|
304
|
-
vue: extractFromVue,
|
|
305
|
-
svelte: extractFromSvelte,
|
|
306
|
-
jsx: extractFromJSX,
|
|
307
|
-
tsx: extractFromJSX,
|
|
308
|
-
js: extractFromStringLiterals,
|
|
309
|
-
ts: extractFromStringLiterals,
|
|
310
|
-
astro: extractFromAstro,
|
|
311
|
-
mdx: extractFromMDX,
|
|
312
|
-
php: extractFromHTML,
|
|
313
|
-
erb: extractFromHTML,
|
|
314
|
-
twig: extractFromHTML,
|
|
315
|
-
"blade.php": extractFromHTML
|
|
87
|
+
function K(s) {
|
|
88
|
+
const e = [];
|
|
89
|
+
let t = "", n = 0;
|
|
90
|
+
for (const r of s)
|
|
91
|
+
r === "[" ? (n++, t += r) : r === "]" ? (n--, t += r) : r === ":" && n === 0 ? (t && e.push(t), t = "") : t += r;
|
|
92
|
+
return n !== 0 ? [] : (t && e.push(t), e);
|
|
93
|
+
}
|
|
94
|
+
function A(s, e) {
|
|
95
|
+
const t = s.match(e ?? X);
|
|
96
|
+
return t ? [...new Set(t)] : [];
|
|
97
|
+
}
|
|
98
|
+
function pe(s, e, t = []) {
|
|
99
|
+
const n = [...t, s];
|
|
100
|
+
return e !== "default" && n.push(e), `_${n.join(":")}`;
|
|
101
|
+
}
|
|
102
|
+
const R = /\bclassName\s*=\s*\{/g, _ = /\bclass\s*=\s*\{/g, I = /\bclass\s*=\s*["']([^"']+)["']/gi, b = /\bclassName\s*=\s*["']([^"']+)["']/gi, M = /\bclass:([^\s={>]+)/g, L = /'([^'\\]*(?:\\.[^'\\]*)*)'/g, F = /"([^"\\]*(?:\\.[^"\\]*)*)"/g, v = /`([^`\\]*(?:\\.[^`\\]*)*)`/g;
|
|
103
|
+
function P(s) {
|
|
104
|
+
let e = 1, t = 0;
|
|
105
|
+
for (; t < s.length && e > 0; ) {
|
|
106
|
+
const n = s[t];
|
|
107
|
+
n === "{" ? e++ : n === "}" && e--, t++;
|
|
108
|
+
}
|
|
109
|
+
return e !== 0 ? null : s.slice(0, t - 1);
|
|
110
|
+
}
|
|
111
|
+
function Z(s) {
|
|
112
|
+
const e = [];
|
|
113
|
+
R.lastIndex = 0;
|
|
114
|
+
let t;
|
|
115
|
+
for (; (t = R.exec(s)) !== null; ) {
|
|
116
|
+
const n = t.index + t[0].length, r = s.slice(n), c = P(r);
|
|
117
|
+
c !== null && e.push(c);
|
|
118
|
+
}
|
|
119
|
+
return e;
|
|
120
|
+
}
|
|
121
|
+
function W(s) {
|
|
122
|
+
const e = [];
|
|
123
|
+
_.lastIndex = 0;
|
|
124
|
+
let t;
|
|
125
|
+
for (; (t = _.exec(s)) !== null; ) {
|
|
126
|
+
const n = t.index + t[0].length, r = s.slice(n), c = P(r);
|
|
127
|
+
c !== null && e.push(c);
|
|
128
|
+
}
|
|
129
|
+
return e;
|
|
130
|
+
}
|
|
131
|
+
function h(s, e) {
|
|
132
|
+
const t = [];
|
|
133
|
+
I.lastIndex = 0;
|
|
134
|
+
let n;
|
|
135
|
+
for (; (n = I.exec(s)) !== null; )
|
|
136
|
+
n[1] && t.push(...A(n[1], e));
|
|
137
|
+
return t;
|
|
138
|
+
}
|
|
139
|
+
function y(s, e) {
|
|
140
|
+
const t = [];
|
|
141
|
+
b.lastIndex = 0;
|
|
142
|
+
let n;
|
|
143
|
+
for (; (n = b.exec(s)) !== null; )
|
|
144
|
+
n[1] && t.push(...A(n[1], e));
|
|
145
|
+
const r = Z(s);
|
|
146
|
+
for (const c of r)
|
|
147
|
+
t.push(...m(c, e));
|
|
148
|
+
return [...new Set(t)];
|
|
149
|
+
}
|
|
150
|
+
function Y(s, e) {
|
|
151
|
+
const t = [], n = s.match(/<template[^>]*>([\s\S]*?)<\/template>/i);
|
|
152
|
+
n?.[1] && (t.push(...h(n[1], e)), t.push(...m(n[1], e)));
|
|
153
|
+
const r = s.match(/<script[^>]*>([\s\S]*?)<\/script>/i);
|
|
154
|
+
return r?.[1] && t.push(...m(r[1], e)), [...new Set(t)];
|
|
155
|
+
}
|
|
156
|
+
function q(s, e) {
|
|
157
|
+
const t = [];
|
|
158
|
+
t.push(...h(s, e));
|
|
159
|
+
const n = W(s);
|
|
160
|
+
for (const a of n)
|
|
161
|
+
t.push(...m(a, e));
|
|
162
|
+
M.lastIndex = 0;
|
|
163
|
+
let r;
|
|
164
|
+
for (; (r = M.exec(s)) !== null; )
|
|
165
|
+
r[1] && t.push(r[1]);
|
|
166
|
+
const c = s.match(/<script[^>]*>([\s\S]*?)<\/script>/i);
|
|
167
|
+
return c?.[1] && t.push(...m(c[1], e)), [...new Set(t)];
|
|
168
|
+
}
|
|
169
|
+
function J(s, e) {
|
|
170
|
+
const t = [];
|
|
171
|
+
t.push(...h(s, e)), t.push(...y(s, e));
|
|
172
|
+
const n = s.match(/^---\n([\s\S]*?)\n---/);
|
|
173
|
+
return n?.[1] && t.push(...m(n[1], e)), [...new Set(t)];
|
|
174
|
+
}
|
|
175
|
+
function m(s, e) {
|
|
176
|
+
const t = [];
|
|
177
|
+
let n;
|
|
178
|
+
for (L.lastIndex = 0; (n = L.exec(s)) !== null; )
|
|
179
|
+
n[1] && t.push(...A(n[1], e));
|
|
180
|
+
for (F.lastIndex = 0; (n = F.exec(s)) !== null; )
|
|
181
|
+
n[1] && t.push(...A(n[1], e));
|
|
182
|
+
for (v.lastIndex = 0; (n = v.exec(s)) !== null; )
|
|
183
|
+
n[1] && t.push(...A(n[1], e));
|
|
184
|
+
return t;
|
|
185
|
+
}
|
|
186
|
+
function ee(s, e) {
|
|
187
|
+
const t = [];
|
|
188
|
+
return t.push(...h(s, e)), t.push(...y(s, e)), [...new Set(t)];
|
|
189
|
+
}
|
|
190
|
+
const te = {
|
|
191
|
+
html: h,
|
|
192
|
+
htm: h,
|
|
193
|
+
vue: Y,
|
|
194
|
+
svelte: q,
|
|
195
|
+
jsx: y,
|
|
196
|
+
tsx: y,
|
|
197
|
+
js: m,
|
|
198
|
+
ts: m,
|
|
199
|
+
astro: J,
|
|
200
|
+
mdx: ee,
|
|
201
|
+
php: h,
|
|
202
|
+
erb: h,
|
|
203
|
+
twig: h,
|
|
204
|
+
"blade.php": h
|
|
316
205
|
};
|
|
317
|
-
function
|
|
318
|
-
if (
|
|
206
|
+
function se(s) {
|
|
207
|
+
if (s.endsWith(".blade.php"))
|
|
319
208
|
return "blade.php";
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
e
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
const t = e.constructor;
|
|
356
|
-
return new t(
|
|
357
|
-
e.buffer.slice(0),
|
|
358
|
-
e.byteOffset,
|
|
359
|
-
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
function ue(e) {
|
|
363
|
-
if (e = e || {}, e.circular)
|
|
364
|
-
return le(e);
|
|
365
|
-
const t = /* @__PURE__ */ new Map();
|
|
366
|
-
if (t.set(Date, (i) => new Date(i)), t.set(
|
|
367
|
-
Map,
|
|
368
|
-
(i, f) => new Map(n(Array.from(i), f))
|
|
369
|
-
), t.set(
|
|
370
|
-
Set,
|
|
371
|
-
(i, f) => new Set(n(Array.from(i), f))
|
|
372
|
-
), e.constructorHandlers)
|
|
373
|
-
for (const i of e.constructorHandlers)
|
|
374
|
-
t.set(i[0], i[1]);
|
|
375
|
-
let r;
|
|
376
|
-
return e.proto ? o : s;
|
|
377
|
-
function n(i, f) {
|
|
378
|
-
const c = Object.keys(i), a = Array.from({ length: c.length });
|
|
379
|
-
for (let l = 0; l < c.length; l++) {
|
|
380
|
-
const u = c[l], d = i[u];
|
|
381
|
-
typeof d != "object" || d === null ? a[u] = d : d.constructor !== Object && (r = t.get(d.constructor)) ? a[u] = r(d, f) : ArrayBuffer.isView(d) ? a[u] = v(d) : a[u] = f(d);
|
|
209
|
+
const e = s.split(".");
|
|
210
|
+
return e[e.length - 1]?.toLowerCase() ?? "";
|
|
211
|
+
}
|
|
212
|
+
function N(s, e, t, n) {
|
|
213
|
+
const r = [], c = se(e);
|
|
214
|
+
if (t)
|
|
215
|
+
for (const l of t)
|
|
216
|
+
r.push(...l(s, e));
|
|
217
|
+
const a = te[c];
|
|
218
|
+
return a ? r.push(...a(s, n)) : r.push(...m(s, n)), [...new Set(r)];
|
|
219
|
+
}
|
|
220
|
+
function U(s, e) {
|
|
221
|
+
if (e.length === 0)
|
|
222
|
+
return s;
|
|
223
|
+
const t = [...e].sort().join(",");
|
|
224
|
+
return `${s}|${t}`;
|
|
225
|
+
}
|
|
226
|
+
function ne(s, e) {
|
|
227
|
+
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const a of e.utilities) {
|
|
229
|
+
t.set(a.name, a);
|
|
230
|
+
const l = /* @__PURE__ */ new Set();
|
|
231
|
+
for (const u of a.values)
|
|
232
|
+
l.add(U(u.key, u.modifiers));
|
|
233
|
+
r.set(a, l);
|
|
234
|
+
}
|
|
235
|
+
for (const a of e.modifiers)
|
|
236
|
+
for (const l of a.key)
|
|
237
|
+
n.set(l, a);
|
|
238
|
+
const c = [];
|
|
239
|
+
for (const a of s) {
|
|
240
|
+
const l = t.get(a.name) ?? null, u = [];
|
|
241
|
+
for (const T of a.modifiers) {
|
|
242
|
+
const w = n.get(T);
|
|
243
|
+
w && u.push(w);
|
|
382
244
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (i.constructor !== Object && (r = t.get(i.constructor)))
|
|
389
|
-
return r(i, s);
|
|
390
|
-
const f = {};
|
|
391
|
-
for (const c in i) {
|
|
392
|
-
if (Object.hasOwnProperty.call(i, c) === false) continue;
|
|
393
|
-
const a = i[c];
|
|
394
|
-
typeof a != "object" || a === null ? f[c] = a : a.constructor !== Object && (r = t.get(a.constructor)) ? f[c] = r(a, s) : ArrayBuffer.isView(a) ? f[c] = v(a) : f[c] = s(a);
|
|
395
|
-
}
|
|
396
|
-
return f;
|
|
397
|
-
}
|
|
398
|
-
function o(i) {
|
|
399
|
-
if (typeof i != "object" || i === null) return i;
|
|
400
|
-
if (Array.isArray(i)) return n(i, o);
|
|
401
|
-
if (i.constructor !== Object && (r = t.get(i.constructor)))
|
|
402
|
-
return r(i, o);
|
|
403
|
-
const f = {};
|
|
404
|
-
for (const c in i) {
|
|
405
|
-
const a = i[c];
|
|
406
|
-
typeof a != "object" || a === null ? f[c] = a : a.constructor !== Object && (r = t.get(a.constructor)) ? f[c] = r(a, o) : ArrayBuffer.isView(a) ? f[c] = v(a) : f[c] = o(a);
|
|
407
|
-
}
|
|
408
|
-
return f;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
function le(e) {
|
|
412
|
-
const t = [], r = [], n = /* @__PURE__ */ new Map();
|
|
413
|
-
if (n.set(Date, (c) => new Date(c)), n.set(
|
|
414
|
-
Map,
|
|
415
|
-
(c, a) => new Map(o(Array.from(c), a))
|
|
416
|
-
), n.set(
|
|
417
|
-
Set,
|
|
418
|
-
(c, a) => new Set(o(Array.from(c), a))
|
|
419
|
-
), e.constructorHandlers)
|
|
420
|
-
for (const c of e.constructorHandlers)
|
|
421
|
-
n.set(c[0], c[1]);
|
|
422
|
-
let s;
|
|
423
|
-
return e.proto ? f : i;
|
|
424
|
-
function o(c, a) {
|
|
425
|
-
const l = Object.keys(c), u = Array.from({ length: l.length });
|
|
426
|
-
for (let d = 0; d < l.length; d++) {
|
|
427
|
-
const y = l[d], m = c[y];
|
|
428
|
-
if (typeof m != "object" || m === null)
|
|
429
|
-
u[y] = m;
|
|
430
|
-
else if (m.constructor !== Object && (s = n.get(m.constructor)))
|
|
431
|
-
u[y] = s(m, a);
|
|
432
|
-
else if (ArrayBuffer.isView(m))
|
|
433
|
-
u[y] = v(m);
|
|
434
|
-
else {
|
|
435
|
-
const p = t.indexOf(m);
|
|
436
|
-
p !== -1 ? u[y] = r[p] : u[y] = a(m);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
return u;
|
|
440
|
-
}
|
|
441
|
-
function i(c) {
|
|
442
|
-
if (typeof c != "object" || c === null) return c;
|
|
443
|
-
if (Array.isArray(c)) return o(c, i);
|
|
444
|
-
if (c.constructor !== Object && (s = n.get(c.constructor)))
|
|
445
|
-
return s(c, i);
|
|
446
|
-
const a = {};
|
|
447
|
-
t.push(c), r.push(a);
|
|
448
|
-
for (const l in c) {
|
|
449
|
-
if (Object.hasOwnProperty.call(c, l) === false) continue;
|
|
450
|
-
const u = c[l];
|
|
451
|
-
if (typeof u != "object" || u === null)
|
|
452
|
-
a[l] = u;
|
|
453
|
-
else if (u.constructor !== Object && (s = n.get(u.constructor)))
|
|
454
|
-
a[l] = s(u, i);
|
|
455
|
-
else if (ArrayBuffer.isView(u))
|
|
456
|
-
a[l] = v(u);
|
|
457
|
-
else {
|
|
458
|
-
const d = t.indexOf(u);
|
|
459
|
-
d !== -1 ? a[l] = r[d] : a[l] = i(u);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
return t.pop(), r.pop(), a;
|
|
463
|
-
}
|
|
464
|
-
function f(c) {
|
|
465
|
-
if (typeof c != "object" || c === null) return c;
|
|
466
|
-
if (Array.isArray(c)) return o(c, f);
|
|
467
|
-
if (c.constructor !== Object && (s = n.get(c.constructor)))
|
|
468
|
-
return s(c, f);
|
|
469
|
-
const a = {};
|
|
470
|
-
t.push(c), r.push(a);
|
|
471
|
-
for (const l in c) {
|
|
472
|
-
const u = c[l];
|
|
473
|
-
if (typeof u != "object" || u === null)
|
|
474
|
-
a[l] = u;
|
|
475
|
-
else if (u.constructor !== Object && (s = n.get(u.constructor)))
|
|
476
|
-
a[l] = s(u, f);
|
|
477
|
-
else if (ArrayBuffer.isView(u))
|
|
478
|
-
a[l] = v(u);
|
|
479
|
-
else {
|
|
480
|
-
const d = t.indexOf(u);
|
|
481
|
-
d !== -1 ? a[l] = r[d] : a[l] = f(u);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
return t.pop(), r.pop(), a;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
ue();
|
|
488
|
-
function generateValueKey(value, modifiers) {
|
|
489
|
-
if (modifiers.length === 0) {
|
|
490
|
-
return value;
|
|
491
|
-
}
|
|
492
|
-
const sortedModifiers = [...modifiers].sort().join(",");
|
|
493
|
-
return `${value}|${sortedModifiers}`;
|
|
494
|
-
}
|
|
495
|
-
function matchUtilities(parsed, root) {
|
|
496
|
-
const utilityMap = /* @__PURE__ */ new Map();
|
|
497
|
-
const modifierMap = /* @__PURE__ */ new Map();
|
|
498
|
-
const factoryValueSets = /* @__PURE__ */ new Map();
|
|
499
|
-
for (const utility of root.utilities) {
|
|
500
|
-
utilityMap.set(utility.name, utility);
|
|
501
|
-
const valueSet = /* @__PURE__ */ new Set();
|
|
502
|
-
for (const v2 of utility.values) {
|
|
503
|
-
valueSet.add(generateValueKey(v2.key, v2.modifiers));
|
|
504
|
-
}
|
|
505
|
-
factoryValueSets.set(utility, valueSet);
|
|
506
|
-
}
|
|
507
|
-
for (const modifier of root.modifiers) {
|
|
508
|
-
for (const key of modifier.key) {
|
|
509
|
-
modifierMap.set(key, modifier);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
const matches = [];
|
|
513
|
-
for (const parsedClass of parsed) {
|
|
514
|
-
const factory = utilityMap.get(parsedClass.name) ?? null;
|
|
515
|
-
const matchedModifiers = [];
|
|
516
|
-
for (const modKey of parsedClass.modifiers) {
|
|
517
|
-
const modifier = modifierMap.get(modKey);
|
|
518
|
-
if (modifier) {
|
|
519
|
-
matchedModifiers.push(modifier);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
let exists = false;
|
|
523
|
-
if (factory) {
|
|
524
|
-
const lookupKey = generateValueKey(
|
|
525
|
-
parsedClass.value,
|
|
526
|
-
parsedClass.modifiers
|
|
245
|
+
let S = !1;
|
|
246
|
+
if (l) {
|
|
247
|
+
const T = U(
|
|
248
|
+
a.value,
|
|
249
|
+
a.modifiers
|
|
527
250
|
);
|
|
528
|
-
|
|
529
|
-
exists = valueSet?.has(lookupKey) ?? false;
|
|
251
|
+
S = r.get(l)?.has(T) ?? !1;
|
|
530
252
|
}
|
|
531
|
-
|
|
532
|
-
parsed:
|
|
533
|
-
factory,
|
|
534
|
-
modifierFactories:
|
|
535
|
-
exists
|
|
253
|
+
c.push({
|
|
254
|
+
parsed: a,
|
|
255
|
+
factory: l,
|
|
256
|
+
modifierFactories: u,
|
|
257
|
+
exists: S
|
|
536
258
|
});
|
|
537
259
|
}
|
|
538
|
-
return
|
|
260
|
+
return c;
|
|
539
261
|
}
|
|
540
|
-
function
|
|
541
|
-
const
|
|
542
|
-
return
|
|
262
|
+
function me(s, e) {
|
|
263
|
+
const t = V(s, e);
|
|
264
|
+
return z(t);
|
|
543
265
|
}
|
|
544
|
-
function
|
|
545
|
-
return (
|
|
266
|
+
function V(s, e) {
|
|
267
|
+
return (e ?? k)(s);
|
|
546
268
|
}
|
|
547
|
-
function
|
|
548
|
-
return (
|
|
549
|
-
const
|
|
269
|
+
function re(s, e) {
|
|
270
|
+
return (t) => {
|
|
271
|
+
const n = V(
|
|
550
272
|
{
|
|
551
|
-
name:
|
|
552
|
-
value:
|
|
553
|
-
modifiers:
|
|
273
|
+
name: t.name,
|
|
274
|
+
value: t.value,
|
|
275
|
+
modifiers: t.modifiers
|
|
554
276
|
},
|
|
555
|
-
|
|
277
|
+
e
|
|
556
278
|
);
|
|
557
|
-
return
|
|
279
|
+
return s.has(n);
|
|
558
280
|
};
|
|
559
281
|
}
|
|
560
|
-
function
|
|
561
|
-
const
|
|
562
|
-
return
|
|
563
|
-
if (child.type !== "utility") {
|
|
564
|
-
return true;
|
|
565
|
-
}
|
|
566
|
-
return filter(child);
|
|
567
|
-
});
|
|
282
|
+
function de(s, e, t) {
|
|
283
|
+
const n = re(e, t);
|
|
284
|
+
return s.children.filter((r) => r.type !== "utility" ? !0 : n(r));
|
|
568
285
|
}
|
|
569
|
-
function
|
|
570
|
-
const
|
|
571
|
-
for (const
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
return classNames;
|
|
286
|
+
function ge(s) {
|
|
287
|
+
const e = /* @__PURE__ */ new Set();
|
|
288
|
+
for (const t of s)
|
|
289
|
+
e.add(t.parsed.raw);
|
|
290
|
+
return e;
|
|
575
291
|
}
|
|
576
|
-
function
|
|
577
|
-
return
|
|
292
|
+
function xe(s) {
|
|
293
|
+
return s.filter((e) => e.factory !== null);
|
|
578
294
|
}
|
|
579
|
-
function
|
|
580
|
-
return
|
|
295
|
+
function Se(s) {
|
|
296
|
+
return s.filter((e) => e.exists);
|
|
581
297
|
}
|
|
582
|
-
function
|
|
583
|
-
return
|
|
298
|
+
function Te(s) {
|
|
299
|
+
return s.filter((e) => e.parsed.isArbitrary);
|
|
584
300
|
}
|
|
585
|
-
const
|
|
586
|
-
function
|
|
587
|
-
const
|
|
588
|
-
if (
|
|
589
|
-
return
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
compiledPatternCache.set(normalized, null);
|
|
593
|
-
return null;
|
|
594
|
-
}
|
|
301
|
+
const E = /* @__PURE__ */ new Map();
|
|
302
|
+
function ce(s) {
|
|
303
|
+
const e = s.replace(/\\/g, "/");
|
|
304
|
+
if (E.has(e))
|
|
305
|
+
return E.get(e);
|
|
306
|
+
if (!e.includes("**") && !e.includes("*") && !e.includes("?"))
|
|
307
|
+
return E.set(e, null), null;
|
|
595
308
|
try {
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
compiledPatternCache.set(normalized, regex);
|
|
599
|
-
return regex;
|
|
309
|
+
const t = oe(e), n = new RegExp(`^${t}$`);
|
|
310
|
+
return E.set(e, n), n;
|
|
600
311
|
} catch {
|
|
601
|
-
|
|
602
|
-
return null;
|
|
312
|
+
return E.set(e, null), null;
|
|
603
313
|
}
|
|
604
314
|
}
|
|
605
|
-
function
|
|
606
|
-
let
|
|
607
|
-
return (...
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
}
|
|
611
|
-
timeoutId = setTimeout(() => {
|
|
612
|
-
fn(...args);
|
|
613
|
-
timeoutId = null;
|
|
614
|
-
}, delay);
|
|
315
|
+
function we(s, e) {
|
|
316
|
+
let t = null;
|
|
317
|
+
return (...n) => {
|
|
318
|
+
t && clearTimeout(t), t = setTimeout(() => {
|
|
319
|
+
s(...n), t = null;
|
|
320
|
+
}, e);
|
|
615
321
|
};
|
|
616
322
|
}
|
|
617
|
-
function
|
|
618
|
-
const { debounce:
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
changedFiles.clear();
|
|
625
|
-
callback(files);
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
const onChange = (filePath) => {
|
|
629
|
-
changedFiles.add(filePath);
|
|
630
|
-
if (timeoutId) {
|
|
631
|
-
clearTimeout(timeoutId);
|
|
323
|
+
function ae(s, e = {}) {
|
|
324
|
+
const { debounce: t = 100 } = e, n = /* @__PURE__ */ new Set();
|
|
325
|
+
let r = null;
|
|
326
|
+
const c = () => {
|
|
327
|
+
if (n.size > 0) {
|
|
328
|
+
const l = [...n];
|
|
329
|
+
n.clear(), s(l);
|
|
632
330
|
}
|
|
633
|
-
timeoutId = setTimeout(() => {
|
|
634
|
-
flush();
|
|
635
|
-
timeoutId = null;
|
|
636
|
-
}, debounceMs);
|
|
637
331
|
};
|
|
638
|
-
return { onChange
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
332
|
+
return { onChange: (l) => {
|
|
333
|
+
n.add(l), r && clearTimeout(r), r = setTimeout(() => {
|
|
334
|
+
c(), r = null;
|
|
335
|
+
}, t);
|
|
336
|
+
}, flush: c };
|
|
337
|
+
}
|
|
338
|
+
function le(s) {
|
|
339
|
+
return s.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
340
|
+
}
|
|
341
|
+
function oe(s) {
|
|
342
|
+
return s.replace(/\*\*/g, "<<<GLOBSTAR>>>").replace(/\*/g, "<<<STAR>>>").replace(/\?/g, "<<<QUESTION>>>").split("<<<GLOBSTAR>>>").map(le).join(".*").replace(/<<<STAR>>>/g, "[^/]*").replace(/<<<QUESTION>>>/g, ".");
|
|
343
|
+
}
|
|
344
|
+
function Ee(s, e) {
|
|
345
|
+
const t = s.replace(/\\/g, "/");
|
|
346
|
+
for (const n of e) {
|
|
347
|
+
const r = ce(n);
|
|
348
|
+
if (r !== null) {
|
|
349
|
+
if (r.test(t))
|
|
350
|
+
return !0;
|
|
654
351
|
} else {
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
657
|
-
return
|
|
658
|
-
}
|
|
352
|
+
const c = n.replace(/\\/g, "/");
|
|
353
|
+
if (t === c)
|
|
354
|
+
return !0;
|
|
659
355
|
}
|
|
660
356
|
}
|
|
661
|
-
return
|
|
662
|
-
}
|
|
663
|
-
function
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
return fg(config.content, {
|
|
671
|
-
cwd,
|
|
672
|
-
absolute: true,
|
|
673
|
-
ignore: DEFAULT_IGNORE_PATTERNS
|
|
357
|
+
return !1;
|
|
358
|
+
}
|
|
359
|
+
function Ae(s) {
|
|
360
|
+
const e = G(), t = s.cwd ?? process.cwd(), n = s.extractors, r = s.utilities?.pattern, c = s.utilities?.parse ?? C;
|
|
361
|
+
async function a() {
|
|
362
|
+
return j(s.content, {
|
|
363
|
+
cwd: t,
|
|
364
|
+
absolute: !0,
|
|
365
|
+
ignore: H
|
|
674
366
|
});
|
|
675
367
|
}
|
|
676
|
-
async function
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const parsed = classNames.map(utilityParse).filter((p) => p !== null);
|
|
690
|
-
const result = {
|
|
691
|
-
path: filePath,
|
|
692
|
-
classes: new Set(classNames),
|
|
693
|
-
parsed,
|
|
368
|
+
async function l(o) {
|
|
369
|
+
const f = await D(o, "utf-8"), d = B(f), p = e.getIfValid(o, d);
|
|
370
|
+
if (p)
|
|
371
|
+
return p;
|
|
372
|
+
const g = N(
|
|
373
|
+
f,
|
|
374
|
+
o,
|
|
375
|
+
n,
|
|
376
|
+
r
|
|
377
|
+
), i = g.map(c).filter((O) => O !== null), x = {
|
|
378
|
+
path: o,
|
|
379
|
+
classes: new Set(g),
|
|
380
|
+
parsed: i,
|
|
694
381
|
lastScanned: Date.now()
|
|
695
382
|
};
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
const filePaths = await getFilePaths();
|
|
710
|
-
const files = /* @__PURE__ */ new Map();
|
|
711
|
-
const allClasses = /* @__PURE__ */ new Set();
|
|
712
|
-
const allParsed = [];
|
|
713
|
-
const results = await Promise.all(
|
|
714
|
-
filePaths.map(async (filePath) => {
|
|
383
|
+
return e.set(o, x, d), x;
|
|
384
|
+
}
|
|
385
|
+
function u(o, f = "inline") {
|
|
386
|
+
return N(
|
|
387
|
+
o,
|
|
388
|
+
f,
|
|
389
|
+
n,
|
|
390
|
+
r
|
|
391
|
+
).map(c).filter((p) => p !== null);
|
|
392
|
+
}
|
|
393
|
+
async function S() {
|
|
394
|
+
const o = await a(), f = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), p = [], g = await Promise.all(
|
|
395
|
+
o.map(async (i) => {
|
|
715
396
|
try {
|
|
716
|
-
return await
|
|
717
|
-
} catch (
|
|
718
|
-
console.warn(
|
|
719
|
-
`[styleframe/scanner] Failed to scan ${
|
|
720
|
-
|
|
721
|
-
);
|
|
722
|
-
return null;
|
|
397
|
+
return await l(i);
|
|
398
|
+
} catch (x) {
|
|
399
|
+
return console.warn(
|
|
400
|
+
`[styleframe/scanner] Failed to scan ${i}:`,
|
|
401
|
+
x
|
|
402
|
+
), null;
|
|
723
403
|
}
|
|
724
404
|
})
|
|
725
405
|
);
|
|
726
|
-
for (const
|
|
727
|
-
if (
|
|
728
|
-
|
|
729
|
-
for (const
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
allParsed.push(...result.parsed);
|
|
406
|
+
for (const i of g)
|
|
407
|
+
if (i) {
|
|
408
|
+
f.set(i.path, i);
|
|
409
|
+
for (const x of i.classes)
|
|
410
|
+
d.add(x);
|
|
411
|
+
p.push(...i.parsed);
|
|
733
412
|
}
|
|
734
|
-
}
|
|
735
413
|
return {
|
|
736
|
-
files,
|
|
737
|
-
allClasses,
|
|
738
|
-
allParsed
|
|
414
|
+
files: f,
|
|
415
|
+
allClasses: d,
|
|
416
|
+
allParsed: p
|
|
739
417
|
};
|
|
740
418
|
}
|
|
741
|
-
function
|
|
742
|
-
return
|
|
419
|
+
function T(o, f) {
|
|
420
|
+
return ne(o, f);
|
|
743
421
|
}
|
|
744
|
-
function
|
|
745
|
-
const { onChange, flush } =
|
|
746
|
-
for (const
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
callback(result);
|
|
422
|
+
function w(o) {
|
|
423
|
+
const { onChange: f, flush: d } = ae(async (p) => {
|
|
424
|
+
for (const i of p)
|
|
425
|
+
e.invalidate(i);
|
|
426
|
+
const g = await S();
|
|
427
|
+
o(g);
|
|
751
428
|
});
|
|
752
429
|
return () => {
|
|
753
|
-
|
|
430
|
+
d();
|
|
754
431
|
};
|
|
755
432
|
}
|
|
756
|
-
function
|
|
757
|
-
|
|
758
|
-
cache.invalidate(filePath);
|
|
759
|
-
} else {
|
|
760
|
-
cache.clear();
|
|
761
|
-
}
|
|
433
|
+
function $(o) {
|
|
434
|
+
o ? e.invalidate(o) : e.clear();
|
|
762
435
|
}
|
|
763
436
|
return {
|
|
764
|
-
scan,
|
|
765
|
-
scanFile,
|
|
766
|
-
scanContent,
|
|
767
|
-
match,
|
|
768
|
-
watch,
|
|
769
|
-
invalidate
|
|
437
|
+
scan: S,
|
|
438
|
+
scanFile: l,
|
|
439
|
+
scanContent: u,
|
|
440
|
+
match: T,
|
|
441
|
+
watch: w,
|
|
442
|
+
invalidate: $
|
|
770
443
|
};
|
|
771
444
|
}
|
|
772
|
-
function
|
|
773
|
-
const
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
445
|
+
function ye(s, e = "inline.html", t) {
|
|
446
|
+
const n = t?.parse ?? C;
|
|
447
|
+
return N(
|
|
448
|
+
s,
|
|
449
|
+
e,
|
|
777
450
|
void 0,
|
|
778
|
-
|
|
779
|
-
);
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
utilities?.pattern
|
|
790
|
-
);
|
|
791
|
-
return classNames.map(parseFn).filter((p) => p !== null);
|
|
792
|
-
};
|
|
451
|
+
t?.pattern
|
|
452
|
+
).map(n).filter((c) => c !== null);
|
|
453
|
+
}
|
|
454
|
+
function Ne(s, e) {
|
|
455
|
+
const t = e?.parse ?? C;
|
|
456
|
+
return (n, r = "inline") => N(
|
|
457
|
+
n,
|
|
458
|
+
r,
|
|
459
|
+
s,
|
|
460
|
+
e?.pattern
|
|
461
|
+
).map(t).filter((a) => a !== null);
|
|
793
462
|
}
|
|
794
463
|
export {
|
|
795
|
-
ARBITRARY_VALUE_PATTERN,
|
|
796
|
-
DEFAULT_EXTENSIONS,
|
|
797
|
-
DEFAULT_IGNORE_PATTERNS,
|
|
798
|
-
UTILITY_CLASS_PATTERN,
|
|
799
|
-
classNameFromUtilityOptions,
|
|
800
|
-
createCache,
|
|
801
|
-
createChangeHandler,
|
|
802
|
-
createContentScanner,
|
|
803
|
-
createScanner,
|
|
804
|
-
createUtilityFilter,
|
|
805
|
-
debounce,
|
|
806
|
-
extractClasses,
|
|
807
|
-
extractFromAstro,
|
|
808
|
-
extractFromHTML,
|
|
809
|
-
extractFromJSX,
|
|
810
|
-
extractFromMDX,
|
|
811
|
-
extractFromStringLiterals,
|
|
812
|
-
extractFromSvelte,
|
|
813
|
-
extractFromVue,
|
|
814
|
-
extractUtilityClasses,
|
|
815
|
-
filterUtilities,
|
|
816
|
-
generateUtilityClassName,
|
|
817
|
-
generateUtilitySelector,
|
|
818
|
-
getArbitraryMatches,
|
|
819
|
-
getExistingMatches,
|
|
820
|
-
getUsedClassNames,
|
|
821
|
-
getValidMatches,
|
|
822
|
-
hashContent,
|
|
823
|
-
matchUtilities,
|
|
824
|
-
matchesPatterns,
|
|
825
|
-
parseUtilityClass,
|
|
826
|
-
quickScan
|
|
464
|
+
Q as ARBITRARY_VALUE_PATTERN,
|
|
465
|
+
he as DEFAULT_EXTENSIONS,
|
|
466
|
+
H as DEFAULT_IGNORE_PATTERNS,
|
|
467
|
+
X as UTILITY_CLASS_PATTERN,
|
|
468
|
+
V as classNameFromUtilityOptions,
|
|
469
|
+
G as createCache,
|
|
470
|
+
ae as createChangeHandler,
|
|
471
|
+
Ne as createContentScanner,
|
|
472
|
+
Ae as createScanner,
|
|
473
|
+
re as createUtilityFilter,
|
|
474
|
+
we as debounce,
|
|
475
|
+
N as extractClasses,
|
|
476
|
+
J as extractFromAstro,
|
|
477
|
+
h as extractFromHTML,
|
|
478
|
+
y as extractFromJSX,
|
|
479
|
+
ee as extractFromMDX,
|
|
480
|
+
m as extractFromStringLiterals,
|
|
481
|
+
q as extractFromSvelte,
|
|
482
|
+
Y as extractFromVue,
|
|
483
|
+
A as extractUtilityClasses,
|
|
484
|
+
de as filterUtilities,
|
|
485
|
+
pe as generateUtilityClassName,
|
|
486
|
+
me as generateUtilitySelector,
|
|
487
|
+
Te as getArbitraryMatches,
|
|
488
|
+
Se as getExistingMatches,
|
|
489
|
+
ge as getUsedClassNames,
|
|
490
|
+
xe as getValidMatches,
|
|
491
|
+
B as hashContent,
|
|
492
|
+
ne as matchUtilities,
|
|
493
|
+
Ee as matchesPatterns,
|
|
494
|
+
C as parseUtilityClass,
|
|
495
|
+
ye as quickScan
|
|
827
496
|
};
|