@kubb/core 4.5.13 → 4.5.15
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/{getBarrelFiles-CQ6mFiyN.d.cts → getBarrelFiles-BVMBhc50.d.cts} +2 -2
- package/dist/{getBarrelFiles-Oqpn6hU5.cjs → getBarrelFiles-BkDzzugQ.cjs} +6 -2
- package/dist/getBarrelFiles-BkDzzugQ.cjs.map +1 -0
- package/dist/{getBarrelFiles-CI9xyXD3.d.ts → getBarrelFiles-DjQ68d4e.d.ts} +2 -2
- package/dist/{getBarrelFiles-DjZ5WaX_.js → getBarrelFiles-a-GlnjYa.js} +6 -2
- package/dist/getBarrelFiles-a-GlnjYa.js.map +1 -0
- package/dist/hooks.d.cts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-C9_e7Xu8.d.ts → types-69-evK37.d.ts} +8 -1
- package/dist/{types-D5svukc1.d.cts → types-tSSA1oz8.d.cts} +8 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/package.json +3 -3
- package/src/PluginManager.ts +3 -0
- package/src/build.ts +1 -1
- package/src/types.ts +7 -0
- package/dist/getBarrelFiles-DjZ5WaX_.js.map +0 -1
- package/dist/getBarrelFiles-Oqpn6hU5.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as Logger } from "./logger-BJDkLsF0.cjs";
|
|
2
|
-
import { c as Plugin, t as BarrelType } from "./types-
|
|
2
|
+
import { c as Plugin, t as BarrelType } from "./types-tSSA1oz8.cjs";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/getBarrelFiles.d.ts
|
|
@@ -34,4 +34,4 @@ declare function getBarrelFiles(files: Array<KubbFile.ResolvedFile>, {
|
|
|
34
34
|
}: AddIndexesProps): Promise<KubbFile.File[]>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { getBarrelFiles as n, FileMetaBase as t };
|
|
37
|
-
//# sourceMappingURL=getBarrelFiles-
|
|
37
|
+
//# sourceMappingURL=getBarrelFiles-BVMBhc50.d.cts.map
|
|
@@ -23,7 +23,7 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
23
23
|
var ValidationPluginError = class extends Error {};
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region ../../node_modules/.pnpm/yocto-queue@1.2.
|
|
26
|
+
//#region ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
27
27
|
var Node = class {
|
|
28
28
|
value;
|
|
29
29
|
next;
|
|
@@ -54,6 +54,7 @@ var Queue = class {
|
|
|
54
54
|
if (!current) return;
|
|
55
55
|
this.#head = this.#head.next;
|
|
56
56
|
this.#size--;
|
|
57
|
+
if (!this.#head) this.#tail = void 0;
|
|
57
58
|
return current.value;
|
|
58
59
|
}
|
|
59
60
|
peek() {
|
|
@@ -251,6 +252,9 @@ var PluginManager = class {
|
|
|
251
252
|
mode: getMode(node_path.default.resolve(this.config.root, this.config.output.path)),
|
|
252
253
|
addFile: async (...files) => {
|
|
253
254
|
await this.options.fabric.addFile(...files);
|
|
255
|
+
},
|
|
256
|
+
upsertFile: async (...files) => {
|
|
257
|
+
await this.options.fabric.upsertFile(...files);
|
|
254
258
|
}
|
|
255
259
|
};
|
|
256
260
|
let mergedExtras = {};
|
|
@@ -1015,4 +1019,4 @@ Object.defineProperty(exports, 'setUniqueName', {
|
|
|
1015
1019
|
return setUniqueName;
|
|
1016
1020
|
}
|
|
1017
1021
|
});
|
|
1018
|
-
//# sourceMappingURL=getBarrelFiles-
|
|
1022
|
+
//# sourceMappingURL=getBarrelFiles-BkDzzugQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBarrelFiles-BkDzzugQ.cjs","names":["path","#head","#tail","#size","promise: Promise<unknown>","#options","path","EventEmitter","#plugins","#usedPluginNames","#promiseManager","#parse","mergedExtras: Record<string, any>","#getSortedPlugins","trim","transformReservedWord","items: Array<ReturnType<ParseResult<H>>>","#execute","#executeSync","parseResult: SafeParseResult<H>","#catcher","output: unknown","#addExecutedToCallStack","path","#options","isValidVarName","camelCase","params: Record<string, string>","#cachedLeaves","leaves: TreeNode[]","root: DirectoryTree","currentLevel: DirectoryTree[]","#options","barrelFile: KubbFile.File","item"],"sources":["../src/fs/utils.ts","../src/errors.ts","../../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/p-limit@7.2.0/node_modules/p-limit/index.js","../src/utils/executeStrategies.ts","../src/PromiseManager.ts","../src/utils/uniqueName.ts","../src/PluginManager.ts","../src/utils/URLPath.ts","../src/utils/TreeNode.ts","../src/BarrelManager.ts","../src/utils/getBarrelFiles.ts"],"sourcesContent":["import { normalize, relative } from 'node:path'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n","export class ValidationPluginError extends Error {}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\n\t\t// Clean up tail reference when queue becomes empty\n\t\tif (!this.#head) {\n\t\t\tthis.#tail = undefined;\n\t\t}\n\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\t// Process the next queued function if we're under the concurrency limit\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tactiveCount++;\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\t// Execute the function and capture the result promise\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\t// Resolve immediately with the promise (don't wait for completion)\n\t\tresolve(result);\n\n\t\t// Wait for the function to complete (success or failure)\n\t\t// We catch errors here to prevent unhandled rejections,\n\t\t// but the original promise rejection is preserved for the caller\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\t// Decrement active count and process next queued function\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue the internal resolve function instead of the run function\n\t\t// to preserve the asynchronous execution context.\n\t\tnew Promise(internalResolve => { // eslint-disable-line promise/param-names\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_)); // eslint-disable-line promise/prefer-await-to-then\n\n\t\t// Start processing immediately if we haven't reached the concurrency limit\n\t\tif (activeCount < concurrency) {\n\t\t\tresumeNext();\n\t\t}\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tmap: {\n\t\t\tasync value(iterable, function_) {\n\t\t\t\tconst promises = Array.from(iterable, (value, index) => this(function_, value, index));\n\t\t\t\treturn Promise.all(promises);\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, options) {\n\tconst {concurrency} = options;\n\tconst limit = pLimit(concurrency);\n\n\treturn (...arguments_) => limit(() => function_(...arguments_));\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import pLimit from 'p-limit'\n\ntype PromiseFunc<T = unknown, T2 = never> = (state?: T) => T2 extends never ? Promise<T> : Promise<T> | T2\n\ntype ValueOfPromiseFuncArray<TInput extends Array<unknown>> = TInput extends Array<PromiseFunc<infer X, infer Y>> ? X | Y : never\n\ntype SeqOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Promise<Array<Awaited<ValueOfPromiseFuncArray<TInput>>>>\n\n/**\n * Chains promises\n */\nexport function hookSeq<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TOutput = SeqOutput<TInput, TValue>>(promises: TInput): TOutput {\n return promises.filter(Boolean).reduce(\n (promise, func) => {\n if (typeof func !== 'function') {\n throw new Error('HookSeq needs a function that returns a promise `() => Promise<unknown>`')\n }\n\n return promise.then((state) => {\n const calledFunc = func(state as TValue)\n\n if (calledFunc) {\n return calledFunc.then(Array.prototype.concat.bind(state))\n }\n })\n },\n Promise.resolve([] as unknown),\n ) as TOutput\n}\n\ntype HookFirstOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown> = ValueOfPromiseFuncArray<TInput>\n\n/**\n * Chains promises, first non-null result stops and returns\n */\nexport function hookFirst<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown, TOutput = HookFirstOutput<TInput, TValue>>(\n promises: TInput,\n nullCheck = (state: any) => state !== null,\n): TOutput {\n let promise: Promise<unknown> = Promise.resolve(null) as Promise<unknown>\n\n for (const func of promises.filter(Boolean)) {\n promise = promise.then((state) => {\n if (nullCheck(state)) {\n return state\n }\n\n return func(state as TValue)\n })\n }\n\n return promise as TOutput\n}\n\ntype HookParallelOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Promise<PromiseSettledResult<Awaited<ValueOfPromiseFuncArray<TInput>>>[]>\n\n/**\n * Runs an array of promise functions with optional concurrency limit.\n */\nexport function hookParallel<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown, TOutput = HookParallelOutput<TInput, TValue>>(\n promises: TInput,\n concurrency: number = Number.POSITIVE_INFINITY,\n): TOutput {\n const limit = pLimit(concurrency)\n\n const tasks = promises.filter(Boolean).map((promise) => limit(() => promise()))\n\n return Promise.allSettled(tasks) as TOutput\n}\n\nexport type Strategy = 'seq' | 'first' | 'parallel'\n\nexport type StrategySwitch<TStrategy extends Strategy, TInput extends Array<PromiseFunc<TValue, null>>, TValue> = TStrategy extends 'first'\n ? HookFirstOutput<TInput, TValue>\n : TStrategy extends 'seq'\n ? SeqOutput<TInput, TValue>\n : TStrategy extends 'parallel'\n ? HookParallelOutput<TInput, TValue>\n : never\n","import type { Strategy, StrategySwitch } from './utils/executeStrategies.ts'\nimport { hookFirst, hookParallel, hookSeq } from './utils/executeStrategies.ts'\n\ntype PromiseFunc<T = unknown, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2\n\ntype Options<TState = any> = {\n nullCheck?: (state: TState) => boolean\n}\n\nexport class PromiseManager<TState = any> {\n #options: Options<TState> = {}\n\n constructor(options: Options<TState> = {}) {\n this.#options = options\n\n return this\n }\n\n run<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TStrategy extends Strategy, TOutput = StrategySwitch<TStrategy, TInput, TValue>>(\n strategy: TStrategy,\n promises: TInput,\n { concurrency = Number.POSITIVE_INFINITY }: { concurrency?: number } = {},\n ): TOutput {\n if (strategy === 'seq') {\n return hookSeq<TInput, TValue, TOutput>(promises)\n }\n\n if (strategy === 'first') {\n return hookFirst<TInput, TValue, TOutput>(promises, this.#options.nullCheck)\n }\n\n if (strategy === 'parallel') {\n return hookParallel<TInput, TValue, TOutput>(promises, concurrency)\n }\n\n throw new Error(`${strategy} not implemented`)\n }\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n\nexport function setUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n\n return originalName\n }\n data[originalName] = 1\n return originalName\n}\n","import path from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport { ValidationPluginError } from './errors.ts'\nimport type { Logger } from './logger.ts'\nimport { isPromiseRejectedResult, PromiseManager } from './PromiseManager.ts'\nimport { transformReservedWord } from './transformers/transformReservedWord.ts'\nimport { trim } from './transformers/trim.ts'\nimport type {\n Config,\n GetPluginFactoryOptions,\n Plugin,\n PluginContext,\n PluginFactoryOptions,\n PluginLifecycle,\n PluginLifecycleHooks,\n PluginParameter,\n PluginWithLifeCycle,\n ResolveNameParams,\n ResolvePathParams,\n UserPlugin,\n} from './types.ts'\nimport { EventEmitter } from './utils/EventEmitter.ts'\nimport { setUniqueName } from './utils/uniqueName.ts'\n\ntype RequiredPluginLifecycle = Required<PluginLifecycle>\n\ntype Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq'\n\ntype Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {\n message: string\n strategy: Strategy\n hookName: H\n plugin: Plugin\n parameters?: unknown[] | undefined\n output?: unknown\n}\n\ntype ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H]\n\ntype SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {\n result: Result\n plugin: Plugin\n}\n\n// inspired by: https://github.com/rollup/rollup/blob/master/src/utils/PluginDriver.ts#\n\ntype Options = {\n fabric: Fabric\n logger: Logger\n /**\n * @default Number.POSITIVE_INFINITY\n */\n concurrency?: number\n}\n\ntype Events = {\n executing: [executer: Executer]\n executed: [executer: Executer]\n error: [error: Error]\n}\n\ntype GetFileProps<TOptions = object> = {\n name: string\n mode?: KubbFile.Mode\n extname: KubbFile.Extname\n pluginKey: Plugin['key']\n options?: TOptions\n}\n\nexport function getMode(fileOrFolder: string | undefined | null): KubbFile.Mode {\n if (!fileOrFolder) {\n return 'split'\n }\n return path.extname(fileOrFolder) ? 'single' : 'split'\n}\n\nexport class PluginManager {\n readonly events: EventEmitter<Events> = new EventEmitter()\n\n readonly config: Config\n\n readonly executed: Array<Executer> = []\n readonly logger: Logger\n readonly options: Options\n\n readonly #plugins = new Set<Plugin<GetPluginFactoryOptions<any>>>()\n readonly #usedPluginNames: Record<string, number> = {}\n readonly #promiseManager: PromiseManager\n\n constructor(config: Config, options: Options) {\n this.config = config\n this.options = options\n this.logger = options.logger\n this.#promiseManager = new PromiseManager({\n nullCheck: (state: SafeParseResult<'resolveName'> | null) => !!state?.result,\n })\n\n ;[...(config.plugins || [])].forEach((plugin) => {\n const parsedPlugin = this.#parse(plugin as UserPlugin)\n\n this.#plugins.add(parsedPlugin)\n })\n\n return this\n }\n\n getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any> {\n const plugins = [...this.#plugins]\n const baseContext = {\n fabric: this.options.fabric,\n config: this.config,\n plugin,\n logger: this.options.logger,\n pluginManager: this,\n mode: getMode(path.resolve(this.config.root, this.config.output.path)),\n addFile: async (...files: Array<KubbFile.File>) => {\n await this.options.fabric.addFile(...files)\n },\n upsertFile: async (...files: Array<KubbFile.File>) => {\n await this.options.fabric.upsertFile(...files)\n },\n } as unknown as PluginContext<TOptions>\n\n let mergedExtras: Record<string, any> = {}\n for (const p of plugins) {\n if (typeof p.inject === 'function') {\n const injector = p.inject.bind(baseContext as any) as any\n\n const result = injector(baseContext)\n if (result && typeof result === 'object') {\n mergedExtras = { ...mergedExtras, ...result }\n }\n }\n }\n\n return {\n ...baseContext,\n ...mergedExtras,\n }\n }\n\n get plugins(): Array<Plugin> {\n return this.#getSortedPlugins()\n }\n\n getFile<TOptions = object>({ name, mode, extname, pluginKey, options }: GetFileProps<TOptions>): KubbFile.File<{ pluginKey: Plugin['key'] }> {\n const baseName = `${name}${extname}` as const\n const path = this.resolvePath({ baseName, mode, pluginKey, options })\n\n if (!path) {\n throw new Error(`Filepath should be defined for resolvedName \"${name}\" and pluginKey [${JSON.stringify(pluginKey)}]`)\n }\n\n return {\n path,\n baseName,\n meta: {\n pluginKey,\n },\n sources: [],\n }\n }\n\n resolvePath = <TOptions = object>(params: ResolvePathParams<TOptions>): KubbFile.Path => {\n const root = path.resolve(this.config.root, this.config.output.path)\n const defaultPath = path.resolve(root, params.baseName)\n\n if (params.pluginKey) {\n const paths = this.hookForPluginSync({\n pluginKey: params.pluginKey,\n hookName: 'resolvePath',\n parameters: [params.baseName, params.mode, params.options as object],\n message: `Resolving path '${params.baseName}'`,\n })\n\n if (paths && paths?.length > 1) {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [\n `Cannot return a path where the 'pluginKey' ${\n params.pluginKey ? JSON.stringify(params.pluginKey) : '\"'\n } is not unique enough\\n\\nPaths: ${JSON.stringify(paths, undefined, 2)}\\n\\nFalling back on the first item.\\n`,\n ],\n })\n }\n\n return paths?.at(0) || defaultPath\n }\n\n const firstResult = this.hookFirstSync({\n hookName: 'resolvePath',\n parameters: [params.baseName, params.mode, params.options as object],\n message: `Resolving path '${params.baseName}'`,\n })\n\n return firstResult?.result || defaultPath\n }\n //TODO refactor by using the order of plugins and the cache of the fileManager instead of guessing and recreating the name/path\n resolveName = (params: ResolveNameParams): string => {\n if (params.pluginKey) {\n const names = this.hookForPluginSync({\n pluginKey: params.pluginKey,\n hookName: 'resolveName',\n parameters: [trim(params.name), params.type],\n message: `Resolving name '${params.name}' and type '${params.type}'`,\n })\n\n if (names && names?.length > 1) {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [\n `Cannot return a name where the 'pluginKey' ${\n params.pluginKey ? JSON.stringify(params.pluginKey) : '\"'\n } is not unique enough\\n\\nNames: ${JSON.stringify(names, undefined, 2)}\\n\\nFalling back on the first item.\\n`,\n ],\n })\n }\n\n return transformReservedWord(names?.at(0) || params.name)\n }\n\n const name = this.hookFirstSync({\n hookName: 'resolveName',\n parameters: [trim(params.name), params.type],\n message: `Resolving name '${params.name}' and type '${params.type}'`,\n }).result\n\n return transformReservedWord(name)\n }\n\n /**\n * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.\n */\n on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void {\n this.events.on(eventName, handler as any)\n }\n\n /**\n * Run a specific hookName for plugin x.\n */\n async hookForPlugin<H extends PluginLifecycleHooks>({\n pluginKey,\n hookName,\n parameters,\n message,\n }: {\n pluginKey: Plugin['key']\n hookName: H\n parameters: PluginParameter<H>\n message: string\n }): Promise<Array<ReturnType<ParseResult<H>> | null>> {\n const plugins = this.getPluginsByKey(hookName, pluginKey)\n\n this.logger.emit('progress_start', { id: hookName, size: plugins.length, message: 'Running plugins...' })\n\n const items: Array<ReturnType<ParseResult<H>>> = []\n\n for (const plugin of plugins) {\n const result = await this.#execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n })\n\n if (result !== undefined && result !== null) {\n items.push(result)\n }\n }\n\n this.logger.emit('progress_stop', { id: hookName })\n\n return items\n }\n /**\n * Run a specific hookName for plugin x.\n */\n\n hookForPluginSync<H extends PluginLifecycleHooks>({\n pluginKey,\n hookName,\n parameters,\n message,\n }: {\n pluginKey: Plugin['key']\n hookName: H\n parameters: PluginParameter<H>\n message: string\n }): Array<ReturnType<ParseResult<H>>> | null {\n const plugins = this.getPluginsByKey(hookName, pluginKey)\n\n const result = plugins\n .map((plugin) => {\n return this.#executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n })\n })\n .filter(Boolean)\n\n return result\n }\n\n /**\n * First non-null result stops and will return it's value.\n */\n async hookFirst<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n message,\n }: {\n hookName: H\n parameters: PluginParameter<H>\n skipped?: ReadonlySet<Plugin> | null\n message: string\n }): Promise<SafeParseResult<H>> {\n const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {\n return skipped ? skipped.has(plugin) : true\n })\n\n this.logger.emit('progress_start', { id: hookName, size: plugins.length })\n\n const promises = plugins.map((plugin) => {\n return async () => {\n const value = await this.#execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n })\n\n return Promise.resolve({\n plugin,\n result: value,\n } as SafeParseResult<H>)\n }\n })\n\n const result = await this.#promiseManager.run('first', promises)\n\n this.logger.emit('progress_stop', { id: hookName })\n\n return result\n }\n\n /**\n * First non-null result stops and will return it's value.\n */\n hookFirstSync<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n message,\n }: {\n hookName: H\n parameters: PluginParameter<H>\n skipped?: ReadonlySet<Plugin> | null\n message: string\n }): SafeParseResult<H> {\n let parseResult: SafeParseResult<H> = null as unknown as SafeParseResult<H>\n const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {\n return skipped ? skipped.has(plugin) : true\n })\n\n for (const plugin of plugins) {\n parseResult = {\n result: this.#executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n }),\n plugin,\n } as SafeParseResult<H>\n\n if (parseResult?.result != null) {\n break\n }\n }\n\n return parseResult\n }\n\n /**\n * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).\n */\n async hookParallel<H extends PluginLifecycleHooks, TOuput = void>({\n hookName,\n parameters,\n message,\n }: {\n hookName: H\n parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined\n message: string\n }): Promise<Awaited<TOuput>[]> {\n const plugins = this.#getSortedPlugins(hookName)\n this.logger.emit('progress_start', { id: hookName, size: plugins.length })\n\n const promises = plugins.map((plugin) => {\n return () =>\n this.#execute({\n strategy: 'hookParallel',\n hookName,\n parameters,\n plugin,\n message,\n }) as Promise<TOuput>\n })\n\n const results = await this.#promiseManager.run('parallel', promises, { concurrency: this.options.concurrency })\n\n results.forEach((result, index) => {\n if (isPromiseRejectedResult<Error>(result)) {\n const plugin = this.#getSortedPlugins(hookName)[index]\n\n this.#catcher<H>(result.reason, plugin, hookName)\n }\n })\n\n this.logger.emit('progress_stop', { id: hookName })\n\n return results.filter((result) => result.status === 'fulfilled').map((result) => (result as PromiseFulfilledResult<Awaited<TOuput>>).value)\n }\n\n /**\n * Chains plugins\n */\n async hookSeq<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n message,\n }: {\n hookName: H\n parameters?: PluginParameter<H>\n message: string\n }): Promise<void> {\n const plugins = this.#getSortedPlugins(hookName)\n this.logger.emit('progress_start', { id: hookName, size: plugins.length })\n\n const promises = plugins.map((plugin) => {\n return () =>\n this.#execute({\n strategy: 'hookSeq',\n hookName,\n parameters,\n plugin,\n message,\n })\n })\n\n await this.#promiseManager.run('seq', promises)\n\n this.logger.emit('progress_stop', { id: hookName })\n }\n\n #getSortedPlugins(hookName?: keyof PluginLifecycle): Array<Plugin> {\n const plugins = [...this.#plugins]\n\n if (hookName) {\n return plugins.filter((plugin) => hookName in plugin)\n }\n // TODO add test case for sorting with pre/post\n\n return plugins\n .map((plugin) => {\n if (plugin.pre) {\n const missingPlugins = plugin.pre.filter((pluginName) => !plugins.find((pluginToFind) => pluginToFind.name === pluginName))\n\n if (missingPlugins.length > 0) {\n throw new ValidationPluginError(`The plugin '${plugin.name}' has a pre set that references missing plugins for '${missingPlugins.join(', ')}'`)\n }\n }\n\n return plugin\n })\n .sort((a, b) => {\n if (b.pre?.includes(a.name)) {\n return 1\n }\n if (b.post?.includes(a.name)) {\n return -1\n }\n return 0\n })\n }\n\n getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined {\n const plugins = [...this.#plugins]\n const [searchPluginName] = pluginKey\n\n return plugins.find((item) => {\n const [name] = item.key\n\n return name === searchPluginName\n })\n }\n\n getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[] {\n const plugins = [...this.plugins]\n const [searchPluginName, searchIdentifier] = pluginKey\n\n const pluginByPluginName = plugins\n .filter((plugin) => hookName in plugin)\n .filter((item) => {\n const [name, identifier] = item.key\n\n const identifierCheck = identifier?.toString() === searchIdentifier?.toString()\n const nameCheck = name === searchPluginName\n\n if (searchIdentifier) {\n return identifierCheck && nameCheck\n }\n\n return nameCheck\n })\n\n if (!pluginByPluginName?.length) {\n // fallback on the core plugin when there is no match\n\n const corePlugin = plugins.find((plugin) => plugin.name === 'core' && hookName in plugin)\n\n if (corePlugin) {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`],\n })\n } else {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`],\n })\n }\n return corePlugin ? [corePlugin] : []\n }\n\n return pluginByPluginName\n }\n\n #addExecutedToCallStack(executer: Executer | undefined) {\n if (executer) {\n this.events.emit('executed', executer)\n this.executed.push(executer)\n\n this.logger.emit('progressed', { id: executer.hookName, message: `${executer.plugin.name}: ${executer.message}` })\n }\n }\n\n /**\n * Run an async plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The actual pluginObject to run.\n */\n // Implementation signature\n #execute<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n message,\n }: {\n strategy: Strategy\n hookName: H\n parameters: unknown[] | undefined\n plugin: PluginWithLifeCycle\n message: string\n }): Promise<ReturnType<ParseResult<H>> | null> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.events.emit('executing', { strategy, hookName, parameters, plugin, message })\n\n const task = (async () => {\n try {\n if (typeof hook === 'function') {\n const context = this.getContext(plugin)\n const result = await Promise.resolve((hook as Function).apply(context, parameters))\n\n output = result\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return result\n }\n\n output = hook\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return hook\n } catch (e) {\n this.#catcher<H>(e as Error, plugin, hookName)\n return null\n }\n })()\n\n return task\n }\n\n /**\n * Run a sync plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be in `PluginHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The acutal plugin\n * @param replaceContext When passed, the plugin context can be overridden.\n */\n #executeSync<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n message,\n }: {\n strategy: Strategy\n hookName: H\n parameters: PluginParameter<H>\n plugin: PluginWithLifeCycle\n message: string\n }): ReturnType<ParseResult<H>> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.events.emit('executing', { strategy, hookName, parameters, plugin, message })\n\n try {\n if (typeof hook === 'function') {\n const context = this.getContext(plugin)\n const fn = (hook as Function).apply(context, parameters) as ReturnType<ParseResult<H>>\n\n output = fn\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return fn\n }\n\n output = hook\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return hook\n } catch (e) {\n this.#catcher<H>(e as Error, plugin, hookName)\n\n return null\n }\n }\n\n #catcher<H extends PluginLifecycleHooks>(cause: Error, plugin?: Plugin, hookName?: H) {\n const text = `${cause.message} (plugin: ${plugin?.name || 'unknown'}, hook: ${hookName || 'unknown'})`\n\n this.logger.emit('error', text, cause)\n this.events.emit('error', cause)\n }\n\n #parse(plugin: UserPlugin): Plugin {\n const usedPluginNames = this.#usedPluginNames\n\n setUniqueName(plugin.name, usedPluginNames)\n\n return {\n install() {},\n ...plugin,\n key: [plugin.name, usedPluginNames[plugin.name]].filter(Boolean) as [typeof plugin.name, string],\n } as unknown as Plugin\n }\n}\n","import { camelCase, isValidVarName } from '../transformers'\n\nexport type URLObject = {\n url: string\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n type?: 'path' | 'template'\n replacer?: (pathParam: string) => string\n stringify?: boolean\n}\n\ntype Options = {\n casing?: 'camelcase'\n}\n\nexport class URLPath {\n path: string\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n\n return this\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isURL(): boolean {\n try {\n const url = new URL(this.path)\n if (url?.href) {\n return true\n }\n } catch (_error) {\n return false\n }\n return false\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n get object(): URLObject | string {\n return this.toObject()\n }\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n let newPath = this.path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, path) => {\n const pathWithoutBrackets = path.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(pathWithoutBrackets) ? pathWithoutBrackets : camelCase(pathWithoutBrackets)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n return prev.replace(path, `\\${${replacer ? replacer(param) : param}}`)\n }, this.path)\n }\n\n return `\\`${prefix}${newPath}\\``\n }\n\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n\n if (!found) {\n return undefined\n }\n\n const params: Record<string, string> = {}\n found.forEach((item) => {\n item = item.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(item) ? item : camelCase(item)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n const key = replacer ? replacer(param) : param\n\n params[key] = key\n }, this.path)\n\n return params\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return this.path.replaceAll('{', ':').replaceAll('}', '')\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport { getMode } from '../PluginManager.ts'\n\ntype BarrelData = {\n file?: KubbFile.File\n /**\n * @deprecated use file instead\n */\n type: KubbFile.Mode\n path: string\n name: string\n}\n\nexport class TreeNode {\n data: BarrelData\n parent?: TreeNode\n children: Array<TreeNode> = []\n #cachedLeaves?: Array<TreeNode> = undefined\n\n constructor(data: BarrelData, parent?: TreeNode) {\n this.data = data\n this.parent = parent\n return this\n }\n\n addChild(data: BarrelData): TreeNode {\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 get root(): TreeNode {\n if (!this.parent) {\n return this\n }\n return this.parent.root\n }\n\n get leaves(): Array<TreeNode> {\n if (!this.children || this.children.length === 0) {\n // this is a leaf\n return [this]\n }\n\n if (this.#cachedLeaves) {\n return this.#cachedLeaves\n }\n\n // if not a leaf, return all children's leaves recursively\n const leaves: TreeNode[] = []\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\n this.#cachedLeaves = leaves\n\n return leaves\n }\n\n forEach(callback: (treeNode: TreeNode) => 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 findDeep(predicate?: (value: TreeNode, index: number, obj: TreeNode[]) => boolean): TreeNode | undefined {\n if (typeof predicate !== 'function') {\n throw new TypeError('find() predicate must be a function')\n }\n\n return this.leaves.find(predicate)\n }\n\n forEachDeep(callback: (treeNode: TreeNode) => void): void {\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n this.leaves.forEach(callback)\n }\n\n filterDeep(callback: (treeNode: TreeNode) => boolean): Array<TreeNode> {\n if (typeof callback !== 'function') {\n throw new TypeError('filter() callback must be a function')\n }\n\n return this.leaves.filter(callback)\n }\n\n mapDeep<T>(callback: (treeNode: TreeNode) => T): Array<T> {\n if (typeof callback !== 'function') {\n throw new TypeError('map() callback must be a function')\n }\n\n return this.leaves.map(callback)\n }\n\n public static build(files: KubbFile.File[], root?: string): TreeNode | null {\n try {\n const filteredTree = buildDirectoryTree(files, root)\n\n if (!filteredTree) {\n return null\n }\n\n const treeNode = new TreeNode({\n name: filteredTree.name,\n path: filteredTree.path,\n file: filteredTree.file,\n type: 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 file: item.file,\n type: 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) => {\n recurse(treeNode, child)\n })\n\n return treeNode\n } catch (e) {\n throw new Error('Something went wrong with creating barrel files with the TreeNode class', { cause: e })\n }\n }\n}\n\nexport type DirectoryTree = {\n name: string\n path: string\n file?: KubbFile.File\n children: Array<DirectoryTree>\n}\n\nconst normalizePath = (p: string): string => p.replace(/\\\\/g, '/')\n\nexport function buildDirectoryTree(files: Array<KubbFile.File>, rootFolder = ''): DirectoryTree | null {\n const normalizedRootFolder = normalizePath(rootFolder)\n const rootPrefix = normalizedRootFolder.endsWith('/') ? normalizedRootFolder : `${normalizedRootFolder}/`\n\n const filteredFiles = files.filter((file) => {\n const normalizedFilePath = normalizePath(file.path)\n return rootFolder ? normalizedFilePath.startsWith(rootPrefix) && !normalizedFilePath.endsWith('.json') : !normalizedFilePath.endsWith('.json')\n })\n\n if (filteredFiles.length === 0) {\n return null // No files match the root folder\n }\n\n const root: DirectoryTree = {\n name: rootFolder || '',\n path: rootFolder || '',\n children: [],\n }\n\n filteredFiles.forEach((file) => {\n const path = file.path.slice(rootFolder.length)\n const parts = path.split('/')\n let currentLevel: DirectoryTree[] = root.children\n let currentPath = rootFolder\n\n parts.forEach((part, index) => {\n if (index !== 0) {\n currentPath += `/${part}`\n } else {\n currentPath += `${part}`\n }\n\n let existingNode = currentLevel.find((node) => node.name === part)\n\n if (!existingNode) {\n if (index === parts.length - 1) {\n // If it's the last part, it's a file\n existingNode = {\n name: part,\n file,\n path: currentPath,\n } as DirectoryTree\n } else {\n // Otherwise, it's a folder\n existingNode = {\n name: part,\n path: currentPath,\n children: [],\n } as DirectoryTree\n }\n currentLevel.push(existingNode)\n }\n\n // Move to the next level if it's a folder\n if (!existingNode.file) {\n currentLevel = existingNode.children\n }\n })\n })\n\n return root\n}\n","/** biome-ignore-all lint/suspicious/useIterableCallbackReturn: not needed */\nimport { join } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { getRelativePath } from './fs/index.ts'\nimport type { Logger } from './logger.ts'\nimport type { FileMetaBase } from './utils/getBarrelFiles.ts'\nimport { TreeNode } from './utils/TreeNode.ts'\n\ntype BarrelManagerOptions = {\n logger?: Logger\n}\n\nexport class BarrelManager {\n #options: BarrelManagerOptions\n\n constructor(options: BarrelManagerOptions = {}) {\n this.#options = options\n\n return this\n }\n\n getFiles({ files: generatedFiles, root }: { files: KubbFile.File[]; root?: string; meta?: FileMetaBase | undefined }): Array<KubbFile.File> {\n const { logger } = this.#options\n\n const cachedFiles = new Map<KubbFile.Path, KubbFile.File>()\n\n TreeNode.build(generatedFiles, root)?.forEach((treeNode) => {\n if (!treeNode || !treeNode.children || !treeNode.parent?.data.path) {\n return undefined\n }\n\n const barrelFile: KubbFile.File = {\n path: join(treeNode.parent?.data.path, 'index.ts') as KubbFile.Path,\n baseName: 'index.ts',\n exports: [],\n sources: [],\n }\n const previousBarrelFile = cachedFiles.get(barrelFile.path)\n const leaves = treeNode.leaves\n\n leaves.forEach((item) => {\n if (!item.data.name) {\n return undefined\n }\n\n const sources = item.data.file?.sources || []\n\n if (!sources.some((source) => source.isIndexable)) {\n logger?.emit(\n 'warning',\n `No isIndexable source found(source should have a name and isIndexable):\\nFile: ${JSON.stringify(item.data.file, undefined, 2)}`,\n )\n }\n\n sources.forEach((source) => {\n if (!item.data.file?.path || !source.isIndexable || !source.name) {\n return undefined\n }\n const alreadyContainInPreviousBarrelFile = previousBarrelFile?.sources.some(\n (item) => item.name === source.name && item.isTypeOnly === source.isTypeOnly,\n )\n\n if (alreadyContainInPreviousBarrelFile) {\n return undefined\n }\n\n if (!barrelFile.exports) {\n barrelFile.exports = []\n }\n\n // true when we have a subdirectory that also contains barrel files\n const isSubExport = !!treeNode.parent?.data.path?.split?.('/')?.length\n\n if (isSubExport) {\n barrelFile.exports.push({\n name: [source.name],\n path: getRelativePath(treeNode.parent?.data.path, item.data.path),\n isTypeOnly: source.isTypeOnly,\n })\n } else {\n barrelFile.exports.push({\n name: [source.name],\n path: `./${item.data.file.baseName}`,\n isTypeOnly: source.isTypeOnly,\n })\n }\n\n barrelFile.sources.push({\n name: source.name,\n isTypeOnly: source.isTypeOnly,\n //TODO use parser to generate import\n value: '',\n isExportable: false,\n isIndexable: false,\n })\n })\n })\n\n if (previousBarrelFile) {\n previousBarrelFile.sources.push(...barrelFile.sources)\n previousBarrelFile.exports?.push(...(barrelFile.exports || []))\n } else {\n cachedFiles.set(barrelFile.path, barrelFile)\n }\n })\n\n return [...cachedFiles.values()]\n }\n}\n","import { join } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { BarrelManager } from '../BarrelManager.ts'\nimport type { Logger } from '../logger.ts'\nimport type { BarrelType, Plugin } from '../types.ts'\n\nexport type FileMetaBase = {\n pluginKey?: Plugin['key']\n}\n\ntype AddIndexesProps = {\n type: BarrelType | false | undefined\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 }\n group?: {\n output: string\n exportAs: string\n }\n logger?: Logger\n\n meta?: FileMetaBase\n}\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport async function getBarrelFiles(\n files: Array<KubbFile.ResolvedFile>,\n { type, meta = {}, root, output, logger }: AddIndexesProps,\n): Promise<KubbFile.File[]> {\n if (!type || type === 'propagate') {\n return []\n }\n\n const barrelManager = new BarrelManager({ logger })\n\n const pathToBuildFrom = join(root, output.path)\n\n if (trimExtName(pathToBuildFrom).endsWith('index')) {\n logger?.emit('warning', 'Output has the same fileName as the barrelFiles, please disable barrel generation')\n\n return []\n }\n\n const barrelFiles = barrelManager.getFiles({ files, root: pathToBuildFrom, meta })\n\n if (type === 'all') {\n return barrelFiles.map((file) => {\n return {\n ...file,\n exports: file.exports?.map((exportItem) => {\n return {\n ...exportItem,\n name: undefined,\n }\n }),\n }\n })\n }\n\n return barrelFiles.map((indexFile) => {\n return {\n ...indexFile,\n meta,\n }\n })\n}\n"],"x_google_ignoreList":[2,3],"mappings":";;;;;;;AAEA,SAAS,MAAM,QAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAKA,OAAK;CAC5C,MAAM,0CAA2BA,OAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,8BAJU,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK;;;;;AC9Bd,IAAa,wBAAb,cAA2C,MAAM;;;;ACKjD,IAAM,OAAN,MAAW;CACV;CACA;CAEA,YAAY,OAAO;AAClB,OAAK,QA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BAAgB,CAAC,SAAS,QAAQ,EAAE;AAClD,UAAQ,KAAK,WAAW,oFAAoF;AAE5G,SAAO,EAAE;;CAGX,MAAM,cAAc,cAAc,SAAS;EAAE;EAAO,MAAM;EAAiB;EAAM,CAAC;AAElF,KAAI,SAAS,MACX,QAAO,YAAY,KAAK,SAAS;AAC/B,SAAO;GACL,GAAG;GACH,SAAS,KAAK,SAAS,KAAK,eAAe;AACzC,WAAO;KACL,GAAG;KACH,MAAM;KACP;KACD;GACH;GACD;AAGJ,QAAO,YAAY,KAAK,cAAc;AACpC,SAAO;GACL,GAAG;GACH;GACD;GACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as Logger } from "./logger-C96jDrSt.js";
|
|
2
|
-
import { c as Plugin, t as BarrelType } from "./types-
|
|
2
|
+
import { c as Plugin, t as BarrelType } from "./types-69-evK37.js";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/getBarrelFiles.d.ts
|
|
@@ -34,4 +34,4 @@ declare function getBarrelFiles(files: Array<KubbFile.ResolvedFile>, {
|
|
|
34
34
|
}: AddIndexesProps): Promise<KubbFile.File[]>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { getBarrelFiles as n, FileMetaBase as t };
|
|
37
|
-
//# sourceMappingURL=getBarrelFiles-
|
|
37
|
+
//# sourceMappingURL=getBarrelFiles-DjQ68d4e.d.ts.map
|
|
@@ -21,7 +21,7 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
|
|
|
21
21
|
var ValidationPluginError = class extends Error {};
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
-
//#region ../../node_modules/.pnpm/yocto-queue@1.2.
|
|
24
|
+
//#region ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
25
25
|
var Node = class {
|
|
26
26
|
value;
|
|
27
27
|
next;
|
|
@@ -52,6 +52,7 @@ var Queue = class {
|
|
|
52
52
|
if (!current) return;
|
|
53
53
|
this.#head = this.#head.next;
|
|
54
54
|
this.#size--;
|
|
55
|
+
if (!this.#head) this.#tail = void 0;
|
|
55
56
|
return current.value;
|
|
56
57
|
}
|
|
57
58
|
peek() {
|
|
@@ -249,6 +250,9 @@ var PluginManager = class {
|
|
|
249
250
|
mode: getMode(path.resolve(this.config.root, this.config.output.path)),
|
|
250
251
|
addFile: async (...files) => {
|
|
251
252
|
await this.options.fabric.addFile(...files);
|
|
253
|
+
},
|
|
254
|
+
upsertFile: async (...files) => {
|
|
255
|
+
await this.options.fabric.upsertFile(...files);
|
|
252
256
|
}
|
|
253
257
|
};
|
|
254
258
|
let mergedExtras = {};
|
|
@@ -960,4 +964,4 @@ async function getBarrelFiles(files, { type, meta = {}, root, output, logger })
|
|
|
960
964
|
|
|
961
965
|
//#endregion
|
|
962
966
|
export { getUniqueName as a, Queue as c, getMode as i, getRelativePath as l, URLPath as n, setUniqueName as o, PluginManager as r, PromiseManager as s, getBarrelFiles as t };
|
|
963
|
-
//# sourceMappingURL=getBarrelFiles-
|
|
967
|
+
//# sourceMappingURL=getBarrelFiles-a-GlnjYa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBarrelFiles-a-GlnjYa.js","names":["path","#head","#tail","#size","resolve","promise: Promise<unknown>","#options","#plugins","#usedPluginNames","#promiseManager","#parse","mergedExtras: Record<string, any>","#getSortedPlugins","path","items: Array<ReturnType<ParseResult<H>>>","#execute","#executeSync","parseResult: SafeParseResult<H>","#catcher","output: unknown","#addExecutedToCallStack","path","#options","params: Record<string, string>","#cachedLeaves","leaves: TreeNode[]","root: DirectoryTree","currentLevel: DirectoryTree[]","#options","barrelFile: KubbFile.File","item"],"sources":["../src/fs/utils.ts","../src/errors.ts","../../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/p-limit@7.2.0/node_modules/p-limit/index.js","../src/utils/executeStrategies.ts","../src/PromiseManager.ts","../src/utils/uniqueName.ts","../src/PluginManager.ts","../src/utils/URLPath.ts","../src/utils/TreeNode.ts","../src/BarrelManager.ts","../src/utils/getBarrelFiles.ts"],"sourcesContent":["import { normalize, relative } from 'node:path'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n","export class ValidationPluginError extends Error {}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\n\t\t// Clean up tail reference when queue becomes empty\n\t\tif (!this.#head) {\n\t\t\tthis.#tail = undefined;\n\t\t}\n\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\t// Process the next queued function if we're under the concurrency limit\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tactiveCount++;\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\t// Execute the function and capture the result promise\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\t// Resolve immediately with the promise (don't wait for completion)\n\t\tresolve(result);\n\n\t\t// Wait for the function to complete (success or failure)\n\t\t// We catch errors here to prevent unhandled rejections,\n\t\t// but the original promise rejection is preserved for the caller\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\t// Decrement active count and process next queued function\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue the internal resolve function instead of the run function\n\t\t// to preserve the asynchronous execution context.\n\t\tnew Promise(internalResolve => { // eslint-disable-line promise/param-names\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_)); // eslint-disable-line promise/prefer-await-to-then\n\n\t\t// Start processing immediately if we haven't reached the concurrency limit\n\t\tif (activeCount < concurrency) {\n\t\t\tresumeNext();\n\t\t}\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tmap: {\n\t\t\tasync value(iterable, function_) {\n\t\t\t\tconst promises = Array.from(iterable, (value, index) => this(function_, value, index));\n\t\t\t\treturn Promise.all(promises);\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, options) {\n\tconst {concurrency} = options;\n\tconst limit = pLimit(concurrency);\n\n\treturn (...arguments_) => limit(() => function_(...arguments_));\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import pLimit from 'p-limit'\n\ntype PromiseFunc<T = unknown, T2 = never> = (state?: T) => T2 extends never ? Promise<T> : Promise<T> | T2\n\ntype ValueOfPromiseFuncArray<TInput extends Array<unknown>> = TInput extends Array<PromiseFunc<infer X, infer Y>> ? X | Y : never\n\ntype SeqOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Promise<Array<Awaited<ValueOfPromiseFuncArray<TInput>>>>\n\n/**\n * Chains promises\n */\nexport function hookSeq<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TOutput = SeqOutput<TInput, TValue>>(promises: TInput): TOutput {\n return promises.filter(Boolean).reduce(\n (promise, func) => {\n if (typeof func !== 'function') {\n throw new Error('HookSeq needs a function that returns a promise `() => Promise<unknown>`')\n }\n\n return promise.then((state) => {\n const calledFunc = func(state as TValue)\n\n if (calledFunc) {\n return calledFunc.then(Array.prototype.concat.bind(state))\n }\n })\n },\n Promise.resolve([] as unknown),\n ) as TOutput\n}\n\ntype HookFirstOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown> = ValueOfPromiseFuncArray<TInput>\n\n/**\n * Chains promises, first non-null result stops and returns\n */\nexport function hookFirst<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown, TOutput = HookFirstOutput<TInput, TValue>>(\n promises: TInput,\n nullCheck = (state: any) => state !== null,\n): TOutput {\n let promise: Promise<unknown> = Promise.resolve(null) as Promise<unknown>\n\n for (const func of promises.filter(Boolean)) {\n promise = promise.then((state) => {\n if (nullCheck(state)) {\n return state\n }\n\n return func(state as TValue)\n })\n }\n\n return promise as TOutput\n}\n\ntype HookParallelOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Promise<PromiseSettledResult<Awaited<ValueOfPromiseFuncArray<TInput>>>[]>\n\n/**\n * Runs an array of promise functions with optional concurrency limit.\n */\nexport function hookParallel<TInput extends Array<PromiseFunc<TValue, null>>, TValue = unknown, TOutput = HookParallelOutput<TInput, TValue>>(\n promises: TInput,\n concurrency: number = Number.POSITIVE_INFINITY,\n): TOutput {\n const limit = pLimit(concurrency)\n\n const tasks = promises.filter(Boolean).map((promise) => limit(() => promise()))\n\n return Promise.allSettled(tasks) as TOutput\n}\n\nexport type Strategy = 'seq' | 'first' | 'parallel'\n\nexport type StrategySwitch<TStrategy extends Strategy, TInput extends Array<PromiseFunc<TValue, null>>, TValue> = TStrategy extends 'first'\n ? HookFirstOutput<TInput, TValue>\n : TStrategy extends 'seq'\n ? SeqOutput<TInput, TValue>\n : TStrategy extends 'parallel'\n ? HookParallelOutput<TInput, TValue>\n : never\n","import type { Strategy, StrategySwitch } from './utils/executeStrategies.ts'\nimport { hookFirst, hookParallel, hookSeq } from './utils/executeStrategies.ts'\n\ntype PromiseFunc<T = unknown, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2\n\ntype Options<TState = any> = {\n nullCheck?: (state: TState) => boolean\n}\n\nexport class PromiseManager<TState = any> {\n #options: Options<TState> = {}\n\n constructor(options: Options<TState> = {}) {\n this.#options = options\n\n return this\n }\n\n run<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TStrategy extends Strategy, TOutput = StrategySwitch<TStrategy, TInput, TValue>>(\n strategy: TStrategy,\n promises: TInput,\n { concurrency = Number.POSITIVE_INFINITY }: { concurrency?: number } = {},\n ): TOutput {\n if (strategy === 'seq') {\n return hookSeq<TInput, TValue, TOutput>(promises)\n }\n\n if (strategy === 'first') {\n return hookFirst<TInput, TValue, TOutput>(promises, this.#options.nullCheck)\n }\n\n if (strategy === 'parallel') {\n return hookParallel<TInput, TValue, TOutput>(promises, concurrency)\n }\n\n throw new Error(`${strategy} not implemented`)\n }\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n\nexport function setUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n\n return originalName\n }\n data[originalName] = 1\n return originalName\n}\n","import path from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport { ValidationPluginError } from './errors.ts'\nimport type { Logger } from './logger.ts'\nimport { isPromiseRejectedResult, PromiseManager } from './PromiseManager.ts'\nimport { transformReservedWord } from './transformers/transformReservedWord.ts'\nimport { trim } from './transformers/trim.ts'\nimport type {\n Config,\n GetPluginFactoryOptions,\n Plugin,\n PluginContext,\n PluginFactoryOptions,\n PluginLifecycle,\n PluginLifecycleHooks,\n PluginParameter,\n PluginWithLifeCycle,\n ResolveNameParams,\n ResolvePathParams,\n UserPlugin,\n} from './types.ts'\nimport { EventEmitter } from './utils/EventEmitter.ts'\nimport { setUniqueName } from './utils/uniqueName.ts'\n\ntype RequiredPluginLifecycle = Required<PluginLifecycle>\n\ntype Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq'\n\ntype Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {\n message: string\n strategy: Strategy\n hookName: H\n plugin: Plugin\n parameters?: unknown[] | undefined\n output?: unknown\n}\n\ntype ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H]\n\ntype SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {\n result: Result\n plugin: Plugin\n}\n\n// inspired by: https://github.com/rollup/rollup/blob/master/src/utils/PluginDriver.ts#\n\ntype Options = {\n fabric: Fabric\n logger: Logger\n /**\n * @default Number.POSITIVE_INFINITY\n */\n concurrency?: number\n}\n\ntype Events = {\n executing: [executer: Executer]\n executed: [executer: Executer]\n error: [error: Error]\n}\n\ntype GetFileProps<TOptions = object> = {\n name: string\n mode?: KubbFile.Mode\n extname: KubbFile.Extname\n pluginKey: Plugin['key']\n options?: TOptions\n}\n\nexport function getMode(fileOrFolder: string | undefined | null): KubbFile.Mode {\n if (!fileOrFolder) {\n return 'split'\n }\n return path.extname(fileOrFolder) ? 'single' : 'split'\n}\n\nexport class PluginManager {\n readonly events: EventEmitter<Events> = new EventEmitter()\n\n readonly config: Config\n\n readonly executed: Array<Executer> = []\n readonly logger: Logger\n readonly options: Options\n\n readonly #plugins = new Set<Plugin<GetPluginFactoryOptions<any>>>()\n readonly #usedPluginNames: Record<string, number> = {}\n readonly #promiseManager: PromiseManager\n\n constructor(config: Config, options: Options) {\n this.config = config\n this.options = options\n this.logger = options.logger\n this.#promiseManager = new PromiseManager({\n nullCheck: (state: SafeParseResult<'resolveName'> | null) => !!state?.result,\n })\n\n ;[...(config.plugins || [])].forEach((plugin) => {\n const parsedPlugin = this.#parse(plugin as UserPlugin)\n\n this.#plugins.add(parsedPlugin)\n })\n\n return this\n }\n\n getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any> {\n const plugins = [...this.#plugins]\n const baseContext = {\n fabric: this.options.fabric,\n config: this.config,\n plugin,\n logger: this.options.logger,\n pluginManager: this,\n mode: getMode(path.resolve(this.config.root, this.config.output.path)),\n addFile: async (...files: Array<KubbFile.File>) => {\n await this.options.fabric.addFile(...files)\n },\n upsertFile: async (...files: Array<KubbFile.File>) => {\n await this.options.fabric.upsertFile(...files)\n },\n } as unknown as PluginContext<TOptions>\n\n let mergedExtras: Record<string, any> = {}\n for (const p of plugins) {\n if (typeof p.inject === 'function') {\n const injector = p.inject.bind(baseContext as any) as any\n\n const result = injector(baseContext)\n if (result && typeof result === 'object') {\n mergedExtras = { ...mergedExtras, ...result }\n }\n }\n }\n\n return {\n ...baseContext,\n ...mergedExtras,\n }\n }\n\n get plugins(): Array<Plugin> {\n return this.#getSortedPlugins()\n }\n\n getFile<TOptions = object>({ name, mode, extname, pluginKey, options }: GetFileProps<TOptions>): KubbFile.File<{ pluginKey: Plugin['key'] }> {\n const baseName = `${name}${extname}` as const\n const path = this.resolvePath({ baseName, mode, pluginKey, options })\n\n if (!path) {\n throw new Error(`Filepath should be defined for resolvedName \"${name}\" and pluginKey [${JSON.stringify(pluginKey)}]`)\n }\n\n return {\n path,\n baseName,\n meta: {\n pluginKey,\n },\n sources: [],\n }\n }\n\n resolvePath = <TOptions = object>(params: ResolvePathParams<TOptions>): KubbFile.Path => {\n const root = path.resolve(this.config.root, this.config.output.path)\n const defaultPath = path.resolve(root, params.baseName)\n\n if (params.pluginKey) {\n const paths = this.hookForPluginSync({\n pluginKey: params.pluginKey,\n hookName: 'resolvePath',\n parameters: [params.baseName, params.mode, params.options as object],\n message: `Resolving path '${params.baseName}'`,\n })\n\n if (paths && paths?.length > 1) {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [\n `Cannot return a path where the 'pluginKey' ${\n params.pluginKey ? JSON.stringify(params.pluginKey) : '\"'\n } is not unique enough\\n\\nPaths: ${JSON.stringify(paths, undefined, 2)}\\n\\nFalling back on the first item.\\n`,\n ],\n })\n }\n\n return paths?.at(0) || defaultPath\n }\n\n const firstResult = this.hookFirstSync({\n hookName: 'resolvePath',\n parameters: [params.baseName, params.mode, params.options as object],\n message: `Resolving path '${params.baseName}'`,\n })\n\n return firstResult?.result || defaultPath\n }\n //TODO refactor by using the order of plugins and the cache of the fileManager instead of guessing and recreating the name/path\n resolveName = (params: ResolveNameParams): string => {\n if (params.pluginKey) {\n const names = this.hookForPluginSync({\n pluginKey: params.pluginKey,\n hookName: 'resolveName',\n parameters: [trim(params.name), params.type],\n message: `Resolving name '${params.name}' and type '${params.type}'`,\n })\n\n if (names && names?.length > 1) {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [\n `Cannot return a name where the 'pluginKey' ${\n params.pluginKey ? JSON.stringify(params.pluginKey) : '\"'\n } is not unique enough\\n\\nNames: ${JSON.stringify(names, undefined, 2)}\\n\\nFalling back on the first item.\\n`,\n ],\n })\n }\n\n return transformReservedWord(names?.at(0) || params.name)\n }\n\n const name = this.hookFirstSync({\n hookName: 'resolveName',\n parameters: [trim(params.name), params.type],\n message: `Resolving name '${params.name}' and type '${params.type}'`,\n }).result\n\n return transformReservedWord(name)\n }\n\n /**\n * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.\n */\n on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void {\n this.events.on(eventName, handler as any)\n }\n\n /**\n * Run a specific hookName for plugin x.\n */\n async hookForPlugin<H extends PluginLifecycleHooks>({\n pluginKey,\n hookName,\n parameters,\n message,\n }: {\n pluginKey: Plugin['key']\n hookName: H\n parameters: PluginParameter<H>\n message: string\n }): Promise<Array<ReturnType<ParseResult<H>> | null>> {\n const plugins = this.getPluginsByKey(hookName, pluginKey)\n\n this.logger.emit('progress_start', { id: hookName, size: plugins.length, message: 'Running plugins...' })\n\n const items: Array<ReturnType<ParseResult<H>>> = []\n\n for (const plugin of plugins) {\n const result = await this.#execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n })\n\n if (result !== undefined && result !== null) {\n items.push(result)\n }\n }\n\n this.logger.emit('progress_stop', { id: hookName })\n\n return items\n }\n /**\n * Run a specific hookName for plugin x.\n */\n\n hookForPluginSync<H extends PluginLifecycleHooks>({\n pluginKey,\n hookName,\n parameters,\n message,\n }: {\n pluginKey: Plugin['key']\n hookName: H\n parameters: PluginParameter<H>\n message: string\n }): Array<ReturnType<ParseResult<H>>> | null {\n const plugins = this.getPluginsByKey(hookName, pluginKey)\n\n const result = plugins\n .map((plugin) => {\n return this.#executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n })\n })\n .filter(Boolean)\n\n return result\n }\n\n /**\n * First non-null result stops and will return it's value.\n */\n async hookFirst<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n message,\n }: {\n hookName: H\n parameters: PluginParameter<H>\n skipped?: ReadonlySet<Plugin> | null\n message: string\n }): Promise<SafeParseResult<H>> {\n const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {\n return skipped ? skipped.has(plugin) : true\n })\n\n this.logger.emit('progress_start', { id: hookName, size: plugins.length })\n\n const promises = plugins.map((plugin) => {\n return async () => {\n const value = await this.#execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n })\n\n return Promise.resolve({\n plugin,\n result: value,\n } as SafeParseResult<H>)\n }\n })\n\n const result = await this.#promiseManager.run('first', promises)\n\n this.logger.emit('progress_stop', { id: hookName })\n\n return result\n }\n\n /**\n * First non-null result stops and will return it's value.\n */\n hookFirstSync<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n message,\n }: {\n hookName: H\n parameters: PluginParameter<H>\n skipped?: ReadonlySet<Plugin> | null\n message: string\n }): SafeParseResult<H> {\n let parseResult: SafeParseResult<H> = null as unknown as SafeParseResult<H>\n const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {\n return skipped ? skipped.has(plugin) : true\n })\n\n for (const plugin of plugins) {\n parseResult = {\n result: this.#executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n message,\n }),\n plugin,\n } as SafeParseResult<H>\n\n if (parseResult?.result != null) {\n break\n }\n }\n\n return parseResult\n }\n\n /**\n * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).\n */\n async hookParallel<H extends PluginLifecycleHooks, TOuput = void>({\n hookName,\n parameters,\n message,\n }: {\n hookName: H\n parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined\n message: string\n }): Promise<Awaited<TOuput>[]> {\n const plugins = this.#getSortedPlugins(hookName)\n this.logger.emit('progress_start', { id: hookName, size: plugins.length })\n\n const promises = plugins.map((plugin) => {\n return () =>\n this.#execute({\n strategy: 'hookParallel',\n hookName,\n parameters,\n plugin,\n message,\n }) as Promise<TOuput>\n })\n\n const results = await this.#promiseManager.run('parallel', promises, { concurrency: this.options.concurrency })\n\n results.forEach((result, index) => {\n if (isPromiseRejectedResult<Error>(result)) {\n const plugin = this.#getSortedPlugins(hookName)[index]\n\n this.#catcher<H>(result.reason, plugin, hookName)\n }\n })\n\n this.logger.emit('progress_stop', { id: hookName })\n\n return results.filter((result) => result.status === 'fulfilled').map((result) => (result as PromiseFulfilledResult<Awaited<TOuput>>).value)\n }\n\n /**\n * Chains plugins\n */\n async hookSeq<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n message,\n }: {\n hookName: H\n parameters?: PluginParameter<H>\n message: string\n }): Promise<void> {\n const plugins = this.#getSortedPlugins(hookName)\n this.logger.emit('progress_start', { id: hookName, size: plugins.length })\n\n const promises = plugins.map((plugin) => {\n return () =>\n this.#execute({\n strategy: 'hookSeq',\n hookName,\n parameters,\n plugin,\n message,\n })\n })\n\n await this.#promiseManager.run('seq', promises)\n\n this.logger.emit('progress_stop', { id: hookName })\n }\n\n #getSortedPlugins(hookName?: keyof PluginLifecycle): Array<Plugin> {\n const plugins = [...this.#plugins]\n\n if (hookName) {\n return plugins.filter((plugin) => hookName in plugin)\n }\n // TODO add test case for sorting with pre/post\n\n return plugins\n .map((plugin) => {\n if (plugin.pre) {\n const missingPlugins = plugin.pre.filter((pluginName) => !plugins.find((pluginToFind) => pluginToFind.name === pluginName))\n\n if (missingPlugins.length > 0) {\n throw new ValidationPluginError(`The plugin '${plugin.name}' has a pre set that references missing plugins for '${missingPlugins.join(', ')}'`)\n }\n }\n\n return plugin\n })\n .sort((a, b) => {\n if (b.pre?.includes(a.name)) {\n return 1\n }\n if (b.post?.includes(a.name)) {\n return -1\n }\n return 0\n })\n }\n\n getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined {\n const plugins = [...this.#plugins]\n const [searchPluginName] = pluginKey\n\n return plugins.find((item) => {\n const [name] = item.key\n\n return name === searchPluginName\n })\n }\n\n getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[] {\n const plugins = [...this.plugins]\n const [searchPluginName, searchIdentifier] = pluginKey\n\n const pluginByPluginName = plugins\n .filter((plugin) => hookName in plugin)\n .filter((item) => {\n const [name, identifier] = item.key\n\n const identifierCheck = identifier?.toString() === searchIdentifier?.toString()\n const nameCheck = name === searchPluginName\n\n if (searchIdentifier) {\n return identifierCheck && nameCheck\n }\n\n return nameCheck\n })\n\n if (!pluginByPluginName?.length) {\n // fallback on the core plugin when there is no match\n\n const corePlugin = plugins.find((plugin) => plugin.name === 'core' && hookName in plugin)\n\n if (corePlugin) {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`],\n })\n } else {\n this.logger.emit('debug', {\n date: new Date(),\n logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`],\n })\n }\n return corePlugin ? [corePlugin] : []\n }\n\n return pluginByPluginName\n }\n\n #addExecutedToCallStack(executer: Executer | undefined) {\n if (executer) {\n this.events.emit('executed', executer)\n this.executed.push(executer)\n\n this.logger.emit('progressed', { id: executer.hookName, message: `${executer.plugin.name}: ${executer.message}` })\n }\n }\n\n /**\n * Run an async plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The actual pluginObject to run.\n */\n // Implementation signature\n #execute<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n message,\n }: {\n strategy: Strategy\n hookName: H\n parameters: unknown[] | undefined\n plugin: PluginWithLifeCycle\n message: string\n }): Promise<ReturnType<ParseResult<H>> | null> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.events.emit('executing', { strategy, hookName, parameters, plugin, message })\n\n const task = (async () => {\n try {\n if (typeof hook === 'function') {\n const context = this.getContext(plugin)\n const result = await Promise.resolve((hook as Function).apply(context, parameters))\n\n output = result\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return result\n }\n\n output = hook\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return hook\n } catch (e) {\n this.#catcher<H>(e as Error, plugin, hookName)\n return null\n }\n })()\n\n return task\n }\n\n /**\n * Run a sync plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be in `PluginHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The acutal plugin\n * @param replaceContext When passed, the plugin context can be overridden.\n */\n #executeSync<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n message,\n }: {\n strategy: Strategy\n hookName: H\n parameters: PluginParameter<H>\n plugin: PluginWithLifeCycle\n message: string\n }): ReturnType<ParseResult<H>> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.events.emit('executing', { strategy, hookName, parameters, plugin, message })\n\n try {\n if (typeof hook === 'function') {\n const context = this.getContext(plugin)\n const fn = (hook as Function).apply(context, parameters) as ReturnType<ParseResult<H>>\n\n output = fn\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return fn\n }\n\n output = hook\n\n this.#addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n message,\n })\n\n return hook\n } catch (e) {\n this.#catcher<H>(e as Error, plugin, hookName)\n\n return null\n }\n }\n\n #catcher<H extends PluginLifecycleHooks>(cause: Error, plugin?: Plugin, hookName?: H) {\n const text = `${cause.message} (plugin: ${plugin?.name || 'unknown'}, hook: ${hookName || 'unknown'})`\n\n this.logger.emit('error', text, cause)\n this.events.emit('error', cause)\n }\n\n #parse(plugin: UserPlugin): Plugin {\n const usedPluginNames = this.#usedPluginNames\n\n setUniqueName(plugin.name, usedPluginNames)\n\n return {\n install() {},\n ...plugin,\n key: [plugin.name, usedPluginNames[plugin.name]].filter(Boolean) as [typeof plugin.name, string],\n } as unknown as Plugin\n }\n}\n","import { camelCase, isValidVarName } from '../transformers'\n\nexport type URLObject = {\n url: string\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n type?: 'path' | 'template'\n replacer?: (pathParam: string) => string\n stringify?: boolean\n}\n\ntype Options = {\n casing?: 'camelcase'\n}\n\nexport class URLPath {\n path: string\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n\n return this\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isURL(): boolean {\n try {\n const url = new URL(this.path)\n if (url?.href) {\n return true\n }\n } catch (_error) {\n return false\n }\n return false\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n get object(): URLObject | string {\n return this.toObject()\n }\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n let newPath = this.path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, path) => {\n const pathWithoutBrackets = path.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(pathWithoutBrackets) ? pathWithoutBrackets : camelCase(pathWithoutBrackets)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n return prev.replace(path, `\\${${replacer ? replacer(param) : param}}`)\n }, this.path)\n }\n\n return `\\`${prefix}${newPath}\\``\n }\n\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n\n if (!found) {\n return undefined\n }\n\n const params: Record<string, string> = {}\n found.forEach((item) => {\n item = item.replaceAll('{', '').replaceAll('}', '')\n\n let param = isValidVarName(item) ? item : camelCase(item)\n\n if (this.#options.casing === 'camelcase') {\n param = camelCase(param)\n }\n\n const key = replacer ? replacer(param) : param\n\n params[key] = key\n }, this.path)\n\n return params\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return this.path.replaceAll('{', ':').replaceAll('}', '')\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport { getMode } from '../PluginManager.ts'\n\ntype BarrelData = {\n file?: KubbFile.File\n /**\n * @deprecated use file instead\n */\n type: KubbFile.Mode\n path: string\n name: string\n}\n\nexport class TreeNode {\n data: BarrelData\n parent?: TreeNode\n children: Array<TreeNode> = []\n #cachedLeaves?: Array<TreeNode> = undefined\n\n constructor(data: BarrelData, parent?: TreeNode) {\n this.data = data\n this.parent = parent\n return this\n }\n\n addChild(data: BarrelData): TreeNode {\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 get root(): TreeNode {\n if (!this.parent) {\n return this\n }\n return this.parent.root\n }\n\n get leaves(): Array<TreeNode> {\n if (!this.children || this.children.length === 0) {\n // this is a leaf\n return [this]\n }\n\n if (this.#cachedLeaves) {\n return this.#cachedLeaves\n }\n\n // if not a leaf, return all children's leaves recursively\n const leaves: TreeNode[] = []\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\n this.#cachedLeaves = leaves\n\n return leaves\n }\n\n forEach(callback: (treeNode: TreeNode) => 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 findDeep(predicate?: (value: TreeNode, index: number, obj: TreeNode[]) => boolean): TreeNode | undefined {\n if (typeof predicate !== 'function') {\n throw new TypeError('find() predicate must be a function')\n }\n\n return this.leaves.find(predicate)\n }\n\n forEachDeep(callback: (treeNode: TreeNode) => void): void {\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n this.leaves.forEach(callback)\n }\n\n filterDeep(callback: (treeNode: TreeNode) => boolean): Array<TreeNode> {\n if (typeof callback !== 'function') {\n throw new TypeError('filter() callback must be a function')\n }\n\n return this.leaves.filter(callback)\n }\n\n mapDeep<T>(callback: (treeNode: TreeNode) => T): Array<T> {\n if (typeof callback !== 'function') {\n throw new TypeError('map() callback must be a function')\n }\n\n return this.leaves.map(callback)\n }\n\n public static build(files: KubbFile.File[], root?: string): TreeNode | null {\n try {\n const filteredTree = buildDirectoryTree(files, root)\n\n if (!filteredTree) {\n return null\n }\n\n const treeNode = new TreeNode({\n name: filteredTree.name,\n path: filteredTree.path,\n file: filteredTree.file,\n type: 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 file: item.file,\n type: 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) => {\n recurse(treeNode, child)\n })\n\n return treeNode\n } catch (e) {\n throw new Error('Something went wrong with creating barrel files with the TreeNode class', { cause: e })\n }\n }\n}\n\nexport type DirectoryTree = {\n name: string\n path: string\n file?: KubbFile.File\n children: Array<DirectoryTree>\n}\n\nconst normalizePath = (p: string): string => p.replace(/\\\\/g, '/')\n\nexport function buildDirectoryTree(files: Array<KubbFile.File>, rootFolder = ''): DirectoryTree | null {\n const normalizedRootFolder = normalizePath(rootFolder)\n const rootPrefix = normalizedRootFolder.endsWith('/') ? normalizedRootFolder : `${normalizedRootFolder}/`\n\n const filteredFiles = files.filter((file) => {\n const normalizedFilePath = normalizePath(file.path)\n return rootFolder ? normalizedFilePath.startsWith(rootPrefix) && !normalizedFilePath.endsWith('.json') : !normalizedFilePath.endsWith('.json')\n })\n\n if (filteredFiles.length === 0) {\n return null // No files match the root folder\n }\n\n const root: DirectoryTree = {\n name: rootFolder || '',\n path: rootFolder || '',\n children: [],\n }\n\n filteredFiles.forEach((file) => {\n const path = file.path.slice(rootFolder.length)\n const parts = path.split('/')\n let currentLevel: DirectoryTree[] = root.children\n let currentPath = rootFolder\n\n parts.forEach((part, index) => {\n if (index !== 0) {\n currentPath += `/${part}`\n } else {\n currentPath += `${part}`\n }\n\n let existingNode = currentLevel.find((node) => node.name === part)\n\n if (!existingNode) {\n if (index === parts.length - 1) {\n // If it's the last part, it's a file\n existingNode = {\n name: part,\n file,\n path: currentPath,\n } as DirectoryTree\n } else {\n // Otherwise, it's a folder\n existingNode = {\n name: part,\n path: currentPath,\n children: [],\n } as DirectoryTree\n }\n currentLevel.push(existingNode)\n }\n\n // Move to the next level if it's a folder\n if (!existingNode.file) {\n currentLevel = existingNode.children\n }\n })\n })\n\n return root\n}\n","/** biome-ignore-all lint/suspicious/useIterableCallbackReturn: not needed */\nimport { join } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { getRelativePath } from './fs/index.ts'\nimport type { Logger } from './logger.ts'\nimport type { FileMetaBase } from './utils/getBarrelFiles.ts'\nimport { TreeNode } from './utils/TreeNode.ts'\n\ntype BarrelManagerOptions = {\n logger?: Logger\n}\n\nexport class BarrelManager {\n #options: BarrelManagerOptions\n\n constructor(options: BarrelManagerOptions = {}) {\n this.#options = options\n\n return this\n }\n\n getFiles({ files: generatedFiles, root }: { files: KubbFile.File[]; root?: string; meta?: FileMetaBase | undefined }): Array<KubbFile.File> {\n const { logger } = this.#options\n\n const cachedFiles = new Map<KubbFile.Path, KubbFile.File>()\n\n TreeNode.build(generatedFiles, root)?.forEach((treeNode) => {\n if (!treeNode || !treeNode.children || !treeNode.parent?.data.path) {\n return undefined\n }\n\n const barrelFile: KubbFile.File = {\n path: join(treeNode.parent?.data.path, 'index.ts') as KubbFile.Path,\n baseName: 'index.ts',\n exports: [],\n sources: [],\n }\n const previousBarrelFile = cachedFiles.get(barrelFile.path)\n const leaves = treeNode.leaves\n\n leaves.forEach((item) => {\n if (!item.data.name) {\n return undefined\n }\n\n const sources = item.data.file?.sources || []\n\n if (!sources.some((source) => source.isIndexable)) {\n logger?.emit(\n 'warning',\n `No isIndexable source found(source should have a name and isIndexable):\\nFile: ${JSON.stringify(item.data.file, undefined, 2)}`,\n )\n }\n\n sources.forEach((source) => {\n if (!item.data.file?.path || !source.isIndexable || !source.name) {\n return undefined\n }\n const alreadyContainInPreviousBarrelFile = previousBarrelFile?.sources.some(\n (item) => item.name === source.name && item.isTypeOnly === source.isTypeOnly,\n )\n\n if (alreadyContainInPreviousBarrelFile) {\n return undefined\n }\n\n if (!barrelFile.exports) {\n barrelFile.exports = []\n }\n\n // true when we have a subdirectory that also contains barrel files\n const isSubExport = !!treeNode.parent?.data.path?.split?.('/')?.length\n\n if (isSubExport) {\n barrelFile.exports.push({\n name: [source.name],\n path: getRelativePath(treeNode.parent?.data.path, item.data.path),\n isTypeOnly: source.isTypeOnly,\n })\n } else {\n barrelFile.exports.push({\n name: [source.name],\n path: `./${item.data.file.baseName}`,\n isTypeOnly: source.isTypeOnly,\n })\n }\n\n barrelFile.sources.push({\n name: source.name,\n isTypeOnly: source.isTypeOnly,\n //TODO use parser to generate import\n value: '',\n isExportable: false,\n isIndexable: false,\n })\n })\n })\n\n if (previousBarrelFile) {\n previousBarrelFile.sources.push(...barrelFile.sources)\n previousBarrelFile.exports?.push(...(barrelFile.exports || []))\n } else {\n cachedFiles.set(barrelFile.path, barrelFile)\n }\n })\n\n return [...cachedFiles.values()]\n }\n}\n","import { join } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { BarrelManager } from '../BarrelManager.ts'\nimport type { Logger } from '../logger.ts'\nimport type { BarrelType, Plugin } from '../types.ts'\n\nexport type FileMetaBase = {\n pluginKey?: Plugin['key']\n}\n\ntype AddIndexesProps = {\n type: BarrelType | false | undefined\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 }\n group?: {\n output: string\n exportAs: string\n }\n logger?: Logger\n\n meta?: FileMetaBase\n}\n\nfunction trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport async function getBarrelFiles(\n files: Array<KubbFile.ResolvedFile>,\n { type, meta = {}, root, output, logger }: AddIndexesProps,\n): Promise<KubbFile.File[]> {\n if (!type || type === 'propagate') {\n return []\n }\n\n const barrelManager = new BarrelManager({ logger })\n\n const pathToBuildFrom = join(root, output.path)\n\n if (trimExtName(pathToBuildFrom).endsWith('index')) {\n logger?.emit('warning', 'Output has the same fileName as the barrelFiles, please disable barrel generation')\n\n return []\n }\n\n const barrelFiles = barrelManager.getFiles({ files, root: pathToBuildFrom, meta })\n\n if (type === 'all') {\n return barrelFiles.map((file) => {\n return {\n ...file,\n exports: file.exports?.map((exportItem) => {\n return {\n ...exportItem,\n name: undefined,\n }\n }),\n }\n })\n }\n\n return barrelFiles.map((indexFile) => {\n return {\n ...indexFile,\n meta,\n }\n })\n}\n"],"x_google_ignoreList":[2,3],"mappings":";;;;;AAE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O;MACpB,CAAC;AAGJ,gBAAW,QAAQ,KAAK;MACtB,MAAM,OAAO;MACb,YAAY,OAAO;MAEnB,OAAO;MACP,cAAc;MACd,aAAa;MACd,CAAC;MACF;KACF;AAEF,OAAI,oBAAoB;AACtB,uBAAmB,QAAQ,KAAK,GAAG,WAAW,QAAQ;AACtD,uBAAmB,SAAS,KAAK,GAAI,WAAW,WAAW,EAAE,CAAE;SAE/D,aAAY,IAAI,WAAW,MAAM,WAAW;IAE9C;AAEF,SAAO,CAAC,GAAG,YAAY,QAAQ,CAAC;;;;;;AC3EpC,SAAS,YAAY,MAAsB;AACzC,QAAO,KAAK,QAAQ,aAAa,GAAG;;AAGtC,eAAsB,eACpB,OACA,EAAE,MAAM,OAAO,EAAE,EAAE,MAAM,QAAQ,UACP;AAC1B,KAAI,CAAC,QAAQ,SAAS,YACpB,QAAO,EAAE;CAGX,MAAM,gBAAgB,IAAI,cAAc,EAAE,QAAQ,CAAC;CAEnD,MAAM,kBAAkB,KAAK,MAAM,OAAO,KAAK;AAE/C,KAAI,YAAY,gBAAgB,CAAC,SAAS,QAAQ,EAAE;AAClD,UAAQ,KAAK,WAAW,oFAAoF;AAE5G,SAAO,EAAE;;CAGX,MAAM,cAAc,cAAc,SAAS;EAAE;EAAO,MAAM;EAAiB;EAAM,CAAC;AAElF,KAAI,SAAS,MACX,QAAO,YAAY,KAAK,SAAS;AAC/B,SAAO;GACL,GAAG;GACH,SAAS,KAAK,SAAS,KAAK,eAAe;AACzC,WAAO;KACL,GAAG;KACH,MAAM;KACP;KACD;GACH;GACD;AAGJ,QAAO,YAAY,KAAK,cAAc;AACpC,SAAO;GACL,GAAG;GACH;GACD;GACD"}
|
package/dist/hooks.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./logger-BJDkLsF0.cjs";
|
|
2
|
-
import { S as PluginManager, c as Plugin, u as PluginFactoryOptions } from "./types-
|
|
2
|
+
import { S as PluginManager, c as Plugin, u as PluginFactoryOptions } from "./types-tSSA1oz8.cjs";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useMode.d.ts
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./logger-C96jDrSt.js";
|
|
2
|
-
import { S as PluginManager, c as Plugin, u as PluginFactoryOptions } from "./types-
|
|
2
|
+
import { S as PluginManager, c as Plugin, u as PluginFactoryOptions } from "./types-69-evK37.js";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useMode.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
3
|
-
const require_getBarrelFiles = require('./getBarrelFiles-
|
|
3
|
+
const require_getBarrelFiles = require('./getBarrelFiles-BkDzzugQ.cjs');
|
|
4
4
|
const require_logger = require('./logger-CPt4U57Z.cjs');
|
|
5
5
|
require('./EventEmitter-BwU6Ixxt.cjs');
|
|
6
6
|
require('./transformers-B-zCAPV-.cjs');
|
|
@@ -224,7 +224,7 @@ async function safeBuild(options, overrides) {
|
|
|
224
224
|
sources: [],
|
|
225
225
|
meta: {}
|
|
226
226
|
};
|
|
227
|
-
await fabric.
|
|
227
|
+
await fabric.upsertFile(rootFile);
|
|
228
228
|
}
|
|
229
229
|
fabric.context.on("process:start", ({ files: files$1 }) => {
|
|
230
230
|
pluginManager.logger.emit("progress_start", {
|