@styleframe/loader 2.4.1 → 3.0.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/dist/index.js CHANGED
@@ -1,1281 +1,153 @@
1
- import { stat, rm, mkdir, writeFile } from "node:fs/promises";
2
- import path from "node:path";
3
- import { validateInstanceLicense, getLicenseKeyFromEnv } from "@styleframe/license";
4
- import { watch } from "chokidar";
5
- import { createJiti } from "jiti";
6
- import { existsSync } from "node:fs";
7
- const F$1 = ["charset", "import", "namespace"], L$1 = ["layer"], D = ({ name: e }) => `[data-theme="${e}"]`, x$1 = ({
8
- name: e,
9
- value: t,
10
- modifiers: r
11
- }) => `._${[...r, e, ...t === "default" ? [] : [t]].filter(Boolean).join("\\:").replace(/[[\].#()%,]/g, "\\$&")}`, w = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
12
- function I$1(e, t) {
13
- return `@${e}${t ? " " : ""}${t}`;
14
- }
15
- const U$1 = /\d/, P$1 = ["-", "_", "/", "."];
16
- function M(e = "") {
17
- if (!U$1.test(e))
18
- return e !== e.toLowerCase();
19
- }
20
- function N(e, t) {
21
- const r = P$1, n = [];
22
- if (!e || typeof e != "string")
23
- return n;
24
- let o = "", s, u;
25
- for (const a of e) {
26
- const c = r.includes(a);
27
- if (c === true) {
28
- n.push(o), o = "", s = void 0;
29
- continue;
30
- }
31
- const i = M(a);
32
- if (u === false) {
33
- if (s === false && i === true) {
34
- n.push(o), o = a, s = i;
35
- continue;
36
- }
37
- if (s === true && i === false && o.length > 1) {
38
- const f = o.at(-1);
39
- n.push(o.slice(0, Math.max(0, o.length - 1))), o = f + a, s = i;
40
- continue;
41
- }
42
- }
43
- o += a, s = i, u = c;
44
- }
45
- return n.push(o), n;
46
- }
47
- function k$1(e) {
48
- return e ? e[0].toUpperCase() + e.slice(1) : "";
49
- }
50
- function V(e) {
51
- return e ? e[0].toLowerCase() + e.slice(1) : "";
52
- }
53
- function K$1(e, t) {
54
- return e ? (Array.isArray(e) ? e : N(e)).map((r) => k$1(r)).join("") : "";
55
- }
56
- function q$1(e, t) {
57
- return V(K$1(e || ""));
58
- }
59
- function z$1(e, t) {
60
- return e ? (Array.isArray(e) ? e : N(e)).map((r) => r.toLowerCase()).join("-") : "";
61
- }
62
- function H(e) {
63
- return ` ${e}`;
64
- }
65
- function Q$1(e) {
66
- return e.split(`
67
- `).map((t) => H(t)).join(`
68
- `);
69
- }
70
- function J$1(e) {
71
- return e === e.toUpperCase();
72
- }
73
- function Z$1(e) {
74
- return q$1(e);
75
- }
76
- function W$1(e) {
77
- return z$1(e);
78
- }
79
- function G$1(e) {
80
- return W$1(e);
81
- }
82
- function O(e, t) {
83
- return `${e.startsWith("--") ? e : G$1(e)}: ${t};`;
84
- }
85
- function Y$1(e) {
86
- return `{${e.length > 0 ? `
87
- ` : ""}${e.map((t) => `${Q$1(`${t}`)}
88
- `).join("")}}`;
89
- }
90
- function B(e) {
91
- return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
92
- }
93
- function X$1(e, t) {
94
- return O(B(e), t);
95
- }
96
- function ee$1(e, t) {
97
- return `var(${B(e)}${t ? `, ${t}` : ""})`;
98
- }
99
- function R$1(e, t) {
100
- return `${e} ${Y$1(t)}`;
101
- }
102
- function te$1(e) {
103
- return function(r, n) {
104
- return Object.entries(r).map(([o, s]) => O(o, e(s, n)));
105
- };
106
- }
107
- function E$1(e) {
108
- return function(r, n) {
109
- const s = (n.variables?.name ?? w)({ name: r.name });
110
- return X$1(s, e(r.value, n));
111
- };
112
- }
113
- function S$1(e) {
114
- const t = E$1(e), r = te$1(e);
115
- return function(o, s, u) {
116
- const { variables: a, declarations: c, children: i } = s, f = o === ":root", l = (a ?? []).map(
117
- (A2) => t(A2, u)
118
- ), m2 = r(
119
- c ?? {},
120
- u
121
- ), y = (i ?? []).map(
122
- (A2) => e(A2, u)
123
- ), p = l.length > 0, b = m2.length > 0, C2 = y.length > 0;
124
- return f ? `${p || b ? R$1(o, [
125
- ...l,
126
- ...p && b ? [""] : [],
127
- ...m2
128
- ]) : ""}${C2 && (p || b) ? `
129
-
130
- ` : ""}${y.join(`
131
-
132
- `)}` : R$1(o, [
133
- ...l,
134
- ...p && (C2 || b) ? [""] : [],
135
- ...m2,
136
- ...b && C2 ? [""] : [],
137
- ...y.flatMap(
138
- (A2, _) => _ === y.length - 1 ? [A2] : [A2, ""]
139
- )
140
- ]);
141
- };
142
- }
143
- function re$1(e) {
144
- const t = S$1(e);
145
- return function(n, o) {
146
- const s = F$1.includes(n.identifier), u = L$1.includes(
147
- n.identifier
148
- ), a = Object.keys(n.declarations).length > 0, c = n.variables.length > 0, i = n.children.length > 0, f = I$1(n.identifier, n.rule);
149
- return s || u && !(a || c || i) ? `${f};` : t(f, n, o);
150
- };
151
- }
152
- function ne$1(e) {
153
- return function(r, n) {
154
- return r.value.map((o) => e(o, n)).join("").trim();
155
- };
156
- }
157
- function oe(e) {
158
- return typeof e == "object" && e !== null;
159
- }
160
- function h(e, t) {
161
- return oe(e) && "type" in e && e.type === t;
162
- }
163
- function ce$1(e) {
164
- return h(e, "variable");
165
- }
166
- function ue$1(e) {
167
- return h(e, "reference");
168
- }
169
- function v$1(e) {
170
- return h(e, "selector");
171
- }
172
- function ie(e) {
173
- return h(e, "at-rule");
174
- }
175
- function se(e) {
176
- return h(e, "utility");
177
- }
178
- function ae$1(e) {
179
- return h(e, "css");
180
- }
181
- function le$1(e) {
182
- return h(e, "theme");
183
- }
184
- function T$1(e) {
185
- return h(e, "root");
186
- }
187
- function fe$1(e) {
188
- return h(e, "recipe");
189
- }
190
- function me$1(e) {
191
- return e.charAt(0).toUpperCase() + e.slice(1);
192
- }
193
- function g(e) {
194
- if (e instanceof Buffer)
195
- return Buffer.from(e);
196
- const t = e.constructor;
197
- return new t(
198
- e.buffer.slice(0),
199
- e.byteOffset,
200
- e.byteLength / e.BYTES_PER_ELEMENT || 1
201
- );
202
- }
203
- function pe$1(e) {
204
- if (e = e || {}, e.circular)
205
- return ye$1(e);
206
- const t = /* @__PURE__ */ new Map();
207
- if (t.set(Date, (u) => new Date(u)), t.set(
208
- Map,
209
- (u, a) => new Map(n(Array.from(u), a))
210
- ), t.set(
211
- Set,
212
- (u, a) => new Set(n(Array.from(u), a))
213
- ), e.constructorHandlers)
214
- for (const u of e.constructorHandlers)
215
- t.set(u[0], u[1]);
216
- let r;
217
- return e.proto ? s : o;
218
- function n(u, a) {
219
- const c = Object.keys(u), i = Array.from({ length: c.length });
220
- for (let f = 0; f < c.length; f++) {
221
- const l = c[f], m2 = u[l];
222
- typeof m2 != "object" || m2 === null ? i[l] = m2 : m2.constructor !== Object && (r = t.get(m2.constructor)) ? i[l] = r(m2, a) : ArrayBuffer.isView(m2) ? i[l] = g(m2) : i[l] = a(m2);
223
- }
224
- return i;
225
- }
226
- function o(u) {
227
- if (typeof u != "object" || u === null) return u;
228
- if (Array.isArray(u)) return n(u, o);
229
- if (u.constructor !== Object && (r = t.get(u.constructor)))
230
- return r(u, o);
231
- const a = {};
232
- for (const c in u) {
233
- if (Object.hasOwnProperty.call(u, c) === false) continue;
234
- const i = u[c];
235
- typeof i != "object" || i === null ? a[c] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[c] = r(i, o) : ArrayBuffer.isView(i) ? a[c] = g(i) : a[c] = o(i);
236
- }
237
- return a;
238
- }
239
- function s(u) {
240
- if (typeof u != "object" || u === null) return u;
241
- if (Array.isArray(u)) return n(u, s);
242
- if (u.constructor !== Object && (r = t.get(u.constructor)))
243
- return r(u, s);
244
- const a = {};
245
- for (const c in u) {
246
- const i = u[c];
247
- typeof i != "object" || i === null ? a[c] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[c] = r(i, s) : ArrayBuffer.isView(i) ? a[c] = g(i) : a[c] = s(i);
248
- }
249
- return a;
250
- }
251
- }
252
- function ye$1(e) {
253
- const t = [], r = [], n = /* @__PURE__ */ new Map();
254
- if (n.set(Date, (c) => new Date(c)), n.set(
255
- Map,
256
- (c, i) => new Map(s(Array.from(c), i))
257
- ), n.set(
258
- Set,
259
- (c, i) => new Set(s(Array.from(c), i))
260
- ), e.constructorHandlers)
261
- for (const c of e.constructorHandlers)
262
- n.set(c[0], c[1]);
263
- let o;
264
- return e.proto ? a : u;
265
- function s(c, i) {
266
- const f = Object.keys(c), l = Array.from({ length: f.length });
267
- for (let m2 = 0; m2 < f.length; m2++) {
268
- const y = f[m2], p = c[y];
269
- if (typeof p != "object" || p === null)
270
- l[y] = p;
271
- else if (p.constructor !== Object && (o = n.get(p.constructor)))
272
- l[y] = o(p, i);
273
- else if (ArrayBuffer.isView(p))
274
- l[y] = g(p);
275
- else {
276
- const b = t.indexOf(p);
277
- b !== -1 ? l[y] = r[b] : l[y] = i(p);
278
- }
279
- }
280
- return l;
281
- }
282
- function u(c) {
283
- if (typeof c != "object" || c === null) return c;
284
- if (Array.isArray(c)) return s(c, u);
285
- if (c.constructor !== Object && (o = n.get(c.constructor)))
286
- return o(c, u);
287
- const i = {};
288
- t.push(c), r.push(i);
289
- for (const f in c) {
290
- if (Object.hasOwnProperty.call(c, f) === false) continue;
291
- const l = c[f];
292
- if (typeof l != "object" || l === null)
293
- i[f] = l;
294
- else if (l.constructor !== Object && (o = n.get(l.constructor)))
295
- i[f] = o(l, u);
296
- else if (ArrayBuffer.isView(l))
297
- i[f] = g(l);
298
- else {
299
- const m2 = t.indexOf(l);
300
- m2 !== -1 ? i[f] = r[m2] : i[f] = u(l);
301
- }
302
- }
303
- return t.pop(), r.pop(), i;
304
- }
305
- function a(c) {
306
- if (typeof c != "object" || c === null) return c;
307
- if (Array.isArray(c)) return s(c, a);
308
- if (c.constructor !== Object && (o = n.get(c.constructor)))
309
- return o(c, a);
310
- const i = {};
311
- t.push(c), r.push(i);
312
- for (const f in c) {
313
- const l = c[f];
314
- if (typeof l != "object" || l === null)
315
- i[f] = l;
316
- else if (l.constructor !== Object && (o = n.get(l.constructor)))
317
- i[f] = o(l, a);
318
- else if (ArrayBuffer.isView(l))
319
- i[f] = g(l);
320
- else {
321
- const m2 = t.indexOf(l);
322
- m2 !== -1 ? i[f] = r[m2] : i[f] = a(l);
323
- }
324
- }
325
- return t.pop(), r.pop(), i;
326
- }
327
- }
328
- pe$1();
329
- function de$1(e) {
330
- return function(r, n) {
331
- return r != null ? `${r}` : "";
332
- };
333
- }
334
- function he(e) {
335
- return function(r, n) {
336
- const s = (n.variables?.name ?? w)({ name: r.name });
337
- return ee$1(
338
- s,
339
- r.fallback ? e(r.fallback, n) : void 0
340
- );
341
- };
342
- }
343
- function be(e) {
344
- const t = S$1(e);
345
- return function(n, o) {
346
- return n.themes.reduce(
347
- (s, u) => (s.push(e(u, o)), s),
348
- [t(":root", n, o)]
349
- // Default theme (root)
350
- ).join(`
351
-
352
- `);
353
- };
354
- }
355
- function Ae$1(e) {
356
- const t = S$1(e);
357
- return function(n, o) {
358
- return t(n.query, n, o);
359
- };
360
- }
361
- function ge$1(e) {
362
- const t = S$1(e);
363
- return function(n, o) {
364
- const u = (o.themes?.selector ?? D)({ name: n.name });
365
- return t(u, n, o);
366
- };
367
- }
368
- function Se(e) {
369
- const t = S$1(e);
370
- return function(n, o) {
371
- const s = [], a = (o.utilities?.selector ?? x$1)({
372
- name: n.name,
373
- value: n.value,
374
- modifiers: n.modifiers
375
- });
376
- return s.push(t(a, n, o)), s.join(`
377
-
378
- `);
379
- };
380
- }
381
- function d(e, t) {
382
- const r = be(d), n = Ae$1(d), o = Se(d), s = re$1(d), u = ge$1(d), a = E$1(d), c = he(d), i = ne$1(d), f = de$1();
383
- switch (true) {
384
- case v$1(e):
385
- return n(e, t);
386
- case se(e):
387
- return o(e, t);
388
- case ie(e):
389
- return s(e, t);
390
- case T$1(e):
391
- return r(e, t);
392
- case le$1(e):
393
- return u(e, t);
394
- case ce$1(e):
395
- return a(e, t);
396
- case ue$1(e):
397
- return c(e, t);
398
- case ae$1(e):
399
- return i(e, t);
400
- default:
401
- return f(e, t);
402
- }
403
- }
404
- function Ce(e) {
405
- return function(r, n) {
406
- let o = r._exportName;
407
- o || (o = Z$1(r.name), r.name[0] && J$1(r.name[0]) && (o = me$1(o)));
408
- const s = `${o}Recipe`, u = r._runtime ?? {};
409
- return `const ${s} = ${JSON.stringify(
410
- u,
411
- null,
412
- 4
413
- )} as const satisfies RecipeRuntime;
414
-
415
- export const ${o} = createRecipe("${r.name}", ${s});
416
- `;
417
- };
418
- }
419
- function je(e) {
420
- return e.filter(
421
- (t) => v$1(t) && !!t._exportName
422
- );
423
- }
424
- function ve(e) {
425
- return function(r, n) {
426
- const o = je(r.children), s = r.recipes.length > 0, u = o.length > 0;
427
- if (!s && !u)
428
- return "";
429
- const a = [];
430
- return s && (a.push(`import { createRecipe } from '@styleframe/runtime';
431
- import type { RecipeRuntime } from '@styleframe/runtime';
432
- `), a.push(e(r.recipes, n))), u && a.push(e(o, n)), a.join(`
433
- `);
434
- };
435
- }
436
- function Re$1(e) {
437
- return function(r, n) {
438
- return r._exportName ? `export const ${r._exportName} = ${JSON.stringify(r.query)};
439
- ` : "";
440
- };
441
- }
442
- function j$1(e, t) {
443
- const r = ve(j$1), n = Ce(), o = Re$1();
444
- switch (true) {
445
- case Array.isArray(e):
446
- return e.map((s) => j$1(s, t)).join(`
447
- `);
448
- case T$1(e):
449
- return r(e, t);
450
- case fe$1(e):
451
- return n(e, t);
452
- case v$1(e):
453
- return o(e, t);
454
- default:
455
- return "";
456
- }
457
- }
458
- const $e = `-----BEGIN PUBLIC KEY-----
459
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
460
- qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
461
- BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
462
- dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
463
- hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
464
- 4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
465
- GwIDAQAB
466
- -----END PUBLIC KEY-----`, we = "__licenseRequired", Ne = "__licenseValidated";
467
- async function Oe(e) {
468
- const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (n) => n.charCodeAt(0));
469
- return await crypto.subtle.importKey(
470
- "spki",
471
- r,
472
- {
473
- name: "RSASSA-PKCS1-v1_5",
474
- hash: "SHA-256"
475
- },
476
- true,
477
- ["verify"]
478
- );
479
- }
480
- async function Be({
481
- payload: e,
482
- signature: t
483
- }) {
484
- const r = new TextEncoder().encode(e), n = Uint8Array.from(
485
- atob(t),
486
- (s) => s.charCodeAt(0)
487
- ), o = await Oe($e);
488
- if (!await crypto.subtle.verify(
489
- { name: "RSASSA-PKCS1-v1_5" },
490
- o,
491
- n,
492
- r
493
- ))
494
- throw new Error(
495
- "License validation failed: Invalid signature detected. The license may have been modified or corrupted."
496
- );
497
- return JSON.parse(e);
498
- }
499
- function Ee(e) {
500
- return Object.prototype.hasOwnProperty.call(e, we);
501
- }
502
- async function Te(e) {
503
- const t = Object.getOwnPropertyDescriptor(
504
- e,
505
- Ne
506
- );
507
- if (!t?.value)
508
- return {
509
- key: "",
510
- instanceId: "",
511
- environment: "",
512
- valid: false
513
- };
514
- const r = t.value;
515
- if (typeof r != "object" || r === null || !("payload" in r) || !("signature" in r) || typeof r.payload != "string" || typeof r.signature != "string")
516
- return {
517
- key: "",
518
- instanceId: "",
519
- environment: "",
520
- valid: false
521
- };
1
+ import { stat as E, rm as x, mkdir as j, writeFile as v } from "node:fs/promises";
2
+ import s from "node:path";
3
+ import { transpile as g } from "@styleframe/transpiler";
4
+ import { validateInstanceLicense as C, getLicenseKeyFromEnv as S } from "@styleframe/license";
5
+ import { isRecipe as b, isSelector as O, isStyleframe as $, styleframe as D } from "@styleframe/core";
6
+ import { watch as J } from "chokidar";
7
+ import { existsSync as l } from "node:fs";
8
+ import { createJiti as m } from "jiti";
9
+ async function u(i) {
522
10
  try {
523
- return await Be(
524
- r
525
- );
11
+ return (await E(i)).isDirectory();
526
12
  } catch {
527
- return {
528
- key: "",
529
- instanceId: "",
530
- environment: "",
531
- valid: false
532
- };
13
+ return !1;
533
14
  }
534
15
  }
535
- function _e(e) {
536
- const t = Math.floor(Math.random() * 100);
537
- e.root.children.push({
538
- type: "selector",
539
- query: `html:nth-of-type(${t}n+1)::after`,
540
- variables: [],
541
- children: [],
542
- declarations: {
543
- content: '"Styleframe Pro: Development Mode – License required for production use"',
544
- zIndex: 99999,
545
- position: "fixed",
546
- display: "block !important",
547
- opacity: "1 !important",
548
- bottom: 0,
549
- left: 0,
550
- background: "rgba(0, 0, 0, 0.5)",
551
- color: "white",
552
- fontSize: "12px",
553
- lineHeight: "1",
554
- padding: "0.5rem",
555
- fontFamily: "sans-serif"
556
- }
557
- });
558
- }
559
- function $(e, t = "") {
560
- return {
561
- name: e,
562
- content: t
563
- };
564
- }
565
- async function Le(e, {
566
- type: t = "all",
567
- consumers: r = { css: d, ts: j$1 }
568
- } = {}) {
569
- const n = { files: [] }, o = e.options;
570
- if (Ee(e)) {
571
- const s = await Te(e);
572
- (!s.valid || s.instanceId !== e.id) && _e(e);
573
- }
574
- if (t === "all" || t === "css") {
575
- const s = $(
576
- "index.css",
577
- r.css(e.root, o)
578
- );
579
- n.files.push(s);
580
- }
581
- if (t === "all" || t === "ts") {
582
- const s = $(
583
- "index.ts",
584
- r.ts(e.root, o)
585
- );
586
- n.files.push(s);
587
- }
588
- return n;
589
- }
590
- async function directoryExists(path2) {
591
- try {
592
- const stats = await stat(path2);
593
- return stats.isDirectory();
594
- } catch {
595
- return false;
596
- }
597
- }
598
- async function build(instance, { clean = true, outputDir = "./styleframe", transpiler } = {}) {
599
- await validateInstanceLicense(instance, {
600
- licenseKey: getLicenseKeyFromEnv() || "",
16
+ async function T(i, { clean: t = !0, outputDir: e = "./styleframe", transpiler: o } = {}) {
17
+ await C(i, {
18
+ licenseKey: S() || "",
601
19
  environment: process.env.NODE_ENV || "development",
602
- isBuild: true
20
+ isBuild: !0
21
+ });
22
+ const n = await g(i, o), a = await u(e);
23
+ t && a && await x(e, { recursive: !0 });
24
+ for (const r of n.files) {
25
+ const c = s.join(e, r.name), f = s.dirname(c);
26
+ await u(f) || await j(f, { recursive: !0 }), await v(c, r.content);
27
+ }
28
+ }
29
+ function p(i, t) {
30
+ return m(i, {
31
+ fsCache: !1,
32
+ moduleCache: !1,
33
+ alias: t
603
34
  });
604
- const output = await Le(instance, transpiler);
605
- const outputDirExists = await directoryExists(outputDir);
606
- if (clean && outputDirExists) {
607
- await rm(outputDir, { recursive: true });
608
- }
609
- for (const file of output.files) {
610
- const filePath = path.join(outputDir, file.name);
611
- const fileOutputDirPath = path.dirname(filePath);
612
- const fileOutputDirExists = await directoryExists(fileOutputDirPath);
613
- if (!fileOutputDirExists) {
614
- await mkdir(fileOutputDirPath, { recursive: true });
615
- }
616
- await writeFile(filePath, file.content);
617
- }
618
- }
619
- function K(e) {
620
- return typeof e == "object" && e !== null;
621
- }
622
- function m(e, r) {
623
- return K(e) && "type" in e && e.type === r;
624
- }
625
- function L(e) {
626
- return m(e, "variable");
627
- }
628
- function A(e) {
629
- return m(e, "reference");
630
- }
631
- function ge(e) {
632
- return m(e, "selector");
633
- }
634
- function q(e) {
635
- return m(e, "modifier");
636
- }
637
- function E(e) {
638
- return m(e, "css");
639
- }
640
- function Ae(e) {
641
- return m(e, "recipe");
642
- }
643
- function G(e) {
644
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
645
- }
646
- function U(e) {
647
- return G(e) || A(e) || E(e) || Array.isArray(e) && e.every(U);
648
- }
649
- function I(e) {
650
- return K(e) && "children" in e && "declarations" in e && "variables" in e;
651
- }
652
- function z(e = (r) => r) {
653
- return (r) => {
654
- let n = r, t;
655
- if (typeof n == "string" && n[0] === "@") {
656
- const i = n.slice(1);
657
- t = e(i), n = {
658
- type: "reference",
659
- name: i
660
- };
661
- } else A(n) ? t = e(n.name) : t = `[${r}]`;
662
- return {
663
- [t]: n
664
- };
665
- };
666
- }
667
- function W(e, r) {
668
- return function(t, ...i) {
669
- return {
670
- type: "css",
671
- value: t.reduce((o, u, s) => (o.push(u), s < i.length && o.push(i[s]), o), [])
672
- };
673
- };
674
- }
675
- function S(e, r) {
676
- return function(t, i, c) {
677
- const o = {
678
- type: "at-rule",
679
- identifier: t,
680
- rule: i,
681
- declarations: {},
682
- variables: [],
683
- children: []
684
- }, u = v(o, r);
685
- return typeof c == "function" ? o.declarations = c(u) ?? {} : c && (o.declarations = c), k(o.declarations, u), e.children.push(o), o;
686
- };
687
- }
688
- function Y(e, r) {
689
- const n = S(e, r);
690
- return function(i, c) {
691
- return n("media", i, c);
692
- };
693
- }
694
- function Z(e, r) {
695
- const n = S(e, r);
696
- return function(i, c) {
697
- return n("keyframes", i, c);
698
- };
699
- }
700
- function J(e, r) {
701
- return function(t, i) {
702
- return L(t) ? {
703
- type: "reference",
704
- name: t.name,
705
- fallback: i
706
- } : {
707
- type: "reference",
708
- name: t,
709
- fallback: i
710
- };
711
- };
712
- }
713
- function Q(e, r) {
714
- return function(t, i) {
715
- const c = {
716
- type: "selector",
717
- query: t,
718
- declarations: {},
719
- variables: [],
720
- children: []
721
- }, o = v(c, r);
722
- return typeof i == "function" ? c.declarations = i(o) ?? {} : I(i) ? (c.variables = i.variables, c.declarations = i.declarations, c.children = i.children) : c.declarations = i, k(c.declarations, o), e.children.push(c), c;
723
- };
724
- }
725
- function X(e, r) {
726
- return function(t, i, c = {
727
- default: false
728
- }) {
729
- const o = typeof t == "string" ? t : t.name, u = e.variables.find(
730
- (f) => f.name === o
731
- );
732
- if (c.default && u)
733
- return u;
734
- if (u)
735
- return u.value = i, u;
736
- const s = {
737
- type: "variable",
738
- name: o,
739
- value: i
740
- };
741
- return e.variables.push(s), s;
742
- };
743
- }
744
- function v(e, r) {
745
- const n = X(e), t = Q(e, r), i = S(e, r), c = Z(r, r), o = Y(e, r), u = J(), s = W();
746
- return {
747
- variable: n,
748
- selector: t,
749
- keyframes: c,
750
- atRule: i,
751
- media: o,
752
- ref: u,
753
- css: s
754
- };
755
- }
756
- function k(e, r) {
757
- for (const n in e)
758
- if (n.startsWith("@")) {
759
- const t = e[n];
760
- if (typeof t == "object" && t !== null && !U(t)) {
761
- const i = n.replace(/^@(\w+).*/, "$1"), c = n.replace(`@${i}`, "").trim();
762
- r.atRule(i, c, t), delete e[n];
763
- }
764
- } else if (/^[.&:]/.test(n)) {
765
- const t = e[n];
766
- typeof t == "object" && (r.selector(n, t), delete e[n]);
767
- }
768
- return e;
769
- }
770
- function j(e) {
771
- if (e instanceof Buffer)
772
- return Buffer.from(e);
773
- const r = e.constructor;
774
- return new r(
775
- e.buffer.slice(0),
776
- e.byteOffset,
777
- e.byteLength / e.BYTES_PER_ELEMENT || 1
778
- );
779
- }
780
- function ee(e) {
781
- if (e = e || {}, e.circular)
782
- return te(e);
783
- const r = /* @__PURE__ */ new Map();
784
- if (r.set(Date, (o) => new Date(o)), r.set(
785
- Map,
786
- (o, u) => new Map(t(Array.from(o), u))
787
- ), r.set(
788
- Set,
789
- (o, u) => new Set(t(Array.from(o), u))
790
- ), e.constructorHandlers)
791
- for (const o of e.constructorHandlers)
792
- r.set(o[0], o[1]);
793
- let n;
794
- return e.proto ? c : i;
795
- function t(o, u) {
796
- const s = Object.keys(o), f = Array.from({ length: s.length });
797
- for (let l = 0; l < s.length; l++) {
798
- const a = s[l], y = o[a];
799
- typeof y != "object" || y === null ? f[a] = y : y.constructor !== Object && (n = r.get(y.constructor)) ? f[a] = n(y, u) : ArrayBuffer.isView(y) ? f[a] = j(y) : f[a] = u(y);
800
- }
801
- return f;
802
- }
803
- function i(o) {
804
- if (typeof o != "object" || o === null) return o;
805
- if (Array.isArray(o)) return t(o, i);
806
- if (o.constructor !== Object && (n = r.get(o.constructor)))
807
- return n(o, i);
808
- const u = {};
809
- for (const s in o) {
810
- if (Object.hasOwnProperty.call(o, s) === false) continue;
811
- const f = o[s];
812
- typeof f != "object" || f === null ? u[s] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[s] = n(f, i) : ArrayBuffer.isView(f) ? u[s] = j(f) : u[s] = i(f);
813
- }
814
- return u;
815
- }
816
- function c(o) {
817
- if (typeof o != "object" || o === null) return o;
818
- if (Array.isArray(o)) return t(o, c);
819
- if (o.constructor !== Object && (n = r.get(o.constructor)))
820
- return n(o, c);
821
- const u = {};
822
- for (const s in o) {
823
- const f = o[s];
824
- typeof f != "object" || f === null ? u[s] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[s] = n(f, c) : ArrayBuffer.isView(f) ? u[s] = j(f) : u[s] = c(f);
825
- }
826
- return u;
827
- }
828
- }
829
- function te(e) {
830
- const r = [], n = [], t = /* @__PURE__ */ new Map();
831
- if (t.set(Date, (s) => new Date(s)), t.set(
832
- Map,
833
- (s, f) => new Map(c(Array.from(s), f))
834
- ), t.set(
835
- Set,
836
- (s, f) => new Set(c(Array.from(s), f))
837
- ), e.constructorHandlers)
838
- for (const s of e.constructorHandlers)
839
- t.set(s[0], s[1]);
840
- let i;
841
- return e.proto ? u : o;
842
- function c(s, f) {
843
- const l = Object.keys(s), a = Array.from({ length: l.length });
844
- for (let y = 0; y < l.length; y++) {
845
- const p = l[y], d2 = s[p];
846
- if (typeof d2 != "object" || d2 === null)
847
- a[p] = d2;
848
- else if (d2.constructor !== Object && (i = t.get(d2.constructor)))
849
- a[p] = i(d2, f);
850
- else if (ArrayBuffer.isView(d2))
851
- a[p] = j(d2);
852
- else {
853
- const h2 = r.indexOf(d2);
854
- h2 !== -1 ? a[p] = n[h2] : a[p] = f(d2);
855
- }
856
- }
857
- return a;
858
- }
859
- function o(s) {
860
- if (typeof s != "object" || s === null) return s;
861
- if (Array.isArray(s)) return c(s, o);
862
- if (s.constructor !== Object && (i = t.get(s.constructor)))
863
- return i(s, o);
864
- const f = {};
865
- r.push(s), n.push(f);
866
- for (const l in s) {
867
- if (Object.hasOwnProperty.call(s, l) === false) continue;
868
- const a = s[l];
869
- if (typeof a != "object" || a === null)
870
- f[l] = a;
871
- else if (a.constructor !== Object && (i = t.get(a.constructor)))
872
- f[l] = i(a, o);
873
- else if (ArrayBuffer.isView(a))
874
- f[l] = j(a);
875
- else {
876
- const y = r.indexOf(a);
877
- y !== -1 ? f[l] = n[y] : f[l] = o(a);
878
- }
879
- }
880
- return r.pop(), n.pop(), f;
881
- }
882
- function u(s) {
883
- if (typeof s != "object" || s === null) return s;
884
- if (Array.isArray(s)) return c(s, u);
885
- if (s.constructor !== Object && (i = t.get(s.constructor)))
886
- return i(s, u);
887
- const f = {};
888
- r.push(s), n.push(f);
889
- for (const l in s) {
890
- const a = s[l];
891
- if (typeof a != "object" || a === null)
892
- f[l] = a;
893
- else if (a.constructor !== Object && (i = t.get(a.constructor)))
894
- f[l] = i(a, u);
895
- else if (ArrayBuffer.isView(a))
896
- f[l] = j(a);
897
- else {
898
- const y = r.indexOf(a);
899
- y !== -1 ? f[l] = n[y] : f[l] = u(a);
900
- }
901
- }
902
- return r.pop(), n.pop(), f;
903
- }
904
- }
905
- const R = ee();
906
- function ne(e, r = 8) {
907
- const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
908
- let t = "";
909
- for (let i = 0; i < r; i++) {
910
- const c = Math.floor(Math.random() * n.length);
911
- t += n[c];
912
- }
913
- return e ? `${e}${t}` : t;
914
- }
915
- function re(e, r) {
916
- const n = e.modifiers.find(
917
- (t) => t.key.includes(r)
918
- );
919
- if (!n)
920
- throw new Error(`Modifier "${r}" not found`);
921
- return n;
922
- }
923
- function ce(e) {
924
- const r = [];
925
- function n(t, i) {
926
- i.length > 0 && r.push([...i].sort());
927
- for (let c = t; c < e.length; c++) {
928
- const o = e[c];
929
- if (o)
930
- if (o.length === 1 && o[0])
931
- n(c + 1, [...i, o[0]]);
932
- else
933
- for (const u of o)
934
- n(c + 1, [...i, u]);
935
- }
936
- }
937
- return n(0, []), r.sort((t, i) => t.length !== i.length ? t.length - i.length : t.join(",").localeCompare(i.join(",")));
938
- }
939
- function fe(e, r, n) {
940
- const t = {
941
- ...e,
942
- modifiers: [...n.keys()]
943
- }, i = v(t, r);
944
- for (const c of n.values())
945
- c.factory({
946
- ...i,
947
- declarations: R(t.declarations),
948
- variables: R(t.variables),
949
- children: R(t.children)
950
- }), k(t.declarations, i);
951
- return t;
952
- }
953
- function ue(e, r) {
954
- return function(t, i) {
955
- const c = {
956
- type: "modifier",
957
- key: Array.isArray(t) ? t : [t],
958
- factory: i
959
- };
960
- return r.modifiers.push(c), c;
961
- };
962
- }
963
- function ae() {
964
- return {
965
- type: "root",
966
- declarations: {},
967
- utilities: [],
968
- modifiers: [],
969
- recipes: [],
970
- variables: [],
971
- children: [],
972
- themes: []
973
- };
974
- }
975
- function le(e, r) {
976
- return function(t, i, c = {}) {
977
- const o = {
978
- type: "utility",
979
- name: t,
980
- factory: i,
981
- values: [],
982
- autogenerate: c.autogenerate ?? z(),
983
- create: (u, s = []) => {
984
- let f = u;
985
- if (Array.isArray(u)) {
986
- f = {};
987
- for (const l of u) {
988
- const a = o.autogenerate(l);
989
- f = {
990
- ...f,
991
- ...a
992
- };
993
- }
994
- }
995
- for (const [l, a] of Object.entries(f)) {
996
- const y = o.values.find(
997
- (h2) => h2.key === l && h2.modifiers.length === 0
998
- ), p = {
999
- type: "utility",
1000
- name: t,
1001
- value: l,
1002
- declarations: {},
1003
- variables: [],
1004
- children: [],
1005
- modifiers: []
1006
- }, d2 = v(
1007
- p,
1008
- r
1009
- );
1010
- if (p.declarations = i({
1011
- ...d2,
1012
- value: a
1013
- }) ?? {}, k(p.declarations, d2), y || (o.values.push({
1014
- key: l,
1015
- value: a,
1016
- modifiers: []
1017
- }), e.children.push(p)), s && s.length > 0) {
1018
- const h2 = s.map((g2) => g2.key), H2 = ce(h2).filter((g2) => !o.values.find(
1019
- (b) => b.key === l && b.modifiers.length === g2.length && b.modifiers.every((w2) => g2.includes(w2))
1020
- )).reduce((g2, b) => {
1021
- const w2 = /* @__PURE__ */ new Map();
1022
- for (const $2 of b) {
1023
- const V2 = s.find(
1024
- (N2) => N2.key.includes($2)
1025
- );
1026
- V2 && q(V2) && w2.set($2, V2);
1027
- }
1028
- return o.values.push({
1029
- key: l,
1030
- value: a,
1031
- modifiers: b
1032
- }), g2.push(fe(p, r, w2)), g2;
1033
- }, []);
1034
- e.children.push(...H2);
1035
- }
1036
- }
1037
- }
1038
- };
1039
- return r.utilities.push(o), o.create;
1040
- };
1041
- }
1042
- function ye(e, r) {
1043
- return function(t, i) {
1044
- const c = r.themes.find((s) => s.name === t), o = c ?? {
1045
- type: "theme",
1046
- name: t,
1047
- declarations: {},
1048
- variables: [],
1049
- children: []
1050
- };
1051
- c || r.themes.push(o);
1052
- const u = v(o, r);
1053
- return i && i(u), o;
1054
- };
1055
- }
1056
- function de(e, r) {
1057
- return function(t) {
1058
- const i = {
1059
- type: "recipe",
1060
- ...t
1061
- };
1062
- return i._runtime = pe(i, r), me(i, r), r.recipes.push(i), i;
1063
- };
1064
- }
1065
- function C(e, r) {
1066
- const n = e.autogenerate(r);
1067
- return Object.keys(n)[0] ?? "default";
1068
- }
1069
- function F(e, r) {
1070
- const n = {};
1071
- for (const [t, i] of Object.entries(e))
1072
- if (P(i)) {
1073
- const c = {};
1074
- for (const [o, u] of Object.entries(i)) {
1075
- const s = T(r, o);
1076
- s ? c[o] = C(
1077
- s,
1078
- u
1079
- ) : console.warn(
1080
- `[styleframe] Utility "${o}" not found in registry. Skipping runtime generation for this declaration.`
1081
- );
1082
- }
1083
- n[t] = c;
1084
- } else if (typeof i == "boolean")
1085
- n[t] = i;
1086
- else {
1087
- const c = T(r, t);
1088
- c ? n[t] = C(c, i) : console.warn(
1089
- `[styleframe] Utility "${t}" not found in registry. Skipping runtime generation for this declaration.`
1090
- );
1091
- }
1092
- return n;
1093
- }
1094
- function pe(e, r) {
1095
- const n = {};
1096
- if (e.base && (n.base = F(e.base, r)), e.variants) {
1097
- const t = {};
1098
- for (const [i, c] of Object.entries(e.variants)) {
1099
- const o = {};
1100
- for (const [u, s] of Object.entries(
1101
- c
1102
- ))
1103
- s == null ? o[u] = null : o[u] = F(
1104
- s,
1105
- r
1106
- );
1107
- t[i] = o;
1108
- }
1109
- n.variants = t;
1110
- }
1111
- return e.defaultVariants && (n.defaultVariants = { ...e.defaultVariants }), e.compoundVariants && (n.compoundVariants = e.compoundVariants.map((t) => ({
1112
- match: { ...t.match },
1113
- css: F(t.css, r)
1114
- }))), n;
1115
- }
1116
- function P(e) {
1117
- return !A(e) && typeof e == "object" && e !== null;
1118
- }
1119
- function x(e, r) {
1120
- const n = (t, i, c) => {
1121
- let o = r.get(t);
1122
- o || (o = [], r.set(t, o)), o.push({ value: i, modifiers: c });
1123
- };
1124
- for (const [t, i] of Object.entries(e))
1125
- if (P(i)) {
1126
- const c = t.split(":");
1127
- for (const [o, u] of Object.entries(i))
1128
- n(o, u, c);
1129
- } else
1130
- n(t, i, []);
1131
- }
1132
- function T(e, r) {
1133
- const n = e.utilities.find((i) => i.name === r);
1134
- if (n)
1135
- return n;
1136
- const t = r.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
1137
- return e.utilities.find((i) => i.name === t);
1138
35
  }
1139
- function me(e, r) {
1140
- const n = /* @__PURE__ */ new Map();
1141
- if (e.base && x(e.base, n), e.variants)
1142
- for (const i of Object.values(e.variants))
1143
- for (const c of Object.values(i))
1144
- x(
1145
- c,
1146
- n
1147
- );
1148
- if (e.compoundVariants)
1149
- for (const i of e.compoundVariants)
1150
- i.css && x(i.css, n);
36
+ function w(i) {
1151
37
  const t = /* @__PURE__ */ new Map();
1152
- for (const [i, c] of n) {
1153
- const o = T(r, i);
1154
- if (!o) {
1155
- console.warn(
1156
- `[styleframe] Utility "${i}" not found in registry. Skipping.`
1157
- );
1158
- continue;
1159
- }
1160
- for (const u of c) {
1161
- const s = [];
1162
- for (const f of u.modifiers) {
1163
- if (!t.has(f))
1164
- try {
1165
- t.set(f, re(r, f));
1166
- } catch {
1167
- console.warn(
1168
- `[styleframe] Modifier "${f}" not found in registry. Skipping modifier for utility "${i}".`
1169
- ), t.set(f, null);
1170
- }
1171
- const l = t.get(f);
1172
- l && s.push(l);
1173
- }
1174
- o.create(
1175
- [u.value],
1176
- s.length > 0 ? s : void 0
1177
- );
1178
- }
38
+ for (const [e, o] of Object.entries(i)) {
39
+ if (e === "default") continue;
40
+ let n = null;
41
+ b(o) ? (n = "recipe", o._exportName = e) : O(o) && (n = "selector", o._exportName = e), n && t.set(e, { name: e, type: n });
1179
42
  }
43
+ return t;
1180
44
  }
1181
- function Re(e) {
1182
- const r = ne("sf-"), n = ae(), t = { ...e }, i = le(n, n), c = ue(n, n), o = de(n, n), u = ye(n, n), { variable: s, selector: f, atRule: l, keyframes: a, media: y, ref: p, css: d2 } = v(n, n);
45
+ async function M(i, t = {}) {
46
+ const { alias: e, validateInstance: o = !0, jiti: n } = t, r = await (n ?? p(s.dirname(i), e)).import(i);
47
+ if (!r.default)
48
+ throw new Error(
49
+ `Missing default export in ${i}. Expected a Styleframe instance.`
50
+ );
51
+ if (o && !$(r.default))
52
+ throw new Error(
53
+ `Invalid default export in ${i}. Expected a Styleframe instance created with styleframe().`
54
+ );
55
+ const c = w(r);
1183
56
  return {
1184
- id: r,
1185
- root: n,
1186
- variable: s,
1187
- selector: f,
1188
- utility: i,
1189
- modifier: c,
1190
- recipe: o,
1191
- theme: u,
1192
- atRule: l,
1193
- keyframes: a,
1194
- media: y,
1195
- ref: p,
1196
- css: d2,
1197
- options: t
57
+ module: r,
58
+ instance: r.default,
59
+ exports: c
1198
60
  };
1199
61
  }
1200
- const SUPPORTED_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
1201
- function hasKnownExtension(filePath) {
1202
- return SUPPORTED_EXTENSIONS.some((ext) => filePath.endsWith(ext));
62
+ async function z(i, t = {}) {
63
+ const { alias: e, jiti: o } = t, a = await (o ?? p(s.dirname(i), e)).import(i), r = w(a);
64
+ return { module: a, exports: r };
1203
65
  }
1204
- function resolveConfigFile(cwd, entry) {
1205
- const basePath = path.isAbsolute(entry) ? entry : path.join(cwd, entry);
1206
- if (hasKnownExtension(basePath)) {
1207
- return existsSync(basePath) ? basePath : void 0;
1208
- }
1209
- for (const ext of SUPPORTED_EXTENSIONS) {
1210
- const filePath = `${basePath}${ext}`;
1211
- if (existsSync(filePath)) {
1212
- return filePath;
1213
- }
1214
- }
1215
- return void 0;
66
+ const h = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
67
+ function N(i) {
68
+ return h.some((t) => i.endsWith(t));
1216
69
  }
1217
- function trackNamedExports(module) {
1218
- for (const [exportName, exportValue] of Object.entries(module)) {
1219
- if (exportName === "default") continue;
1220
- if (Ae(exportValue)) {
1221
- exportValue._exportName = exportName;
1222
- } else if (ge(exportValue)) {
1223
- exportValue._exportName = exportName;
1224
- }
70
+ function y(i, t) {
71
+ const e = s.isAbsolute(t) ? t : s.join(i, t);
72
+ if (N(e))
73
+ return l(e) ? e : void 0;
74
+ for (const o of h) {
75
+ const n = `${e}${o}`;
76
+ if (l(n))
77
+ return n;
1225
78
  }
1226
79
  }
1227
- async function loadConfiguration({
1228
- cwd = process.cwd(),
1229
- entry = "styleframe.config"
80
+ async function d({
81
+ cwd: i = process.cwd(),
82
+ entry: t = "styleframe.config"
1230
83
  } = {}) {
1231
- const resolvedPath = resolveConfigFile(cwd, entry);
1232
- if (!resolvedPath) {
1233
- return Re();
1234
- }
1235
- const jiti = createJiti(path.dirname(resolvedPath), {
1236
- fsCache: false,
1237
- moduleCache: false
1238
- });
1239
- const module = await jiti.import(resolvedPath);
1240
- if (!module.default) {
1241
- throw new Error(
1242
- `Missing default export in ${resolvedPath}. Expected a Styleframe instance.`
1243
- );
1244
- }
1245
- trackNamedExports(module);
1246
- return module.default;
1247
- }
1248
- async function watchConfiguration({
1249
- cwd = process.cwd(),
1250
- entry = "styleframe.config",
1251
- onUpdate,
1252
- onError
84
+ const e = y(i, t);
85
+ if (!e)
86
+ return D();
87
+ const { instance: o } = await M(e);
88
+ return o;
89
+ }
90
+ async function B({
91
+ cwd: i = process.cwd(),
92
+ entry: t = "styleframe.config",
93
+ onUpdate: e,
94
+ onError: o
1253
95
  } = {}) {
1254
- const resolvedPath = resolveConfigFile(cwd, entry);
1255
- if (!resolvedPath) {
1256
- throw new Error(`Config file not found: ${entry}`);
1257
- }
1258
- const watcher = watch(resolvedPath, { ignoreInitial: true });
1259
- watcher.on("change", async () => {
96
+ const n = y(i, t);
97
+ if (!n)
98
+ throw new Error(`Config file not found: ${t}`);
99
+ const a = J(n, { ignoreInitial: !0 });
100
+ return a.on("change", async () => {
1260
101
  try {
1261
- const config = await loadConfiguration({ entry: resolvedPath });
1262
- onUpdate?.(config);
1263
- } catch (error) {
1264
- onError?.(error instanceof Error ? error : new Error(String(error)));
1265
- }
1266
- });
1267
- watcher.on("unlink", () => {
1268
- onError?.(new Error(`Config file was deleted: ${resolvedPath}`));
102
+ const r = await d({ entry: n });
103
+ e?.(r);
104
+ } catch (r) {
105
+ o?.(r instanceof Error ? r : new Error(String(r)));
106
+ }
107
+ }), a.on("unlink", () => {
108
+ o?.(new Error(`Config file was deleted: ${n}`));
109
+ }), {
110
+ config: await d({ entry: n }),
111
+ configFile: n,
112
+ unwatch: () => a.close()
113
+ };
114
+ }
115
+ function U(i = {}) {
116
+ return m(process.cwd(), {
117
+ interopDefault: !0,
118
+ moduleCache: !0,
119
+ // Enable module caching for shared dependencies
120
+ ...i
1269
121
  });
1270
- return {
1271
- config: await loadConfiguration({ entry: resolvedPath }),
1272
- configFile: resolvedPath,
1273
- unwatch: () => watcher.close()
1274
- };
122
+ }
123
+ function V(i, ...t) {
124
+ const e = i.cache;
125
+ if (e)
126
+ for (const o of t) {
127
+ const n = s.resolve(o);
128
+ typeof e == "object" && e !== null && (e instanceof Map ? (e.delete(n), e.delete(`file://${n}`)) : typeof e == "object" && (delete e[n], delete e[`file://${n}`]));
129
+ }
130
+ }
131
+ function W(i) {
132
+ const t = i.cache;
133
+ if (t) {
134
+ if (t instanceof Map)
135
+ t.clear();
136
+ else if (typeof t == "object")
137
+ for (const e of Object.keys(t))
138
+ delete t[e];
139
+ }
1275
140
  }
1276
141
  export {
1277
- build,
1278
- directoryExists,
1279
- loadConfiguration,
1280
- watchConfiguration
142
+ T as build,
143
+ W as clearAllJitiCache,
144
+ V as clearJitiCache,
145
+ p as createLoader,
146
+ U as createSharedJiti,
147
+ u as directoryExists,
148
+ d as loadConfiguration,
149
+ z as loadExtensionModule,
150
+ M as loadModule,
151
+ w as trackExports,
152
+ B as watchConfiguration
1281
153
  };