@kubb/fabric-core 0.13.0 → 0.13.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.
Files changed (54) hide show
  1. package/dist/{Fabric-CrRJykMN.d.ts → Fabric-BOjvMvNC.d.ts} +6 -9
  2. package/dist/{Fabric-DMmgrLto.d.cts → Fabric-w9Y9duM6.d.ts} +7 -7
  3. package/dist/{RootContext-Cf7WJM7r.d.cts → RootContext-BQHfIhhC.d.ts} +3 -3
  4. package/dist/{RootContext-CvaGJ-4g.d.ts → RootContext-Cbs-UQXM.d.ts} +3 -4
  5. package/dist/{chunk-BVHe6Par.js → chunk-BYypO7fO.js} +1 -5
  6. package/dist/{chunk-DVipidnM.cjs → chunk-uaV2rQ02.cjs} +0 -10
  7. package/dist/{defaultParser-BK-zOanQ.cjs → defaultParser-BAgmtMo_.cjs} +2 -3
  8. package/dist/{defaultParser-BK-zOanQ.cjs.map → defaultParser-BAgmtMo_.cjs.map} +1 -1
  9. package/dist/{defaultParser-BD_N68Bo.js → defaultParser-C1atU7yU.js} +2 -3
  10. package/dist/{defaultParser-BD_N68Bo.js.map → defaultParser-C1atU7yU.js.map} +1 -1
  11. package/dist/{getRelativePath-C4Au07ON.js → getRelativePath-BcieQL5M.js} +1 -2
  12. package/dist/{getRelativePath-C4Au07ON.js.map → getRelativePath-BcieQL5M.js.map} +1 -1
  13. package/dist/{getRelativePath-DpbA6qm5.cjs → getRelativePath-DVG8dIzW.cjs} +2 -2
  14. package/dist/{getRelativePath-DpbA6qm5.cjs.map → getRelativePath-DVG8dIzW.cjs.map} +1 -1
  15. package/dist/index.cjs +13 -10
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +6 -4
  18. package/dist/index.js +12 -10
  19. package/dist/index.js.map +1 -1
  20. package/dist/{onProcessExit-7fgW-UTF.js → onProcessExit-B0rJqX4s.js} +80 -182
  21. package/dist/onProcessExit-B0rJqX4s.js.map +1 -0
  22. package/dist/{onProcessExit-C7dVg0S0.cjs → onProcessExit-DENCUkMz.cjs} +80 -205
  23. package/dist/onProcessExit-DENCUkMz.cjs.map +1 -0
  24. package/dist/parsers/typescript.cjs +4 -4
  25. package/dist/parsers/typescript.cjs.map +1 -1
  26. package/dist/parsers/typescript.d.ts +1 -2
  27. package/dist/parsers/typescript.js +3 -4
  28. package/dist/parsers/typescript.js.map +1 -1
  29. package/dist/parsers.cjs +2 -3
  30. package/dist/parsers.cjs.map +1 -1
  31. package/dist/parsers.d.ts +1 -2
  32. package/dist/parsers.js +2 -3
  33. package/dist/parsers.js.map +1 -1
  34. package/dist/plugins.cjs +31 -41
  35. package/dist/plugins.cjs.map +1 -1
  36. package/dist/plugins.d.ts +2 -3
  37. package/dist/plugins.js +30 -41
  38. package/dist/plugins.js.map +1 -1
  39. package/dist/types.cjs +1 -1
  40. package/dist/types.d.ts +3 -4
  41. package/dist/types.js +1 -1
  42. package/dist/{useNodeTree-CgEKFUV-.d.cts → useNodeTree-6ZhDpI13.d.ts} +2 -2
  43. package/dist/{useNodeTree-CamNuFQP.d.ts → useNodeTree-Brj-fAVZ.d.ts} +2 -3
  44. package/package.json +3 -3
  45. package/src/Fabric.ts +5 -6
  46. package/src/createFabric.ts +5 -2
  47. package/src/utils/onProcessExit.ts +9 -0
  48. package/dist/index.d.cts +0 -602
  49. package/dist/onProcessExit-7fgW-UTF.js.map +0 -1
  50. package/dist/onProcessExit-C7dVg0S0.cjs.map +0 -1
  51. package/dist/parsers/typescript.d.cts +0 -45
  52. package/dist/parsers.d.cts +0 -37
  53. package/dist/plugins.d.cts +0 -119
  54. package/dist/types.d.cts +0 -11
@@ -1,6 +1,5 @@
1
- import { n as __name } from "./chunk-BVHe6Par.js";
2
- import { r as trimExtName } from "./getRelativePath-C4Au07ON.js";
3
- import { t as defaultParser } from "./defaultParser-BD_N68Bo.js";
1
+ import { r as trimExtName } from "./getRelativePath-BcieQL5M.js";
2
+ import { t as defaultParser } from "./defaultParser-C1atU7yU.js";
4
3
  import { sortBy, uniqueBy } from "remeda";
5
4
  import { createHash } from "node:crypto";
6
5
  import path from "node:path";
@@ -83,18 +82,11 @@ const NodeTreeContext = createContext(null);
83
82
  //#region src/createFile.ts
84
83
  function combineSources(sources) {
85
84
  return uniqueBy(sources, (obj) => {
86
- var _ref;
87
- var _obj$name;
88
- var _obj$isExportable;
89
- var _obj$isTypeOnly;
90
- return `${(_ref = (_obj$name = obj.name) !== null && _obj$name !== void 0 ? _obj$name : obj.value) !== null && _ref !== void 0 ? _ref : ""}:${(_obj$isExportable = obj.isExportable) !== null && _obj$isExportable !== void 0 ? _obj$isExportable : false}:${(_obj$isTypeOnly = obj.isTypeOnly) !== null && _obj$isTypeOnly !== void 0 ? _obj$isTypeOnly : false}`;
85
+ return `${obj.name ?? obj.value ?? ""}:${obj.isExportable ?? false}:${obj.isTypeOnly ?? false}`;
91
86
  });
92
87
  }
93
88
  function combineExports(exports) {
94
- const sorted = sortBy(exports, (v) => !!Array.isArray(v.name), (v) => !v.isTypeOnly, (v) => v.path, (v) => !!v.name, (v) => {
95
- var _v$name;
96
- return Array.isArray(v.name) ? [...v.name].sort().join("\0") : (_v$name = v.name) !== null && _v$name !== void 0 ? _v$name : "";
97
- });
89
+ const sorted = sortBy(exports, (v) => !!Array.isArray(v.name), (v) => !v.isTypeOnly, (v) => v.path, (v) => !!v.name, (v) => Array.isArray(v.name) ? [...v.name].sort().join("\0") : v.name ?? "");
98
90
  const prev = [];
99
91
  const pathMap = /* @__PURE__ */ new Map();
100
92
  const uniqueMap = /* @__PURE__ */ new Map();
@@ -103,7 +95,7 @@ function combineExports(exports) {
103
95
  const pathKey = curr.path;
104
96
  const prevByPath = pathMap.get(pathKey);
105
97
  const uniqueKey = `${`${pathKey}:${Array.isArray(name) ? JSON.stringify(name) : name || ""}:${curr.isTypeOnly}`}:${curr.asAlias || ""}`;
106
- if (uniqueMap.get(uniqueKey) || Array.isArray(name) && !name.length || (prevByPath === null || prevByPath === void 0 ? void 0 : prevByPath.asAlias) && !curr.asAlias) continue;
98
+ if (uniqueMap.get(uniqueKey) || Array.isArray(name) && !name.length || prevByPath?.asAlias && !curr.asAlias) continue;
107
99
  if (!prevByPath) {
108
100
  const newItem = {
109
101
  ...curr,
@@ -143,10 +135,7 @@ function combineImports(imports, exports, source) {
143
135
  usageCache.set(importName, isUsed);
144
136
  return isUsed;
145
137
  };
146
- const sorted = sortBy(imports, (v) => Array.isArray(v.name), (v) => !v.isTypeOnly, (v) => v.path, (v) => !!v.name, (v) => {
147
- var _v$name2;
148
- return Array.isArray(v.name) ? [...v.name].sort().join("\0") : (_v$name2 = v.name) !== null && _v$name2 !== void 0 ? _v$name2 : "";
149
- });
138
+ const sorted = sortBy(imports, (v) => Array.isArray(v.name), (v) => !v.isTypeOnly, (v) => v.path, (v) => !!v.name, (v) => Array.isArray(v.name) ? [...v.name].sort().join("\0") : v.name ?? "");
150
139
  const prev = [];
151
140
  const pathTypeMap = /* @__PURE__ */ new Map();
152
141
  const uniqueMap = /* @__PURE__ */ new Map();
@@ -183,15 +172,12 @@ function combineImports(imports, exports, source) {
183
172
  * Helper to create a file with name and id set
184
173
  */
185
174
  function createFile(file) {
186
- var _file$exports;
187
- var _file$imports;
188
- var _file$sources;
189
175
  const extname = path.extname(file.baseName);
190
176
  if (!extname) throw new Error(`No extname found for ${file.baseName}`);
191
177
  const source = file.sources.map((item) => item.value).join("\n\n");
192
- const exports = ((_file$exports = file.exports) === null || _file$exports === void 0 ? void 0 : _file$exports.length) ? combineExports(file.exports) : [];
193
- const imports = ((_file$imports = file.imports) === null || _file$imports === void 0 ? void 0 : _file$imports.length) && source ? combineImports(file.imports, exports, source) : [];
194
- const sources = ((_file$sources = file.sources) === null || _file$sources === void 0 ? void 0 : _file$sources.length) ? combineSources(file.sources) : [];
178
+ const exports = file.exports?.length ? combineExports(file.exports) : [];
179
+ const imports = file.imports?.length && source ? combineImports(file.imports, exports, source) : [];
180
+ const sources = file.sources?.length ? combineSources(file.sources) : [];
195
181
  return {
196
182
  ...file,
197
183
  id: createHash("sha256").update(file.path).digest("hex"),
@@ -204,53 +190,20 @@ function createFile(file) {
204
190
  };
205
191
  }
206
192
 
207
- //#endregion
208
- //#region \0@oxc-project+runtime@0.112.0/helpers/checkPrivateRedeclaration.js
209
- function _checkPrivateRedeclaration(e, t) {
210
- if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
211
- }
212
-
213
- //#endregion
214
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldInitSpec.js
215
- function _classPrivateFieldInitSpec(e, t, a) {
216
- _checkPrivateRedeclaration(e, t), t.set(e, a);
217
- }
218
-
219
- //#endregion
220
- //#region \0@oxc-project+runtime@0.112.0/helpers/assertClassBrand.js
221
- function _assertClassBrand(e, t, n) {
222
- if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
223
- throw new TypeError("Private element is not present on this object");
224
- }
225
-
226
- //#endregion
227
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldGet2.js
228
- function _classPrivateFieldGet2(s, a) {
229
- return s.get(_assertClassBrand(s, a));
230
- }
231
-
232
- //#endregion
233
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldSet2.js
234
- function _classPrivateFieldSet2(s, a, r) {
235
- return s.set(_assertClassBrand(s, a), r), r;
236
- }
237
-
238
193
  //#endregion
239
194
  //#region src/utils/AsyncEventEmitter.ts
240
- var _emitter = /* @__PURE__ */ new WeakMap();
241
- var _mode = /* @__PURE__ */ new WeakMap();
242
195
  var AsyncEventEmitter = class {
243
196
  constructor({ maxListener = 100, mode = "sequential" } = {}) {
244
- _classPrivateFieldInitSpec(this, _emitter, new EventEmitter());
245
- _classPrivateFieldInitSpec(this, _mode, void 0);
246
- _classPrivateFieldGet2(_emitter, this).setMaxListeners(maxListener);
247
- _classPrivateFieldSet2(_mode, this, mode);
197
+ this.#emitter.setMaxListeners(maxListener);
198
+ this.#mode = mode;
248
199
  }
200
+ #emitter = new EventEmitter();
201
+ #mode;
249
202
  async emit(eventName, ...eventArgs) {
250
- const listeners = _classPrivateFieldGet2(_emitter, this).listeners(eventName);
203
+ const listeners = this.#emitter.listeners(eventName);
251
204
  if (listeners.length === 0) return;
252
205
  const errors = [];
253
- if (_classPrivateFieldGet2(_mode, this) === "sequential") for (const listener of listeners) try {
206
+ if (this.#mode === "sequential") for (const listener of listeners) try {
254
207
  await listener(...eventArgs);
255
208
  } catch (err) {
256
209
  const error = err instanceof Error ? err : new Error(String(err));
@@ -271,7 +224,7 @@ var AsyncEventEmitter = class {
271
224
  if (errors.length > 1) throw new AggregateError(errors, `Errors in async listeners for "${eventName}"`);
272
225
  }
273
226
  on(eventName, handler) {
274
- _classPrivateFieldGet2(_emitter, this).on(eventName, handler);
227
+ this.#emitter.on(eventName, handler);
275
228
  }
276
229
  onOnce(eventName, handler) {
277
230
  const wrapper = (...args) => {
@@ -281,67 +234,24 @@ var AsyncEventEmitter = class {
281
234
  this.on(eventName, wrapper);
282
235
  }
283
236
  off(eventName, handler) {
284
- _classPrivateFieldGet2(_emitter, this).off(eventName, handler);
237
+ this.#emitter.off(eventName, handler);
285
238
  }
286
239
  removeAll() {
287
- _classPrivateFieldGet2(_emitter, this).removeAllListeners();
240
+ this.#emitter.removeAllListeners();
288
241
  }
289
242
  };
290
243
 
291
- //#endregion
292
- //#region \0@oxc-project+runtime@0.112.0/helpers/typeof.js
293
- function _typeof(o) {
294
- "@babel/helpers - typeof";
295
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
296
- return typeof o;
297
- } : function(o) {
298
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
299
- }, _typeof(o);
300
- }
301
-
302
- //#endregion
303
- //#region \0@oxc-project+runtime@0.112.0/helpers/toPrimitive.js
304
- function toPrimitive(t, r) {
305
- if ("object" != _typeof(t) || !t) return t;
306
- var e = t[Symbol.toPrimitive];
307
- if (void 0 !== e) {
308
- var i = e.call(t, r || "default");
309
- if ("object" != _typeof(i)) return i;
310
- throw new TypeError("@@toPrimitive must return a primitive value.");
311
- }
312
- return ("string" === r ? String : Number)(t);
313
- }
314
-
315
- //#endregion
316
- //#region \0@oxc-project+runtime@0.112.0/helpers/toPropertyKey.js
317
- function toPropertyKey(t) {
318
- var i = toPrimitive(t, "string");
319
- return "symbol" == _typeof(i) ? i : i + "";
320
- }
321
-
322
- //#endregion
323
- //#region \0@oxc-project+runtime@0.112.0/helpers/defineProperty.js
324
- function _defineProperty(e, r, t) {
325
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
326
- value: t,
327
- enumerable: !0,
328
- configurable: !0,
329
- writable: !0
330
- }) : e[r] = t, e;
331
- }
332
-
333
244
  //#endregion
334
245
  //#region src/FileProcessor.ts
335
- var _limit = /* @__PURE__ */ new WeakMap();
336
246
  var FileProcessor = class {
247
+ #limit = pLimit(100);
248
+ events;
337
249
  constructor({ events = new AsyncEventEmitter() } = {}) {
338
- _classPrivateFieldInitSpec(this, _limit, pLimit(100));
339
- _defineProperty(this, "events", void 0);
340
250
  this.events = events;
341
251
  return this;
342
252
  }
343
253
  async parse(file, { parsers, extension } = {}) {
344
- const parseExtName = (extension === null || extension === void 0 ? void 0 : extension[file.extname]) || void 0;
254
+ const parseExtName = extension?.[file.extname] || void 0;
345
255
  if (!parsers) {
346
256
  console.warn("No parsers provided, using default parser. If you want to use a specific parser, please provide it in the options.");
347
257
  return defaultParser.parse(file, { extname: parseExtName });
@@ -378,7 +288,7 @@ var FileProcessor = class {
378
288
  }
379
289
  for await (const [file, index] of asyncFiles()) if (file) await processOne(file, index);
380
290
  } else {
381
- const promises = files.map((resolvedFile, index) => _classPrivateFieldGet2(_limit, this).call(this, () => processOne(resolvedFile, index)));
291
+ const promises = files.map((resolvedFile, index) => this.#limit(() => processOne(resolvedFile, index)));
382
292
  await Promise.all(promises);
383
293
  }
384
294
  await this.events.emit("files:processing:end", files);
@@ -388,39 +298,29 @@ var FileProcessor = class {
388
298
 
389
299
  //#endregion
390
300
  //#region src/utils/Cache.ts
391
- var _buffer = /* @__PURE__ */ new WeakMap();
392
301
  var Cache = class {
393
- constructor() {
394
- _classPrivateFieldInitSpec(this, _buffer, /* @__PURE__ */ new Map());
395
- }
302
+ #buffer = /* @__PURE__ */ new Map();
396
303
  get(key) {
397
- var _this$buffer$get;
398
- return (_this$buffer$get = _classPrivateFieldGet2(_buffer, this).get(key)) !== null && _this$buffer$get !== void 0 ? _this$buffer$get : null;
304
+ return this.#buffer.get(key) ?? null;
399
305
  }
400
306
  set(key, value) {
401
- _classPrivateFieldGet2(_buffer, this).set(key, value);
307
+ this.#buffer.set(key, value);
402
308
  }
403
309
  delete(key) {
404
- _classPrivateFieldGet2(_buffer, this).delete(key);
310
+ this.#buffer.delete(key);
405
311
  }
406
312
  clear() {
407
- _classPrivateFieldGet2(_buffer, this).clear();
313
+ this.#buffer.clear();
408
314
  }
409
315
  keys() {
410
- return [..._classPrivateFieldGet2(_buffer, this).keys()];
316
+ return [...this.#buffer.keys()];
411
317
  }
412
318
  values() {
413
- return [..._classPrivateFieldGet2(_buffer, this).values()];
319
+ return [...this.#buffer.values()];
414
320
  }
415
321
  flush() {}
416
322
  };
417
323
 
418
- //#endregion
419
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateMethodInitSpec.js
420
- function _classPrivateMethodInitSpec(e, a) {
421
- _checkPrivateRedeclaration(e, a), a.add(e);
422
- }
423
-
424
324
  //#endregion
425
325
  //#region src/FileManager.ts
426
326
  function mergeFile(a, b) {
@@ -431,20 +331,24 @@ function mergeFile(a, b) {
431
331
  exports: [...a.exports || [], ...b.exports || []]
432
332
  };
433
333
  }
434
- var _cache = /* @__PURE__ */ new WeakMap();
435
- var _filesCache = /* @__PURE__ */ new WeakMap();
436
- var _FileManager_brand = /* @__PURE__ */ new WeakSet();
437
334
  var FileManager = class {
335
+ #cache = new Cache();
336
+ #filesCache = null;
337
+ events;
338
+ processor;
438
339
  constructor({ events = new AsyncEventEmitter() } = {}) {
439
- _classPrivateMethodInitSpec(this, _FileManager_brand);
440
- _classPrivateFieldInitSpec(this, _cache, new Cache());
441
- _classPrivateFieldInitSpec(this, _filesCache, null);
442
- _defineProperty(this, "events", void 0);
443
- _defineProperty(this, "processor", void 0);
444
340
  this.processor = new FileProcessor({ events });
445
341
  this.events = events;
446
342
  return this;
447
343
  }
344
+ #resolvePath(file) {
345
+ this.events.emit("file:resolve:path", file);
346
+ return file;
347
+ }
348
+ #resolveName(file) {
349
+ this.events.emit("file:resolve:name", file);
350
+ return file;
351
+ }
448
352
  add(...files) {
449
353
  const resolvedFiles = [];
450
354
  const mergedFiles = /* @__PURE__ */ new Map();
@@ -454,10 +358,10 @@ var FileManager = class {
454
358
  else mergedFiles.set(file.path, file);
455
359
  });
456
360
  for (let file of mergedFiles.values()) {
457
- file = _assertClassBrand(_FileManager_brand, this, _resolveName).call(this, file);
458
- file = _assertClassBrand(_FileManager_brand, this, _resolvePath).call(this, file);
361
+ file = this.#resolveName(file);
362
+ file = this.#resolvePath(file);
459
363
  const resolvedFile = createFile(file);
460
- _classPrivateFieldGet2(_cache, this).set(resolvedFile.path, resolvedFile);
364
+ this.#cache.set(resolvedFile.path, resolvedFile);
461
365
  this.flush();
462
366
  resolvedFiles.push(resolvedFile);
463
367
  }
@@ -473,11 +377,11 @@ var FileManager = class {
473
377
  else mergedFiles.set(file.path, file);
474
378
  });
475
379
  for (let file of mergedFiles.values()) {
476
- const existing = _classPrivateFieldGet2(_cache, this).get(file.path);
477
- file = _assertClassBrand(_FileManager_brand, this, _resolveName).call(this, file);
478
- file = _assertClassBrand(_FileManager_brand, this, _resolvePath).call(this, file);
380
+ const existing = this.#cache.get(file.path);
381
+ file = this.#resolveName(file);
382
+ file = this.#resolvePath(file);
479
383
  const resolvedFile = createFile(existing ? mergeFile(existing, file) : file);
480
- _classPrivateFieldGet2(_cache, this).set(resolvedFile.path, resolvedFile);
384
+ this.#cache.set(resolvedFile.path, resolvedFile);
481
385
  this.flush();
482
386
  resolvedFiles.push(resolvedFile);
483
387
  }
@@ -485,29 +389,29 @@ var FileManager = class {
485
389
  return resolvedFiles;
486
390
  }
487
391
  flush() {
488
- _classPrivateFieldSet2(_filesCache, this, null);
489
- _classPrivateFieldGet2(_cache, this).flush();
392
+ this.#filesCache = null;
393
+ this.#cache.flush();
490
394
  }
491
395
  getByPath(path) {
492
- return _classPrivateFieldGet2(_cache, this).get(path);
396
+ return this.#cache.get(path);
493
397
  }
494
398
  deleteByPath(path) {
495
- _classPrivateFieldGet2(_cache, this).delete(path);
496
- _classPrivateFieldSet2(_filesCache, this, null);
399
+ this.#cache.delete(path);
400
+ this.#filesCache = null;
497
401
  }
498
402
  clear() {
499
- _classPrivateFieldGet2(_cache, this).clear();
500
- _classPrivateFieldSet2(_filesCache, this, null);
403
+ this.#cache.clear();
404
+ this.#filesCache = null;
501
405
  }
502
406
  get files() {
503
- if (_classPrivateFieldGet2(_filesCache, this)) return _classPrivateFieldGet2(_filesCache, this);
504
- const keys = sortBy(_classPrivateFieldGet2(_cache, this).keys(), (v) => v.length, (v) => trimExtName(v).endsWith("index"));
407
+ if (this.#filesCache) return this.#filesCache;
408
+ const keys = sortBy(this.#cache.keys(), (v) => v.length, (v) => trimExtName(v).endsWith("index"));
505
409
  const files = [];
506
410
  for (const key of keys) {
507
- const file = _classPrivateFieldGet2(_cache, this).get(key);
411
+ const file = this.#cache.get(key);
508
412
  if (file) files.push(file);
509
413
  }
510
- _classPrivateFieldSet2(_filesCache, this, files);
414
+ this.#filesCache = files;
511
415
  return files;
512
416
  }
513
417
  async write(options) {
@@ -518,41 +422,31 @@ var FileManager = class {
518
422
  return resolvedFiles;
519
423
  }
520
424
  };
521
- function _resolvePath(file) {
522
- this.events.emit("file:resolve:path", file);
523
- return file;
524
- }
525
- function _resolveName(file) {
526
- this.events.emit("file:resolve:name", file);
527
- return file;
528
- }
529
425
 
530
426
  //#endregion
531
427
  //#region src/utils/TreeNode.ts
532
- var _childrenMap = /* @__PURE__ */ new WeakMap();
533
- var _cachedLeaves = /* @__PURE__ */ new WeakMap();
534
428
  var TreeNode = class TreeNode {
429
+ data;
430
+ parent;
431
+ children = [];
432
+ #childrenMap = /* @__PURE__ */ new Map();
433
+ #cachedLeaves;
535
434
  constructor(data, parent) {
536
- _defineProperty(this, "data", void 0);
537
- _defineProperty(this, "parent", void 0);
538
- _defineProperty(this, "children", []);
539
- _classPrivateFieldInitSpec(this, _childrenMap, /* @__PURE__ */ new Map());
540
- _classPrivateFieldInitSpec(this, _cachedLeaves, void 0);
541
435
  this.data = data;
542
436
  this.parent = parent;
543
437
  }
544
438
  addChild(data) {
545
439
  const child = new TreeNode(data, this);
546
440
  this.children.push(child);
547
- if (typeof data === "object" && data !== null && "name" in data) _classPrivateFieldGet2(_childrenMap, this).set(data.name, child);
548
- _classPrivateFieldSet2(_cachedLeaves, this, void 0);
441
+ if (typeof data === "object" && data !== null && "name" in data) this.#childrenMap.set(data.name, child);
442
+ this.#cachedLeaves = void 0;
549
443
  return child;
550
444
  }
551
445
  getChildByName(name) {
552
- return _classPrivateFieldGet2(_childrenMap, this).get(name);
446
+ return this.#childrenMap.get(name);
553
447
  }
554
448
  get leaves() {
555
- if (_classPrivateFieldGet2(_cachedLeaves, this)) return _classPrivateFieldGet2(_cachedLeaves, this);
449
+ if (this.#cachedLeaves) return this.#cachedLeaves;
556
450
  if (this.children.length === 0) return [this];
557
451
  const result = [];
558
452
  const stack = [...this.children];
@@ -564,7 +458,7 @@ var TreeNode = class TreeNode {
564
458
  if (node.children.length > 0) stack.push(...node.children);
565
459
  else result.push(node);
566
460
  }
567
- _classPrivateFieldSet2(_cachedLeaves, this, result);
461
+ this.#cachedLeaves = result;
568
462
  return result;
569
463
  }
570
464
  forEach(callback) {
@@ -611,8 +505,7 @@ var TreeNode = class TreeNode {
611
505
  const normalizedPaths = /* @__PURE__ */ new Map();
612
506
  const filteredFiles = [];
613
507
  for (const file of files) {
614
- var _normalizedPaths$get;
615
- const filePath = (_normalizedPaths$get = normalizedPaths.get(file)) !== null && _normalizedPaths$get !== void 0 ? _normalizedPaths$get : normalizePath(file.path);
508
+ const filePath = normalizedPaths.get(file) ?? normalizePath(file.path);
616
509
  normalizedPaths.set(file, filePath);
617
510
  if (!filePath.endsWith(".json") && (!rootFolder || filePath.startsWith(rootPrefix))) filteredFiles.push(file);
618
511
  }
@@ -762,9 +655,8 @@ function createComponent(type, Component) {
762
655
  fn.props = args[0];
763
656
  fn.type = type;
764
657
  fn.children = (...children) => {
765
- var _args$;
766
658
  const propsWithChildren = {
767
- ...(_args$ = args[0]) !== null && _args$ !== void 0 ? _args$ : {},
659
+ ...args[0] ?? {},
768
660
  children() {
769
661
  return renderIntrinsic(children);
770
662
  }
@@ -812,7 +704,7 @@ const Root = createComponent("Root", ({ onError, onExit, treeNode, fileManager,
812
704
  try {
813
705
  return children;
814
706
  } catch (e) {
815
- if (e instanceof Error) onError === null || onError === void 0 || onError(e);
707
+ if (e instanceof Error) onError?.(e);
816
708
  return "";
817
709
  }
818
710
  });
@@ -828,10 +720,15 @@ const SIGNALS = [
828
720
  /**
829
721
  * Register a callback to run when the process exits (via exit event or common signals).
830
722
  * Returns an unsubscribe function.
723
+ *
724
+ * Dynamically adjusts `process.maxListeners` to avoid MaxListenersExceededWarning
725
+ * when multiple instances are created (e.g. in tests).
831
726
  */
832
727
  function onProcessExit(callback) {
833
728
  const exitHandler = (code) => callback(code);
834
729
  const signalHandlers = /* @__PURE__ */ new Map();
730
+ const count = SIGNALS.length + 1;
731
+ process.setMaxListeners(process.getMaxListeners() + count);
835
732
  for (const signal of SIGNALS) {
836
733
  const handler = () => {
837
734
  unsubscribe();
@@ -848,10 +745,11 @@ function onProcessExit(callback) {
848
745
  function unsubscribe() {
849
746
  process.removeListener("exit", exitHandler);
850
747
  for (const [signal, handler] of signalHandlers) process.removeListener(signal, handler);
748
+ process.setMaxListeners(Math.max(process.getMaxListeners() - count, 0));
851
749
  }
852
750
  return unsubscribe;
853
751
  }
854
752
 
855
753
  //#endregion
856
- export { unprovide as S, createFile as _, renderIndent as a, inject as b, RootContext as c, FileProcessor as d, _defineProperty as f, _classPrivateFieldInitSpec as g, _classPrivateFieldGet2 as h, createIntrinsic as i, TreeNode as l, _classPrivateFieldSet2 as m, Root as n, renderIntrinsic as o, AsyncEventEmitter as p, createComponent as r, RenderContext as s, onProcessExit as t, FileManager as u, NodeTreeContext as v, provide as x, createContext as y };
857
- //# sourceMappingURL=onProcessExit-7fgW-UTF.js.map
754
+ export { provide as _, renderIndent as a, RootContext as c, FileProcessor as d, AsyncEventEmitter as f, inject as g, createContext as h, createIntrinsic as i, TreeNode as l, NodeTreeContext as m, Root as n, renderIntrinsic as o, createFile as p, createComponent as r, RenderContext as s, onProcessExit as t, FileManager as u, unprovide as v };
755
+ //# sourceMappingURL=onProcessExit-B0rJqX4s.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onProcessExit-B0rJqX4s.js","names":["#emitter","#mode","NodeEventEmitter","#limit","#buffer","#resolveName","#resolvePath","#cache","#filesCache","#childrenMap","#cachedLeaves"],"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","../src/utils/onProcessExit.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 { sortBy, 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 = sortBy(\n exports,\n (v) => !!Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n // join with null byte — can't appear in identifiers, so avoids collisions between e.g. ['a','b'] and ['a,b']\n (v) => (Array.isArray(v.name) ? [...v.name].sort().join('\\0') : (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\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\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 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 }\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 = sortBy(\n imports,\n (v) => Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n // join with null byte — can't appear in identifiers, so avoids collisions between e.g. ['a','b'] and ['a,b']\n (v) => (Array.isArray(v.name) ? [...v.name].sort().join('\\0') : (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\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\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 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 }\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 { sortBy } from 'remeda'\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 = sortBy(\n cachedKeys,\n (v) => v.length,\n (v) => trimExtName(v).endsWith('index'),\n )\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 * Callback to exit the Fabric application.\n *\n * Call this to stop rendering and clean up resources.\n */\n onExit: (error?: Error) => void\n /**\n * Error handler for runtime exceptions.\n *\n * Receives errors thrown during component rendering.\n */\n onError: (error: Error) => void\n /**\n * Tree structure representing the component hierarchy.\n *\n * Used internally for tracking component relationships.\n */\n treeNode: TreeNode<ComponentNode>\n /**\n * FileManager instance for file operations.\n *\n * Manages all files created during rendering.\n */\n fileManager: FileManager\n /**\n * Child components.\n */\n children?: FabricNode\n}\n\n/**\n * Root component providing core Fabric runtime context.\n *\n * This component is typically used internally by the Fabric renderer.\n * It provides the root context including FileManager, error handling,\n * and lifecycle management.\n *\n * @example\n * ```tsx\n * <Root\n * onExit={(error) => process.exit(error ? 1 : 0)}\n * onError={(error) => console.error(error)}\n * treeNode={treeNode}\n * fileManager={fileManager}\n * >\n * <App>\n * Your components here\n * </App>\n * </Root>\n * ```\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 = 'Root'\n","const SIGNALS: NodeJS.Signals[] = ['SIGINT', 'SIGTERM', 'SIGHUP']\n\n/**\n * Register a callback to run when the process exits (via exit event or common signals).\n * Returns an unsubscribe function.\n *\n * Dynamically adjusts `process.maxListeners` to avoid MaxListenersExceededWarning\n * when multiple instances are created (e.g. in tests).\n */\nexport function onProcessExit(callback: (code: number | null) => void): () => void {\n const exitHandler = (code: number) => callback(code)\n\n const signalHandlers = new Map<NodeJS.Signals, () => void>()\n const count = SIGNALS.length + 1 // SIGINT + SIGTERM + SIGHUP + exit\n\n // Increase the limit to accommodate this registration\n process.setMaxListeners(process.getMaxListeners() + count)\n\n for (const signal of SIGNALS) {\n const handler = () => {\n unsubscribe()\n try {\n callback(null)\n } finally {\n process.kill(process.pid, signal)\n }\n }\n signalHandlers.set(signal, handler)\n process.on(signal, handler)\n }\n\n process.on('exit', exitHandler)\n\n function unsubscribe() {\n process.removeListener('exit', exitHandler)\n for (const [signal, handler] of signalHandlers) {\n process.removeListener(signal, handler)\n }\n // Restore the limit when listeners are removed\n process.setMaxListeners(Math.max(process.getMaxListeners() - count, 0))\n }\n\n return unsubscribe\n}\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;;;;;;AAO9B,SAAgB,UAAa,KAAgC;CAC3D,MAAM,QAAQ,aAAa,IAAI,IAAI;AACnC,KAAI,SAAS,MAAM,SAAS,EAC1B,OAAM,KAAK;;;;;;;;;;;;AAcf,SAAgB,cAAiB,cAA6B;CAC5D,MAAM,MAAM,OAAO,UAAU;AAC7B,iBAAgB,IAAI,KAAK,aAAa;AAEtC,QAAO;;;;;;;;ACzET,MAAa,kBAAkB,cAA8C,KAAK;;;;ACDlF,SAAgB,eAAe,SAAyD;AACtF,QAAO,SAAS,UAAU,QAAQ;AAOhC,SAAO,GAHU,IAAI,QAAQ,IAAI,SAAS,GAGvB,GAFE,IAAI,gBAAgB,MAEN,GADhB,IAAI,cAAc;GAErC;;AAGJ,SAAgB,eAAe,SAA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