@kubb/core 3.0.0-alpha.3 → 3.0.0-alpha.5

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 (41) hide show
  1. package/dist/{FileManager-BW--rO8q.d.ts → FileManager-jZpqETKU.d.cts} +15 -20
  2. package/dist/{FileManager-Bw-FNS3q.d.cts → FileManager-tzl0YsYE.d.ts} +15 -20
  3. package/dist/{chunk-SA2GZKXS.js → chunk-CEWT73XF.js} +110 -69
  4. package/dist/chunk-CEWT73XF.js.map +1 -0
  5. package/dist/{chunk-ADC5UNZ5.cjs → chunk-FWU62YO5.cjs} +319 -281
  6. package/dist/chunk-FWU62YO5.cjs.map +1 -0
  7. package/dist/{chunk-LM2YQC3T.cjs → chunk-RBP2ASUX.cjs} +38 -23
  8. package/dist/chunk-RBP2ASUX.cjs.map +1 -0
  9. package/dist/{chunk-3OXCZ5DJ.js → chunk-Z5CHJQJB.js} +29 -21
  10. package/dist/chunk-Z5CHJQJB.js.map +1 -0
  11. package/dist/index.cjs +43 -130
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +4 -15
  14. package/dist/index.d.ts +4 -15
  15. package/dist/index.js +25 -105
  16. package/dist/index.js.map +1 -1
  17. package/dist/{logger-DChjnJMn.d.cts → logger-BnWJh6Yq.d.cts} +17 -19
  18. package/dist/{logger-DChjnJMn.d.ts → logger-BnWJh6Yq.d.ts} +17 -19
  19. package/dist/logger.cjs +3 -4
  20. package/dist/logger.cjs.map +1 -1
  21. package/dist/logger.d.cts +2 -2
  22. package/dist/logger.d.ts +2 -2
  23. package/dist/logger.js +2 -3
  24. package/dist/mocks.cjs +3 -3
  25. package/dist/mocks.cjs.map +1 -1
  26. package/dist/mocks.d.cts +2 -4
  27. package/dist/mocks.d.ts +2 -4
  28. package/dist/mocks.js +4 -4
  29. package/dist/mocks.js.map +1 -1
  30. package/package.json +7 -8
  31. package/src/BarrelManager.ts +10 -1
  32. package/src/FileManager.ts +107 -63
  33. package/src/PluginManager.ts +6 -22
  34. package/src/build.ts +19 -101
  35. package/src/errors.ts +0 -11
  36. package/src/index.ts +0 -1
  37. package/src/logger.ts +43 -33
  38. package/dist/chunk-3OXCZ5DJ.js.map +0 -1
  39. package/dist/chunk-ADC5UNZ5.cjs.map +0 -1
  40. package/dist/chunk-LM2YQC3T.cjs.map +0 -1
  41. package/dist/chunk-SA2GZKXS.js.map +0 -1
@@ -1,10 +1,9 @@
1
- import PQueue from 'p-queue';
2
1
  import { write, read } from '@kubb/fs';
3
2
  import * as KubbFile from '@kubb/fs/types';
4
3
  import { BaseName, File, UUID } from '@kubb/fs/src/types.ts';
5
4
  import { PossiblePromise, GreaterThan } from '@kubb/types';
6
5
  import { DirectoryTreeOptions } from 'directory-tree';
7
- import { E as EventEmitter, L as Logger } from './logger-DChjnJMn.js';
6
+ import { E as EventEmitter, L as Logger } from './logger-BnWJh6Yq.cjs';
8
7
 
9
8
  type BarrelManagerOptions = {
10
9
  treeNode?: DirectoryTreeOptions;
@@ -34,12 +33,8 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
34
33
  result: Result;
35
34
  plugin: Plugin;
36
35
  };
37
- type Options$1 = {
36
+ type Options = {
38
37
  logger: Logger;
39
- /**
40
- * Task for the FileManager
41
- */
42
- task: (file: ResolvedFile) => Promise<ResolvedFile>;
43
38
  };
44
39
  type Events = {
45
40
  execute: [executer: Executer];
@@ -61,8 +56,7 @@ declare class PluginManager {
61
56
  readonly config: Config;
62
57
  readonly executed: Array<Executer>;
63
58
  readonly logger: Logger;
64
- readonly queue: PQueue;
65
- constructor(config: Config, options: Options$1);
59
+ constructor(config: Config, options: Options);
66
60
  getFile<TOptions = object>({ name, mode, extName, pluginKey, options }: GetFileProps<TOptions>): KubbFile.File<{
67
61
  pluginKey: Plugin['key'];
68
62
  }>;
@@ -409,29 +403,30 @@ type AddIndexesProps = {
409
403
  };
410
404
  logger: Logger;
411
405
  options?: BarrelManagerOptions;
412
- meta?: FileWithMeta['meta'];
413
- };
414
- type Options = {
415
- queue?: PQueue;
416
- task?: (file: ResolvedFile) => Promise<ResolvedFile>;
406
+ plugin: Plugin;
417
407
  };
418
408
  declare class FileManager {
419
409
  #private;
420
- constructor({ task, queue }?: Options);
410
+ constructor();
421
411
  get files(): Array<FileWithMeta>;
422
- get isExecuting(): boolean;
423
412
  add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T>;
424
- addIndexes({ root, output, meta, logger, options }: AddIndexesProps): Promise<void>;
413
+ getIndexFiles({ plugin, root, output, logger, options }: AddIndexesProps): Promise<ResolvedFile[]>;
425
414
  getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined;
426
415
  get(path: KubbFile.Path): Array<FileWithMeta> | undefined;
427
416
  remove(path: KubbFile.Path): void;
428
- write(...params: Parameters<typeof write>): Promise<string | undefined>;
429
- read(...params: Parameters<typeof read>): Promise<string>;
430
- static getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string>;
417
+ write(...params: Parameters<typeof write>): ReturnType<typeof write>;
418
+ read(...params: Parameters<typeof read>): ReturnType<typeof read>;
419
+ processFiles(...params: Parameters<typeof processFiles>): ReturnType<typeof processFiles>;
431
420
  static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>>;
432
421
  static getMode(path: string | undefined | null): KubbFile.Mode;
433
422
  static get extensions(): Array<KubbFile.Extname>;
434
423
  static isJavascript(baseName: string): boolean;
435
424
  }
425
+ type WriteFilesProps = {
426
+ files: KubbFile.File[];
427
+ logger: Logger;
428
+ dryRun?: boolean;
429
+ };
430
+ declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<KubbFile.File<FileMetaBase>[]>;
436
431
 
437
432
  export { type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, type UserPlugin as g, type Plugin as h, type PluginWithLifeCycle as i, type PluginLifecycle as j, type PluginLifecycleHooks as k, type PluginParameter as l, type PluginCache as m, type ResolveNameParams as n };
@@ -1,10 +1,9 @@
1
- import PQueue from 'p-queue';
2
1
  import { write, read } from '@kubb/fs';
3
2
  import * as KubbFile from '@kubb/fs/types';
4
3
  import { BaseName, File, UUID } from '@kubb/fs/src/types.ts';
5
4
  import { PossiblePromise, GreaterThan } from '@kubb/types';
6
5
  import { DirectoryTreeOptions } from 'directory-tree';
7
- import { E as EventEmitter, L as Logger } from './logger-DChjnJMn.cjs';
6
+ import { E as EventEmitter, L as Logger } from './logger-BnWJh6Yq.js';
8
7
 
9
8
  type BarrelManagerOptions = {
10
9
  treeNode?: DirectoryTreeOptions;
@@ -34,12 +33,8 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
34
33
  result: Result;
35
34
  plugin: Plugin;
36
35
  };
37
- type Options$1 = {
36
+ type Options = {
38
37
  logger: Logger;
39
- /**
40
- * Task for the FileManager
41
- */
42
- task: (file: ResolvedFile) => Promise<ResolvedFile>;
43
38
  };
44
39
  type Events = {
45
40
  execute: [executer: Executer];
@@ -61,8 +56,7 @@ declare class PluginManager {
61
56
  readonly config: Config;
62
57
  readonly executed: Array<Executer>;
63
58
  readonly logger: Logger;
64
- readonly queue: PQueue;
65
- constructor(config: Config, options: Options$1);
59
+ constructor(config: Config, options: Options);
66
60
  getFile<TOptions = object>({ name, mode, extName, pluginKey, options }: GetFileProps<TOptions>): KubbFile.File<{
67
61
  pluginKey: Plugin['key'];
68
62
  }>;
@@ -409,29 +403,30 @@ type AddIndexesProps = {
409
403
  };
410
404
  logger: Logger;
411
405
  options?: BarrelManagerOptions;
412
- meta?: FileWithMeta['meta'];
413
- };
414
- type Options = {
415
- queue?: PQueue;
416
- task?: (file: ResolvedFile) => Promise<ResolvedFile>;
406
+ plugin: Plugin;
417
407
  };
418
408
  declare class FileManager {
419
409
  #private;
420
- constructor({ task, queue }?: Options);
410
+ constructor();
421
411
  get files(): Array<FileWithMeta>;
422
- get isExecuting(): boolean;
423
412
  add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T>;
424
- addIndexes({ root, output, meta, logger, options }: AddIndexesProps): Promise<void>;
413
+ getIndexFiles({ plugin, root, output, logger, options }: AddIndexesProps): Promise<ResolvedFile[]>;
425
414
  getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined;
426
415
  get(path: KubbFile.Path): Array<FileWithMeta> | undefined;
427
416
  remove(path: KubbFile.Path): void;
428
- write(...params: Parameters<typeof write>): Promise<string | undefined>;
429
- read(...params: Parameters<typeof read>): Promise<string>;
430
- static getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string>;
417
+ write(...params: Parameters<typeof write>): ReturnType<typeof write>;
418
+ read(...params: Parameters<typeof read>): ReturnType<typeof read>;
419
+ processFiles(...params: Parameters<typeof processFiles>): ReturnType<typeof processFiles>;
431
420
  static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>>;
432
421
  static getMode(path: string | undefined | null): KubbFile.Mode;
433
422
  static get extensions(): Array<KubbFile.Extname>;
434
423
  static isJavascript(baseName: string): boolean;
435
424
  }
425
+ type WriteFilesProps = {
426
+ files: KubbFile.File[];
427
+ logger: Logger;
428
+ dryRun?: boolean;
429
+ };
430
+ declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<KubbFile.File<FileMetaBase>[]>;
436
431
 
437
432
  export { type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, type UserPlugin as g, type Plugin as h, type PluginWithLifeCycle as i, type PluginLifecycle as j, type PluginLifecycleHooks as k, type PluginParameter as l, type PluginCache as m, type ResolveNameParams as n };
@@ -18,8 +18,7 @@ import {
18
18
 
19
19
  // src/FileManager.ts
20
20
  import crypto from "crypto";
21
- import { extname, resolve } from "path";
22
- import PQueue from "p-queue";
21
+ import path2, { extname, resolve } from "path";
23
22
  import { isDeepEqual } from "remeda";
24
23
  import { getRelativePath, read, write } from "@kubb/fs";
25
24
 
@@ -91,10 +90,10 @@ var TreeNode = class _TreeNode {
91
90
  }
92
91
  return this;
93
92
  }
94
- static build(path2, options = {}) {
93
+ static build(path3, options = {}) {
95
94
  try {
96
95
  const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean);
97
- const filteredTree = dirTree(path2, {
96
+ const filteredTree = dirTree(path3, {
98
97
  extensions: options.extensions,
99
98
  exclude: [/node_modules/, ...exclude]
100
99
  });
@@ -134,12 +133,16 @@ var BarrelManager = class {
134
133
  __privateSet(this, _options, options);
135
134
  return this;
136
135
  }
136
+ /**
137
+ * Loop through the file and find all exports(with the help of the ts printer)
138
+ * Important: a real file is needed(cannot work from memory/FileManager)
139
+ */
137
140
  getNamedExport(root, item) {
138
141
  const exportedNames = getExports(path.resolve(root, item.path));
139
142
  if (!exportedNames) {
140
143
  return [item];
141
144
  }
142
- return exportedNames.reduce(
145
+ const exports = exportedNames.reduce(
143
146
  (prev, curr) => {
144
147
  if (!prev[0]?.name || !prev[1]?.name) {
145
148
  return prev;
@@ -164,6 +167,7 @@ var BarrelManager = class {
164
167
  }
165
168
  ]
166
169
  );
170
+ return exports;
167
171
  }
168
172
  getNamedExports(root, exports) {
169
173
  return exports?.flatMap((item) => {
@@ -228,15 +232,12 @@ var BarrelManager = class {
228
232
  _options = new WeakMap();
229
233
 
230
234
  // src/FileManager.ts
231
- var _cache, _task, _queue, _FileManager_instances, add_fn, addOrAppend_fn;
235
+ import PQueue from "p-queue";
236
+ var _cache, _FileManager_instances, add_fn, addOrAppend_fn;
232
237
  var _FileManager = class _FileManager {
233
- constructor({ task = async (file) => file, queue = new PQueue() } = {}) {
238
+ constructor() {
234
239
  __privateAdd(this, _FileManager_instances);
235
240
  __privateAdd(this, _cache, /* @__PURE__ */ new Map());
236
- __privateAdd(this, _task);
237
- __privateAdd(this, _queue);
238
- __privateSet(this, _task, task);
239
- __privateSet(this, _queue, queue);
240
241
  return this;
241
242
  }
242
243
  get files() {
@@ -246,9 +247,6 @@ var _FileManager = class _FileManager {
246
247
  });
247
248
  return files;
248
249
  }
249
- get isExecuting() {
250
- return __privateGet(this, _queue).size !== 0 && __privateGet(this, _queue).pending !== 0;
251
- }
252
250
  async add(...files) {
253
251
  const promises = combineFiles(files).map((file) => {
254
252
  if (file.override) {
@@ -262,15 +260,15 @@ var _FileManager = class _FileManager {
262
260
  }
263
261
  return resolvedFiles[0];
264
262
  }
265
- async addIndexes({ root, output, meta, logger, options = {} }) {
263
+ async getIndexFiles({ plugin, root, output, logger, options = {} }) {
266
264
  const { exportType = "barrel" } = output;
267
265
  if (exportType === false) {
268
- return void 0;
266
+ return [];
269
267
  }
270
268
  const pathToBuildFrom = resolve(root, output.path);
271
269
  if (transformers_default.trimExtName(pathToBuildFrom).endsWith("index")) {
272
270
  logger.emit("warning", "Output has the same fileName as the barrelFiles, please disable barrel generation");
273
- return;
271
+ return [];
274
272
  }
275
273
  const exportPath = output.path.startsWith("./") ? trimExtName(output.path) : `./${trimExtName(output.path)}`;
276
274
  const mode = _FileManager.getMode(output.path);
@@ -280,27 +278,8 @@ var _FileManager = class _FileManager {
280
278
  });
281
279
  let files = barrelManager.getIndexes(pathToBuildFrom);
282
280
  if (!files) {
283
- return void 0;
281
+ return [];
284
282
  }
285
- if (exportType === "barrelNamed") {
286
- files = files.map((file) => {
287
- if (file.exports) {
288
- return {
289
- ...file,
290
- exports: barrelManager.getNamedExports(pathToBuildFrom, file.exports)
291
- };
292
- }
293
- return file;
294
- });
295
- }
296
- await Promise.all(
297
- files.map((file) => {
298
- return __privateMethod(this, _FileManager_instances, addOrAppend_fn).call(this, {
299
- ...file,
300
- meta: meta ? meta : file.meta
301
- });
302
- })
303
- );
304
283
  const rootPath = mode === "split" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
305
284
  const rootFile = {
306
285
  path: resolve(root, "index.ts"),
@@ -319,13 +298,49 @@ var _FileManager = class _FileManager {
319
298
  ],
320
299
  exportable: true
321
300
  };
322
- if (exportType === "barrelNamed" && !output.exportAs && rootFile.exports?.[0]) {
323
- rootFile.exports = barrelManager.getNamedExport(root, rootFile.exports[0]);
301
+ if (exportType === "barrelNamed") {
302
+ files = files.map((file) => {
303
+ if (file.exports) {
304
+ return {
305
+ ...file,
306
+ exports: barrelManager.getNamedExports(pathToBuildFrom, file.exports)
307
+ };
308
+ }
309
+ return file;
310
+ });
311
+ const barrelExportRoot = rootFile.exports?.[0];
312
+ if (!output.exportAs && barrelExportRoot) {
313
+ const exportFile = files.find((file) => {
314
+ return trimExtName(file.path) === path2.resolve(root, barrelExportRoot.path);
315
+ });
316
+ if (exportFile?.exports) {
317
+ rootFile.exports = exportFile.exports.map((exportItem) => {
318
+ return {
319
+ ...exportItem,
320
+ path: getRelativePath(rootFile.path, exportFile.path)
321
+ };
322
+ });
323
+ }
324
+ }
324
325
  }
325
- await __privateMethod(this, _FileManager_instances, addOrAppend_fn).call(this, {
326
- ...rootFile,
327
- meta: meta ? meta : rootFile.meta
328
- });
326
+ return [
327
+ ...await Promise.all(
328
+ files.map((file) => {
329
+ return __privateMethod(this, _FileManager_instances, addOrAppend_fn).call(this, {
330
+ ...file,
331
+ meta: {
332
+ pluginKey: plugin.key
333
+ }
334
+ });
335
+ })
336
+ ),
337
+ await __privateMethod(this, _FileManager_instances, addOrAppend_fn).call(this, {
338
+ ...rootFile,
339
+ meta: {
340
+ pluginKey: plugin.key
341
+ }
342
+ })
343
+ ];
329
344
  }
330
345
  getCacheByUUID(UUID) {
331
346
  let cache;
@@ -334,15 +349,15 @@ var _FileManager = class _FileManager {
334
349
  });
335
350
  return cache;
336
351
  }
337
- get(path2) {
338
- return __privateGet(this, _cache).get(path2);
352
+ get(path3) {
353
+ return __privateGet(this, _cache).get(path3);
339
354
  }
340
- remove(path2) {
341
- const cacheItem = this.get(path2);
355
+ remove(path3) {
356
+ const cacheItem = this.get(path3);
342
357
  if (!cacheItem) {
343
358
  return;
344
359
  }
345
- __privateGet(this, _cache).delete(path2);
360
+ __privateGet(this, _cache).delete(path3);
346
361
  }
347
362
  async write(...params) {
348
363
  return write(...params);
@@ -350,18 +365,18 @@ var _FileManager = class _FileManager {
350
365
  async read(...params) {
351
366
  return read(...params);
352
367
  }
353
- // statics
354
- static async getSource(file) {
355
- return getSource(file);
368
+ async processFiles(...params) {
369
+ return processFiles(...params);
356
370
  }
371
+ // statics
357
372
  static combineFiles(files) {
358
373
  return combineFiles(files);
359
374
  }
360
- static getMode(path2) {
361
- if (!path2) {
375
+ static getMode(path3) {
376
+ if (!path3) {
362
377
  return "split";
363
378
  }
364
- return extname(path2) ? "single" : "split";
379
+ return extname(path3) ? "single" : "split";
365
380
  }
366
381
  static get extensions() {
367
382
  return [".js", ".ts", ".tsx"];
@@ -371,8 +386,6 @@ var _FileManager = class _FileManager {
371
386
  }
372
387
  };
373
388
  _cache = new WeakMap();
374
- _task = new WeakMap();
375
- _queue = new WeakMap();
376
389
  _FileManager_instances = new WeakSet();
377
390
  add_fn = async function(file) {
378
391
  const controller = new AbortController();
@@ -392,13 +405,7 @@ add_fn = async function(file) {
392
405
  });
393
406
  }
394
407
  __privateGet(this, _cache).set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }]);
395
- return __privateGet(this, _queue).add(
396
- async () => {
397
- var _a;
398
- return (_a = __privateGet(this, _task)) == null ? void 0 : _a.call(this, resolvedFile);
399
- },
400
- { signal: controller.signal }
401
- );
408
+ return resolvedFile;
402
409
  };
403
410
  addOrAppend_fn = async function(file) {
404
411
  const previousCaches = __privateGet(this, _cache).get(file.path);
@@ -456,13 +463,13 @@ async function getSource(file) {
456
463
  const exports = file.exports ? combineExports(file.exports) : [];
457
464
  const imports = file.imports && file.source ? combineImports(file.imports, exports, file.source) : [];
458
465
  const importNodes = imports.filter((item) => {
459
- const path2 = item.root ? getRelativePath(item.root, item.path) : item.path;
460
- return path2 !== trimExtName(file.path);
466
+ const path3 = item.root ? getRelativePath(item.root, item.path) : item.path;
467
+ return path3 !== trimExtName(file.path);
461
468
  }).map((item) => {
462
- const path2 = item.root ? getRelativePath(item.root, item.path) : item.path;
469
+ const path3 = item.root ? getRelativePath(item.root, item.path) : item.path;
463
470
  return parser.factory.createImportDeclaration({
464
471
  name: item.name,
465
- path: item.extName ? `${path2}${item.extName}` : path2,
472
+ path: item.extName ? `${path3}${item.extName}` : path3,
466
473
  isTypeOnly: item.isTypeOnly
467
474
  });
468
475
  });
@@ -589,8 +596,42 @@ function getEnvSource(source, env) {
589
596
  return prev;
590
597
  }, source);
591
598
  }
599
+ var queue = new PQueue({ concurrency: 10 });
600
+ async function processFiles({ dryRun, logger, files }) {
601
+ const mergedFiles = await Promise.all(
602
+ files.map(async (file) => ({
603
+ ...file,
604
+ source: await getSource(file)
605
+ }))
606
+ );
607
+ const orderedFiles = orderBy(mergedFiles, [(v) => !v.meta?.pluginKey, (v) => v.path.length, (v) => trimExtName(v.path).endsWith("index")], ["desc", "desc"]);
608
+ logger.emit(
609
+ "debug",
610
+ orderedFiles.map((item) => `[${item.meta?.pluginKey || "unknown"}]${item.path}:
611
+ ${item.source}`)
612
+ );
613
+ if (!dryRun) {
614
+ logger.consola?.pauseLogs();
615
+ const size = orderedFiles.length;
616
+ const promises = orderedFiles.map(async (file, index) => {
617
+ await queue.add(async () => {
618
+ logger.emit("progress", { count: index, size, file });
619
+ await write(file.path, file.source, { sanity: false });
620
+ await new Promise((resolve2) => {
621
+ setTimeout(resolve2, 0);
622
+ });
623
+ logger.emit("progress", { count: index + 1, size, file });
624
+ });
625
+ });
626
+ await Promise.all(promises);
627
+ logger.consola?.resumeLogs();
628
+ }
629
+ return mergedFiles;
630
+ }
592
631
 
593
632
  export {
594
- FileManager
633
+ FileManager,
634
+ getSource,
635
+ processFiles
595
636
  };
596
- //# sourceMappingURL=chunk-SA2GZKXS.js.map
637
+ //# sourceMappingURL=chunk-CEWT73XF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/FileManager.ts","../src/BarrelManager.ts","../src/utils/TreeNode.ts"],"sourcesContent":["import crypto from 'node:crypto'\nimport path, { extname, resolve } from 'node:path'\n\nimport { orderBy } from 'natural-orderby'\nimport { isDeepEqual } from 'remeda'\n\nimport { getRelativePath, read, write } from '@kubb/fs'\nimport { BarrelManager } from './BarrelManager.ts'\nimport { searchAndReplace } from './transformers/searchAndReplace.ts'\nimport { trimExtName } from './transformers/trim.ts'\n\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { BaseName, File, UUID } from '@kubb/fs/src/types.ts'\nimport type { GreaterThan } from '@kubb/types'\nimport type { BarrelManagerOptions } from './BarrelManager.ts'\nimport type { Logger } from './logger.ts'\nimport transformers from './transformers/index.ts'\nimport type { Plugin } from './types.ts'\nimport { getParser } from './utils'\nimport PQueue from 'p-queue'\n\nexport type ResolvedFile<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = File<TMeta, TBaseName> & {\n /**\n * @default crypto.randomUUID()\n */\n id: UUID\n /**\n * Contains the first part of the baseName, generated based on baseName\n * @link https://nodejs.org/api/path.html#pathformatpathobject\n */\n\n name: string\n}\n\nexport type FileMetaBase = {\n pluginKey?: Plugin['key']\n}\n\ntype FileWithMeta<TMeta extends FileMetaBase = FileMetaBase> = KubbFile.File<TMeta>\n\ntype CacheItem = ResolvedFile & {\n cancel?: () => void\n}\n\ntype AddResult<T extends Array<FileWithMeta>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>\n\ntype AddIndexesProps = {\n /**\n * Root based on root and output.path specified in the config\n */\n root: string\n /**\n * Output for plugin\n */\n output: {\n path: string\n exportAs?: string\n extName?: KubbFile.Extname\n exportType?: 'barrel' | 'barrelNamed' | false\n }\n logger: Logger\n options?: BarrelManagerOptions\n plugin: Plugin\n}\n\nexport class FileManager {\n #cache: Map<KubbFile.Path, CacheItem[]> = new Map()\n constructor() {\n return this\n }\n\n get files(): Array<FileWithMeta> {\n const files: Array<FileWithMeta> = []\n this.#cache.forEach((item) => {\n files.push(...item.flat(1))\n })\n\n return files\n }\n\n async add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T> {\n const promises = combineFiles(files).map((file) => {\n if (file.override) {\n return this.#add(file)\n }\n\n return this.#addOrAppend(file)\n })\n\n const resolvedFiles = await Promise.all(promises)\n\n if (files.length > 1) {\n return resolvedFiles as unknown as AddResult<T>\n }\n\n return resolvedFiles[0] as unknown as AddResult<T>\n }\n\n async #add(file: FileWithMeta): Promise<ResolvedFile> {\n const controller = new AbortController()\n const resolvedFile: ResolvedFile = {\n id: crypto.randomUUID(),\n name: trimExtName(file.baseName),\n ...file,\n }\n\n if (resolvedFile.exports?.length) {\n const folder = resolvedFile.path.replace(resolvedFile.baseName, '')\n\n resolvedFile.exports = resolvedFile.exports.filter((exportItem) => {\n const exportedFile = this.files.find((file) => file.path.includes(resolve(folder, exportItem.path)))\n\n if (exportedFile) {\n return exportedFile.exportable\n }\n\n return true\n })\n }\n\n this.#cache.set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }])\n\n return resolvedFile\n }\n\n async #addOrAppend(file: FileWithMeta): Promise<ResolvedFile> {\n const previousCaches = this.#cache.get(file.path)\n const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : undefined\n\n if (previousCache) {\n this.#cache.delete(previousCache.path)\n\n return this.#add({\n ...file,\n source: previousCache.source && file.source ? `${previousCache.source}\\n${file.source}` : '',\n imports: [...(previousCache.imports || []), ...(file.imports || [])],\n exports: [...(previousCache.exports || []), ...(file.exports || [])],\n env: { ...(previousCache.env || {}), ...(file.env || {}) },\n })\n }\n return this.#add(file)\n }\n\n async getIndexFiles({ plugin, root, output, logger, options = {} }: AddIndexesProps): Promise<ResolvedFile[]> {\n const { exportType = 'barrel' } = output\n if (exportType === false) {\n return []\n }\n\n const pathToBuildFrom = resolve(root, output.path)\n\n if (transformers.trimExtName(pathToBuildFrom).endsWith('index')) {\n logger.emit('warning', 'Output has the same fileName as the barrelFiles, please disable barrel generation')\n return []\n }\n\n const exportPath = output.path.startsWith('./') ? trimExtName(output.path) : `./${trimExtName(output.path)}`\n const mode = FileManager.getMode(output.path)\n const barrelManager = new BarrelManager({\n extName: output.extName,\n ...options,\n })\n let files = barrelManager.getIndexes(pathToBuildFrom)\n\n if (!files) {\n return []\n }\n\n const rootPath = mode === 'split' ? `${exportPath}/index${output.extName || ''}` : `${exportPath}${output.extName || ''}`\n const rootFile: FileWithMeta = {\n path: resolve(root, 'index.ts'),\n baseName: 'index.ts',\n source: '',\n exports: [\n output.exportAs\n ? {\n name: output.exportAs,\n asAlias: true,\n path: rootPath,\n isTypeOnly: options.isTypeOnly,\n }\n : {\n path: rootPath,\n isTypeOnly: options.isTypeOnly,\n },\n ],\n exportable: true,\n }\n\n if (exportType === 'barrelNamed') {\n files = files.map((file) => {\n if (file.exports) {\n return {\n ...file,\n exports: barrelManager.getNamedExports(pathToBuildFrom, file.exports),\n }\n }\n return file\n })\n\n const barrelExportRoot = rootFile.exports?.[0]\n\n if (!output.exportAs && barrelExportRoot) {\n const exportFile = files.find((file) => {\n return trimExtName(file.path) === path.resolve(root, barrelExportRoot.path)\n })\n\n if (exportFile?.exports) {\n rootFile.exports = exportFile.exports.map((exportItem) => {\n return {\n ...exportItem,\n path: getRelativePath(rootFile.path, exportFile.path),\n }\n })\n }\n }\n }\n\n return [\n ...(await Promise.all(\n files.map((file) => {\n return this.#addOrAppend({\n ...file,\n meta: {\n pluginKey: plugin.key,\n },\n })\n }),\n )),\n await this.#addOrAppend({\n ...rootFile,\n meta: {\n pluginKey: plugin.key,\n },\n }),\n ]\n }\n\n getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined {\n let cache: FileWithMeta | undefined\n\n this.#cache.forEach((files) => {\n cache = files.find((item) => item.id === UUID)\n })\n return cache\n }\n\n get(path: KubbFile.Path): Array<FileWithMeta> | undefined {\n return this.#cache.get(path)\n }\n\n remove(path: KubbFile.Path): void {\n const cacheItem = this.get(path)\n if (!cacheItem) {\n return\n }\n\n this.#cache.delete(path)\n }\n\n async write(...params: Parameters<typeof write>): ReturnType<typeof write> {\n return write(...params)\n }\n\n async read(...params: Parameters<typeof read>): ReturnType<typeof read> {\n return read(...params)\n }\n\n async processFiles(...params: Parameters<typeof processFiles>): ReturnType<typeof processFiles> {\n return processFiles(...params)\n }\n\n // statics\n\n static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>> {\n return combineFiles<TMeta>(files)\n }\n static getMode(path: string | undefined | null): KubbFile.Mode {\n if (!path) {\n return 'split'\n }\n return extname(path) ? 'single' : 'split'\n }\n\n static get extensions(): Array<KubbFile.Extname> {\n return ['.js', '.ts', '.tsx']\n }\n\n static isJavascript(baseName: string): boolean {\n return FileManager.extensions.some((extension) => baseName.endsWith(extension))\n }\n}\n\nfunction combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>> {\n return files.filter(Boolean).reduce(\n (acc, file: FileWithMeta<TMeta>) => {\n const prevIndex = acc.findIndex((item) => item.path === file.path)\n\n if (prevIndex === -1) {\n return [...acc, file]\n }\n\n const prev = acc[prevIndex]\n\n if (prev && file.override) {\n acc[prevIndex] = {\n imports: [],\n exports: [],\n ...file,\n }\n return acc\n }\n\n if (prev) {\n acc[prevIndex] = {\n ...file,\n source: prev.source && file.source ? `${prev.source}\\n${file.source}` : '',\n imports: [...(prev.imports || []), ...(file.imports || [])],\n exports: [...(prev.exports || []), ...(file.exports || [])],\n env: { ...(prev.env || {}), ...(file.env || {}) },\n }\n }\n\n return acc\n },\n [] as Array<FileWithMeta<TMeta>>,\n )\n}\n\nexport async function getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string> {\n // only use .js, .ts or .tsx files for ESM imports\n\n if (file.language ? !['typescript', 'javascript'].includes(file.language) : !FileManager.isJavascript(file.baseName)) {\n return file.source\n }\n\n const parser = await getParser(file.language)\n\n const exports = file.exports ? combineExports(file.exports) : []\n // imports should be defined and source should contain code or we have imports without them being used\n const imports = file.imports && file.source ? combineImports(file.imports, exports, file.source) : []\n\n const importNodes = imports\n .filter((item) => {\n const path = item.root ? getRelativePath(item.root, item.path) : item.path\n // trim extName\n return path !== trimExtName(file.path)\n })\n .map((item) => {\n const path = item.root ? getRelativePath(item.root, item.path) : item.path\n\n return parser.factory.createImportDeclaration({\n name: item.name,\n path: item.extName ? `${path}${item.extName}` : path,\n isTypeOnly: item.isTypeOnly,\n })\n })\n const exportNodes = exports.map((item) =>\n parser.factory.createExportDeclaration({\n name: item.name,\n path: item.extName ? `${item.path}${item.extName}` : item.path,\n isTypeOnly: item.isTypeOnly,\n asAlias: item.asAlias,\n }),\n )\n\n const source = [parser.print([...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join('\\n')\n\n // do some basic linting with the ts compiler\n return parser.print([], { source, noEmitHelpers: false })\n}\n\nexport function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export> {\n const combinedExports = orderBy(exports, [(v) => !v.isTypeOnly], ['asc']).reduce(\n (prev, curr) => {\n const name = curr.name\n const prevByPath = prev.findLast((imp) => imp.path === curr.path)\n const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (export type ...)\n return prev\n }\n\n const uniquePrev = prev.findLast(\n (imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias,\n )\n\n if (uniquePrev || (Array.isArray(name) && !name.length) || (prevByPath?.asAlias && !curr.asAlias)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name: Array.isArray(name) ? [...new Set(name)] : name,\n },\n ]\n }\n\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\n return prev\n }\n\n return [...prev, curr]\n },\n [] as Array<KubbFile.Export>,\n )\n\n return orderBy(combinedExports, [(v) => !v.isTypeOnly, (v) => v.asAlias], ['desc', 'desc'])\n}\n\nexport function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import> {\n const combinedImports = orderBy(imports, [(v) => !v.isTypeOnly], ['asc']).reduce(\n (prev, curr) => {\n let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name\n\n const hasImportInSource = (importName: string) => {\n if (!source) {\n return true\n }\n\n const checker = (name?: string) => name && !!source.includes(name)\n\n return checker(importName) || exports.some(({ name }) => (Array.isArray(name) ? name.some(checker) : checker(name)))\n }\n\n if (curr.path === curr.root) {\n // root and path are the same file, remove the \"./\" import\n return prev\n }\n\n if (Array.isArray(name)) {\n name = name.filter((item) => (typeof item === 'string' ? hasImportInSource(item) : hasImportInSource(item.propertyName)))\n }\n\n const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly)\n const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly)\n const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathNameAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (import type ...)\n return prev\n }\n\n if (uniquePrev || (Array.isArray(name) && !name.length)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name,\n },\n ]\n }\n\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...name])]\n\n return prev\n }\n\n if (!Array.isArray(name) && name && !hasImportInSource(name)) {\n return prev\n }\n\n return [...prev, curr]\n },\n [] as Array<KubbFile.Import>,\n )\n\n return orderBy(combinedImports, [(v) => !v.isTypeOnly], ['desc'])\n}\n\nfunction getEnvSource(source: string, env: NodeJS.ProcessEnv | undefined): string {\n if (!env) {\n return source\n }\n\n const keys = Object.keys(env)\n\n if (!keys.length) {\n return source\n }\n\n return keys.reduce((prev, key: string) => {\n const environmentValue = env[key]\n const replaceBy = environmentValue ? `'${environmentValue.replaceAll('\"', '')?.replaceAll(\"'\", '')}'` : 'undefined'\n\n if (key.toUpperCase() !== key) {\n throw new TypeError(`Environment should be in upperCase for ${key}`)\n }\n\n if (typeof replaceBy === 'string') {\n prev = searchAndReplace({\n text: prev.replaceAll(`process.env.${key}`, replaceBy),\n replaceBy,\n prefix: 'process.env',\n key,\n })\n // removes `declare const ...`\n prev = searchAndReplace({\n text: prev.replaceAll(/(declare const).*\\n/gi, ''),\n replaceBy,\n key,\n })\n }\n\n return prev\n }, source)\n}\n\ntype WriteFilesProps = {\n files: KubbFile.File[]\n logger: Logger\n dryRun?: boolean\n}\n/**\n * Global queue\n */\nconst queue = new PQueue({ concurrency: 10 })\n\nexport async function processFiles({ dryRun, logger, files }: WriteFilesProps) {\n const mergedFiles: Array<KubbFile.File<FileMetaBase>> = await Promise.all(\n files.map(async (file) => ({\n ...file,\n source: await getSource(file),\n })),\n )\n const orderedFiles = orderBy(mergedFiles, [(v) => !v.meta?.pluginKey, (v) => v.path.length, (v) => trimExtName(v.path).endsWith('index')], ['desc', 'desc'])\n\n logger.emit(\n 'debug',\n orderedFiles.map((item) => `[${item.meta?.pluginKey || 'unknown'}]${item.path}: \\n${item.source}`),\n )\n\n if (!dryRun) {\n logger.consola?.pauseLogs()\n const size = orderedFiles.length\n\n const promises = orderedFiles.map(async (file, index) => {\n await queue.add(async () => {\n logger.emit('progress', { count: index, size, file })\n await write(file.path, file.source, { sanity: false })\n await new Promise((resolve) => {\n setTimeout(resolve, 0)\n })\n logger.emit('progress', { count: index + 1, size, file })\n })\n })\n\n await Promise.all(promises)\n\n logger.consola?.resumeLogs()\n }\n\n return mergedFiles\n}\n","import { getExports } from '@kubb/parser-ts'\n\nimport path from 'node:path'\n\nimport { trimExtName } from './transformers/trim.ts'\nimport { TreeNode } from './utils/TreeNode.ts'\n\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { DirectoryTreeOptions } from 'directory-tree'\n\nexport type BarrelManagerOptions = {\n treeNode?: DirectoryTreeOptions\n isTypeOnly?: boolean\n /**\n * Add .ts or .js\n */\n extName?: KubbFile.Extname\n}\n\n/**\n * Replace with the use of the FileManager exports/imports\n */\nexport class BarrelManager {\n #options: BarrelManagerOptions\n\n constructor(options: BarrelManagerOptions = {}) {\n this.#options = options\n\n return this\n }\n\n /**\n * Loop through the file and find all exports(with the help of the ts printer)\n * Important: a real file is needed(cannot work from memory/FileManager)\n */\n getNamedExport(root: string, item: KubbFile.Export): KubbFile.Export[] {\n const exportedNames = getExports(path.resolve(root, item.path))\n\n if (!exportedNames) {\n return [item]\n }\n\n const exports = exportedNames.reduce(\n (prev, curr) => {\n if (!prev[0]?.name || !prev[1]?.name) {\n return prev\n }\n\n if (curr.isTypeOnly) {\n prev[1] = { ...prev[1], name: [...prev[1].name, curr.name] }\n } else {\n prev[0] = { ...prev[0], name: [...prev[0].name, curr.name] }\n }\n\n return prev\n },\n [\n {\n ...item,\n name: [],\n isTypeOnly: false,\n },\n {\n ...item,\n name: [],\n isTypeOnly: true,\n },\n ] as KubbFile.Export[],\n )\n\n return exports\n }\n\n getNamedExports(root: string, exports: KubbFile.Export[]): KubbFile.Export[] {\n return exports?.flatMap((item) => {\n return this.getNamedExport(root, item)\n })\n }\n\n getIndexes(root: string): Array<KubbFile.File> | null {\n const { treeNode = {}, isTypeOnly, extName } = this.#options\n const tree = TreeNode.build(root, treeNode)\n\n if (!tree) {\n return null\n }\n\n const fileReducer = (files: Array<KubbFile.File>, treeNode: TreeNode) => {\n if (!treeNode.children) {\n return []\n }\n\n if (treeNode.children.length > 1) {\n const indexPath: KubbFile.Path = path.resolve(treeNode.data.path, 'index.ts')\n\n const exports: Array<KubbFile.Export> = treeNode.children\n .filter(Boolean)\n .map((file) => {\n const importPath: string = file.data.type === 'split' ? `./${file.data.name}/index` : `./${trimExtName(file.data.name)}`\n\n if (importPath.endsWith('index') && file.data.type === 'single') {\n return undefined\n }\n\n return {\n path: extName ? `${importPath}${extName}` : importPath,\n isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n\n files.push({\n path: indexPath,\n baseName: 'index.ts',\n source: '',\n exports,\n exportable: true,\n })\n } else if (treeNode.children.length === 1) {\n const [treeNodeChild] = treeNode.children as [TreeNode]\n\n const indexPath = path.resolve(treeNode.data.path, 'index.ts')\n const importPath = treeNodeChild.data.type === 'split' ? `./${treeNodeChild.data.name}/index` : `./${trimExtName(treeNodeChild.data.name)}`\n\n const exports = [\n {\n path: extName ? `${importPath}${extName}` : importPath,\n isTypeOnly,\n },\n ]\n\n files.push({\n path: indexPath,\n baseName: 'index.ts',\n source: '',\n exports,\n exportable: true,\n })\n }\n\n treeNode.children.forEach((childItem) => {\n fileReducer(files, childItem)\n })\n\n return files\n }\n\n return fileReducer([], tree).reverse()\n }\n}\n","import dirTree from 'directory-tree'\n\nimport { FileManager } from '../FileManager.ts'\n\nimport type * as KubbFile from '@kubb/fs/types'\nimport type { DirectoryTree, DirectoryTreeOptions } from 'directory-tree'\n\nexport type TreeNodeOptions = DirectoryTreeOptions\n\ntype BarrelData = { type: KubbFile.Mode; path: KubbFile.Path; name: string }\n\nexport class TreeNode<T = BarrelData> {\n public data: T\n\n public parent?: TreeNode<T>\n\n public children: Array<TreeNode<T>> = []\n\n constructor(data: T, parent?: TreeNode<T>) {\n this.data = data\n this.parent = parent\n return this\n }\n\n addChild(data: T): TreeNode<T> {\n const child = new TreeNode(data, this)\n if (!this.children) {\n this.children = []\n }\n this.children.push(child)\n return child\n }\n\n find(data?: T): TreeNode<T> | null {\n if (!data) {\n return null\n }\n\n if (data === this.data) {\n return this\n }\n\n if (this.children?.length) {\n for (let i = 0, { length } = this.children, target: TreeNode<T> | null = null; i < length; i++) {\n target = this.children[i]!.find(data)\n if (target) {\n return target\n }\n }\n }\n\n return null\n }\n\n get leaves(): TreeNode<T>[] {\n if (!this.children || this.children.length === 0) {\n // this is a leaf\n return [this]\n }\n\n // if not a leaf, return all children's leaves recursively\n const leaves: TreeNode<T>[] = []\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n leaves.push.apply(leaves, this.children[i]!.leaves)\n }\n }\n return leaves\n }\n\n get root(): TreeNode<T> {\n if (!this.parent) {\n return this\n }\n return this.parent.root\n }\n\n forEach(callback: (treeNode: TreeNode<T>) => void): this {\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n // run this node through function\n callback(this)\n\n // do the same for all children\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n this.children[i]?.forEach(callback)\n }\n }\n\n return this\n }\n\n public static build(path: string, options: TreeNodeOptions = {}): TreeNode | null {\n try {\n const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean)\n const filteredTree = dirTree(path, {\n extensions: options.extensions,\n exclude: [/node_modules/, ...exclude],\n })\n\n if (!filteredTree) {\n return null\n }\n\n const treeNode = new TreeNode({\n name: filteredTree.name,\n path: filteredTree.path,\n type: FileManager.getMode(filteredTree.path),\n })\n\n const recurse = (node: typeof treeNode, item: DirectoryTree) => {\n const subNode = node.addChild({\n name: item.name,\n path: item.path,\n type: FileManager.getMode(item.path),\n })\n\n if (item.children?.length) {\n item.children?.forEach((child) => {\n recurse(subNode, child)\n })\n }\n }\n\n filteredTree.children?.forEach((child) => recurse(treeNode, child))\n\n return treeNode\n } catch (e) {\n throw new Error('Something went wrong with creating index files with the TreehNode class', { cause: e })\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,YAAY;AACnB,OAAOA,SAAQ,SAAS,eAAe;AAGvC,SAAS,mBAAmB;AAE5B,SAAS,iBAAiB,MAAM,aAAa;;;ACN7C,SAAS,kBAAkB;AAE3B,OAAO,UAAU;;;ACFjB,OAAO,aAAa;AAWb,IAAM,WAAN,MAAM,UAAyB;AAAA,EAOpC,YAAY,MAAS,QAAsB;AAF3C,SAAO,WAA+B,CAAC;AAGrC,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,WAAO;AAAA,EACT;AAAA,EAEA,SAAS,MAAsB;AAC7B,UAAM,QAAQ,IAAI,UAAS,MAAM,IAAI;AACrC,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,WAAW,CAAC;AAAA,IACnB;AACA,SAAK,SAAS,KAAK,KAAK;AACxB,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,MAA8B;AACjC,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,KAAK,MAAM;AACtB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,UAAU,QAAQ;AACzB,eAAS,IAAI,GAAG,EAAE,OAAO,IAAI,KAAK,UAAU,SAA6B,MAAM,IAAI,QAAQ,KAAK;AAC9F,iBAAS,KAAK,SAAS,CAAC,EAAG,KAAK,IAAI;AACpC,YAAI,QAAQ;AACV,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,SAAwB;AAC1B,QAAI,CAAC,KAAK,YAAY,KAAK,SAAS,WAAW,GAAG;AAEhD,aAAO,C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