@kubb/core 3.0.0-alpha.4 → 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.
- package/dist/{FileManager-CaejIVBd.d.ts → FileManager-jZpqETKU.d.cts} +4 -17
- package/dist/{FileManager--scIq4y4.d.cts → FileManager-tzl0YsYE.d.ts} +4 -17
- package/dist/{chunk-UUBPTMRW.js → chunk-CEWT73XF.js} +72 -43
- package/dist/chunk-CEWT73XF.js.map +1 -0
- package/dist/{chunk-V5THHXXQ.cjs → chunk-FWU62YO5.cjs} +77 -48
- package/dist/chunk-FWU62YO5.cjs.map +1 -0
- package/dist/{chunk-QRIDQ4RG.cjs → chunk-RBP2ASUX.cjs} +1 -1
- package/dist/{chunk-QRIDQ4RG.cjs.map → chunk-RBP2ASUX.cjs.map} +1 -1
- package/dist/{chunk-EFQPHF4E.js → chunk-Z5CHJQJB.js} +1 -1
- package/dist/chunk-Z5CHJQJB.js.map +1 -0
- package/dist/index.cjs +15 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/{logger-dzAcLeAA.d.cts → logger-BnWJh6Yq.d.cts} +6 -1
- package/dist/{logger-dzAcLeAA.d.ts → logger-BnWJh6Yq.d.ts} +6 -1
- package/dist/logger.cjs +2 -2
- package/dist/logger.d.cts +2 -1
- package/dist/logger.d.ts +2 -1
- package/dist/logger.js +1 -1
- package/dist/mocks.cjs +2 -2
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +2 -2
- package/dist/mocks.d.ts +2 -2
- package/dist/mocks.js +3 -3
- package/dist/mocks.js.map +1 -1
- package/package.json +7 -7
- package/src/BarrelManager.ts +10 -1
- package/src/FileManager.ts +57 -33
- package/src/PluginManager.ts +2 -2
- package/src/build.ts +1 -7
- package/src/logger.ts +2 -1
- package/dist/chunk-EFQPHF4E.js.map +0 -1
- package/dist/chunk-UUBPTMRW.js.map +0 -1
- package/dist/chunk-V5THHXXQ.cjs.map +0 -1
|
@@ -3,7 +3,7 @@ import * as KubbFile from '@kubb/fs/types';
|
|
|
3
3
|
import { BaseName, File, UUID } from '@kubb/fs/src/types.ts';
|
|
4
4
|
import { PossiblePromise, GreaterThan } from '@kubb/types';
|
|
5
5
|
import { DirectoryTreeOptions } from 'directory-tree';
|
|
6
|
-
import { E as EventEmitter, L as Logger } from './logger-
|
|
6
|
+
import { E as EventEmitter, L as Logger } from './logger-BnWJh6Yq.cjs';
|
|
7
7
|
|
|
8
8
|
type BarrelManagerOptions = {
|
|
9
9
|
treeNode?: DirectoryTreeOptions;
|
|
@@ -403,21 +403,20 @@ type AddIndexesProps = {
|
|
|
403
403
|
};
|
|
404
404
|
logger: Logger;
|
|
405
405
|
options?: BarrelManagerOptions;
|
|
406
|
-
|
|
406
|
+
plugin: Plugin;
|
|
407
407
|
};
|
|
408
408
|
declare class FileManager {
|
|
409
409
|
#private;
|
|
410
410
|
constructor();
|
|
411
411
|
get files(): Array<FileWithMeta>;
|
|
412
412
|
add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T>;
|
|
413
|
-
getIndexFiles({ root, output,
|
|
413
|
+
getIndexFiles({ plugin, root, output, logger, options }: AddIndexesProps): Promise<ResolvedFile[]>;
|
|
414
414
|
getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined;
|
|
415
415
|
get(path: KubbFile.Path): Array<FileWithMeta> | undefined;
|
|
416
416
|
remove(path: KubbFile.Path): void;
|
|
417
417
|
write(...params: Parameters<typeof write>): ReturnType<typeof write>;
|
|
418
418
|
read(...params: Parameters<typeof read>): ReturnType<typeof read>;
|
|
419
419
|
processFiles(...params: Parameters<typeof processFiles>): ReturnType<typeof processFiles>;
|
|
420
|
-
static getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string>;
|
|
421
420
|
static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>>;
|
|
422
421
|
static getMode(path: string | undefined | null): KubbFile.Mode;
|
|
423
422
|
static get extensions(): Array<KubbFile.Extname>;
|
|
@@ -428,18 +427,6 @@ type WriteFilesProps = {
|
|
|
428
427
|
logger: Logger;
|
|
429
428
|
dryRun?: boolean;
|
|
430
429
|
};
|
|
431
|
-
declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<
|
|
432
|
-
source: string;
|
|
433
|
-
id?: string;
|
|
434
|
-
baseName: `${string}.${string}`;
|
|
435
|
-
path: KubbFile.AdvancedPath<TBaseName> | KubbFile.Path;
|
|
436
|
-
imports?: KubbFile.Import[];
|
|
437
|
-
exports?: KubbFile.Export[];
|
|
438
|
-
override?: boolean;
|
|
439
|
-
meta?: object | undefined;
|
|
440
|
-
exportable?: boolean;
|
|
441
|
-
env?: NodeJS.ProcessEnv;
|
|
442
|
-
language?: string;
|
|
443
|
-
}[]>;
|
|
430
|
+
declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<KubbFile.File<FileMetaBase>[]>;
|
|
444
431
|
|
|
445
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 };
|
|
@@ -3,7 +3,7 @@ import * as KubbFile from '@kubb/fs/types';
|
|
|
3
3
|
import { BaseName, File, UUID } from '@kubb/fs/src/types.ts';
|
|
4
4
|
import { PossiblePromise, GreaterThan } from '@kubb/types';
|
|
5
5
|
import { DirectoryTreeOptions } from 'directory-tree';
|
|
6
|
-
import { E as EventEmitter, L as Logger } from './logger-
|
|
6
|
+
import { E as EventEmitter, L as Logger } from './logger-BnWJh6Yq.js';
|
|
7
7
|
|
|
8
8
|
type BarrelManagerOptions = {
|
|
9
9
|
treeNode?: DirectoryTreeOptions;
|
|
@@ -403,21 +403,20 @@ type AddIndexesProps = {
|
|
|
403
403
|
};
|
|
404
404
|
logger: Logger;
|
|
405
405
|
options?: BarrelManagerOptions;
|
|
406
|
-
|
|
406
|
+
plugin: Plugin;
|
|
407
407
|
};
|
|
408
408
|
declare class FileManager {
|
|
409
409
|
#private;
|
|
410
410
|
constructor();
|
|
411
411
|
get files(): Array<FileWithMeta>;
|
|
412
412
|
add<T extends Array<FileWithMeta> = Array<FileWithMeta>>(...files: T): AddResult<T>;
|
|
413
|
-
getIndexFiles({ root, output,
|
|
413
|
+
getIndexFiles({ plugin, root, output, logger, options }: AddIndexesProps): Promise<ResolvedFile[]>;
|
|
414
414
|
getCacheByUUID(UUID: KubbFile.UUID): FileWithMeta | undefined;
|
|
415
415
|
get(path: KubbFile.Path): Array<FileWithMeta> | undefined;
|
|
416
416
|
remove(path: KubbFile.Path): void;
|
|
417
417
|
write(...params: Parameters<typeof write>): ReturnType<typeof write>;
|
|
418
418
|
read(...params: Parameters<typeof read>): ReturnType<typeof read>;
|
|
419
419
|
processFiles(...params: Parameters<typeof processFiles>): ReturnType<typeof processFiles>;
|
|
420
|
-
static getSource<TMeta extends FileMetaBase = FileMetaBase>(file: FileWithMeta<TMeta>): Promise<string>;
|
|
421
420
|
static combineFiles<TMeta extends FileMetaBase = FileMetaBase>(files: Array<FileWithMeta<TMeta> | null>): Array<FileWithMeta<TMeta>>;
|
|
422
421
|
static getMode(path: string | undefined | null): KubbFile.Mode;
|
|
423
422
|
static get extensions(): Array<KubbFile.Extname>;
|
|
@@ -428,18 +427,6 @@ type WriteFilesProps = {
|
|
|
428
427
|
logger: Logger;
|
|
429
428
|
dryRun?: boolean;
|
|
430
429
|
};
|
|
431
|
-
declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<
|
|
432
|
-
source: string;
|
|
433
|
-
id?: string;
|
|
434
|
-
baseName: `${string}.${string}`;
|
|
435
|
-
path: KubbFile.AdvancedPath<TBaseName> | KubbFile.Path;
|
|
436
|
-
imports?: KubbFile.Import[];
|
|
437
|
-
exports?: KubbFile.Export[];
|
|
438
|
-
override?: boolean;
|
|
439
|
-
meta?: object | undefined;
|
|
440
|
-
exportable?: boolean;
|
|
441
|
-
env?: NodeJS.ProcessEnv;
|
|
442
|
-
language?: string;
|
|
443
|
-
}[]>;
|
|
430
|
+
declare function processFiles({ dryRun, logger, files }: WriteFilesProps): Promise<KubbFile.File<FileMetaBase>[]>;
|
|
444
431
|
|
|
445
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,7 +18,7 @@ import {
|
|
|
18
18
|
|
|
19
19
|
// src/FileManager.ts
|
|
20
20
|
import crypto from "crypto";
|
|
21
|
-
import { extname, resolve } from "path";
|
|
21
|
+
import path2, { extname, resolve } from "path";
|
|
22
22
|
import { isDeepEqual } from "remeda";
|
|
23
23
|
import { getRelativePath, read, write } from "@kubb/fs";
|
|
24
24
|
|
|
@@ -90,10 +90,10 @@ var TreeNode = class _TreeNode {
|
|
|
90
90
|
}
|
|
91
91
|
return this;
|
|
92
92
|
}
|
|
93
|
-
static build(
|
|
93
|
+
static build(path3, options = {}) {
|
|
94
94
|
try {
|
|
95
95
|
const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean);
|
|
96
|
-
const filteredTree = dirTree(
|
|
96
|
+
const filteredTree = dirTree(path3, {
|
|
97
97
|
extensions: options.extensions,
|
|
98
98
|
exclude: [/node_modules/, ...exclude]
|
|
99
99
|
});
|
|
@@ -133,12 +133,16 @@ var BarrelManager = class {
|
|
|
133
133
|
__privateSet(this, _options, options);
|
|
134
134
|
return this;
|
|
135
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
|
+
*/
|
|
136
140
|
getNamedExport(root, item) {
|
|
137
141
|
const exportedNames = getExports(path.resolve(root, item.path));
|
|
138
142
|
if (!exportedNames) {
|
|
139
143
|
return [item];
|
|
140
144
|
}
|
|
141
|
-
|
|
145
|
+
const exports = exportedNames.reduce(
|
|
142
146
|
(prev, curr) => {
|
|
143
147
|
if (!prev[0]?.name || !prev[1]?.name) {
|
|
144
148
|
return prev;
|
|
@@ -163,6 +167,7 @@ var BarrelManager = class {
|
|
|
163
167
|
}
|
|
164
168
|
]
|
|
165
169
|
);
|
|
170
|
+
return exports;
|
|
166
171
|
}
|
|
167
172
|
getNamedExports(root, exports) {
|
|
168
173
|
return exports?.flatMap((item) => {
|
|
@@ -255,7 +260,7 @@ var _FileManager = class _FileManager {
|
|
|
255
260
|
}
|
|
256
261
|
return resolvedFiles[0];
|
|
257
262
|
}
|
|
258
|
-
async getIndexFiles({ root, output,
|
|
263
|
+
async getIndexFiles({ plugin, root, output, logger, options = {} }) {
|
|
259
264
|
const { exportType = "barrel" } = output;
|
|
260
265
|
if (exportType === false) {
|
|
261
266
|
return [];
|
|
@@ -275,17 +280,6 @@ var _FileManager = class _FileManager {
|
|
|
275
280
|
if (!files) {
|
|
276
281
|
return [];
|
|
277
282
|
}
|
|
278
|
-
if (exportType === "barrelNamed") {
|
|
279
|
-
files = files.map((file) => {
|
|
280
|
-
if (file.exports) {
|
|
281
|
-
return {
|
|
282
|
-
...file,
|
|
283
|
-
exports: barrelManager.getNamedExports(pathToBuildFrom, file.exports)
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
return file;
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
283
|
const rootPath = mode === "split" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
|
|
290
284
|
const rootFile = {
|
|
291
285
|
path: resolve(root, "index.ts"),
|
|
@@ -304,21 +298,47 @@ var _FileManager = class _FileManager {
|
|
|
304
298
|
],
|
|
305
299
|
exportable: true
|
|
306
300
|
};
|
|
307
|
-
if (exportType === "barrelNamed"
|
|
308
|
-
|
|
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
|
+
}
|
|
309
325
|
}
|
|
310
326
|
return [
|
|
311
327
|
...await Promise.all(
|
|
312
328
|
files.map((file) => {
|
|
313
329
|
return __privateMethod(this, _FileManager_instances, addOrAppend_fn).call(this, {
|
|
314
330
|
...file,
|
|
315
|
-
meta:
|
|
331
|
+
meta: {
|
|
332
|
+
pluginKey: plugin.key
|
|
333
|
+
}
|
|
316
334
|
});
|
|
317
335
|
})
|
|
318
336
|
),
|
|
319
337
|
await __privateMethod(this, _FileManager_instances, addOrAppend_fn).call(this, {
|
|
320
338
|
...rootFile,
|
|
321
|
-
meta:
|
|
339
|
+
meta: {
|
|
340
|
+
pluginKey: plugin.key
|
|
341
|
+
}
|
|
322
342
|
})
|
|
323
343
|
];
|
|
324
344
|
}
|
|
@@ -329,15 +349,15 @@ var _FileManager = class _FileManager {
|
|
|
329
349
|
});
|
|
330
350
|
return cache;
|
|
331
351
|
}
|
|
332
|
-
get(
|
|
333
|
-
return __privateGet(this, _cache).get(
|
|
352
|
+
get(path3) {
|
|
353
|
+
return __privateGet(this, _cache).get(path3);
|
|
334
354
|
}
|
|
335
|
-
remove(
|
|
336
|
-
const cacheItem = this.get(
|
|
355
|
+
remove(path3) {
|
|
356
|
+
const cacheItem = this.get(path3);
|
|
337
357
|
if (!cacheItem) {
|
|
338
358
|
return;
|
|
339
359
|
}
|
|
340
|
-
__privateGet(this, _cache).delete(
|
|
360
|
+
__privateGet(this, _cache).delete(path3);
|
|
341
361
|
}
|
|
342
362
|
async write(...params) {
|
|
343
363
|
return write(...params);
|
|
@@ -349,17 +369,14 @@ var _FileManager = class _FileManager {
|
|
|
349
369
|
return processFiles(...params);
|
|
350
370
|
}
|
|
351
371
|
// statics
|
|
352
|
-
static async getSource(file) {
|
|
353
|
-
return getSource(file);
|
|
354
|
-
}
|
|
355
372
|
static combineFiles(files) {
|
|
356
373
|
return combineFiles(files);
|
|
357
374
|
}
|
|
358
|
-
static getMode(
|
|
359
|
-
if (!
|
|
375
|
+
static getMode(path3) {
|
|
376
|
+
if (!path3) {
|
|
360
377
|
return "split";
|
|
361
378
|
}
|
|
362
|
-
return extname(
|
|
379
|
+
return extname(path3) ? "single" : "split";
|
|
363
380
|
}
|
|
364
381
|
static get extensions() {
|
|
365
382
|
return [".js", ".ts", ".tsx"];
|
|
@@ -446,13 +463,13 @@ async function getSource(file) {
|
|
|
446
463
|
const exports = file.exports ? combineExports(file.exports) : [];
|
|
447
464
|
const imports = file.imports && file.source ? combineImports(file.imports, exports, file.source) : [];
|
|
448
465
|
const importNodes = imports.filter((item) => {
|
|
449
|
-
const
|
|
450
|
-
return
|
|
466
|
+
const path3 = item.root ? getRelativePath(item.root, item.path) : item.path;
|
|
467
|
+
return path3 !== trimExtName(file.path);
|
|
451
468
|
}).map((item) => {
|
|
452
|
-
const
|
|
469
|
+
const path3 = item.root ? getRelativePath(item.root, item.path) : item.path;
|
|
453
470
|
return parser.factory.createImportDeclaration({
|
|
454
471
|
name: item.name,
|
|
455
|
-
path: item.extName ? `${
|
|
472
|
+
path: item.extName ? `${path3}${item.extName}` : path3,
|
|
456
473
|
isTypeOnly: item.isTypeOnly
|
|
457
474
|
});
|
|
458
475
|
});
|
|
@@ -579,23 +596,34 @@ function getEnvSource(source, env) {
|
|
|
579
596
|
return prev;
|
|
580
597
|
}, source);
|
|
581
598
|
}
|
|
582
|
-
var queue = new PQueue({ concurrency:
|
|
599
|
+
var queue = new PQueue({ concurrency: 10 });
|
|
583
600
|
async function processFiles({ dryRun, logger, files }) {
|
|
584
601
|
const mergedFiles = await Promise.all(
|
|
585
602
|
files.map(async (file) => ({
|
|
586
603
|
...file,
|
|
587
|
-
source: await
|
|
604
|
+
source: await getSource(file)
|
|
588
605
|
}))
|
|
589
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
|
+
);
|
|
590
613
|
if (!dryRun) {
|
|
591
614
|
logger.consola?.pauseLogs();
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
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 });
|
|
596
624
|
});
|
|
597
625
|
});
|
|
598
|
-
await Promise.all(
|
|
626
|
+
await Promise.all(promises);
|
|
599
627
|
logger.consola?.resumeLogs();
|
|
600
628
|
}
|
|
601
629
|
return mergedFiles;
|
|
@@ -603,6 +631,7 @@ async function processFiles({ dryRun, logger, files }) {
|
|
|
603
631
|
|
|
604
632
|
export {
|
|
605
633
|
FileManager,
|
|
634
|
+
getSource,
|
|
606
635
|
processFiles
|
|
607
636
|
};
|
|
608
|
-
//# sourceMappingURL=chunk-
|
|
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,eA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