@kubb/fabric-core 0.12.0 → 0.12.2
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/{Fabric-eh92yS1R.d.ts → Fabric-dUuj_QO6.d.ts} +7 -6
- package/dist/{Fabric-BbVC650D.d.cts → Fabric-yRxItrhk.d.cts} +6 -5
- package/dist/{Root-SC_lWG_q.cjs → Root-DvQofGOy.cjs} +55 -161
- package/dist/Root-DvQofGOy.cjs.map +1 -0
- package/dist/{Root-BT59jU0W.js → Root-Y8o5WxXY.js} +51 -157
- package/dist/Root-Y8o5WxXY.js.map +1 -0
- package/dist/{defaultParser-DDFR9BTS.js → defaultParser-DCYPZf5F.js} +3 -3
- package/dist/{defaultParser-DDFR9BTS.js.map → defaultParser-DCYPZf5F.js.map} +1 -1
- package/dist/{getRelativePath-COUEoqbz.js → getRelativePath-DlmBsdV8.js} +5 -5
- package/dist/getRelativePath-DlmBsdV8.js.map +1 -0
- package/dist/index.cjs +5 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/parsers/typescript.cjs +1 -1
- package/dist/parsers/typescript.d.cts +1 -2
- package/dist/parsers/typescript.d.ts +2 -2
- package/dist/parsers/typescript.js +1 -1
- package/dist/parsers.cjs +1 -1
- package/dist/parsers.d.cts +1 -1
- package/dist/parsers.d.ts +2 -2
- package/dist/parsers.js +4 -4
- package/dist/plugins.cjs +28 -28
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +4 -4
- package/dist/plugins.js +27 -27
- package/dist/plugins.js.map +1 -1
- package/dist/{types-BI7rICUP.d.cts → types-DHjLDbT5.d.cts} +3 -3
- package/dist/{types-DpITKjSb.d.ts → types-_X71gVe5.d.ts} +4 -4
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/types.js.map +1 -1
- package/dist/{typescriptParser-qjzb2pIh.cjs → typescriptParser-3Mjce6yD.cjs} +6 -6
- package/dist/{typescriptParser-qjzb2pIh.cjs.map → typescriptParser-3Mjce6yD.cjs.map} +1 -1
- package/dist/{typescriptParser-DyosyI_A.js → typescriptParser-D8rhO8nO.js} +8 -8
- package/dist/typescriptParser-D8rhO8nO.js.map +1 -0
- package/dist/{useNodeTree-CmXKaRqq.d.cts → useNodeTree-CdlPBTwH.d.cts} +2 -2
- package/dist/{useNodeTree-DUdlgys5.d.ts → useNodeTree-vLaKh36n.d.ts} +3 -3
- package/package.json +2 -1
- package/src/KubbFile.ts +12 -9
- package/dist/Root-BT59jU0W.js.map +0 -1
- package/dist/Root-SC_lWG_q.cjs.map +0 -1
- package/dist/getRelativePath-COUEoqbz.js.map +0 -1
- package/dist/typescriptParser-DyosyI_A.js.map +0 -1
- /package/dist/{chunk-8X4u0d05.js → chunk-Cq_TCZj9.js} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { n as __name } from "./chunk-
|
|
2
|
-
import { r as trimExtName } from "./getRelativePath-
|
|
3
|
-
import { t as defaultParser } from "./defaultParser-
|
|
1
|
+
import { n as __name } from "./chunk-Cq_TCZj9.js";
|
|
2
|
+
import { r as trimExtName } from "./getRelativePath-DlmBsdV8.js";
|
|
3
|
+
import { t as defaultParser } from "./defaultParser-DCYPZf5F.js";
|
|
4
4
|
import { orderBy } from "natural-orderby";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import path from "node:path";
|
|
7
|
+
import { uniqueBy } from "remeda";
|
|
7
8
|
import pLimit from "p-limit";
|
|
8
9
|
import { EventEmitter } from "node:events";
|
|
9
10
|
|
|
@@ -79,117 +80,10 @@ function createContext(defaultValue) {
|
|
|
79
80
|
*/
|
|
80
81
|
const NodeTreeContext = createContext(null);
|
|
81
82
|
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/utilityEvaluators-D7O7U3FY.js
|
|
84
|
-
const t$2 = {
|
|
85
|
-
done: !1,
|
|
86
|
-
hasNext: !1
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/pipe-CRsqNjLF.js
|
|
91
|
-
function t$1(e, ...t$3) {
|
|
92
|
-
let a = e;
|
|
93
|
-
let o = t$3.map((e$1) => `lazy` in e$1 ? r$1(e$1) : void 0);
|
|
94
|
-
let s = 0;
|
|
95
|
-
for (; s < t$3.length;) {
|
|
96
|
-
if (o[s] === void 0 || !i(a)) {
|
|
97
|
-
let e$2 = t$3[s];
|
|
98
|
-
a = e$2(a), s += 1;
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
let e$1 = [];
|
|
102
|
-
for (let n$2 = s; n$2 < t$3.length; n$2++) {
|
|
103
|
-
let t$4 = o[n$2];
|
|
104
|
-
if (t$4 === void 0 || (e$1.push(t$4), t$4.isSingle)) break;
|
|
105
|
-
}
|
|
106
|
-
let r$2 = [];
|
|
107
|
-
for (let t$4 of a) if (n$1(t$4, r$2, e$1)) break;
|
|
108
|
-
let { isSingle: c } = e$1.at(-1);
|
|
109
|
-
a = c ? r$2[0] : r$2, s += e$1.length;
|
|
110
|
-
}
|
|
111
|
-
return a;
|
|
112
|
-
}
|
|
113
|
-
__name(t$1, "t");
|
|
114
|
-
function n$1(t$3, r$2, i$1) {
|
|
115
|
-
if (i$1.length === 0) return r$2.push(t$3), !1;
|
|
116
|
-
let a = t$3;
|
|
117
|
-
let o = t$2;
|
|
118
|
-
let s = !1;
|
|
119
|
-
for (let [e, t$4] of i$1.entries()) {
|
|
120
|
-
let { index: c, items: l } = t$4;
|
|
121
|
-
if (l.push(a), o = t$4(a, c, l), t$4.index += 1, o.hasNext) {
|
|
122
|
-
var _o$hasMany;
|
|
123
|
-
if ((_o$hasMany = o.hasMany) !== null && _o$hasMany !== void 0 ? _o$hasMany : !1) {
|
|
124
|
-
for (let t$5 of o.next) if (n$1(t$5, r$2, i$1.slice(e + 1))) return !0;
|
|
125
|
-
return s;
|
|
126
|
-
}
|
|
127
|
-
a = o.next;
|
|
128
|
-
}
|
|
129
|
-
if (!o.hasNext) break;
|
|
130
|
-
o.done && (s = !0);
|
|
131
|
-
}
|
|
132
|
-
return o.hasNext && r$2.push(a), s;
|
|
133
|
-
}
|
|
134
|
-
__name(n$1, "n");
|
|
135
|
-
function r$1(e) {
|
|
136
|
-
var _t$single;
|
|
137
|
-
let { lazy: t$3, lazyArgs: n$2 } = e;
|
|
138
|
-
let r$2 = t$3(...n$2);
|
|
139
|
-
return Object.assign(r$2, {
|
|
140
|
-
isSingle: (_t$single = t$3.single) !== null && _t$single !== void 0 ? _t$single : !1,
|
|
141
|
-
index: 0,
|
|
142
|
-
items: []
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
__name(r$1, "r");
|
|
146
|
-
function i(e) {
|
|
147
|
-
return typeof e == `string` || typeof e == `object` && !!e && Symbol.iterator in e;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/purryFromLazy-C1RBdBlx.js
|
|
152
|
-
function t(t$3, n$2) {
|
|
153
|
-
let r$2 = n$2.length - t$3.length;
|
|
154
|
-
if (r$2 === 1) {
|
|
155
|
-
let [r$3, ...i$1] = n$2;
|
|
156
|
-
return t$1(r$3, {
|
|
157
|
-
lazy: t$3,
|
|
158
|
-
lazyArgs: i$1
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
if (r$2 === 0) {
|
|
162
|
-
let r$3 = {
|
|
163
|
-
lazy: t$3,
|
|
164
|
-
lazyArgs: n$2
|
|
165
|
-
};
|
|
166
|
-
return Object.assign((t$4) => t$1(t$4, r$3), r$3);
|
|
167
|
-
}
|
|
168
|
-
throw Error(`Wrong number of arguments`);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/uniqueBy.js
|
|
173
|
-
function n(...e) {
|
|
174
|
-
return t(r, e);
|
|
175
|
-
}
|
|
176
|
-
function r(t$3) {
|
|
177
|
-
let n$2 = t$3;
|
|
178
|
-
let r$2 = /* @__PURE__ */ new Set();
|
|
179
|
-
return (t$4, i$1, a) => {
|
|
180
|
-
let o = n$2(t$4, i$1, a);
|
|
181
|
-
return r$2.has(o) ? t$2 : (r$2.add(o), {
|
|
182
|
-
done: !1,
|
|
183
|
-
hasNext: !0,
|
|
184
|
-
next: t$4
|
|
185
|
-
});
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
83
|
//#endregion
|
|
190
84
|
//#region src/createFile.ts
|
|
191
85
|
function combineSources(sources) {
|
|
192
|
-
return
|
|
86
|
+
return uniqueBy(sources, (obj) => {
|
|
193
87
|
var _ref;
|
|
194
88
|
var _obj$name;
|
|
195
89
|
var _obj$isExportable;
|
|
@@ -331,34 +225,34 @@ function createFile(file) {
|
|
|
331
225
|
}
|
|
332
226
|
|
|
333
227
|
//#endregion
|
|
334
|
-
//#region \0@oxc-project+runtime@0.
|
|
335
|
-
function _checkPrivateRedeclaration(e, t
|
|
336
|
-
if (t
|
|
228
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/checkPrivateRedeclaration.js
|
|
229
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
230
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
337
231
|
}
|
|
338
232
|
|
|
339
233
|
//#endregion
|
|
340
|
-
//#region \0@oxc-project+runtime@0.
|
|
341
|
-
function _classPrivateFieldInitSpec(e, t
|
|
342
|
-
_checkPrivateRedeclaration(e, t
|
|
234
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/classPrivateFieldInitSpec.js
|
|
235
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
236
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
343
237
|
}
|
|
344
238
|
|
|
345
239
|
//#endregion
|
|
346
|
-
//#region \0@oxc-project+runtime@0.
|
|
347
|
-
function _assertClassBrand(e, t
|
|
348
|
-
if ("function" == typeof e ? e === t
|
|
240
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/assertClassBrand.js
|
|
241
|
+
function _assertClassBrand(e, t, n) {
|
|
242
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
349
243
|
throw new TypeError("Private element is not present on this object");
|
|
350
244
|
}
|
|
351
245
|
|
|
352
246
|
//#endregion
|
|
353
|
-
//#region \0@oxc-project+runtime@0.
|
|
247
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/classPrivateFieldGet2.js
|
|
354
248
|
function _classPrivateFieldGet2(s, a) {
|
|
355
249
|
return s.get(_assertClassBrand(s, a));
|
|
356
250
|
}
|
|
357
251
|
|
|
358
252
|
//#endregion
|
|
359
|
-
//#region \0@oxc-project+runtime@0.
|
|
360
|
-
function _classPrivateFieldSet2(s, a, r
|
|
361
|
-
return s.set(_assertClassBrand(s, a), r
|
|
253
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/classPrivateFieldSet2.js
|
|
254
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
255
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
362
256
|
}
|
|
363
257
|
|
|
364
258
|
//#endregion
|
|
@@ -415,45 +309,45 @@ var AsyncEventEmitter = class {
|
|
|
415
309
|
};
|
|
416
310
|
|
|
417
311
|
//#endregion
|
|
418
|
-
//#region \0@oxc-project+runtime@0.
|
|
312
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/typeof.js
|
|
419
313
|
function _typeof(o) {
|
|
420
314
|
"@babel/helpers - typeof";
|
|
421
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o
|
|
422
|
-
return typeof o
|
|
423
|
-
} : function(o
|
|
424
|
-
return o
|
|
315
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
316
|
+
return typeof o;
|
|
317
|
+
} : function(o) {
|
|
318
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
425
319
|
}, _typeof(o);
|
|
426
320
|
}
|
|
427
321
|
|
|
428
322
|
//#endregion
|
|
429
|
-
//#region \0@oxc-project+runtime@0.
|
|
430
|
-
function toPrimitive(t
|
|
431
|
-
if ("object" != _typeof(t
|
|
432
|
-
var e = t
|
|
323
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/toPrimitive.js
|
|
324
|
+
function toPrimitive(t, r) {
|
|
325
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
326
|
+
var e = t[Symbol.toPrimitive];
|
|
433
327
|
if (void 0 !== e) {
|
|
434
|
-
var i
|
|
435
|
-
if ("object" != _typeof(i
|
|
328
|
+
var i = e.call(t, r || "default");
|
|
329
|
+
if ("object" != _typeof(i)) return i;
|
|
436
330
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
437
331
|
}
|
|
438
|
-
return ("string" === r
|
|
332
|
+
return ("string" === r ? String : Number)(t);
|
|
439
333
|
}
|
|
440
334
|
|
|
441
335
|
//#endregion
|
|
442
|
-
//#region \0@oxc-project+runtime@0.
|
|
443
|
-
function toPropertyKey(t
|
|
444
|
-
var i
|
|
445
|
-
return "symbol" == _typeof(i
|
|
336
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/toPropertyKey.js
|
|
337
|
+
function toPropertyKey(t) {
|
|
338
|
+
var i = toPrimitive(t, "string");
|
|
339
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
446
340
|
}
|
|
447
341
|
|
|
448
342
|
//#endregion
|
|
449
|
-
//#region \0@oxc-project+runtime@0.
|
|
450
|
-
function _defineProperty(e, r
|
|
451
|
-
return (r
|
|
452
|
-
value: t
|
|
343
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/defineProperty.js
|
|
344
|
+
function _defineProperty(e, r, t) {
|
|
345
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
346
|
+
value: t,
|
|
453
347
|
enumerable: !0,
|
|
454
348
|
configurable: !0,
|
|
455
349
|
writable: !0
|
|
456
|
-
}) : e[r
|
|
350
|
+
}) : e[r] = t, e;
|
|
457
351
|
}
|
|
458
352
|
|
|
459
353
|
//#endregion
|
|
@@ -542,7 +436,7 @@ var Cache = class {
|
|
|
542
436
|
};
|
|
543
437
|
|
|
544
438
|
//#endregion
|
|
545
|
-
//#region \0@oxc-project+runtime@0.
|
|
439
|
+
//#region \0@oxc-project+runtime@0.110.0/helpers/classPrivateMethodInitSpec.js
|
|
546
440
|
function _classPrivateMethodInitSpec(e, a) {
|
|
547
441
|
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
548
442
|
}
|
|
@@ -614,11 +508,11 @@ var FileManager = class {
|
|
|
614
508
|
_classPrivateFieldSet2(_filesCache, this, null);
|
|
615
509
|
_classPrivateFieldGet2(_cache, this).flush();
|
|
616
510
|
}
|
|
617
|
-
getByPath(path
|
|
618
|
-
return _classPrivateFieldGet2(_cache, this).get(path
|
|
511
|
+
getByPath(path) {
|
|
512
|
+
return _classPrivateFieldGet2(_cache, this).get(path);
|
|
619
513
|
}
|
|
620
|
-
deleteByPath(path
|
|
621
|
-
_classPrivateFieldGet2(_cache, this).delete(path
|
|
514
|
+
deleteByPath(path) {
|
|
515
|
+
_classPrivateFieldGet2(_cache, this).delete(path);
|
|
622
516
|
_classPrivateFieldSet2(_filesCache, this, null);
|
|
623
517
|
}
|
|
624
518
|
clear() {
|
|
@@ -695,8 +589,8 @@ var TreeNode = class TreeNode {
|
|
|
695
589
|
}
|
|
696
590
|
forEach(callback) {
|
|
697
591
|
const stack = [this];
|
|
698
|
-
for (let i
|
|
699
|
-
const node = stack[i
|
|
592
|
+
for (let i = 0; i < stack.length; i++) {
|
|
593
|
+
const node = stack[i];
|
|
700
594
|
callback(node);
|
|
701
595
|
if (node.children.length > 0) stack.push(...node.children);
|
|
702
596
|
}
|
|
@@ -709,8 +603,8 @@ var TreeNode = class TreeNode {
|
|
|
709
603
|
const nodes = [];
|
|
710
604
|
const edges = [];
|
|
711
605
|
const stack = [root];
|
|
712
|
-
for (let i
|
|
713
|
-
const node = stack[i
|
|
606
|
+
for (let i = 0; i < stack.length; i++) {
|
|
607
|
+
const node = stack[i];
|
|
714
608
|
nodes.push({
|
|
715
609
|
id: node.data.path,
|
|
716
610
|
label: node.data.name
|
|
@@ -833,7 +727,7 @@ function renderIndent(content, renderContext) {
|
|
|
833
727
|
const indentStr = " ".repeat(renderContext.indentLevel * renderContext.indentSize);
|
|
834
728
|
const lines = content.split("\n");
|
|
835
729
|
let out = "";
|
|
836
|
-
for (const [i
|
|
730
|
+
for (const [i, line] of lines.entries()) {
|
|
837
731
|
if (renderContext.currentLineLength === 0 && line.length > 0) {
|
|
838
732
|
out += indentStr + line;
|
|
839
733
|
renderContext.currentLineLength = indentStr.length + line.length;
|
|
@@ -841,7 +735,7 @@ function renderIndent(content, renderContext) {
|
|
|
841
735
|
out += line;
|
|
842
736
|
renderContext.currentLineLength += line.length;
|
|
843
737
|
}
|
|
844
|
-
if (i
|
|
738
|
+
if (i !== lines.length - 1) {
|
|
845
739
|
out += "\n";
|
|
846
740
|
renderContext.currentLineLength = 0;
|
|
847
741
|
}
|
|
@@ -928,4 +822,4 @@ Root.displayName = "KubbRoot";
|
|
|
928
822
|
|
|
929
823
|
//#endregion
|
|
930
824
|
export { NodeTreeContext as _, renderIntrinsic as a, provide as b, TreeNode as c, _defineProperty as d, AsyncEventEmitter as f, createFile as g, _classPrivateFieldInitSpec as h, renderIndent as i, FileManager as l, _classPrivateFieldGet2 as m, createComponent as n, RenderContext as o, _classPrivateFieldSet2 as p, createIntrinsic as r, RootContext as s, Root as t, FileProcessor as u, createContext as v, unprovide as x, inject as y };
|
|
931
|
-
//# sourceMappingURL=Root-
|
|
825
|
+
//# sourceMappingURL=Root-Y8o5WxXY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Root-Y8o5WxXY.js","names":["NodeEventEmitter"],"sources":["../src/context.ts","../src/contexts/NodeTreeContext.ts","../src/createFile.ts","../src/utils/AsyncEventEmitter.ts","../src/FileProcessor.ts","../src/utils/Cache.ts","../src/FileManager.ts","../src/utils/TreeNode.ts","../src/contexts/RootContext.ts","../src/contexts/RenderContext.ts","../src/intrinsic.ts","../src/createComponent.ts","../src/components/Root.ts"],"sourcesContent":["/**\n * Context type that carries type information about its value\n * This is a branded symbol type that enables type-safe context usage\n */\nexport type Context<T> = symbol & { readonly __type: T }\n\n/**\n * Context stack for tracking the current context values\n *\n * Note: This uses a global Map for simplicity in code generation scenarios.\n * For concurrent runtime execution, consider using AsyncLocalStorage or\n * instance-based context management.\n */\nconst contextStack = new Map<symbol, unknown[]>()\nconst contextDefaults = new Map<symbol, unknown>()\n\n/**\n * Provides a value to descendant components (Vue 3 style)\n *\n * @example\n * ```ts\n * const ThemeKey = Symbol('theme')\n * provide(ThemeKey, { color: 'blue' })\n * ```\n */\nexport function provide<T>(key: symbol | Context<T>, value: T): void {\n if (!contextStack.has(key)) {\n contextStack.set(key, [])\n }\n contextStack.get(key)!.push(value)\n}\n\n/**\n * Injects a value provided by an ancestor component (Vue 3 style)\n *\n * @example\n * ```ts\n * const theme = inject(ThemeKey, { color: 'default' })\n * ```\n */\nexport function inject<T>(key: symbol | Context<T>, defaultValue?: T): T {\n const stack = contextStack.get(key)\n if (!stack || stack.length === 0) {\n if (defaultValue !== undefined) {\n return defaultValue\n }\n const storedDefault = contextDefaults.get(key)\n if (storedDefault !== undefined) {\n return storedDefault as T\n }\n throw new Error(`No value provided for key: ${key.toString()}`)\n }\n return stack[stack.length - 1] as T\n}\n\n/**\n * Unprovides a value (for cleanup)\n * @internal\n */\nexport function unprovide<T>(key: symbol | Context<T>): void {\n const stack = contextStack.get(key)\n if (stack && stack.length > 0) {\n stack.pop()\n }\n}\n\n/**\n * Creates a context key with a default value (React-style compatibility)\n *\n * @example\n * ```ts\n * const ThemeContext = createContext({ color: 'blue' })\n * // ThemeContext is now typed as Context<{ color: string }>\n * const theme = useContext(ThemeContext) // theme is { color: string }\n * ```\n */\nexport function createContext<T>(defaultValue: T): Context<T> {\n const key = Symbol('context') as Context<T>\n contextDefaults.set(key, defaultValue)\n\n return key\n}\n","import type { ComponentNode } from '../composables/useNodeTree.ts'\nimport { createContext } from '../context.ts'\nimport type { TreeNode } from '../utils/TreeNode.ts'\n\n/**\n * Context for having the current NodeTree\n */\nexport const NodeTreeContext = createContext<TreeNode<ComponentNode> | null>(null)\n","import { createHash } from 'node:crypto'\nimport path from 'node:path'\nimport { orderBy } from 'natural-orderby'\nimport { uniqueBy } from 'remeda'\nimport type * as KubbFile from './KubbFile.ts'\nimport { trimExtName } from './utils/trimExtName.ts'\n\nexport function combineSources(sources: Array<KubbFile.Source>): Array<KubbFile.Source> {\n return uniqueBy(sources, (obj) => {\n // For named sources, deduplicate by name, isExportable, and isTypeOnly\n // For unnamed sources, include the value to avoid deduplicating different code blocks\n // If both name and value are undefined, use an empty string as the unique identifier\n const uniqueId = obj.name ?? obj.value ?? ''\n const isExportable = obj.isExportable ?? false\n const isTypeOnly = obj.isTypeOnly ?? false\n return `${uniqueId}:${isExportable}:${isTypeOnly}`\n })\n}\n\nexport function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export> {\n const sorted = orderBy(exports, [\n (v) => !!Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n (v) => (Array.isArray(v.name) ? orderBy(v.name) : v.name),\n ])\n\n const prev: Array<KubbFile.Export> = []\n // Map to track items by path for O(1) lookup\n const pathMap = new Map<string, KubbFile.Export>()\n // Map to track unique items by path+name+isTypeOnly+asAlias\n const uniqueMap = new Map<string, KubbFile.Export>()\n // Map to track items by path+name where isTypeOnly=true (for type-only check)\n const pathNameTypeTrueMap = new Map<string, KubbFile.Export>()\n\n for (const curr of sorted) {\n const name = curr.name\n const pathKey = curr.path\n const prevByPath = pathMap.get(pathKey)\n\n // Create unique key for path+name+isTypeOnly\n const nameKey = Array.isArray(name) ? JSON.stringify(name) : name || ''\n const pathNameTypeKey = `${pathKey}:${nameKey}:${curr.isTypeOnly}`\n // Check if there's already an item with the same path+name but with isTypeOnly=true\n const pathNameKey = `${pathKey}:${nameKey}`\n const prevByPathAndIsTypeOnly = pathNameTypeTrueMap.get(pathNameKey)\n\n if (prevByPathAndIsTypeOnly) {\n // we already have an export that has the same path and name but uses `isTypeOnly` (export type ...)\n continue\n }\n\n // Create unique key for path+name+isTypeOnly+asAlias\n const uniqueKey = `${pathNameTypeKey}:${curr.asAlias || ''}`\n const uniquePrev = uniqueMap.get(uniqueKey)\n\n // we already have an item that was unique enough or name field is empty or prev asAlias is set but current has no changes\n if (uniquePrev || (Array.isArray(name) && !name.length) || (prevByPath?.asAlias && !curr.asAlias)) {\n continue\n }\n\n if (!prevByPath) {\n const newItem = {\n ...curr,\n name: Array.isArray(name) ? [...new Set(name)] : name,\n }\n prev.push(newItem)\n pathMap.set(pathKey, newItem)\n uniqueMap.set(uniqueKey, newItem)\n // Track items with isTypeOnly=true for the type-only check\n if (newItem.isTypeOnly) {\n pathNameTypeTrueMap.set(pathNameKey, newItem)\n }\n continue\n }\n\n // merge all names when prev and current both have the same isTypeOnly set\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...curr.name])]\n continue\n }\n\n prev.push(curr)\n uniqueMap.set(uniqueKey, curr)\n // Track items with isTypeOnly=true for the type-only check\n if (curr.isTypeOnly) {\n pathNameTypeTrueMap.set(pathNameKey, curr)\n }\n }\n\n return prev\n}\n\nexport function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import> {\n const exportedNameLookup = new Set<string>()\n for (const item of exports) {\n const { name } = item\n if (!name) {\n continue\n }\n\n if (Array.isArray(name)) {\n for (const value of name) {\n if (value) {\n exportedNameLookup.add(value)\n }\n }\n continue\n }\n\n exportedNameLookup.add(name)\n }\n\n const usageCache = new Map<string, boolean>()\n const hasImportInSource = (importName: string): boolean => {\n if (!source) {\n return true\n }\n\n const cached = usageCache.get(importName)\n if (cached !== undefined) {\n return cached\n }\n\n const isUsed = source.includes(importName) || exportedNameLookup.has(importName)\n usageCache.set(importName, isUsed)\n\n return isUsed\n }\n\n const sorted = orderBy(imports, [\n (v) => !!Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n (v) => (Array.isArray(v.name) ? orderBy(v.name) : v.name),\n ])\n\n const prev: Array<KubbFile.Import> = []\n // Map to track items by path+isTypeOnly for O(1) lookup\n const pathTypeMap = new Map<string, KubbFile.Import>()\n // Map to track unique items by path+name+isTypeOnly\n const uniqueMap = new Map<string, KubbFile.Import>()\n // Map to track items by path+name where isTypeOnly=true (for type-only check)\n const pathNameTypeTrueMap = new Map<string, KubbFile.Import>()\n\n for (const curr of sorted) {\n let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name\n\n if (curr.path === curr.root) {\n // root and path are the same file, remove the \"./\" import\n continue\n }\n\n // merge all names and check if the importName is being used in the generated source and if not filter those imports out\n if (Array.isArray(name)) {\n name = name.filter((item) => (typeof item === 'string' ? hasImportInSource(item) : hasImportInSource(item.propertyName)))\n }\n\n const pathTypeKey = `${curr.path}:${curr.isTypeOnly}`\n const prevByPath = pathTypeMap.get(pathTypeKey)\n\n // Create key for name comparison\n const nameKey = Array.isArray(name) ? JSON.stringify(name) : name || ''\n const pathNameTypeKey = `${curr.path}:${nameKey}:${curr.isTypeOnly}`\n const uniquePrev = uniqueMap.get(pathNameTypeKey)\n // Check if there's already an item with the same path+name but with isTypeOnly=true\n const pathNameKey = `${curr.path}:${nameKey}`\n const prevByPathNameAndIsTypeOnly = pathNameTypeTrueMap.get(pathNameKey)\n\n if (prevByPathNameAndIsTypeOnly) {\n // we already have an import that has the same path and name but uses `isTypeOnly` (import type ...)\n continue\n }\n\n // already unique enough or name is empty\n if (uniquePrev || (Array.isArray(name) && !name.length)) {\n continue\n }\n\n // new item, append name\n if (!prevByPath) {\n const newItem = {\n ...curr,\n name,\n }\n prev.push(newItem)\n pathTypeMap.set(pathTypeKey, newItem)\n uniqueMap.set(pathNameTypeKey, newItem)\n // Track items with isTypeOnly=true for the type-only check\n if (newItem.isTypeOnly) {\n pathNameTypeTrueMap.set(pathNameKey, newItem)\n }\n continue\n }\n\n // merge all names when prev and current both have the same isTypeOnly set\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...name])]\n continue\n }\n\n // no import was found in the source, ignore import\n if (!Array.isArray(name) && name && !hasImportInSource(name)) {\n continue\n }\n\n prev.push(curr)\n uniqueMap.set(pathNameTypeKey, curr)\n // Track items with isTypeOnly=true for the type-only check\n if (curr.isTypeOnly) {\n pathNameTypeTrueMap.set(pathNameKey, curr)\n }\n }\n\n return prev\n}\n\n/**\n * Helper to create a file with name and id set\n */\nexport function createFile<TMeta extends object = object>(file: KubbFile.File<TMeta>): KubbFile.ResolvedFile<TMeta> {\n const extname = path.extname(file.baseName) as KubbFile.Extname\n if (!extname) {\n throw new Error(`No extname found for ${file.baseName}`)\n }\n\n const source = file.sources.map((item) => item.value).join('\\n\\n')\n const exports = file.exports?.length ? combineExports(file.exports) : []\n const imports = file.imports?.length && source ? combineImports(file.imports, exports, source) : []\n const sources = file.sources?.length ? combineSources(file.sources) : []\n\n return {\n ...file,\n id: createHash('sha256').update(file.path).digest('hex'),\n name: trimExtName(file.baseName),\n extname,\n imports: imports,\n exports: exports,\n sources: sources,\n meta: file.meta || ({} as TMeta),\n }\n}\n","import { EventEmitter as NodeEventEmitter } from 'node:events'\nimport type { FabricMode } from '../Fabric.ts'\n\ntype Options = {\n mode?: FabricMode\n maxListener?: number\n}\n\nexport class AsyncEventEmitter<TEvents extends Record<string, any>> {\n constructor({ maxListener = 100, mode = 'sequential' }: Options = {}) {\n this.#emitter.setMaxListeners(maxListener)\n this.#mode = mode\n }\n\n #emitter = new NodeEventEmitter()\n #mode: FabricMode\n\n async emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void> {\n const listeners = this.#emitter.listeners(eventName) as Array<(...args: TEvents[TEventName]) => any>\n\n if (listeners.length === 0) {\n return\n }\n\n const errors: Error[] = []\n\n if (this.#mode === 'sequential') {\n // Run listeners one by one, in order\n for (const listener of listeners) {\n try {\n await listener(...eventArgs)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n errors.push(error)\n }\n }\n } else {\n // Run all listeners concurrently\n const promises = listeners.map(async (listener) => {\n try {\n await listener(...eventArgs)\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err))\n errors.push(error)\n }\n })\n await Promise.all(promises)\n }\n\n if (errors.length === 1) {\n throw errors[0]\n }\n\n if (errors.length > 1) {\n throw new AggregateError(errors, `Errors in async listeners for \"${eventName}\"`)\n }\n }\n\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.on(eventName, handler as any)\n }\n\n onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void {\n const wrapper = (...args: TEvents[TEventName]) => {\n this.off(eventName, wrapper)\n handler(...args)\n }\n this.on(eventName, wrapper)\n }\n\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.off(eventName, handler as any)\n }\n\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n","import pLimit from 'p-limit'\nimport type { FabricEvents, FabricMode } from './Fabric.ts'\nimport type * as KubbFile from './KubbFile.ts'\nimport { defaultParser } from './parsers/defaultParser.ts'\nimport type { Parser } from './parsers/types.ts'\nimport { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\n\nexport type ProcessFilesProps = {\n parsers?: Map<KubbFile.Extname, Parser>\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n dryRun?: boolean\n /**\n * @default 'sequential'\n */\n mode?: FabricMode\n}\n\ntype GetParseOptions = {\n parsers?: Map<KubbFile.Extname, Parser>\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n}\n\ntype Options = {\n events?: AsyncEventEmitter<FabricEvents>\n}\n\nexport class FileProcessor {\n #limit = pLimit(100)\n events: AsyncEventEmitter<FabricEvents>\n\n constructor({ events = new AsyncEventEmitter<FabricEvents>() }: Options = {}) {\n this.events = events\n\n return this\n }\n\n async parse(file: KubbFile.ResolvedFile, { parsers, extension }: GetParseOptions = {}): Promise<string> {\n const parseExtName = extension?.[file.extname] || undefined\n\n if (!parsers) {\n console.warn('No parsers provided, using default parser. If you want to use a specific parser, please provide it in the options.')\n\n return defaultParser.parse(file, { extname: parseExtName })\n }\n\n if (!file.extname) {\n return defaultParser.parse(file, { extname: parseExtName })\n }\n\n const parser = parsers.get(file.extname)\n\n if (!parser) {\n return defaultParser.parse(file, { extname: parseExtName })\n }\n\n return parser.parse(file, { extname: parseExtName })\n }\n\n async run(\n files: Array<KubbFile.ResolvedFile>,\n { parsers, mode = 'sequential', dryRun, extension }: ProcessFilesProps = {},\n ): Promise<KubbFile.ResolvedFile[]> {\n await this.events.emit('files:processing:start', files)\n\n const total = files.length\n let processed = 0\n\n const processOne = async (resolvedFile: KubbFile.ResolvedFile, index: number) => {\n await this.events.emit('file:processing:start', resolvedFile, index, total)\n\n const source = dryRun ? undefined : await this.parse(resolvedFile, { extension, parsers })\n\n const currentProcessed = ++processed\n const percentage = (currentProcessed / total) * 100\n\n await this.events.emit('file:processing:update', {\n file: resolvedFile,\n source,\n processed: currentProcessed,\n percentage,\n total,\n })\n\n await this.events.emit('file:processing:end', resolvedFile, index, total)\n }\n\n if (mode === 'sequential') {\n async function* asyncFiles() {\n for (let index = 0; index < files.length; index++) {\n yield [files[index], index] as const\n }\n }\n\n for await (const [file, index] of asyncFiles()) {\n if (file) {\n await processOne(file, index)\n }\n }\n } else {\n const promises = files.map((resolvedFile, index) => this.#limit(() => processOne(resolvedFile, index)))\n await Promise.all(promises)\n }\n\n await this.events.emit('files:processing:end', files)\n\n return files\n }\n}\n","export class Cache<T> {\n #buffer = new Map<string, T>()\n\n get(key: string): T | null {\n return this.#buffer.get(key) ?? null\n }\n\n set(key: string, value: T): void {\n this.#buffer.set(key, value)\n }\n\n delete(key: string): void {\n this.#buffer.delete(key)\n }\n\n clear(): void {\n this.#buffer.clear()\n }\n\n keys(): string[] {\n return [...this.#buffer.keys()]\n }\n\n values(): Array<T> {\n return [...this.#buffer.values()]\n }\n\n flush(): void {\n // No-op for base cache\n }\n}\n","import { orderBy } from 'natural-orderby'\nimport { createFile } from './createFile.ts'\nimport type { FabricEvents } from './Fabric.ts'\nimport { FileProcessor, type ProcessFilesProps } from './FileProcessor.ts'\nimport type * as KubbFile from './KubbFile.ts'\nimport { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport { Cache } from './utils/Cache.ts'\nimport { trimExtName } from './utils/trimExtName.ts'\n\nfunction mergeFile<TMeta extends object = object>(a: KubbFile.File<TMeta>, b: KubbFile.File<TMeta>): KubbFile.File<TMeta> {\n return {\n ...a,\n sources: [...(a.sources || []), ...(b.sources || [])],\n imports: [...(a.imports || []), ...(b.imports || [])],\n exports: [...(a.exports || []), ...(b.exports || [])],\n }\n}\n\ntype Options = {\n events?: AsyncEventEmitter<FabricEvents>\n}\n\nexport class FileManager {\n #cache = new Cache<KubbFile.ResolvedFile>()\n #filesCache: Array<KubbFile.ResolvedFile> | null = null\n events: AsyncEventEmitter<FabricEvents>\n processor: FileProcessor\n\n constructor({ events = new AsyncEventEmitter<FabricEvents>() }: Options = {}) {\n this.processor = new FileProcessor({ events })\n\n this.events = events\n return this\n }\n\n #resolvePath(file: KubbFile.File): KubbFile.File {\n this.events.emit('file:resolve:path', file)\n\n return file\n }\n\n #resolveName(file: KubbFile.File): KubbFile.File {\n this.events.emit('file:resolve:name', file)\n\n return file\n }\n\n add(...files: Array<KubbFile.File>): Array<KubbFile.ResolvedFile> {\n const resolvedFiles: Array<KubbFile.ResolvedFile> = []\n\n const mergedFiles = new Map<string, KubbFile.File>()\n\n files.forEach((file) => {\n const existing = mergedFiles.get(file.path)\n if (existing) {\n mergedFiles.set(file.path, mergeFile(existing, file))\n } else {\n mergedFiles.set(file.path, file)\n }\n })\n\n for (let file of mergedFiles.values()) {\n file = this.#resolveName(file)\n file = this.#resolvePath(file)\n\n const resolvedFile = createFile(file)\n\n this.#cache.set(resolvedFile.path, resolvedFile)\n this.flush()\n\n resolvedFiles.push(resolvedFile)\n }\n\n this.events.emit('files:added', resolvedFiles)\n\n return resolvedFiles\n }\n\n upsert(...files: Array<KubbFile.File>): Array<KubbFile.ResolvedFile> {\n const resolvedFiles: Array<KubbFile.ResolvedFile> = []\n\n const mergedFiles = new Map<string, KubbFile.File>()\n\n files.forEach((file) => {\n const existing = mergedFiles.get(file.path)\n if (existing) {\n mergedFiles.set(file.path, mergeFile(existing, file))\n } else {\n mergedFiles.set(file.path, file)\n }\n })\n\n for (let file of mergedFiles.values()) {\n const existing = this.#cache.get(file.path)\n\n file = this.#resolveName(file)\n file = this.#resolvePath(file)\n\n const merged = existing ? mergeFile(existing, file) : file\n const resolvedFile = createFile(merged)\n\n this.#cache.set(resolvedFile.path, resolvedFile)\n this.flush()\n\n resolvedFiles.push(resolvedFile)\n }\n\n this.events.emit('files:added', resolvedFiles)\n\n return resolvedFiles\n }\n\n flush() {\n this.#filesCache = null\n this.#cache.flush()\n }\n\n getByPath(path: KubbFile.Path): KubbFile.ResolvedFile | null {\n return this.#cache.get(path)\n }\n\n deleteByPath(path: KubbFile.Path): void {\n this.#cache.delete(path)\n this.#filesCache = null\n }\n\n clear(): void {\n this.#cache.clear()\n this.#filesCache = null\n }\n\n get files(): Array<KubbFile.ResolvedFile> {\n if (this.#filesCache) {\n return this.#filesCache\n }\n\n const cachedKeys = this.#cache.keys()\n\n // order by path length and if file is a barrel file\n const keys = orderBy(cachedKeys, [(v) => v.length, (v) => trimExtName(v).endsWith('index')])\n\n const files: Array<KubbFile.ResolvedFile> = []\n\n for (const key of keys) {\n const file = this.#cache.get(key)\n if (file) {\n files.push(file)\n }\n }\n\n this.#filesCache = files\n\n return files\n }\n\n //TODO add test and check if write of FileManager contains the newly added file\n async write(options: ProcessFilesProps): Promise<KubbFile.ResolvedFile[]> {\n await this.events.emit('files:writing:start', this.files)\n\n const resolvedFiles = await this.processor.run(this.files, options)\n\n this.clear()\n\n await this.events.emit('files:writing:end', resolvedFiles)\n\n return resolvedFiles\n }\n}\n","import type * as KubbFile from '../KubbFile.ts'\n\ntype BarrelData = {\n file?: KubbFile.File\n path: string\n name: string\n}\n\nexport type Graph = {\n nodes: Array<{ id: string; label: string }>\n edges: Array<{ from: string; to: string }>\n}\n\nexport class TreeNode<TData = unknown> {\n data: TData\n parent?: TreeNode<TData>\n children: Array<TreeNode<TData>> = []\n #childrenMap = new Map<string, TreeNode<TData>>()\n #cachedLeaves?: Array<TreeNode<TData>>\n\n constructor(data: TData, parent?: TreeNode<TData>) {\n this.data = data\n this.parent = parent\n }\n\n addChild(data: TData): TreeNode<TData> {\n const child = new TreeNode(data, this)\n this.children.push(child)\n // Update Map if data has a name property (for BarrelData)\n if (typeof data === 'object' && data !== null && 'name' in data) {\n this.#childrenMap.set((data as { name: string }).name, child)\n }\n this.#cachedLeaves = undefined // invalidate cached leaves\n return child\n }\n\n getChildByName(name: string): TreeNode<TData> | undefined {\n return this.#childrenMap.get(name)\n }\n\n get leaves(): Array<TreeNode<TData>> {\n if (this.#cachedLeaves) return this.#cachedLeaves\n if (this.children.length === 0) return [this]\n\n const result: Array<TreeNode<TData>> = []\n const stack: Array<TreeNode<TData>> = [...this.children]\n const visited = new Set<TreeNode<TData>>()\n\n while (stack.length > 0) {\n const node = stack.pop()!\n if (visited.has(node)) {\n continue\n }\n visited.add(node)\n\n if (node.children.length > 0) {\n stack.push(...node.children)\n } else {\n result.push(node)\n }\n }\n\n this.#cachedLeaves = result\n return result\n }\n\n forEach(callback: (node: TreeNode<TData>) => void): this {\n const stack: Array<TreeNode<TData>> = [this]\n\n for (let i = 0; i < stack.length; i++) {\n const node = stack[i]!\n callback(node)\n\n if (node.children.length > 0) {\n stack.push(...node.children)\n }\n }\n\n return this\n }\n\n findDeep(predicate: (node: TreeNode<TData>) => boolean): TreeNode<TData> | undefined {\n for (const leaf of this.leaves) {\n if (predicate(leaf)) return leaf\n }\n return undefined\n }\n\n static toGraph(root: TreeNode<BarrelData>): Graph {\n const nodes: Array<{ id: string; label: string }> = []\n const edges: Array<{ from: string; to: string }> = []\n\n const stack: Array<TreeNode<BarrelData>> = [root]\n\n for (let i = 0; i < stack.length; i++) {\n const node = stack[i]!\n\n nodes.push({\n id: node.data.path,\n label: node.data.name,\n })\n\n const children = node.children\n if (children.length > 0) {\n for (let j = 0, len = children.length; j < len; j++) {\n const child = children[j]!\n edges.push({\n from: node.data.path,\n to: child.data.path,\n })\n stack.push(child)\n }\n }\n }\n\n return { nodes, edges }\n }\n\n static fromFiles(files: Array<KubbFile.File>, rootFolder = ''): TreeNode<BarrelData> | null {\n const normalizePath = (p: string): string => p.replace(/\\\\/g, '/')\n const normalizedRoot = normalizePath(rootFolder)\n const rootPrefix = normalizedRoot.endsWith('/') ? normalizedRoot : `${normalizedRoot}/`\n\n const normalizedPaths = new Map<KubbFile.File, string>()\n const filteredFiles: Array<KubbFile.File> = []\n for (const file of files) {\n const filePath = normalizedPaths.get(file) ?? normalizePath(file.path)\n normalizedPaths.set(file, filePath)\n if (!filePath.endsWith('.json') && (!rootFolder || filePath.startsWith(rootPrefix))) {\n filteredFiles.push(file)\n }\n }\n\n if (filteredFiles.length === 0) {\n return null\n }\n\n const treeNode = new TreeNode<BarrelData>({\n name: rootFolder || '',\n path: rootFolder || '',\n file: undefined,\n })\n\n for (const file of filteredFiles) {\n const filePath = normalizedPaths.get(file)!\n const relPath = filePath.slice(rootPrefix.length)\n const parts = relPath.split('/')\n\n let current = treeNode\n let currentPath = rootFolder\n\n for (const [index, part] of parts.entries()) {\n const isLast = index === parts.length - 1\n currentPath += (currentPath.endsWith('/') ? '' : '/') + part\n\n let next = current.getChildByName(part)\n\n if (!next) {\n next = current.addChild({\n name: part,\n path: currentPath,\n file: isLast ? file : undefined,\n })\n }\n\n current = next\n }\n }\n\n return treeNode\n }\n}\n","import type { ComponentNode } from '../composables/useNodeTree.ts'\nimport { createContext } from '../context.ts'\nimport { FileManager } from '../FileManager.ts'\nimport { TreeNode } from '../utils/TreeNode.ts'\n\nexport type RootContextProps = {\n /**\n * Exit (unmount) the whole app.\n */\n exit: (error?: Error) => void\n /**\n * TreeNode representing the tree structure of the app.\n */\n treeNode: TreeNode<ComponentNode>\n /**\n * FileManager instance for managing files within the app.\n */\n fileManager: FileManager\n}\n\n/**\n * Context providing root-level functionalities such as exit hook, tree node structure, and file management.\n * Define in the `render` helper of the runtime.\n */\nexport const RootContext = createContext<RootContextProps>({\n exit: () => {},\n treeNode: new TreeNode({ type: 'Root', props: {} }),\n fileManager: new FileManager(),\n})\n","import { createContext } from '../context.ts'\n\nexport type RenderContextProps = {\n indentLevel: number\n indentSize: number\n currentLineLength: number\n shouldBreak: boolean\n}\n\n/**\n * Provides a context for tracking rendering state such as indentation and line length.\n */\nexport const RenderContext = createContext<RenderContextProps>({ indentLevel: 0, indentSize: 2, currentLineLength: 0, shouldBreak: false })\n","import { inject, provide } from './context.ts'\nimport { RenderContext, type RenderContextProps } from './contexts/RenderContext.ts'\nimport type { FabricElement, FabricNode } from './Fabric.ts'\n\ntype IntrinsicType =\n | 'br' // Line break - adds newline with current indentation\n | 'indent' // Increase indentation level\n | 'dedent' // Decrease indentation level\n\nexport type Intrinsic = {\n type: IntrinsicType\n __intrinsic: true\n}\n\nfunction isFabricElement<TProps extends object = object>(value: any): value is FabricElement<TProps> {\n return typeof value === 'function' && 'type' in value && 'component' in value\n}\n\n/**\n * Type guard to check if a value is an intrinsic element\n */\nexport function isIntrinsic(value: any): value is Intrinsic {\n return value && typeof value === 'object' && value.__intrinsic === true\n}\n\n/**\n * Render a single intrinsic node\n */\nfunction renderIntrinsicNode(node: Intrinsic, renderContext: RenderContextProps): string {\n switch (node.type) {\n case 'br':\n renderContext.currentLineLength = 0\n return '\\n'\n\n case 'indent':\n renderContext.indentLevel++\n return ''\n\n case 'dedent':\n renderContext.indentLevel = Math.max(0, renderContext.indentLevel - 1)\n return ''\n\n default:\n return ''\n }\n}\n\n/**\n * Helper: render a plain string while applying current indentation at the\n * start of each logical line. This ensures `${indent}` intrinsics affect\n * subsequent string content.\n */\nexport function renderIndent(content: string, renderContext: RenderContextProps): string {\n if (content.length === 0) {\n return ''\n }\n\n const indentStr = ' '.repeat(renderContext.indentLevel * renderContext.indentSize)\n const lines = content.split('\\n')\n let out = ''\n\n for (const [i, line] of lines.entries()) {\n if (renderContext.currentLineLength === 0 && line.length > 0) {\n // At start of a (logical) line: prefix indentation\n out += indentStr + line\n renderContext.currentLineLength = indentStr.length + line.length\n } else {\n out += line\n renderContext.currentLineLength += line.length\n }\n\n // If not the last line, add newline and reset line length so next line gets indentation\n if (i !== lines.length - 1) {\n out += '\\n'\n renderContext.currentLineLength = 0\n }\n }\n\n return out\n}\n\nexport function renderIntrinsic(children: FabricNode, context?: RenderContextProps): string {\n const renderContext = context || inject(RenderContext)\n\n provide(RenderContext, renderContext)\n\n if (!children) {\n return ''\n }\n\n if (isFabricElement(children)) {\n try {\n // FabricElements are already wrapped in transform by createComponent\n // Just call them and return the result (which is already a string)\n const result = children()\n return renderIntrinsic(result)\n } catch {\n return ''\n }\n }\n\n if (Array.isArray(children)) {\n return children.map((child) => renderIntrinsic(child)).join('')\n }\n\n if (isIntrinsic(children)) {\n // Render intrinsic node(s) using the shared render context\n return renderIntrinsicNode(children, renderContext)\n }\n\n if (typeof children === 'function') {\n return renderIntrinsic(children())\n }\n\n if (typeof children === 'string') {\n return renderIndent(children, renderContext)\n }\n\n if (typeof children === 'number') {\n return renderIndent(String(children), renderContext)\n }\n\n if (typeof children === 'boolean') {\n return renderIndent(children ? 'true' : 'false', renderContext)\n }\n\n // Fallback for FabricElement/object-like values\n try {\n return renderIndent(children, renderContext)\n } catch {\n return ''\n }\n}\n\n/**\n * Create an intrinsic element\n */\nexport function createIntrinsic(type: IntrinsicType): Intrinsic {\n return {\n type,\n __intrinsic: true,\n }\n}\n","import type { FabricComponent, FabricElement, FabricNode } from './Fabric.ts'\nimport { renderIntrinsic } from './intrinsic.ts'\n\ntype MakeChildrenOptional<T extends object> = T extends { children?: any } ? Omit<T, 'children'> & Partial<Pick<T, 'children'>> : T\n\nexport type ComponentBuilder<T extends object> = {\n (...args: unknown extends T ? [] : {} extends Omit<T, 'children'> ? [props?: MakeChildrenOptional<T>] : [props: MakeChildrenOptional<T>]): FabricComponent<T>\n displayName?: string | undefined\n}\n\nexport function createComponent<TProps extends object>(type: string, Component: (props: TProps) => FabricNode): ComponentBuilder<TProps> {\n return (...args) => {\n const fn: FabricComponent<TProps> = (() => renderIntrinsic(Component(args[0] as TProps) as FabricNode)) as any\n fn.component = Component\n fn.props = args[0]! as TProps\n fn.type = type\n fn.children = (...children: Array<FabricNode>) => {\n const propsWithChildren = {\n ...(args[0] ?? {}),\n children() {\n return renderIntrinsic(children)\n },\n } as unknown as TProps\n\n const fnChild = (() => renderIntrinsic(Component(propsWithChildren) as FabricNode)) as FabricElement<TProps>\n fnChild.component = Component\n fnChild.props = args[0]! as TProps\n fnChild.type = type\n return fnChild\n }\n\n return fn\n }\n}\n","import type { ComponentNode } from '../composables/useNodeTree.ts'\nimport { provide } from '../context.ts'\nimport { NodeTreeContext } from '../contexts/NodeTreeContext.ts'\nimport { RootContext } from '../contexts/RootContext.ts'\nimport { createComponent } from '../createComponent.ts'\nimport type { FabricNode } from '../Fabric.ts'\nimport type { FileManager } from '../FileManager.ts'\nimport type { TreeNode } from '../utils/TreeNode.ts'\n\nexport type RootProps = {\n /**\n * Exit (unmount) the whole app.\n */\n onExit: (error?: Error) => void\n /**\n * Error hook receiving runtime exceptions.\n */\n onError: (error: Error) => void\n /**\n * TreeNode representing the tree structure of the app.\n */\n treeNode: TreeNode<ComponentNode>\n /**\n * FileManager instance for managing files within the app.\n */\n fileManager: FileManager\n /**\n * Children nodes.\n */\n children?: FabricNode\n}\n\n/**\n * This component provides the root behavior for the Fabric runtime.\n */\nexport const Root = createComponent('Root', ({ onError, onExit, treeNode, fileManager, children }: RootProps) => {\n provide(RootContext, { exit: onExit, treeNode, fileManager })\n provide(NodeTreeContext, treeNode)\n\n try {\n return children\n } catch (e) {\n if (e instanceof Error) {\n onError?.(e)\n }\n return ''\n }\n})\n\nRoot.displayName = 'KubbRoot'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,MAAM,+BAAe,IAAI,KAAwB;AACjD,MAAM,kCAAkB,IAAI,KAAsB;;;;;;;;;;AAWlD,SAAgB,QAAW,KAA0B,OAAgB;AACnE,KAAI,CAAC,aAAa,IAAI,IAAI,CACxB,cAAa,IAAI,KAAK,EAAE,CAAC;AAE3B,cAAa,IAAI,IAAI,CAAE,KAAK,MAAM;;;;;;;;;;AAWpC,SAAgB,OAAU,KAA0B,cAAqB;CACvE,MAAM,QAAQ,aAAa,IAAI,IAAI;AACnC,KAAI,CAAC,SAAS,MAAM,WAAW,GAAG;AAChC,MAAI,iBAAiB,OACnB,QAAO;EAET,MAAM,gBAAgB,gBAAgB,IAAI,IAAI;AAC9C,MAAI,kBAAkB,OACpB,QAAO;AAET,QAAM,IAAI,MAAM,8BAA8B,IAAI,UAAU,GAAG;;AAEjE,QAAO,MAAM,MAAM,SAAS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AA0B;AAC/G,SAAQ,aAAa;EAAE,MAAM;EAAQ;EAAU;EAAa,CAAC;AAC7D,SAAQ,iBAAiB,SAAS;AAElC,KAAI;AACF,SAAO;UACA,GAAG;AACV,MAAI,aAAa,MACf,mDAAU,EAAE;AAEd,SAAO;;EAET;AAEF,KAAK,cAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as __name } from "./chunk-
|
|
2
|
-
import { n as defineParser } from "./getRelativePath-
|
|
1
|
+
import { n as __name } from "./chunk-Cq_TCZj9.js";
|
|
2
|
+
import { n as defineParser } from "./getRelativePath-DlmBsdV8.js";
|
|
3
3
|
|
|
4
4
|
//#region src/parsers/defaultParser.ts
|
|
5
5
|
const defaultParser = defineParser({
|
|
@@ -13,4 +13,4 @@ const defaultParser = defineParser({
|
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { defaultParser as t };
|
|
16
|
-
//# sourceMappingURL=defaultParser-
|
|
16
|
+
//# sourceMappingURL=defaultParser-DCYPZf5F.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultParser-
|
|
1
|
+
{"version":3,"file":"defaultParser-DCYPZf5F.js","names":[],"sources":["../src/parsers/defaultParser.ts"],"sourcesContent":["import { defineParser } from './defineParser.ts'\n\nexport const defaultParser = defineParser({\n name: 'default',\n extNames: ['.json'],\n install() {},\n async parse(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;;AAEA,MAAa,gBAAgB,aAAa;CACxC,MAAM;CACN,UAAU,CAAC,QAAQ;CACnB,UAAU;CACV,MAAM,MAAM,MAAM;AAChB,SAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;;CAE7D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as __name } from "./chunk-
|
|
1
|
+
import { n as __name } from "./chunk-Cq_TCZj9.js";
|
|
2
2
|
import { normalize, relative } from "node:path";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/trimExtName.ts
|
|
@@ -17,9 +17,9 @@ function defineParser(parser) {
|
|
|
17
17
|
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/utils/getRelativePath.ts
|
|
20
|
-
function slash(path
|
|
21
|
-
const isWindowsPath = /^\\\\\?\\/.test(path
|
|
22
|
-
const normalizedPath = normalize(path
|
|
20
|
+
function slash(path, platform = "linux") {
|
|
21
|
+
const isWindowsPath = /^\\\\\?\\/.test(path);
|
|
22
|
+
const normalizedPath = normalize(path);
|
|
23
23
|
if (["linux", "mac"].includes(platform) && !isWindowsPath) return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
|
|
24
24
|
return normalizedPath.replaceAll(/\\/g, "/").replace("../", "");
|
|
25
25
|
}
|
|
@@ -32,4 +32,4 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { defineParser as n, trimExtName as r, getRelativePath as t };
|
|
35
|
-
//# sourceMappingURL=getRelativePath-
|
|
35
|
+
//# sourceMappingURL=getRelativePath-DlmBsdV8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRelativePath-DlmBsdV8.js","names":[],"sources":["../src/utils/trimExtName.ts","../src/parsers/defineParser.ts","../src/utils/getRelativePath.ts"],"sourcesContent":["export function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n","import type { Parser, UserParser } from './types.ts'\n\nexport function defineParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta> {\n return {\n type: 'parser',\n ...parser,\n }\n}\n","import { normalize, relative } from 'node:path'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n"],"mappings":";;;;AAAA,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG;;;;;ACCtC,SAAgB,aAA6D,QAA8D;AACzI,QAAO;EACL,MAAM;EACN,GAAG;EACJ;;;;;ACJH,SAAS,MAAM,MAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAK,KAAK;CAC5C,MAAM,iBAAiB,UAAU,KAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,MAJC,SAAS,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_getRelativePath = require('./getRelativePath-jYLCpluV.cjs');
|
|
2
|
-
const require_Root = require('./Root-
|
|
3
|
-
const require_typescriptParser = require('./typescriptParser-
|
|
2
|
+
const require_Root = require('./Root-DvQofGOy.cjs');
|
|
3
|
+
const require_typescriptParser = require('./typescriptParser-3Mjce6yD.cjs');
|
|
4
|
+
let remeda = require("remeda");
|
|
4
5
|
|
|
5
6
|
//#region src/composables/useContext.ts
|
|
6
7
|
function useContext(key, defaultValue) {
|
|
@@ -24,10 +25,6 @@ const AppContext = require_Root.createContext({
|
|
|
24
25
|
meta: {}
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/isFunction.js
|
|
29
|
-
const e = (e$1) => typeof e$1 == `function`;
|
|
30
|
-
|
|
31
28
|
//#endregion
|
|
32
29
|
//#region src/components/App.ts
|
|
33
30
|
/**
|
|
@@ -440,7 +437,7 @@ function createFabric(config = { mode: "sequential" }) {
|
|
|
440
437
|
if (pluginOrParser.type === "plugin") {
|
|
441
438
|
if (installedPlugins.has(pluginOrParser)) console.warn(`Plugin "${pluginOrParser.name}" already applied.`);
|
|
442
439
|
else installedPlugins.add(pluginOrParser);
|
|
443
|
-
if (
|
|
440
|
+
if ((0, remeda.isFunction)(pluginOrParser.inject)) {
|
|
444
441
|
const injecter = pluginOrParser.inject;
|
|
445
442
|
const injected = injecter(context, ...options);
|
|
446
443
|
Object.assign(fabric, injected);
|
|
@@ -455,7 +452,7 @@ function createFabric(config = { mode: "sequential" }) {
|
|
|
455
452
|
installedParsers.set(extName, pluginOrParser);
|
|
456
453
|
}
|
|
457
454
|
}
|
|
458
|
-
if (
|
|
455
|
+
if ((0, remeda.isFunction)(pluginOrParser.install)) {
|
|
459
456
|
const installer = pluginOrParser.install;
|
|
460
457
|
await installer(context, ...options);
|
|
461
458
|
}
|