@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,6 @@
1
- const require_chunk = require('./chunk-DVipidnM.cjs');
2
- const require_getRelativePath = require('./getRelativePath-DpbA6qm5.cjs');
3
- const require_defaultParser = require('./defaultParser-BK-zOanQ.cjs');
1
+ const require_chunk = require('./chunk-uaV2rQ02.cjs');
2
+ const require_getRelativePath = require('./getRelativePath-DVG8dIzW.cjs');
3
+ const require_defaultParser = require('./defaultParser-BAgmtMo_.cjs');
4
4
  let remeda = require("remeda");
5
5
  let node_crypto = require("node:crypto");
6
6
  let node_path = require("node:path");
@@ -85,18 +85,11 @@ const NodeTreeContext = createContext(null);
85
85
  //#region src/createFile.ts
86
86
  function combineSources(sources) {
87
87
  return (0, remeda.uniqueBy)(sources, (obj) => {
88
- var _ref;
89
- var _obj$name;
90
- var _obj$isExportable;
91
- var _obj$isTypeOnly;
92
- 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}`;
88
+ return `${obj.name ?? obj.value ?? ""}:${obj.isExportable ?? false}:${obj.isTypeOnly ?? false}`;
93
89
  });
94
90
  }
95
91
  function combineExports(exports) {
96
- const sorted = (0, remeda.sortBy)(exports, (v) => !!Array.isArray(v.name), (v) => !v.isTypeOnly, (v) => v.path, (v) => !!v.name, (v) => {
97
- var _v$name;
98
- return Array.isArray(v.name) ? [...v.name].sort().join("\0") : (_v$name = v.name) !== null && _v$name !== void 0 ? _v$name : "";
99
- });
92
+ const sorted = (0, remeda.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 ?? "");
100
93
  const prev = [];
101
94
  const pathMap = /* @__PURE__ */ new Map();
102
95
  const uniqueMap = /* @__PURE__ */ new Map();
@@ -105,7 +98,7 @@ function combineExports(exports) {
105
98
  const pathKey = curr.path;
106
99
  const prevByPath = pathMap.get(pathKey);
107
100
  const uniqueKey = `${`${pathKey}:${Array.isArray(name) ? JSON.stringify(name) : name || ""}:${curr.isTypeOnly}`}:${curr.asAlias || ""}`;
108
- if (uniqueMap.get(uniqueKey) || Array.isArray(name) && !name.length || (prevByPath === null || prevByPath === void 0 ? void 0 : prevByPath.asAlias) && !curr.asAlias) continue;
101
+ if (uniqueMap.get(uniqueKey) || Array.isArray(name) && !name.length || prevByPath?.asAlias && !curr.asAlias) continue;
109
102
  if (!prevByPath) {
110
103
  const newItem = {
111
104
  ...curr,
@@ -145,10 +138,7 @@ function combineImports(imports, exports, source) {
145
138
  usageCache.set(importName, isUsed);
146
139
  return isUsed;
147
140
  };
148
- const sorted = (0, remeda.sortBy)(imports, (v) => Array.isArray(v.name), (v) => !v.isTypeOnly, (v) => v.path, (v) => !!v.name, (v) => {
149
- var _v$name2;
150
- return Array.isArray(v.name) ? [...v.name].sort().join("\0") : (_v$name2 = v.name) !== null && _v$name2 !== void 0 ? _v$name2 : "";
151
- });
141
+ const sorted = (0, remeda.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 ?? "");
152
142
  const prev = [];
153
143
  const pathTypeMap = /* @__PURE__ */ new Map();
154
144
  const uniqueMap = /* @__PURE__ */ new Map();
@@ -185,15 +175,12 @@ function combineImports(imports, exports, source) {
185
175
  * Helper to create a file with name and id set
186
176
  */
187
177
  function createFile(file) {
188
- var _file$exports;
189
- var _file$imports;
190
- var _file$sources;
191
178
  const extname = node_path.default.extname(file.baseName);
192
179
  if (!extname) throw new Error(`No extname found for ${file.baseName}`);
193
180
  const source = file.sources.map((item) => item.value).join("\n\n");
194
- const exports = ((_file$exports = file.exports) === null || _file$exports === void 0 ? void 0 : _file$exports.length) ? combineExports(file.exports) : [];
195
- const imports = ((_file$imports = file.imports) === null || _file$imports === void 0 ? void 0 : _file$imports.length) && source ? combineImports(file.imports, exports, source) : [];
196
- const sources = ((_file$sources = file.sources) === null || _file$sources === void 0 ? void 0 : _file$sources.length) ? combineSources(file.sources) : [];
181
+ const exports = file.exports?.length ? combineExports(file.exports) : [];
182
+ const imports = file.imports?.length && source ? combineImports(file.imports, exports, source) : [];
183
+ const sources = file.sources?.length ? combineSources(file.sources) : [];
197
184
  return {
198
185
  ...file,
199
186
  id: (0, node_crypto.createHash)("sha256").update(file.path).digest("hex"),
@@ -206,53 +193,20 @@ function createFile(file) {
206
193
  };
207
194
  }
208
195
 
209
- //#endregion
210
- //#region \0@oxc-project+runtime@0.112.0/helpers/checkPrivateRedeclaration.js
211
- function _checkPrivateRedeclaration(e, t) {
212
- if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
213
- }
214
-
215
- //#endregion
216
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldInitSpec.js
217
- function _classPrivateFieldInitSpec(e, t, a) {
218
- _checkPrivateRedeclaration(e, t), t.set(e, a);
219
- }
220
-
221
- //#endregion
222
- //#region \0@oxc-project+runtime@0.112.0/helpers/assertClassBrand.js
223
- function _assertClassBrand(e, t, n) {
224
- if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
225
- throw new TypeError("Private element is not present on this object");
226
- }
227
-
228
- //#endregion
229
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldGet2.js
230
- function _classPrivateFieldGet2(s, a) {
231
- return s.get(_assertClassBrand(s, a));
232
- }
233
-
234
- //#endregion
235
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldSet2.js
236
- function _classPrivateFieldSet2(s, a, r) {
237
- return s.set(_assertClassBrand(s, a), r), r;
238
- }
239
-
240
196
  //#endregion
241
197
  //#region src/utils/AsyncEventEmitter.ts
242
- var _emitter = /* @__PURE__ */ new WeakMap();
243
- var _mode = /* @__PURE__ */ new WeakMap();
244
198
  var AsyncEventEmitter = class {
245
199
  constructor({ maxListener = 100, mode = "sequential" } = {}) {
246
- _classPrivateFieldInitSpec(this, _emitter, new node_events.EventEmitter());
247
- _classPrivateFieldInitSpec(this, _mode, void 0);
248
- _classPrivateFieldGet2(_emitter, this).setMaxListeners(maxListener);
249
- _classPrivateFieldSet2(_mode, this, mode);
200
+ this.#emitter.setMaxListeners(maxListener);
201
+ this.#mode = mode;
250
202
  }
203
+ #emitter = new node_events.EventEmitter();
204
+ #mode;
251
205
  async emit(eventName, ...eventArgs) {
252
- const listeners = _classPrivateFieldGet2(_emitter, this).listeners(eventName);
206
+ const listeners = this.#emitter.listeners(eventName);
253
207
  if (listeners.length === 0) return;
254
208
  const errors = [];
255
- if (_classPrivateFieldGet2(_mode, this) === "sequential") for (const listener of listeners) try {
209
+ if (this.#mode === "sequential") for (const listener of listeners) try {
256
210
  await listener(...eventArgs);
257
211
  } catch (err) {
258
212
  const error = err instanceof Error ? err : new Error(String(err));
@@ -273,7 +227,7 @@ var AsyncEventEmitter = class {
273
227
  if (errors.length > 1) throw new AggregateError(errors, `Errors in async listeners for "${eventName}"`);
274
228
  }
275
229
  on(eventName, handler) {
276
- _classPrivateFieldGet2(_emitter, this).on(eventName, handler);
230
+ this.#emitter.on(eventName, handler);
277
231
  }
278
232
  onOnce(eventName, handler) {
279
233
  const wrapper = (...args) => {
@@ -283,67 +237,24 @@ var AsyncEventEmitter = class {
283
237
  this.on(eventName, wrapper);
284
238
  }
285
239
  off(eventName, handler) {
286
- _classPrivateFieldGet2(_emitter, this).off(eventName, handler);
240
+ this.#emitter.off(eventName, handler);
287
241
  }
288
242
  removeAll() {
289
- _classPrivateFieldGet2(_emitter, this).removeAllListeners();
243
+ this.#emitter.removeAllListeners();
290
244
  }
291
245
  };
292
246
 
293
- //#endregion
294
- //#region \0@oxc-project+runtime@0.112.0/helpers/typeof.js
295
- function _typeof(o) {
296
- "@babel/helpers - typeof";
297
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
298
- return typeof o;
299
- } : function(o) {
300
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
301
- }, _typeof(o);
302
- }
303
-
304
- //#endregion
305
- //#region \0@oxc-project+runtime@0.112.0/helpers/toPrimitive.js
306
- function toPrimitive(t, r) {
307
- if ("object" != _typeof(t) || !t) return t;
308
- var e = t[Symbol.toPrimitive];
309
- if (void 0 !== e) {
310
- var i = e.call(t, r || "default");
311
- if ("object" != _typeof(i)) return i;
312
- throw new TypeError("@@toPrimitive must return a primitive value.");
313
- }
314
- return ("string" === r ? String : Number)(t);
315
- }
316
-
317
- //#endregion
318
- //#region \0@oxc-project+runtime@0.112.0/helpers/toPropertyKey.js
319
- function toPropertyKey(t) {
320
- var i = toPrimitive(t, "string");
321
- return "symbol" == _typeof(i) ? i : i + "";
322
- }
323
-
324
- //#endregion
325
- //#region \0@oxc-project+runtime@0.112.0/helpers/defineProperty.js
326
- function _defineProperty(e, r, t) {
327
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
328
- value: t,
329
- enumerable: !0,
330
- configurable: !0,
331
- writable: !0
332
- }) : e[r] = t, e;
333
- }
334
-
335
247
  //#endregion
336
248
  //#region src/FileProcessor.ts
337
- var _limit = /* @__PURE__ */ new WeakMap();
338
249
  var FileProcessor = class {
250
+ #limit = (0, p_limit.default)(100);
251
+ events;
339
252
  constructor({ events = new AsyncEventEmitter() } = {}) {
340
- _classPrivateFieldInitSpec(this, _limit, (0, p_limit.default)(100));
341
- _defineProperty(this, "events", void 0);
342
253
  this.events = events;
343
254
  return this;
344
255
  }
345
256
  async parse(file, { parsers, extension } = {}) {
346
- const parseExtName = (extension === null || extension === void 0 ? void 0 : extension[file.extname]) || void 0;
257
+ const parseExtName = extension?.[file.extname] || void 0;
347
258
  if (!parsers) {
348
259
  console.warn("No parsers provided, using default parser. If you want to use a specific parser, please provide it in the options.");
349
260
  return require_defaultParser.defaultParser.parse(file, { extname: parseExtName });
@@ -380,7 +291,7 @@ var FileProcessor = class {
380
291
  }
381
292
  for await (const [file, index] of asyncFiles()) if (file) await processOne(file, index);
382
293
  } else {
383
- const promises = files.map((resolvedFile, index) => _classPrivateFieldGet2(_limit, this).call(this, () => processOne(resolvedFile, index)));
294
+ const promises = files.map((resolvedFile, index) => this.#limit(() => processOne(resolvedFile, index)));
384
295
  await Promise.all(promises);
385
296
  }
386
297
  await this.events.emit("files:processing:end", files);
@@ -390,39 +301,29 @@ var FileProcessor = class {
390
301
 
391
302
  //#endregion
392
303
  //#region src/utils/Cache.ts
393
- var _buffer = /* @__PURE__ */ new WeakMap();
394
304
  var Cache = class {
395
- constructor() {
396
- _classPrivateFieldInitSpec(this, _buffer, /* @__PURE__ */ new Map());
397
- }
305
+ #buffer = /* @__PURE__ */ new Map();
398
306
  get(key) {
399
- var _this$buffer$get;
400
- return (_this$buffer$get = _classPrivateFieldGet2(_buffer, this).get(key)) !== null && _this$buffer$get !== void 0 ? _this$buffer$get : null;
307
+ return this.#buffer.get(key) ?? null;
401
308
  }
402
309
  set(key, value) {
403
- _classPrivateFieldGet2(_buffer, this).set(key, value);
310
+ this.#buffer.set(key, value);
404
311
  }
405
312
  delete(key) {
406
- _classPrivateFieldGet2(_buffer, this).delete(key);
313
+ this.#buffer.delete(key);
407
314
  }
408
315
  clear() {
409
- _classPrivateFieldGet2(_buffer, this).clear();
316
+ this.#buffer.clear();
410
317
  }
411
318
  keys() {
412
- return [..._classPrivateFieldGet2(_buffer, this).keys()];
319
+ return [...this.#buffer.keys()];
413
320
  }
414
321
  values() {
415
- return [..._classPrivateFieldGet2(_buffer, this).values()];
322
+ return [...this.#buffer.values()];
416
323
  }
417
324
  flush() {}
418
325
  };
419
326
 
420
- //#endregion
421
- //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateMethodInitSpec.js
422
- function _classPrivateMethodInitSpec(e, a) {
423
- _checkPrivateRedeclaration(e, a), a.add(e);
424
- }
425
-
426
327
  //#endregion
427
328
  //#region src/FileManager.ts
428
329
  function mergeFile(a, b) {
@@ -433,20 +334,24 @@ function mergeFile(a, b) {
433
334
  exports: [...a.exports || [], ...b.exports || []]
434
335
  };
435
336
  }
436
- var _cache = /* @__PURE__ */ new WeakMap();
437
- var _filesCache = /* @__PURE__ */ new WeakMap();
438
- var _FileManager_brand = /* @__PURE__ */ new WeakSet();
439
337
  var FileManager = class {
338
+ #cache = new Cache();
339
+ #filesCache = null;
340
+ events;
341
+ processor;
440
342
  constructor({ events = new AsyncEventEmitter() } = {}) {
441
- _classPrivateMethodInitSpec(this, _FileManager_brand);
442
- _classPrivateFieldInitSpec(this, _cache, new Cache());
443
- _classPrivateFieldInitSpec(this, _filesCache, null);
444
- _defineProperty(this, "events", void 0);
445
- _defineProperty(this, "processor", void 0);
446
343
  this.processor = new FileProcessor({ events });
447
344
  this.events = events;
448
345
  return this;
449
346
  }
347
+ #resolvePath(file) {
348
+ this.events.emit("file:resolve:path", file);
349
+ return file;
350
+ }
351
+ #resolveName(file) {
352
+ this.events.emit("file:resolve:name", file);
353
+ return file;
354
+ }
450
355
  add(...files) {
451
356
  const resolvedFiles = [];
452
357
  const mergedFiles = /* @__PURE__ */ new Map();
@@ -456,10 +361,10 @@ var FileManager = class {
456
361
  else mergedFiles.set(file.path, file);
457
362
  });
458
363
  for (let file of mergedFiles.values()) {
459
- file = _assertClassBrand(_FileManager_brand, this, _resolveName).call(this, file);
460
- file = _assertClassBrand(_FileManager_brand, this, _resolvePath).call(this, file);
364
+ file = this.#resolveName(file);
365
+ file = this.#resolvePath(file);
461
366
  const resolvedFile = createFile(file);
462
- _classPrivateFieldGet2(_cache, this).set(resolvedFile.path, resolvedFile);
367
+ this.#cache.set(resolvedFile.path, resolvedFile);
463
368
  this.flush();
464
369
  resolvedFiles.push(resolvedFile);
465
370
  }
@@ -475,11 +380,11 @@ var FileManager = class {
475
380
  else mergedFiles.set(file.path, file);
476
381
  });
477
382
  for (let file of mergedFiles.values()) {
478
- const existing = _classPrivateFieldGet2(_cache, this).get(file.path);
479
- file = _assertClassBrand(_FileManager_brand, this, _resolveName).call(this, file);
480
- file = _assertClassBrand(_FileManager_brand, this, _resolvePath).call(this, file);
383
+ const existing = this.#cache.get(file.path);
384
+ file = this.#resolveName(file);
385
+ file = this.#resolvePath(file);
481
386
  const resolvedFile = createFile(existing ? mergeFile(existing, file) : file);
482
- _classPrivateFieldGet2(_cache, this).set(resolvedFile.path, resolvedFile);
387
+ this.#cache.set(resolvedFile.path, resolvedFile);
483
388
  this.flush();
484
389
  resolvedFiles.push(resolvedFile);
485
390
  }
@@ -487,29 +392,29 @@ var FileManager = class {
487
392
  return resolvedFiles;
488
393
  }
489
394
  flush() {
490
- _classPrivateFieldSet2(_filesCache, this, null);
491
- _classPrivateFieldGet2(_cache, this).flush();
395
+ this.#filesCache = null;
396
+ this.#cache.flush();
492
397
  }
493
398
  getByPath(path) {
494
- return _classPrivateFieldGet2(_cache, this).get(path);
399
+ return this.#cache.get(path);
495
400
  }
496
401
  deleteByPath(path) {
497
- _classPrivateFieldGet2(_cache, this).delete(path);
498
- _classPrivateFieldSet2(_filesCache, this, null);
402
+ this.#cache.delete(path);
403
+ this.#filesCache = null;
499
404
  }
500
405
  clear() {
501
- _classPrivateFieldGet2(_cache, this).clear();
502
- _classPrivateFieldSet2(_filesCache, this, null);
406
+ this.#cache.clear();
407
+ this.#filesCache = null;
503
408
  }
504
409
  get files() {
505
- if (_classPrivateFieldGet2(_filesCache, this)) return _classPrivateFieldGet2(_filesCache, this);
506
- const keys = (0, remeda.sortBy)(_classPrivateFieldGet2(_cache, this).keys(), (v) => v.length, (v) => require_getRelativePath.trimExtName(v).endsWith("index"));
410
+ if (this.#filesCache) return this.#filesCache;
411
+ const keys = (0, remeda.sortBy)(this.#cache.keys(), (v) => v.length, (v) => require_getRelativePath.trimExtName(v).endsWith("index"));
507
412
  const files = [];
508
413
  for (const key of keys) {
509
- const file = _classPrivateFieldGet2(_cache, this).get(key);
414
+ const file = this.#cache.get(key);
510
415
  if (file) files.push(file);
511
416
  }
512
- _classPrivateFieldSet2(_filesCache, this, files);
417
+ this.#filesCache = files;
513
418
  return files;
514
419
  }
515
420
  async write(options) {
@@ -520,41 +425,31 @@ var FileManager = class {
520
425
  return resolvedFiles;
521
426
  }
522
427
  };
523
- function _resolvePath(file) {
524
- this.events.emit("file:resolve:path", file);
525
- return file;
526
- }
527
- function _resolveName(file) {
528
- this.events.emit("file:resolve:name", file);
529
- return file;
530
- }
531
428
 
532
429
  //#endregion
533
430
  //#region src/utils/TreeNode.ts
534
- var _childrenMap = /* @__PURE__ */ new WeakMap();
535
- var _cachedLeaves = /* @__PURE__ */ new WeakMap();
536
431
  var TreeNode = class TreeNode {
432
+ data;
433
+ parent;
434
+ children = [];
435
+ #childrenMap = /* @__PURE__ */ new Map();
436
+ #cachedLeaves;
537
437
  constructor(data, parent) {
538
- _defineProperty(this, "data", void 0);
539
- _defineProperty(this, "parent", void 0);
540
- _defineProperty(this, "children", []);
541
- _classPrivateFieldInitSpec(this, _childrenMap, /* @__PURE__ */ new Map());
542
- _classPrivateFieldInitSpec(this, _cachedLeaves, void 0);
543
438
  this.data = data;
544
439
  this.parent = parent;
545
440
  }
546
441
  addChild(data) {
547
442
  const child = new TreeNode(data, this);
548
443
  this.children.push(child);
549
- if (typeof data === "object" && data !== null && "name" in data) _classPrivateFieldGet2(_childrenMap, this).set(data.name, child);
550
- _classPrivateFieldSet2(_cachedLeaves, this, void 0);
444
+ if (typeof data === "object" && data !== null && "name" in data) this.#childrenMap.set(data.name, child);
445
+ this.#cachedLeaves = void 0;
551
446
  return child;
552
447
  }
553
448
  getChildByName(name) {
554
- return _classPrivateFieldGet2(_childrenMap, this).get(name);
449
+ return this.#childrenMap.get(name);
555
450
  }
556
451
  get leaves() {
557
- if (_classPrivateFieldGet2(_cachedLeaves, this)) return _classPrivateFieldGet2(_cachedLeaves, this);
452
+ if (this.#cachedLeaves) return this.#cachedLeaves;
558
453
  if (this.children.length === 0) return [this];
559
454
  const result = [];
560
455
  const stack = [...this.children];
@@ -566,7 +461,7 @@ var TreeNode = class TreeNode {
566
461
  if (node.children.length > 0) stack.push(...node.children);
567
462
  else result.push(node);
568
463
  }
569
- _classPrivateFieldSet2(_cachedLeaves, this, result);
464
+ this.#cachedLeaves = result;
570
465
  return result;
571
466
  }
572
467
  forEach(callback) {
@@ -613,8 +508,7 @@ var TreeNode = class TreeNode {
613
508
  const normalizedPaths = /* @__PURE__ */ new Map();
614
509
  const filteredFiles = [];
615
510
  for (const file of files) {
616
- var _normalizedPaths$get;
617
- const filePath = (_normalizedPaths$get = normalizedPaths.get(file)) !== null && _normalizedPaths$get !== void 0 ? _normalizedPaths$get : normalizePath(file.path);
511
+ const filePath = normalizedPaths.get(file) ?? normalizePath(file.path);
618
512
  normalizedPaths.set(file, filePath);
619
513
  if (!filePath.endsWith(".json") && (!rootFolder || filePath.startsWith(rootPrefix))) filteredFiles.push(file);
620
514
  }
@@ -764,9 +658,8 @@ function createComponent(type, Component) {
764
658
  fn.props = args[0];
765
659
  fn.type = type;
766
660
  fn.children = (...children) => {
767
- var _args$;
768
661
  const propsWithChildren = {
769
- ...(_args$ = args[0]) !== null && _args$ !== void 0 ? _args$ : {},
662
+ ...args[0] ?? {},
770
663
  children() {
771
664
  return renderIntrinsic(children);
772
665
  }
@@ -814,7 +707,7 @@ const Root = createComponent("Root", ({ onError, onExit, treeNode, fileManager,
814
707
  try {
815
708
  return children;
816
709
  } catch (e) {
817
- if (e instanceof Error) onError === null || onError === void 0 || onError(e);
710
+ if (e instanceof Error) onError?.(e);
818
711
  return "";
819
712
  }
820
713
  });
@@ -830,10 +723,15 @@ const SIGNALS = [
830
723
  /**
831
724
  * Register a callback to run when the process exits (via exit event or common signals).
832
725
  * Returns an unsubscribe function.
726
+ *
727
+ * Dynamically adjusts `process.maxListeners` to avoid MaxListenersExceededWarning
728
+ * when multiple instances are created (e.g. in tests).
833
729
  */
834
730
  function onProcessExit(callback) {
835
731
  const exitHandler = (code) => callback(code);
836
732
  const signalHandlers = /* @__PURE__ */ new Map();
733
+ const count = SIGNALS.length + 1;
734
+ process.setMaxListeners(process.getMaxListeners() + count);
837
735
  for (const signal of SIGNALS) {
838
736
  const handler = () => {
839
737
  unsubscribe();
@@ -850,6 +748,7 @@ function onProcessExit(callback) {
850
748
  function unsubscribe() {
851
749
  process.removeListener("exit", exitHandler);
852
750
  for (const [signal, handler] of signalHandlers) process.removeListener(signal, handler);
751
+ process.setMaxListeners(Math.max(process.getMaxListeners() - count, 0));
853
752
  }
854
753
  return unsubscribe;
855
754
  }
@@ -903,30 +802,6 @@ Object.defineProperty(exports, 'TreeNode', {
903
802
  return TreeNode;
904
803
  }
905
804
  });
906
- Object.defineProperty(exports, '_classPrivateFieldGet2', {
907
- enumerable: true,
908
- get: function () {
909
- return _classPrivateFieldGet2;
910
- }
911
- });
912
- Object.defineProperty(exports, '_classPrivateFieldInitSpec', {
913
- enumerable: true,
914
- get: function () {
915
- return _classPrivateFieldInitSpec;
916
- }
917
- });
918
- Object.defineProperty(exports, '_classPrivateFieldSet2', {
919
- enumerable: true,
920
- get: function () {
921
- return _classPrivateFieldSet2;
922
- }
923
- });
924
- Object.defineProperty(exports, '_defineProperty', {
925
- enumerable: true,
926
- get: function () {
927
- return _defineProperty;
928
- }
929
- });
930
805
  Object.defineProperty(exports, 'createComponent', {
931
806
  enumerable: true,
932
807
  get: function () {
@@ -987,4 +862,4 @@ Object.defineProperty(exports, 'unprovide', {
987
862
  return unprovide;
988
863
  }
989
864
  });
990
- //# sourceMappingURL=onProcessExit-C7dVg0S0.cjs.map
865
+ //# sourceMappingURL=onProcessExit-DENCUkMz.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onProcessExit-DENCUkMz.cjs","names":["path","trimExtName","#emitter","#mode","NodeEventEmitter","defaultParser","#limit","#buffer","#resolveName","#resolvePath","#cache","#filesCache","trimExtName","#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,KAA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