@kubb/core 4.32.0 → 4.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{chunk-DKWOrOAv.js → chunk--u3MIqq1.js} +1 -2
  2. package/dist/{chunk-CNbaEX1y.cjs → chunk-ByKO4r7w.cjs} +17 -23
  3. package/dist/{write-CwpeNfTd.cjs → fs-D4eqq6bR.cjs} +33 -38
  4. package/dist/fs-D4eqq6bR.cjs.map +1 -0
  5. package/dist/{write-pEo2oQGI.js → fs-TVBCPkE-.js} +4 -9
  6. package/dist/fs-TVBCPkE-.js.map +1 -0
  7. package/dist/fs.cjs +8 -9
  8. package/dist/fs.d.ts +1 -1
  9. package/dist/fs.js +2 -3
  10. package/dist/hooks.cjs +3 -6
  11. package/dist/hooks.cjs.map +1 -1
  12. package/dist/hooks.d.ts +2 -2
  13. package/dist/hooks.js +2 -5
  14. package/dist/hooks.js.map +1 -1
  15. package/dist/index.cjs +15 -21
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +5 -14
  19. package/dist/index.js.map +1 -1
  20. package/dist/{packageManager-B7KCmp2R.d.ts → packageManager-_7I0WFQU.d.ts} +3 -3
  21. package/dist/{packageManager-BGUS6_Pq.cjs → packageManager-jzjuEj2U.cjs} +79 -93
  22. package/dist/{packageManager-BGUS6_Pq.cjs.map → packageManager-jzjuEj2U.cjs.map} +1 -1
  23. package/dist/{packageManager-B6NiaZeW.js → packageManager-wMCQlgd6.js} +5 -19
  24. package/dist/{packageManager-B6NiaZeW.js.map → packageManager-wMCQlgd6.js.map} +1 -1
  25. package/dist/{toRegExp-DdJ1Kgbf.js → transformers-BwSpAhvT.js} +26 -15
  26. package/dist/transformers-BwSpAhvT.js.map +1 -0
  27. package/dist/{toRegExp-DGgAWZ_m.cjs → transformers-BweFhqh-.cjs} +121 -104
  28. package/dist/transformers-BweFhqh-.cjs.map +1 -0
  29. package/dist/transformers.cjs +24 -46
  30. package/dist/transformers.d.ts +1 -1
  31. package/dist/transformers.js +1 -26
  32. package/dist/{types-CiePC9Y3.d.ts → types-f_no0d7G.d.ts} +2 -2
  33. package/dist/utils.cjs +6 -20
  34. package/dist/utils.cjs.map +1 -1
  35. package/dist/utils.d.ts +3 -3
  36. package/dist/utils.js +4 -18
  37. package/dist/utils.js.map +1 -1
  38. package/package.json +5 -1
  39. package/dist/toRegExp-DGgAWZ_m.cjs.map +0 -1
  40. package/dist/toRegExp-DdJ1Kgbf.js.map +0 -1
  41. package/dist/transformers.cjs.map +0 -1
  42. package/dist/transformers.js.map +0 -1
  43. package/dist/write-CwpeNfTd.cjs.map +0 -1
  44. package/dist/write-pEo2oQGI.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["#context","#options","AsyncEventEmitter","URLPath","exists","clean","fsPlugin","typescriptParser","write","PluginManager","BuildError","getElapsedMs","formatMs","getRelativePath","#cache","#cwd","#SLASHES","mod","os","pkg","read","readSync","#match"],"sources":["../src/BaseGenerator.ts","../src/config.ts","../package.json","../src/utils/diagnostics.ts","../src/build.ts","../src/defineLogger.ts","../src/definePlugin.ts","../src/PackageManager.ts","../src/types.ts"],"sourcesContent":["/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import type { InputPath, UserConfig } from './types.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /** Path to `kubb.config.js` */\n config?: string\n\n /** Enable watch mode for input files */\n watch?: boolean\n\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n\n /** Run Kubb with Bun */\n bun?: boolean\n}\n/**\n * Helper for defining a Kubb configuration.\n *\n * Accepts either:\n * - A config object or array of configs\n * - A function returning the config(s), optionally async,\n * receiving the CLI options as argument\n *\n * @example\n * export default defineConfig(({ logLevel }) => ({\n * root: 'src',\n * plugins: [myPlugin()],\n * }))\n */\nexport function defineConfig(\n config: PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>),\n): typeof config {\n return config\n}\n\n/**\n * Type guard to check if a given config has an `input.path`.\n */\nexport function isInputPath(config: UserConfig | undefined): config is UserConfig<InputPath> {\n return typeof config?.input === 'object' && config.input !== null && 'path' in config.input\n}\n","","import { version as nodeVersion } from 'node:process'\nimport { version as KubbVersion } from '../../package.json'\n\n/**\n * Get diagnostic information for debugging\n */\nexport function getDiagnosticInfo() {\n return {\n nodeVersion,\n KubbVersion,\n platform: process.platform,\n arch: process.arch,\n cwd: process.cwd(),\n } as const\n}\n","import { resolve } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport { createFabric } from '@kubb/react-fabric'\nimport { typescriptParser } from '@kubb/react-fabric/parsers'\nimport { fsPlugin } from '@kubb/react-fabric/plugins'\nimport { isInputPath } from './config.ts'\nimport { BuildError } from './errors.ts'\nimport { clean, exists, getRelativePath, write } from './fs/index.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport type { Config, KubbEvents, Output, Plugin, UserConfig } from './types.ts'\nimport { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport { getDiagnosticInfo } from './utils/diagnostics.ts'\nimport { formatMs, getElapsedMs } from './utils/formatHrtime.ts'\nimport { URLPath } from './utils/URLPath.ts'\n\ntype BuildOptions = {\n config: UserConfig\n events?: AsyncEventEmitter<KubbEvents>\n}\n\ntype BuildOutput = {\n failedPlugins: Set<{ plugin: Plugin; error: Error }>\n fabric: Fabric\n files: Array<KubbFile.ResolvedFile>\n pluginManager: PluginManager\n pluginTimings: Map<string, number>\n error?: Error\n sources: Map<KubbFile.Path, string>\n}\n\ntype SetupResult = {\n events: AsyncEventEmitter<KubbEvents>\n fabric: Fabric\n pluginManager: PluginManager\n sources: Map<KubbFile.Path, string>\n}\n\nexport async function setup(options: BuildOptions): Promise<SetupResult> {\n const { config: userConfig, events = new AsyncEventEmitter<KubbEvents>() } = options\n\n const sources: Map<KubbFile.Path, string> = new Map<KubbFile.Path, string>()\n const diagnosticInfo = getDiagnosticInfo()\n\n if (Array.isArray(userConfig.input)) {\n await events.emit('warn', 'This feature is still under development — use with caution')\n }\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n 'Configuration:',\n ` • Name: ${userConfig.name || 'unnamed'}`,\n ` • Root: ${userConfig.root || process.cwd()}`,\n ` • Output: ${userConfig.output?.path || 'not specified'}`,\n ` • Plugins: ${userConfig.plugins?.length || 0}`,\n 'Output Settings:',\n ` • Write: ${userConfig.output?.write !== false ? 'enabled' : 'disabled'}`,\n ` • Formatter: ${userConfig.output?.format || 'none'}`,\n ` • Linter: ${userConfig.output?.lint || 'none'}`,\n 'Environment:',\n Object.entries(diagnosticInfo)\n .map(([key, value]) => ` • ${key}: ${value}`)\n .join('\\n'),\n ],\n })\n\n try {\n if (isInputPath(userConfig) && !new URLPath(userConfig.input.path).isURL) {\n await exists(userConfig.input.path)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Input file validated: ${userConfig.input.path}`],\n })\n }\n } catch (caughtError) {\n if (isInputPath(userConfig)) {\n const error = caughtError as Error\n\n throw new Error(\n `Cannot read file/URL defined in \\`input.path\\` or set with \\`kubb generate PATH\\` in the CLI of your Kubb config ${userConfig.input.path}`,\n {\n cause: error,\n },\n )\n }\n }\n\n const definedConfig: Config = {\n root: userConfig.root || process.cwd(),\n ...userConfig,\n output: {\n write: true,\n barrelType: 'named',\n extension: {\n '.ts': '.ts',\n },\n defaultBanner: 'simple',\n ...userConfig.output,\n },\n plugins: userConfig.plugins as Config['plugins'],\n }\n\n if (definedConfig.output.clean) {\n await events.emit('debug', {\n date: new Date(),\n logs: ['Cleaning output directories', ` • Output: ${definedConfig.output.path}`],\n })\n await clean(definedConfig.output.path)\n }\n\n const fabric = createFabric()\n fabric.use(fsPlugin)\n fabric.use(typescriptParser)\n\n fabric.context.on('files:processing:start', (files) => {\n events.emit('files:processing:start', files)\n events.emit('debug', {\n date: new Date(),\n logs: [`Writing ${files.length} files...`],\n })\n })\n\n fabric.context.on('file:processing:update', async (params) => {\n const { file, source } = params\n await events.emit('file:processing:update', {\n ...params,\n config: definedConfig,\n source,\n })\n\n if (source) {\n if (definedConfig.output.write) {\n await write(file.path, source, { sanity: false })\n }\n\n sources.set(file.path, source)\n }\n })\n\n fabric.context.on('files:processing:end', async (files) => {\n await events.emit('files:processing:end', files)\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ File write process completed for ${files.length} files`],\n })\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n '✓ Fabric initialized',\n ` • File writing: ${definedConfig.output.write ? 'enabled' : 'disabled (dry-run)'}`,\n ` • Barrel type: ${definedConfig.output.barrelType || 'none'}`,\n ],\n })\n\n const pluginManager = new PluginManager(definedConfig, {\n fabric,\n events,\n concurrency: 15, // Increased from 5 to 15 for better parallel plugin execution\n })\n\n return {\n events,\n fabric,\n pluginManager,\n sources,\n }\n}\n\nexport async function build(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, files, pluginManager, failedPlugins, pluginTimings, error, sources } = await safeBuild(options, overrides)\n\n if (error) {\n throw error\n }\n\n if (failedPlugins.size > 0) {\n const errors = [...failedPlugins].map(({ error }) => error)\n\n throw new BuildError(`Build Error with ${failedPlugins.size} failed plugins`, { errors })\n }\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n error: undefined,\n sources,\n }\n}\n\nexport async function safeBuild(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, pluginManager, events, sources } = overrides ? overrides : await setup(options)\n\n const failedPlugins = new Set<{ plugin: Plugin; error: Error }>()\n // in ms\n const pluginTimings = new Map<string, number>()\n const config = pluginManager.config\n\n try {\n for (const plugin of pluginManager.plugins) {\n const context = pluginManager.getContext(plugin)\n const hrStart = process.hrtime()\n\n const installer = plugin.install.bind(context)\n\n try {\n const timestamp = new Date()\n\n await events.emit('plugin:start', plugin)\n\n await events.emit('debug', {\n date: timestamp,\n logs: ['Installing plugin...', ` • Plugin Key: [${plugin.key.join(', ')}]`],\n })\n\n await installer(context)\n\n const duration = getElapsedMs(hrStart)\n pluginTimings.set(plugin.name, duration)\n\n await events.emit('plugin:end', plugin, { duration, success: true })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Plugin installed successfully (${formatMs(duration)})`],\n })\n } catch (caughtError) {\n const error = caughtError as Error\n const errorTimestamp = new Date()\n const duration = getElapsedMs(hrStart)\n\n await events.emit('plugin:end', plugin, {\n duration,\n success: false,\n error,\n })\n\n await events.emit('debug', {\n date: errorTimestamp,\n logs: [\n '✗ Plugin installation failed',\n ` • Plugin Key: ${JSON.stringify(plugin.key)}`,\n ` • Error: ${error.constructor.name} - ${error.message}`,\n ' • Stack Trace:',\n error.stack || 'No stack trace available',\n ],\n })\n\n failedPlugins.add({ plugin, error })\n }\n }\n\n if (config.output.barrelType) {\n const root = resolve(config.root)\n const rootPath = resolve(root, config.output.path, 'index.ts')\n\n await events.emit('debug', {\n date: new Date(),\n logs: ['Generating barrel file', ` • Type: ${config.output.barrelType}`, ` • Path: ${rootPath}`],\n })\n\n const barrelFiles = fabric.files.filter((file) => {\n return file.sources.some((source) => source.isIndexable)\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`Found ${barrelFiles.length} indexable files for barrel export`],\n })\n\n // Build a Map of plugin keys to plugins for efficient lookups\n const pluginKeyMap = new Map<string, Plugin>()\n for (const plugin of pluginManager.plugins) {\n pluginKeyMap.set(JSON.stringify(plugin.key), plugin)\n }\n\n const rootFile: KubbFile.File = {\n path: rootPath,\n baseName: 'index.ts',\n exports: barrelFiles\n .flatMap((file) => {\n const containsOnlyTypes = file.sources?.every((source) => source.isTypeOnly)\n\n return file.sources\n ?.map((source) => {\n if (!file.path || !source.isIndexable) {\n return undefined\n }\n\n // validate of the file is coming from plugin x, needs pluginKey on every file TODO update typing\n const meta = file.meta as any\n const plugin = meta?.pluginKey ? pluginKeyMap.get(JSON.stringify(meta.pluginKey)) : undefined\n const pluginOptions = plugin?.options as {\n output?: Output<any>\n }\n\n if (!pluginOptions || pluginOptions?.output?.barrelType === false) {\n return undefined\n }\n\n return {\n name: config.output.barrelType === 'all' ? undefined : [source.name],\n path: getRelativePath(rootPath, file.path),\n isTypeOnly: config.output.barrelType === 'all' ? containsOnlyTypes : source.isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n })\n .filter(Boolean),\n sources: [],\n imports: [],\n meta: {},\n }\n\n await fabric.upsertFile(rootFile)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Generated barrel file (${rootFile.exports?.length || 0} exports)`],\n })\n }\n\n const files = [...fabric.files]\n\n await fabric.write({ extension: config.output.extension })\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n sources,\n }\n } catch (error) {\n return {\n failedPlugins,\n fabric,\n files: [],\n pluginManager,\n pluginTimings,\n error: error as Error,\n sources,\n }\n }\n}\n","import type { Logger, LoggerOptions, UserLogger } from './types.ts'\n\nexport function defineLogger<Options extends LoggerOptions = LoggerOptions>(logger: UserLogger<Options>): Logger<Options> {\n return {\n ...logger,\n }\n}\n","import type { PluginFactoryOptions, UserPluginWithLifeCycle } from './types.ts'\n\ntype PluginBuilder<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>\n\n/**\n * Wraps a plugin builder to make the options parameter optional.\n */\nexport function definePlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(\n build: PluginBuilder<T>,\n): (options?: T['options']) => UserPluginWithLifeCycle<T> {\n return (options) => build(options ?? ({} as T['options']))\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport * as pkg from 'empathic/package'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/index.ts'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n const lastChar = directory[directory.length - 1]\n if (lastChar && !this.#SLASHES.has(lastChar)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() === 'win32') {\n location = pathToFileURL(location).href\n }\n\n const module = await import(location)\n\n return module?.default ?? module\n } catch (error) {\n console.error(error)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...(packageJSON['dependencies'] || {}),\n ...(packageJSON['devDependencies'] || {}),\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport type { KubbEvents } from './Kubb.ts'\nimport type { PluginManager } from './PluginManager.ts'\nimport type { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\ndeclare global {\n namespace Kubb {\n interface PluginContext {}\n }\n}\n\n/**\n * Config used in `kubb.config.ts`\n *\n * @example\n * import { defineConfig } from '@kubb/core'\n * export default defineConfig({\n * ...\n * })\n */\nexport type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root?: string\n /**\n * An array of Kubb plugins used for generation. Each plugin may have additional configurable options (defined within the plugin itself). If a plugin relies on another plugin, an error will occur if the required dependency is missing. Refer to “pre” for more details.\n */\n // inject needs to be omitted because else we have a clash with the PluginManager instance\n plugins?: Array<Omit<UnknownUserPlugin, 'inject'>>\n}\n\nexport type InputPath = {\n /**\n * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.\n */\n path: string\n}\n\nexport type InputData = {\n /**\n * A `string` or `object` that contains your Swagger/OpenAPI data.\n */\n data: string | unknown\n}\n\ntype Input = InputPath | InputData | Array<InputPath>\n\nexport type BarrelType = 'all' | 'named' | 'propagate'\n\n/**\n * @private\n */\nexport type Config<TInput = Input> = {\n /**\n * The name to display in the CLI output.\n */\n name?: string\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root: string\n /**\n * You can use either `input.path` or `input.data`, depending on your specific needs.\n */\n input: TInput\n output: {\n /**\n * The path where all generated files receives exported.\n * This can be an absolute path or a path relative to the specified root option.\n */\n path: string\n /**\n * Clean the output directory before each build.\n */\n clean?: boolean\n /**\n * Save files to the file system.\n * @default true\n */\n write?: boolean\n /**\n * Specifies the formatting tool to be used.\n * - 'auto' automatically detects and uses biome or prettier (in that order of preference).\n * - 'prettier' uses Prettier for code formatting.\n * - 'biome' uses Biome for code formatting.\n * - 'oxfmt' uses Oxfmt for code formatting.\n * - false disables code formatting.\n * @default 'prettier'\n */\n format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false\n /**\n * Specifies the linter that should be used to analyze the code.\n * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).\n * - 'eslint' uses ESLint for linting.\n * - 'biome' uses Biome for linting.\n * - 'oxlint' uses Oxlint for linting.\n * - false disables linting.\n * @default 'auto'\n */\n lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false\n /**\n * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.\n * @default { '.ts': '.ts'}\n */\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n /**\n * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).\n * @default 'named'\n */\n barrelType?: Exclude<BarrelType, 'propagate'> | false\n /**\n * Adds a default banner to the start of every generated file indicating it was generated by Kubb.\n * - 'simple' adds banner with link to Kubb.\n * - 'full' adds source, title, description, and OpenAPI version.\n * - false disables banner generation.\n * @default 'simple'\n */\n defaultBanner?: 'simple' | 'full' | false\n /**\n * Whether to override existing external files if they already exist.\n * When setting the option in the global configuration, all plugins inherit the same behavior by default.\n * However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.\n * @default false\n */\n override?: boolean\n }\n /**\n * An array of Kubb plugins that used in the generation.\n * Each plugin may include additional configurable options(defined in the plugin itself).\n * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.\n */\n plugins?: Array<Plugin>\n /**\n * Hooks triggered when a specific action occurs in Kubb.\n */\n hooks?: {\n /**\n * Hook that triggers at the end of all executions.\n * Useful for running Prettier or ESLint to format/lint your code.\n */\n done?: string | Array<string>\n }\n}\n\n// plugin\n\nexport type PluginFactoryOptions<\n /**\n * Name to be used for the plugin, this will also be used for they key.\n */\n TName extends string = string,\n /**\n * Options of the plugin.\n */\n TOptions extends object = object,\n /**\n * Options of the plugin that can be used later on, see `options` inside your plugin config.\n */\n TResolvedOptions extends object = TOptions,\n /**\n * Context that you want to expose to other plugins.\n */\n TContext = any,\n /**\n * When calling `resolvePath` you can specify better types.\n */\n TResolvePathOptions extends object = object,\n> = {\n name: TName\n /**\n * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`\n */\n key: PluginKey<TName | string>\n options: TOptions\n resolvedOptions: TResolvedOptions\n context: TContext\n resolvePathOptions: TResolvePathOptions\n}\n\nexport type PluginKey<TName> = [name: TName, identifier?: string | number]\n\nexport type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never\n\nexport type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>\n\ntype UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>\n\nexport type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Internal key used when a developer uses more than one of the same plugin\n * @private\n */\n key: TOptions['key']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n\n install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).\n */\n inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>\n\nexport type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Start of the lifecycle of a plugin.\n * @type hookParallel\n */\n install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).\n * Options can als be included.\n * @type hookFirst\n * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'\n */\n resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path\n /**\n * Resolve to a name based on a string.\n * Useful when converting to PascalCase or camelCase.\n * @type hookFirst\n * @example ('pet') => 'Pet'\n */\n resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n}\n\nexport type PluginLifecycleHooks = keyof PluginLifecycle\n\nexport type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>\n\nexport type ResolvePathParams<TOptions = object> = {\n pluginKey?: Plugin['key']\n baseName: KubbFile.BaseName\n mode?: KubbFile.Mode\n /**\n * Options to be passed to 'resolvePath' 3th parameter\n */\n options?: TOptions\n}\n\nexport type ResolveNameParams = {\n name: string\n pluginKey?: Plugin['key']\n /**\n * Specifies the type of entity being named.\n * - 'file' customizes the name of the created file (uses camelCase).\n * - 'function' customizes the exported function names (uses camelCase).\n * - 'type' customizes TypeScript types (uses PascalCase).\n * - 'const' customizes variable names (uses camelCase).\n * @default undefined\n */\n type?: 'file' | 'function' | 'type' | 'const'\n}\n\nexport type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n fabric: Fabric\n config: Config\n pluginManager: PluginManager\n /**\n * Only add when the file does not exist yet\n */\n addFile: (...file: Array<KubbFile.File>) => Promise<void>\n /**\n * merging multiple sources into the same output file\n */\n upsertFile: (...file: Array<KubbFile.File>) => Promise<void>\n events: AsyncEventEmitter<KubbEvents>\n mode: KubbFile.Mode\n /**\n * Current plugin\n */\n plugin: Plugin<TOptions>\n} & Kubb.PluginContext\n/**\n * Specify the export location for the files and define the behavior of the output\n */\nexport type Output<TOptions> = {\n /**\n * Path to the output folder or file that will contain the generated code\n */\n path: string\n /**\n * Define what needs to be exported, here you can also disable the export of barrel files\n * @default 'named'\n */\n barrelType?: BarrelType | false\n /**\n * Add a banner text in the beginning of every file\n */\n banner?: string | ((options: TOptions) => string)\n /**\n * Add a footer text in the beginning of every file\n */\n footer?: string | ((options: TOptions) => string)\n /**\n * Whether to override existing external files if they already exist.\n * @default false\n */\n override?: boolean\n}\n\ntype GroupContext = {\n group: string\n}\n\nexport type Group = {\n /**\n * Defines the type where to group the files.\n * - 'tag' groups files by OpenAPI tags.\n * - 'path' groups files by OpenAPI paths.\n * @default undefined\n */\n type: 'tag' | 'path'\n /**\n * Return the name of a group based on the group name, this used for the file and name generation\n */\n name?: (context: GroupContext) => string\n}\n\nexport const LogLevel = {\n silent: Number.NEGATIVE_INFINITY,\n error: 0,\n warn: 1,\n info: 3,\n verbose: 4,\n debug: 5,\n} as const\n\nexport type LoggerOptions = {\n /**\n * @default 3\n */\n logLevel: (typeof LogLevel)[keyof typeof LogLevel]\n}\n\n/**\n * Shared context passed to all plugins, parsers, and Fabric internals.\n */\nexport interface LoggerContext extends AsyncEventEmitter<KubbEvents> {}\n\ntype Install<TOptions = unknown> = (context: LoggerContext, options?: TOptions) => void | Promise<void>\n\nexport type Logger<TOptions extends LoggerOptions = LoggerOptions> = {\n name: string\n install: Install<TOptions>\n}\n\nexport type UserLogger<TOptions extends LoggerOptions = LoggerOptions> = Omit<Logger<TOptions>, 'logLevel'>\n\nexport type { KubbEvents } from './Kubb.ts'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAsB,gBAAtB,MAA4E;CAC1E,WAAqB,EAAE;CACvB,WAAqB,EAAE;CAEvB,YAAY,SAAoB,SAAoB;AAClD,MAAI,QACF,OAAKA,UAAW;AAGlB,MAAI,QACF,OAAKC,UAAW;AAGlB,SAAO;;CAGT,IAAI,UAAoB;AACtB,SAAO,MAAKA;;CAGd,IAAI,UAAoB;AACtB,SAAO,MAAKD;;CAGd,IAAI,QAAQ,SAAmB;AAC7B,QAAKC,UAAW;GAAE,GAAG,MAAKA;GAAU,GAAG;GAAS;;;;;;;;;;;;;;;;;;;;ACWpD,SAAgB,aACd,QACe;AACf,QAAO;;;;;AAMT,SAAgB,YAAY,QAAiE;AAC3F,QAAO,OAAO,QAAQ,UAAU,YAAY,OAAO,UAAU,QAAQ,UAAU,OAAO;;;;;;;;;;;;AE5CxF,SAAgB,oBAAoB;AAClC,QAAO;EACL;EACA;EACA,UAAU,QAAQ;EAClB,MAAM,QAAQ;EACd,KAAK,QAAQ,KAAK;EACnB;;;;;ACyBH,eAAsB,MAAM,SAA6C;CACvE,MAAM,EAAE,QAAQ,YAAY,SAAS,IAAIC,0CAA+B,KAAK;CAE7E,MAAM,0BAAsC,IAAI,KAA4B;CAC5E,MAAM,iBAAiB,mBAAmB;AAE1C,KAAI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AAO,eAAe,YAAY,gBAAeR,MAAO,YAC1D,QAAO,gBAAeA,MAAO;EAG/B,MAAM,cAAc,KAAK,oBAAoB;AAE7C,MAAI,CAAC,YACH;AAGF,SAAO,MAAKQ,MAAO,aAAa,WAAW;;CAG7C,MAAM,QAAQ,YAAqC,SAA8C;EAC/F,MAAM,iBAAiB,MAAM,KAAK,WAAW,WAAW;AAExD,MAAI,CAAC,eACH,QAAO;AAGT,MAAI,mBAAmB,QACrB,QAAO;EAGT,MAAM,4BAAgB,eAAe;AAErC,MAAI,CAAC,OACH,QAAO;AAGT,+BAAiB,QAAQ,QAAQ;;CAEnC,YAAY,YAAqC,SAAqC;EACpF,MAAM,iBAAiB,KAAK,eAAe,WAAW;AAEtD,MAAI,CAAC,eACH,QAAO;AAGT,MAAI,mBAAmB,QACrB,QAAO;EAGT,MAAM,4BAAgB,eAAe;AAErC,MAAI,CAAC,OACH,QAAO;AAGT,+BAAiB,QAAQ,QAAQ;;;;;;ACmLrC,MAAa,WAAW;CACtB,QAAQ,OAAO;CACf,OAAO;CACP,MAAM;CACN,MAAM;CACN,SAAS;CACT,OAAO;CACR"}
1
+ {"version":3,"file":"index.cjs","names":["#context","#options","AsyncEventEmitter","URLPath","exists","clean","fsPlugin","typescriptParser","write","PluginManager","BuildError","getElapsedMs","formatMs","getRelativePath","#cache","#cwd","#SLASHES","mod","os","pkg","read","readSync","#match"],"sources":["../src/BaseGenerator.ts","../src/config.ts","../package.json","../src/utils/diagnostics.ts","../src/build.ts","../src/defineLogger.ts","../src/definePlugin.ts","../src/PackageManager.ts","../src/types.ts"],"sourcesContent":["/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import type { InputPath, UserConfig } from './types.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /** Path to `kubb.config.js` */\n config?: string\n\n /** Enable watch mode for input files */\n watch?: boolean\n\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n\n /** Run Kubb with Bun */\n bun?: boolean\n}\n/**\n * Helper for defining a Kubb configuration.\n *\n * Accepts either:\n * - A config object or array of configs\n * - A function returning the config(s), optionally async,\n * receiving the CLI options as argument\n *\n * @example\n * export default defineConfig(({ logLevel }) => ({\n * root: 'src',\n * plugins: [myPlugin()],\n * }))\n */\nexport function defineConfig(\n config: PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>),\n): typeof config {\n return config\n}\n\n/**\n * Type guard to check if a given config has an `input.path`.\n */\nexport function isInputPath(config: UserConfig | undefined): config is UserConfig<InputPath> {\n return typeof config?.input === 'object' && config.input !== null && 'path' in config.input\n}\n","","import { version as nodeVersion } from 'node:process'\nimport { version as KubbVersion } from '../../package.json'\n\n/**\n * Get diagnostic information for debugging\n */\nexport function getDiagnosticInfo() {\n return {\n nodeVersion,\n KubbVersion,\n platform: process.platform,\n arch: process.arch,\n cwd: process.cwd(),\n } as const\n}\n","import { resolve } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport { createFabric } from '@kubb/react-fabric'\nimport { typescriptParser } from '@kubb/react-fabric/parsers'\nimport { fsPlugin } from '@kubb/react-fabric/plugins'\nimport { isInputPath } from './config.ts'\nimport { BuildError } from './errors.ts'\nimport { clean, exists, getRelativePath, write } from './fs/index.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport type { Config, KubbEvents, Output, Plugin, UserConfig } from './types.ts'\nimport { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport { getDiagnosticInfo } from './utils/diagnostics.ts'\nimport { formatMs, getElapsedMs } from './utils/formatHrtime.ts'\nimport { URLPath } from './utils/URLPath.ts'\n\ntype BuildOptions = {\n config: UserConfig\n events?: AsyncEventEmitter<KubbEvents>\n}\n\ntype BuildOutput = {\n failedPlugins: Set<{ plugin: Plugin; error: Error }>\n fabric: Fabric\n files: Array<KubbFile.ResolvedFile>\n pluginManager: PluginManager\n pluginTimings: Map<string, number>\n error?: Error\n sources: Map<KubbFile.Path, string>\n}\n\ntype SetupResult = {\n events: AsyncEventEmitter<KubbEvents>\n fabric: Fabric\n pluginManager: PluginManager\n sources: Map<KubbFile.Path, string>\n}\n\nexport async function setup(options: BuildOptions): Promise<SetupResult> {\n const { config: userConfig, events = new AsyncEventEmitter<KubbEvents>() } = options\n\n const sources: Map<KubbFile.Path, string> = new Map<KubbFile.Path, string>()\n const diagnosticInfo = getDiagnosticInfo()\n\n if (Array.isArray(userConfig.input)) {\n await events.emit('warn', 'This feature is still under development — use with caution')\n }\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n 'Configuration:',\n ` • Name: ${userConfig.name || 'unnamed'}`,\n ` • Root: ${userConfig.root || process.cwd()}`,\n ` • Output: ${userConfig.output?.path || 'not specified'}`,\n ` • Plugins: ${userConfig.plugins?.length || 0}`,\n 'Output Settings:',\n ` • Write: ${userConfig.output?.write !== false ? 'enabled' : 'disabled'}`,\n ` • Formatter: ${userConfig.output?.format || 'none'}`,\n ` • Linter: ${userConfig.output?.lint || 'none'}`,\n 'Environment:',\n Object.entries(diagnosticInfo)\n .map(([key, value]) => ` • ${key}: ${value}`)\n .join('\\n'),\n ],\n })\n\n try {\n if (isInputPath(userConfig) && !new URLPath(userConfig.input.path).isURL) {\n await exists(userConfig.input.path)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Input file validated: ${userConfig.input.path}`],\n })\n }\n } catch (caughtError) {\n if (isInputPath(userConfig)) {\n const error = caughtError as Error\n\n throw new Error(\n `Cannot read file/URL defined in \\`input.path\\` or set with \\`kubb generate PATH\\` in the CLI of your Kubb config ${userConfig.input.path}`,\n {\n cause: error,\n },\n )\n }\n }\n\n const definedConfig: Config = {\n root: userConfig.root || process.cwd(),\n ...userConfig,\n output: {\n write: true,\n barrelType: 'named',\n extension: {\n '.ts': '.ts',\n },\n defaultBanner: 'simple',\n ...userConfig.output,\n },\n plugins: userConfig.plugins as Config['plugins'],\n }\n\n if (definedConfig.output.clean) {\n await events.emit('debug', {\n date: new Date(),\n logs: ['Cleaning output directories', ` • Output: ${definedConfig.output.path}`],\n })\n await clean(definedConfig.output.path)\n }\n\n const fabric = createFabric()\n fabric.use(fsPlugin)\n fabric.use(typescriptParser)\n\n fabric.context.on('files:processing:start', (files) => {\n events.emit('files:processing:start', files)\n events.emit('debug', {\n date: new Date(),\n logs: [`Writing ${files.length} files...`],\n })\n })\n\n fabric.context.on('file:processing:update', async (params) => {\n const { file, source } = params\n await events.emit('file:processing:update', {\n ...params,\n config: definedConfig,\n source,\n })\n\n if (source) {\n if (definedConfig.output.write) {\n await write(file.path, source, { sanity: false })\n }\n\n sources.set(file.path, source)\n }\n })\n\n fabric.context.on('files:processing:end', async (files) => {\n await events.emit('files:processing:end', files)\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ File write process completed for ${files.length} files`],\n })\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n '✓ Fabric initialized',\n ` • File writing: ${definedConfig.output.write ? 'enabled' : 'disabled (dry-run)'}`,\n ` • Barrel type: ${definedConfig.output.barrelType || 'none'}`,\n ],\n })\n\n const pluginManager = new PluginManager(definedConfig, {\n fabric,\n events,\n concurrency: 15, // Increased from 5 to 15 for better parallel plugin execution\n })\n\n return {\n events,\n fabric,\n pluginManager,\n sources,\n }\n}\n\nexport async function build(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, files, pluginManager, failedPlugins, pluginTimings, error, sources } = await safeBuild(options, overrides)\n\n if (error) {\n throw error\n }\n\n if (failedPlugins.size > 0) {\n const errors = [...failedPlugins].map(({ error }) => error)\n\n throw new BuildError(`Build Error with ${failedPlugins.size} failed plugins`, { errors })\n }\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n error: undefined,\n sources,\n }\n}\n\nexport async function safeBuild(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, pluginManager, events, sources } = overrides ? overrides : await setup(options)\n\n const failedPlugins = new Set<{ plugin: Plugin; error: Error }>()\n // in ms\n const pluginTimings = new Map<string, number>()\n const config = pluginManager.config\n\n try {\n for (const plugin of pluginManager.plugins) {\n const context = pluginManager.getContext(plugin)\n const hrStart = process.hrtime()\n\n const installer = plugin.install.bind(context)\n\n try {\n const timestamp = new Date()\n\n await events.emit('plugin:start', plugin)\n\n await events.emit('debug', {\n date: timestamp,\n logs: ['Installing plugin...', ` • Plugin Key: [${plugin.key.join(', ')}]`],\n })\n\n await installer(context)\n\n const duration = getElapsedMs(hrStart)\n pluginTimings.set(plugin.name, duration)\n\n await events.emit('plugin:end', plugin, { duration, success: true })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Plugin installed successfully (${formatMs(duration)})`],\n })\n } catch (caughtError) {\n const error = caughtError as Error\n const errorTimestamp = new Date()\n const duration = getElapsedMs(hrStart)\n\n await events.emit('plugin:end', plugin, {\n duration,\n success: false,\n error,\n })\n\n await events.emit('debug', {\n date: errorTimestamp,\n logs: [\n '✗ Plugin installation failed',\n ` • Plugin Key: ${JSON.stringify(plugin.key)}`,\n ` • Error: ${error.constructor.name} - ${error.message}`,\n ' • Stack Trace:',\n error.stack || 'No stack trace available',\n ],\n })\n\n failedPlugins.add({ plugin, error })\n }\n }\n\n if (config.output.barrelType) {\n const root = resolve(config.root)\n const rootPath = resolve(root, config.output.path, 'index.ts')\n\n await events.emit('debug', {\n date: new Date(),\n logs: ['Generating barrel file', ` • Type: ${config.output.barrelType}`, ` • Path: ${rootPath}`],\n })\n\n const barrelFiles = fabric.files.filter((file) => {\n return file.sources.some((source) => source.isIndexable)\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`Found ${barrelFiles.length} indexable files for barrel export`],\n })\n\n // Build a Map of plugin keys to plugins for efficient lookups\n const pluginKeyMap = new Map<string, Plugin>()\n for (const plugin of pluginManager.plugins) {\n pluginKeyMap.set(JSON.stringify(plugin.key), plugin)\n }\n\n const rootFile: KubbFile.File = {\n path: rootPath,\n baseName: 'index.ts',\n exports: barrelFiles\n .flatMap((file) => {\n const containsOnlyTypes = file.sources?.every((source) => source.isTypeOnly)\n\n return file.sources\n ?.map((source) => {\n if (!file.path || !source.isIndexable) {\n return undefined\n }\n\n // validate of the file is coming from plugin x, needs pluginKey on every file TODO update typing\n const meta = file.meta as any\n const plugin = meta?.pluginKey ? pluginKeyMap.get(JSON.stringify(meta.pluginKey)) : undefined\n const pluginOptions = plugin?.options as {\n output?: Output<any>\n }\n\n if (!pluginOptions || pluginOptions?.output?.barrelType === false) {\n return undefined\n }\n\n return {\n name: config.output.barrelType === 'all' ? undefined : [source.name],\n path: getRelativePath(rootPath, file.path),\n isTypeOnly: config.output.barrelType === 'all' ? containsOnlyTypes : source.isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n })\n .filter(Boolean),\n sources: [],\n imports: [],\n meta: {},\n }\n\n await fabric.upsertFile(rootFile)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Generated barrel file (${rootFile.exports?.length || 0} exports)`],\n })\n }\n\n const files = [...fabric.files]\n\n await fabric.write({ extension: config.output.extension })\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n sources,\n }\n } catch (error) {\n return {\n failedPlugins,\n fabric,\n files: [],\n pluginManager,\n pluginTimings,\n error: error as Error,\n sources,\n }\n }\n}\n","import type { Logger, LoggerOptions, UserLogger } from './types.ts'\n\nexport function defineLogger<Options extends LoggerOptions = LoggerOptions>(logger: UserLogger<Options>): Logger<Options> {\n return {\n ...logger,\n }\n}\n","import type { PluginFactoryOptions, UserPluginWithLifeCycle } from './types.ts'\n\ntype PluginBuilder<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>\n\n/**\n * Wraps a plugin builder to make the options parameter optional.\n */\nexport function definePlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(\n build: PluginBuilder<T>,\n): (options?: T['options']) => UserPluginWithLifeCycle<T> {\n return (options) => build(options ?? ({} as T['options']))\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport * as pkg from 'empathic/package'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/index.ts'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n const lastChar = directory[directory.length - 1]\n if (lastChar && !this.#SLASHES.has(lastChar)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() === 'win32') {\n location = pathToFileURL(location).href\n }\n\n const module = await import(location)\n\n return module?.default ?? module\n } catch (error) {\n console.error(error)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...(packageJSON['dependencies'] || {}),\n ...(packageJSON['devDependencies'] || {}),\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport type { KubbEvents } from './Kubb.ts'\nimport type { PluginManager } from './PluginManager.ts'\nimport type { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\ndeclare global {\n namespace Kubb {\n interface PluginContext {}\n }\n}\n\n/**\n * Config used in `kubb.config.ts`\n *\n * @example\n * import { defineConfig } from '@kubb/core'\n * export default defineConfig({\n * ...\n * })\n */\nexport type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root?: string\n /**\n * An array of Kubb plugins used for generation. Each plugin may have additional configurable options (defined within the plugin itself). If a plugin relies on another plugin, an error will occur if the required dependency is missing. Refer to “pre” for more details.\n */\n // inject needs to be omitted because else we have a clash with the PluginManager instance\n plugins?: Array<Omit<UnknownUserPlugin, 'inject'>>\n}\n\nexport type InputPath = {\n /**\n * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.\n */\n path: string\n}\n\nexport type InputData = {\n /**\n * A `string` or `object` that contains your Swagger/OpenAPI data.\n */\n data: string | unknown\n}\n\ntype Input = InputPath | InputData | Array<InputPath>\n\nexport type BarrelType = 'all' | 'named' | 'propagate'\n\n/**\n * @private\n */\nexport type Config<TInput = Input> = {\n /**\n * The name to display in the CLI output.\n */\n name?: string\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root: string\n /**\n * You can use either `input.path` or `input.data`, depending on your specific needs.\n */\n input: TInput\n output: {\n /**\n * The path where all generated files receives exported.\n * This can be an absolute path or a path relative to the specified root option.\n */\n path: string\n /**\n * Clean the output directory before each build.\n */\n clean?: boolean\n /**\n * Save files to the file system.\n * @default true\n */\n write?: boolean\n /**\n * Specifies the formatting tool to be used.\n * - 'auto' automatically detects and uses biome or prettier (in that order of preference).\n * - 'prettier' uses Prettier for code formatting.\n * - 'biome' uses Biome for code formatting.\n * - 'oxfmt' uses Oxfmt for code formatting.\n * - false disables code formatting.\n * @default 'prettier'\n */\n format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false\n /**\n * Specifies the linter that should be used to analyze the code.\n * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).\n * - 'eslint' uses ESLint for linting.\n * - 'biome' uses Biome for linting.\n * - 'oxlint' uses Oxlint for linting.\n * - false disables linting.\n * @default 'auto'\n */\n lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false\n /**\n * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.\n * @default { '.ts': '.ts'}\n */\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n /**\n * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).\n * @default 'named'\n */\n barrelType?: Exclude<BarrelType, 'propagate'> | false\n /**\n * Adds a default banner to the start of every generated file indicating it was generated by Kubb.\n * - 'simple' adds banner with link to Kubb.\n * - 'full' adds source, title, description, and OpenAPI version.\n * - false disables banner generation.\n * @default 'simple'\n */\n defaultBanner?: 'simple' | 'full' | false\n /**\n * Whether to override existing external files if they already exist.\n * When setting the option in the global configuration, all plugins inherit the same behavior by default.\n * However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.\n * @default false\n */\n override?: boolean\n }\n /**\n * An array of Kubb plugins that used in the generation.\n * Each plugin may include additional configurable options(defined in the plugin itself).\n * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.\n */\n plugins?: Array<Plugin>\n /**\n * Hooks triggered when a specific action occurs in Kubb.\n */\n hooks?: {\n /**\n * Hook that triggers at the end of all executions.\n * Useful for running Prettier or ESLint to format/lint your code.\n */\n done?: string | Array<string>\n }\n}\n\n// plugin\n\nexport type PluginFactoryOptions<\n /**\n * Name to be used for the plugin, this will also be used for they key.\n */\n TName extends string = string,\n /**\n * Options of the plugin.\n */\n TOptions extends object = object,\n /**\n * Options of the plugin that can be used later on, see `options` inside your plugin config.\n */\n TResolvedOptions extends object = TOptions,\n /**\n * Context that you want to expose to other plugins.\n */\n TContext = any,\n /**\n * When calling `resolvePath` you can specify better types.\n */\n TResolvePathOptions extends object = object,\n> = {\n name: TName\n /**\n * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`\n */\n key: PluginKey<TName | string>\n options: TOptions\n resolvedOptions: TResolvedOptions\n context: TContext\n resolvePathOptions: TResolvePathOptions\n}\n\nexport type PluginKey<TName> = [name: TName, identifier?: string | number]\n\nexport type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never\n\nexport type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>\n\ntype UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>\n\nexport type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Internal key used when a developer uses more than one of the same plugin\n * @private\n */\n key: TOptions['key']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n\n install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).\n */\n inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>\n\nexport type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Start of the lifecycle of a plugin.\n * @type hookParallel\n */\n install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).\n * Options can als be included.\n * @type hookFirst\n * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'\n */\n resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path\n /**\n * Resolve to a name based on a string.\n * Useful when converting to PascalCase or camelCase.\n * @type hookFirst\n * @example ('pet') => 'Pet'\n */\n resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n}\n\nexport type PluginLifecycleHooks = keyof PluginLifecycle\n\nexport type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>\n\nexport type ResolvePathParams<TOptions = object> = {\n pluginKey?: Plugin['key']\n baseName: KubbFile.BaseName\n mode?: KubbFile.Mode\n /**\n * Options to be passed to 'resolvePath' 3th parameter\n */\n options?: TOptions\n}\n\nexport type ResolveNameParams = {\n name: string\n pluginKey?: Plugin['key']\n /**\n * Specifies the type of entity being named.\n * - 'file' customizes the name of the created file (uses camelCase).\n * - 'function' customizes the exported function names (uses camelCase).\n * - 'type' customizes TypeScript types (uses PascalCase).\n * - 'const' customizes variable names (uses camelCase).\n * @default undefined\n */\n type?: 'file' | 'function' | 'type' | 'const'\n}\n\nexport type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n fabric: Fabric\n config: Config\n pluginManager: PluginManager\n /**\n * Only add when the file does not exist yet\n */\n addFile: (...file: Array<KubbFile.File>) => Promise<void>\n /**\n * merging multiple sources into the same output file\n */\n upsertFile: (...file: Array<KubbFile.File>) => Promise<void>\n events: AsyncEventEmitter<KubbEvents>\n mode: KubbFile.Mode\n /**\n * Current plugin\n */\n plugin: Plugin<TOptions>\n} & Kubb.PluginContext\n/**\n * Specify the export location for the files and define the behavior of the output\n */\nexport type Output<TOptions> = {\n /**\n * Path to the output folder or file that will contain the generated code\n */\n path: string\n /**\n * Define what needs to be exported, here you can also disable the export of barrel files\n * @default 'named'\n */\n barrelType?: BarrelType | false\n /**\n * Add a banner text in the beginning of every file\n */\n banner?: string | ((options: TOptions) => string)\n /**\n * Add a footer text in the beginning of every file\n */\n footer?: string | ((options: TOptions) => string)\n /**\n * Whether to override existing external files if they already exist.\n * @default false\n */\n override?: boolean\n}\n\ntype GroupContext = {\n group: string\n}\n\nexport type Group = {\n /**\n * Defines the type where to group the files.\n * - 'tag' groups files by OpenAPI tags.\n * - 'path' groups files by OpenAPI paths.\n * @default undefined\n */\n type: 'tag' | 'path'\n /**\n * Return the name of a group based on the group name, this used for the file and name generation\n */\n name?: (context: GroupContext) => string\n}\n\nexport const LogLevel = {\n silent: Number.NEGATIVE_INFINITY,\n error: 0,\n warn: 1,\n info: 3,\n verbose: 4,\n debug: 5,\n} as const\n\nexport type LoggerOptions = {\n /**\n * @default 3\n */\n logLevel: (typeof LogLevel)[keyof typeof LogLevel]\n}\n\n/**\n * Shared context passed to all plugins, parsers, and Fabric internals.\n */\nexport interface LoggerContext extends AsyncEventEmitter<KubbEvents> {}\n\ntype Install<TOptions = unknown> = (context: LoggerContext, options?: TOptions) => void | Promise<void>\n\nexport type Logger<TOptions extends LoggerOptions = LoggerOptions> = {\n name: string\n install: Install<TOptions>\n}\n\nexport type UserLogger<TOptions extends LoggerOptions = LoggerOptions> = Omit<Logger<TOptions>, 'logLevel'>\n\nexport type { KubbEvents } from './Kubb.ts'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAsB,gBAAtB,MAA4E;CAC1E,WAAqB,EAAE;CACvB,WAAqB,EAAE;CAEvB,YAAY,SAAoB,SAAoB;AAClD,MAAI,QACF,OAAA,UAAgB;AAGlB,MAAI,QACF,OAAA,UAAgB;AAGlB,SAAO;;CAGT,IAAI,UAAoB;AACtB,SAAO,MAAA;;CAGT,IAAI,UAAoB;AACtB,SAAO,MAAA;;CAGT,IAAI,QAAQ,SAAmB;AAC7B,QAAA,UAAgB;GAAE,GAAG,MAAA;GAAe,GAAG;GAAS;;;;;;;;;;;;;;;;;;;ACWpD,SAAgB,aACd,QACe;AACf,QAAO;;;;;AAMT,SAAgB,YAAY,QAAiE;AAC3F,QAAO,OAAO,QAAQ,UAAU,YAAY,OAAO,UAAU,QAAQ,UAAU,OAAO;;;;;;;;;;AE5CxF,SAAgB,oBAAoB;AAClC,QAAO;EACL,aAAA,aAAA;EACA,aAAA;EACA,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import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { A as AsyncEventEmitter, C as UserLogger, D as KubbEvents, O as PluginManager, S as UserConfig, T as UserPluginWithLifeCycle, _ as PluginLifecycleHooks, a as InputData, b as ResolveNameParams, c as Logger, d as Output, f as Plugin, g as PluginLifecycle, h as PluginKey, i as Group, k as getMode, l as LoggerContext, m as PluginFactoryOptions, n as Config, o as InputPath, p as PluginContext, r as GetPluginFactoryOptions, s as LogLevel, t as BarrelType, u as LoggerOptions, v as PluginParameter, w as UserPlugin, x as ResolvePathParams, y as PluginWithLifeCycle } from "./types-CiePC9Y3.js";
3
- import { a as getBarrelFiles, c as isInputPath, i as FileMetaBase, n as PackageManagerName, o as CLIOptions, r as detectPackageManager, s as defineConfig, t as PackageManagerInfo } from "./packageManager-B7KCmp2R.js";
1
+ import { t as __name } from "./chunk--u3MIqq1.js";
2
+ import { A as AsyncEventEmitter, C as UserLogger, D as KubbEvents, O as PluginManager, S as UserConfig, T as UserPluginWithLifeCycle, _ as PluginLifecycleHooks, a as InputData, b as ResolveNameParams, c as Logger, d as Output, f as Plugin, g as PluginLifecycle, h as PluginKey, i as Group, k as getMode, l as LoggerContext, m as PluginFactoryOptions, n as Config, o as InputPath, p as PluginContext, r as GetPluginFactoryOptions, s as LogLevel, t as BarrelType, u as LoggerOptions, v as PluginParameter, w as UserPlugin, x as ResolvePathParams, y as PluginWithLifeCycle } from "./types-f_no0d7G.js";
3
+ import { a as getBarrelFiles, c as isInputPath, i as FileMetaBase, n as PackageManagerName, o as CLIOptions, r as detectPackageManager, s as defineConfig, t as PackageManagerInfo } from "./packageManager-_7I0WFQU.js";
4
4
  import { Fabric } from "@kubb/react-fabric";
5
5
  import { KubbFile } from "@kubb/fabric-core/types";
6
6
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { a as formatMs, c as PluginManager, f as PromiseManager, l as getMode, n as getBarrelFiles, o as getElapsedMs, p as BuildError, r as URLPath, s as AsyncEventEmitter, t as detectPackageManager } from "./packageManager-B6NiaZeW.js";
3
- import { a as exists, i as readSync, n as getRelativePath, o as clean, r as read, t as write } from "./write-pEo2oQGI.js";
1
+ import "./chunk--u3MIqq1.js";
2
+ import { a as formatMs, c as PluginManager, f as PromiseManager, l as getMode, n as getBarrelFiles, o as getElapsedMs, p as BuildError, r as URLPath, s as AsyncEventEmitter, t as detectPackageManager } from "./packageManager-wMCQlgd6.js";
3
+ import { a as exists, i as readSync, n as getRelativePath, o as clean, r as read, t as write } from "./fs-TVBCPkE-.js";
4
4
  import mod from "node:module";
5
5
  import { resolve } from "node:path";
6
6
  import { createFabric } from "@kubb/react-fabric";
@@ -11,7 +11,6 @@ import os from "node:os";
11
11
  import { pathToFileURL } from "node:url";
12
12
  import * as pkg from "empathic/package";
13
13
  import { coerce, satisfies } from "semver";
14
-
15
14
  //#region src/BaseGenerator.ts
16
15
  /**
17
16
  * Abstract class that contains the building blocks for plugins to create their own Generator
@@ -38,7 +37,6 @@ var BaseGenerator = class {
38
37
  };
39
38
  }
40
39
  };
41
-
42
40
  //#endregion
43
41
  //#region src/config.ts
44
42
  /**
@@ -64,11 +62,9 @@ function defineConfig(config) {
64
62
  function isInputPath(config) {
65
63
  return typeof config?.input === "object" && config.input !== null && "path" in config.input;
66
64
  }
67
-
68
65
  //#endregion
69
66
  //#region package.json
70
- var version$1 = "4.32.0";
71
-
67
+ var version$1 = "4.32.1";
72
68
  //#endregion
73
69
  //#region src/utils/diagnostics.ts
74
70
  /**
@@ -83,7 +79,6 @@ function getDiagnosticInfo() {
83
79
  cwd: process.cwd()
84
80
  };
85
81
  }
86
-
87
82
  //#endregion
88
83
  //#region src/build.ts
89
84
  async function setup(options) {
@@ -326,13 +321,11 @@ async function safeBuild(options, overrides) {
326
321
  };
327
322
  }
328
323
  }
329
-
330
324
  //#endregion
331
325
  //#region src/defineLogger.ts
332
326
  function defineLogger(logger) {
333
327
  return { ...logger };
334
328
  }
335
-
336
329
  //#endregion
337
330
  //#region src/definePlugin.ts
338
331
  /**
@@ -341,7 +334,6 @@ function defineLogger(logger) {
341
334
  function definePlugin(build) {
342
335
  return (options) => build(options ?? {});
343
336
  }
344
-
345
337
  //#endregion
346
338
  //#region src/PackageManager.ts
347
339
  var PackageManager = class PackageManager {
@@ -432,7 +424,6 @@ var PackageManager = class PackageManager {
432
424
  return satisfies(semVer, version);
433
425
  }
434
426
  };
435
-
436
427
  //#endregion
437
428
  //#region src/types.ts
438
429
  const LogLevel = {
@@ -443,7 +434,7 @@ const LogLevel = {
443
434
  verbose: 4,
444
435
  debug: 5
445
436
  };
446
-
447
437
  //#endregion
448
438
  export { BaseGenerator, LogLevel, PackageManager, PluginManager, PromiseManager, build, build as default, defineConfig, defineLogger, definePlugin, detectPackageManager, getBarrelFiles, getMode, isInputPath, safeBuild, setup };
439
+
449
440
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["#context","#options","#cache","#cwd","#SLASHES","#match"],"sources":["../src/BaseGenerator.ts","../src/config.ts","../package.json","../src/utils/diagnostics.ts","../src/build.ts","../src/defineLogger.ts","../src/definePlugin.ts","../src/PackageManager.ts","../src/types.ts"],"sourcesContent":["/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import type { InputPath, UserConfig } from './types.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /** Path to `kubb.config.js` */\n config?: string\n\n /** Enable watch mode for input files */\n watch?: boolean\n\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n\n /** Run Kubb with Bun */\n bun?: boolean\n}\n/**\n * Helper for defining a Kubb configuration.\n *\n * Accepts either:\n * - A config object or array of configs\n * - A function returning the config(s), optionally async,\n * receiving the CLI options as argument\n *\n * @example\n * export default defineConfig(({ logLevel }) => ({\n * root: 'src',\n * plugins: [myPlugin()],\n * }))\n */\nexport function defineConfig(\n config: PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>),\n): typeof config {\n return config\n}\n\n/**\n * Type guard to check if a given config has an `input.path`.\n */\nexport function isInputPath(config: UserConfig | undefined): config is UserConfig<InputPath> {\n return typeof config?.input === 'object' && config.input !== null && 'path' in config.input\n}\n","","import { version as nodeVersion } from 'node:process'\nimport { version as KubbVersion } from '../../package.json'\n\n/**\n * Get diagnostic information for debugging\n */\nexport function getDiagnosticInfo() {\n return {\n nodeVersion,\n KubbVersion,\n platform: process.platform,\n arch: process.arch,\n cwd: process.cwd(),\n } as const\n}\n","import { resolve } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport { createFabric } from '@kubb/react-fabric'\nimport { typescriptParser } from '@kubb/react-fabric/parsers'\nimport { fsPlugin } from '@kubb/react-fabric/plugins'\nimport { isInputPath } from './config.ts'\nimport { BuildError } from './errors.ts'\nimport { clean, exists, getRelativePath, write } from './fs/index.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport type { Config, KubbEvents, Output, Plugin, UserConfig } from './types.ts'\nimport { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport { getDiagnosticInfo } from './utils/diagnostics.ts'\nimport { formatMs, getElapsedMs } from './utils/formatHrtime.ts'\nimport { URLPath } from './utils/URLPath.ts'\n\ntype BuildOptions = {\n config: UserConfig\n events?: AsyncEventEmitter<KubbEvents>\n}\n\ntype BuildOutput = {\n failedPlugins: Set<{ plugin: Plugin; error: Error }>\n fabric: Fabric\n files: Array<KubbFile.ResolvedFile>\n pluginManager: PluginManager\n pluginTimings: Map<string, number>\n error?: Error\n sources: Map<KubbFile.Path, string>\n}\n\ntype SetupResult = {\n events: AsyncEventEmitter<KubbEvents>\n fabric: Fabric\n pluginManager: PluginManager\n sources: Map<KubbFile.Path, string>\n}\n\nexport async function setup(options: BuildOptions): Promise<SetupResult> {\n const { config: userConfig, events = new AsyncEventEmitter<KubbEvents>() } = options\n\n const sources: Map<KubbFile.Path, string> = new Map<KubbFile.Path, string>()\n const diagnosticInfo = getDiagnosticInfo()\n\n if (Array.isArray(userConfig.input)) {\n await events.emit('warn', 'This feature is still under development — use with caution')\n }\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n 'Configuration:',\n ` • Name: ${userConfig.name || 'unnamed'}`,\n ` • Root: ${userConfig.root || process.cwd()}`,\n ` • Output: ${userConfig.output?.path || 'not specified'}`,\n ` • Plugins: ${userConfig.plugins?.length || 0}`,\n 'Output Settings:',\n ` • Write: ${userConfig.output?.write !== false ? 'enabled' : 'disabled'}`,\n ` • Formatter: ${userConfig.output?.format || 'none'}`,\n ` • Linter: ${userConfig.output?.lint || 'none'}`,\n 'Environment:',\n Object.entries(diagnosticInfo)\n .map(([key, value]) => ` • ${key}: ${value}`)\n .join('\\n'),\n ],\n })\n\n try {\n if (isInputPath(userConfig) && !new URLPath(userConfig.input.path).isURL) {\n await exists(userConfig.input.path)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Input file validated: ${userConfig.input.path}`],\n })\n }\n } catch (caughtError) {\n if (isInputPath(userConfig)) {\n const error = caughtError as Error\n\n throw new Error(\n `Cannot read file/URL defined in \\`input.path\\` or set with \\`kubb generate PATH\\` in the CLI of your Kubb config ${userConfig.input.path}`,\n {\n cause: error,\n },\n )\n }\n }\n\n const definedConfig: Config = {\n root: userConfig.root || process.cwd(),\n ...userConfig,\n output: {\n write: true,\n barrelType: 'named',\n extension: {\n '.ts': '.ts',\n },\n defaultBanner: 'simple',\n ...userConfig.output,\n },\n plugins: userConfig.plugins as Config['plugins'],\n }\n\n if (definedConfig.output.clean) {\n await events.emit('debug', {\n date: new Date(),\n logs: ['Cleaning output directories', ` • Output: ${definedConfig.output.path}`],\n })\n await clean(definedConfig.output.path)\n }\n\n const fabric = createFabric()\n fabric.use(fsPlugin)\n fabric.use(typescriptParser)\n\n fabric.context.on('files:processing:start', (files) => {\n events.emit('files:processing:start', files)\n events.emit('debug', {\n date: new Date(),\n logs: [`Writing ${files.length} files...`],\n })\n })\n\n fabric.context.on('file:processing:update', async (params) => {\n const { file, source } = params\n await events.emit('file:processing:update', {\n ...params,\n config: definedConfig,\n source,\n })\n\n if (source) {\n if (definedConfig.output.write) {\n await write(file.path, source, { sanity: false })\n }\n\n sources.set(file.path, source)\n }\n })\n\n fabric.context.on('files:processing:end', async (files) => {\n await events.emit('files:processing:end', files)\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ File write process completed for ${files.length} files`],\n })\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n '✓ Fabric initialized',\n ` • File writing: ${definedConfig.output.write ? 'enabled' : 'disabled (dry-run)'}`,\n ` • Barrel type: ${definedConfig.output.barrelType || 'none'}`,\n ],\n })\n\n const pluginManager = new PluginManager(definedConfig, {\n fabric,\n events,\n concurrency: 15, // Increased from 5 to 15 for better parallel plugin execution\n })\n\n return {\n events,\n fabric,\n pluginManager,\n sources,\n }\n}\n\nexport async function build(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, files, pluginManager, failedPlugins, pluginTimings, error, sources } = await safeBuild(options, overrides)\n\n if (error) {\n throw error\n }\n\n if (failedPlugins.size > 0) {\n const errors = [...failedPlugins].map(({ error }) => error)\n\n throw new BuildError(`Build Error with ${failedPlugins.size} failed plugins`, { errors })\n }\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n error: undefined,\n sources,\n }\n}\n\nexport async function safeBuild(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, pluginManager, events, sources } = overrides ? overrides : await setup(options)\n\n const failedPlugins = new Set<{ plugin: Plugin; error: Error }>()\n // in ms\n const pluginTimings = new Map<string, number>()\n const config = pluginManager.config\n\n try {\n for (const plugin of pluginManager.plugins) {\n const context = pluginManager.getContext(plugin)\n const hrStart = process.hrtime()\n\n const installer = plugin.install.bind(context)\n\n try {\n const timestamp = new Date()\n\n await events.emit('plugin:start', plugin)\n\n await events.emit('debug', {\n date: timestamp,\n logs: ['Installing plugin...', ` • Plugin Key: [${plugin.key.join(', ')}]`],\n })\n\n await installer(context)\n\n const duration = getElapsedMs(hrStart)\n pluginTimings.set(plugin.name, duration)\n\n await events.emit('plugin:end', plugin, { duration, success: true })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Plugin installed successfully (${formatMs(duration)})`],\n })\n } catch (caughtError) {\n const error = caughtError as Error\n const errorTimestamp = new Date()\n const duration = getElapsedMs(hrStart)\n\n await events.emit('plugin:end', plugin, {\n duration,\n success: false,\n error,\n })\n\n await events.emit('debug', {\n date: errorTimestamp,\n logs: [\n '✗ Plugin installation failed',\n ` • Plugin Key: ${JSON.stringify(plugin.key)}`,\n ` • Error: ${error.constructor.name} - ${error.message}`,\n ' • Stack Trace:',\n error.stack || 'No stack trace available',\n ],\n })\n\n failedPlugins.add({ plugin, error })\n }\n }\n\n if (config.output.barrelType) {\n const root = resolve(config.root)\n const rootPath = resolve(root, config.output.path, 'index.ts')\n\n await events.emit('debug', {\n date: new Date(),\n logs: ['Generating barrel file', ` • Type: ${config.output.barrelType}`, ` • Path: ${rootPath}`],\n })\n\n const barrelFiles = fabric.files.filter((file) => {\n return file.sources.some((source) => source.isIndexable)\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`Found ${barrelFiles.length} indexable files for barrel export`],\n })\n\n // Build a Map of plugin keys to plugins for efficient lookups\n const pluginKeyMap = new Map<string, Plugin>()\n for (const plugin of pluginManager.plugins) {\n pluginKeyMap.set(JSON.stringify(plugin.key), plugin)\n }\n\n const rootFile: KubbFile.File = {\n path: rootPath,\n baseName: 'index.ts',\n exports: barrelFiles\n .flatMap((file) => {\n const containsOnlyTypes = file.sources?.every((source) => source.isTypeOnly)\n\n return file.sources\n ?.map((source) => {\n if (!file.path || !source.isIndexable) {\n return undefined\n }\n\n // validate of the file is coming from plugin x, needs pluginKey on every file TODO update typing\n const meta = file.meta as any\n const plugin = meta?.pluginKey ? pluginKeyMap.get(JSON.stringify(meta.pluginKey)) : undefined\n const pluginOptions = plugin?.options as {\n output?: Output<any>\n }\n\n if (!pluginOptions || pluginOptions?.output?.barrelType === false) {\n return undefined\n }\n\n return {\n name: config.output.barrelType === 'all' ? undefined : [source.name],\n path: getRelativePath(rootPath, file.path),\n isTypeOnly: config.output.barrelType === 'all' ? containsOnlyTypes : source.isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n })\n .filter(Boolean),\n sources: [],\n imports: [],\n meta: {},\n }\n\n await fabric.upsertFile(rootFile)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Generated barrel file (${rootFile.exports?.length || 0} exports)`],\n })\n }\n\n const files = [...fabric.files]\n\n await fabric.write({ extension: config.output.extension })\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n sources,\n }\n } catch (error) {\n return {\n failedPlugins,\n fabric,\n files: [],\n pluginManager,\n pluginTimings,\n error: error as Error,\n sources,\n }\n }\n}\n","import type { Logger, LoggerOptions, UserLogger } from './types.ts'\n\nexport function defineLogger<Options extends LoggerOptions = LoggerOptions>(logger: UserLogger<Options>): Logger<Options> {\n return {\n ...logger,\n }\n}\n","import type { PluginFactoryOptions, UserPluginWithLifeCycle } from './types.ts'\n\ntype PluginBuilder<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>\n\n/**\n * Wraps a plugin builder to make the options parameter optional.\n */\nexport function definePlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(\n build: PluginBuilder<T>,\n): (options?: T['options']) => UserPluginWithLifeCycle<T> {\n return (options) => build(options ?? ({} as T['options']))\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport * as pkg from 'empathic/package'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/index.ts'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n const lastChar = directory[directory.length - 1]\n if (lastChar && !this.#SLASHES.has(lastChar)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() === 'win32') {\n location = pathToFileURL(location).href\n }\n\n const module = await import(location)\n\n return module?.default ?? module\n } catch (error) {\n console.error(error)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...(packageJSON['dependencies'] || {}),\n ...(packageJSON['devDependencies'] || {}),\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport type { KubbEvents } from './Kubb.ts'\nimport type { PluginManager } from './PluginManager.ts'\nimport type { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\ndeclare global {\n namespace Kubb {\n interface PluginContext {}\n }\n}\n\n/**\n * Config used in `kubb.config.ts`\n *\n * @example\n * import { defineConfig } from '@kubb/core'\n * export default defineConfig({\n * ...\n * })\n */\nexport type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root?: string\n /**\n * An array of Kubb plugins used for generation. Each plugin may have additional configurable options (defined within the plugin itself). If a plugin relies on another plugin, an error will occur if the required dependency is missing. Refer to “pre” for more details.\n */\n // inject needs to be omitted because else we have a clash with the PluginManager instance\n plugins?: Array<Omit<UnknownUserPlugin, 'inject'>>\n}\n\nexport type InputPath = {\n /**\n * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.\n */\n path: string\n}\n\nexport type InputData = {\n /**\n * A `string` or `object` that contains your Swagger/OpenAPI data.\n */\n data: string | unknown\n}\n\ntype Input = InputPath | InputData | Array<InputPath>\n\nexport type BarrelType = 'all' | 'named' | 'propagate'\n\n/**\n * @private\n */\nexport type Config<TInput = Input> = {\n /**\n * The name to display in the CLI output.\n */\n name?: string\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root: string\n /**\n * You can use either `input.path` or `input.data`, depending on your specific needs.\n */\n input: TInput\n output: {\n /**\n * The path where all generated files receives exported.\n * This can be an absolute path or a path relative to the specified root option.\n */\n path: string\n /**\n * Clean the output directory before each build.\n */\n clean?: boolean\n /**\n * Save files to the file system.\n * @default true\n */\n write?: boolean\n /**\n * Specifies the formatting tool to be used.\n * - 'auto' automatically detects and uses biome or prettier (in that order of preference).\n * - 'prettier' uses Prettier for code formatting.\n * - 'biome' uses Biome for code formatting.\n * - 'oxfmt' uses Oxfmt for code formatting.\n * - false disables code formatting.\n * @default 'prettier'\n */\n format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false\n /**\n * Specifies the linter that should be used to analyze the code.\n * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).\n * - 'eslint' uses ESLint for linting.\n * - 'biome' uses Biome for linting.\n * - 'oxlint' uses Oxlint for linting.\n * - false disables linting.\n * @default 'auto'\n */\n lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false\n /**\n * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.\n * @default { '.ts': '.ts'}\n */\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n /**\n * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).\n * @default 'named'\n */\n barrelType?: Exclude<BarrelType, 'propagate'> | false\n /**\n * Adds a default banner to the start of every generated file indicating it was generated by Kubb.\n * - 'simple' adds banner with link to Kubb.\n * - 'full' adds source, title, description, and OpenAPI version.\n * - false disables banner generation.\n * @default 'simple'\n */\n defaultBanner?: 'simple' | 'full' | false\n /**\n * Whether to override existing external files if they already exist.\n * When setting the option in the global configuration, all plugins inherit the same behavior by default.\n * However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.\n * @default false\n */\n override?: boolean\n }\n /**\n * An array of Kubb plugins that used in the generation.\n * Each plugin may include additional configurable options(defined in the plugin itself).\n * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.\n */\n plugins?: Array<Plugin>\n /**\n * Hooks triggered when a specific action occurs in Kubb.\n */\n hooks?: {\n /**\n * Hook that triggers at the end of all executions.\n * Useful for running Prettier or ESLint to format/lint your code.\n */\n done?: string | Array<string>\n }\n}\n\n// plugin\n\nexport type PluginFactoryOptions<\n /**\n * Name to be used for the plugin, this will also be used for they key.\n */\n TName extends string = string,\n /**\n * Options of the plugin.\n */\n TOptions extends object = object,\n /**\n * Options of the plugin that can be used later on, see `options` inside your plugin config.\n */\n TResolvedOptions extends object = TOptions,\n /**\n * Context that you want to expose to other plugins.\n */\n TContext = any,\n /**\n * When calling `resolvePath` you can specify better types.\n */\n TResolvePathOptions extends object = object,\n> = {\n name: TName\n /**\n * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`\n */\n key: PluginKey<TName | string>\n options: TOptions\n resolvedOptions: TResolvedOptions\n context: TContext\n resolvePathOptions: TResolvePathOptions\n}\n\nexport type PluginKey<TName> = [name: TName, identifier?: string | number]\n\nexport type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never\n\nexport type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>\n\ntype UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>\n\nexport type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Internal key used when a developer uses more than one of the same plugin\n * @private\n */\n key: TOptions['key']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n\n install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).\n */\n inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>\n\nexport type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Start of the lifecycle of a plugin.\n * @type hookParallel\n */\n install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).\n * Options can als be included.\n * @type hookFirst\n * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'\n */\n resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path\n /**\n * Resolve to a name based on a string.\n * Useful when converting to PascalCase or camelCase.\n * @type hookFirst\n * @example ('pet') => 'Pet'\n */\n resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n}\n\nexport type PluginLifecycleHooks = keyof PluginLifecycle\n\nexport type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>\n\nexport type ResolvePathParams<TOptions = object> = {\n pluginKey?: Plugin['key']\n baseName: KubbFile.BaseName\n mode?: KubbFile.Mode\n /**\n * Options to be passed to 'resolvePath' 3th parameter\n */\n options?: TOptions\n}\n\nexport type ResolveNameParams = {\n name: string\n pluginKey?: Plugin['key']\n /**\n * Specifies the type of entity being named.\n * - 'file' customizes the name of the created file (uses camelCase).\n * - 'function' customizes the exported function names (uses camelCase).\n * - 'type' customizes TypeScript types (uses PascalCase).\n * - 'const' customizes variable names (uses camelCase).\n * @default undefined\n */\n type?: 'file' | 'function' | 'type' | 'const'\n}\n\nexport type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n fabric: Fabric\n config: Config\n pluginManager: PluginManager\n /**\n * Only add when the file does not exist yet\n */\n addFile: (...file: Array<KubbFile.File>) => Promise<void>\n /**\n * merging multiple sources into the same output file\n */\n upsertFile: (...file: Array<KubbFile.File>) => Promise<void>\n events: AsyncEventEmitter<KubbEvents>\n mode: KubbFile.Mode\n /**\n * Current plugin\n */\n plugin: Plugin<TOptions>\n} & Kubb.PluginContext\n/**\n * Specify the export location for the files and define the behavior of the output\n */\nexport type Output<TOptions> = {\n /**\n * Path to the output folder or file that will contain the generated code\n */\n path: string\n /**\n * Define what needs to be exported, here you can also disable the export of barrel files\n * @default 'named'\n */\n barrelType?: BarrelType | false\n /**\n * Add a banner text in the beginning of every file\n */\n banner?: string | ((options: TOptions) => string)\n /**\n * Add a footer text in the beginning of every file\n */\n footer?: string | ((options: TOptions) => string)\n /**\n * Whether to override existing external files if they already exist.\n * @default false\n */\n override?: boolean\n}\n\ntype GroupContext = {\n group: string\n}\n\nexport type Group = {\n /**\n * Defines the type where to group the files.\n * - 'tag' groups files by OpenAPI tags.\n * - 'path' groups files by OpenAPI paths.\n * @default undefined\n */\n type: 'tag' | 'path'\n /**\n * Return the name of a group based on the group name, this used for the file and name generation\n */\n name?: (context: GroupContext) => string\n}\n\nexport const LogLevel = {\n silent: Number.NEGATIVE_INFINITY,\n error: 0,\n warn: 1,\n info: 3,\n verbose: 4,\n debug: 5,\n} as const\n\nexport type LoggerOptions = {\n /**\n * @default 3\n */\n logLevel: (typeof LogLevel)[keyof typeof LogLevel]\n}\n\n/**\n * Shared context passed to all plugins, parsers, and Fabric internals.\n */\nexport interface LoggerContext extends AsyncEventEmitter<KubbEvents> {}\n\ntype Install<TOptions = unknown> = (context: LoggerContext, options?: TOptions) => void | Promise<void>\n\nexport type Logger<TOptions extends LoggerOptions = LoggerOptions> = {\n name: string\n install: Install<TOptions>\n}\n\nexport type UserLogger<TOptions extends LoggerOptions = LoggerOptions> = Omit<Logger<TOptions>, 'logLevel'>\n\nexport type { KubbEvents } from './Kubb.ts'\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,IAAsB,gBAAtB,MAA4E;CAC1E,WAAqB,EAAE;CACvB,WAAqB,EAAE;CAEvB,YAAY,SAAoB,SAAoB;AAClD,MAAI,QACF,OAAKA,UAAW;AAGlB,MAAI,QACF,OAAKC,UAAW;AAGlB,SAAO;;CAGT,IAAI,UAAoB;AACtB,SAAO,MAAKA;;CAGd,IAAI,UAAoB;AACtB,SAAO,MAAKD;;CAGd,IAAI,QAAQ,SAAmB;AAC7B,QAAKC,UAAW;GAAE,GAAG,MAAKA;GAAU,GAAG;GAAS;;;;;;;;;;;;;;;;;;;;ACWpD,SAAgB,aACd,QACe;AACf,QAAO;;;;;AAMT,SAAgB,YAAY,QAAiE;AAC3F,QAAO,OAAO,QAAQ,UAAU,YAAY,OAAO,UAAU,QAAQ,UAAU,OAAO;;;;;;;;;;;;AE5CxF,SAAgB,oBAAoB;AAClC,QAAO;EACL;EACA;EACA,UAAU,QAAQ;EAClB,MAAM,QAAQ;EACd,KAAK,QAAQ,KAAK;EACnB;;;;;ACyBH,eAAsB,MAAM,SAA6C;CACvE,MAAM,EAAE,QAAQ,YAAY,SAAS,IAAI,mBAA+B,KAAK;CAE7E,MAAM,0BAAsC,IAAI,KAA4B;CAC5E,MAAM,iBAAiB,mBAAmB;AAE1C,KAAI,MAA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AO,YAC1D,QAAO,gBAAeA,MAAO;EAG/B,MAAM,cAAc,KAAK,oBAAoB;AAE7C,MAAI,CAAC,YACH;AAGF,SAAO,MAAKG,MAAO,aAAa,WAAW;;CAG7C,MAAM,QAAQ,YAAqC,SAA8C;EAC/F,MAAM,iBAAiB,MAAM,KAAK,WAAW,WAAW;AAExD,MAAI,CAAC,eACH,QAAO;AAGT,MAAI,mBAAmB,QACrB,QAAO;EAGT,MAAM,SAAS,OAAO,eAAe;AAErC,MAAI,CAAC,OACH,QAAO;AAGT,SAAO,UAAU,QAAQ,QAAQ;;CAEnC,YAAY,YAAqC,SAAqC;EACpF,MAAM,iBAAiB,KAAK,eAAe,WAAW;AAEtD,MAAI,CAAC,eACH,QAAO;AAGT,MAAI,mBAAmB,QACrB,QAAO;EAGT,MAAM,SAAS,OAAO,eAAe;AAErC,MAAI,CAAC,OACH,QAAO;AAGT,SAAO,UAAU,QAAQ,QAAQ;;;;;;ACmLrC,MAAa,WAAW;CACtB,QAAQ,OAAO;CACf,OAAO;CACP,MAAM;CACN,MAAM;CACN,SAAS;CACT,OAAO;CACR"}
1
+ {"version":3,"file":"index.js","names":["#context","#options","#cache","#cwd","#SLASHES","#match"],"sources":["../src/BaseGenerator.ts","../src/config.ts","../package.json","../src/utils/diagnostics.ts","../src/build.ts","../src/defineLogger.ts","../src/definePlugin.ts","../src/PackageManager.ts","../src/types.ts"],"sourcesContent":["/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import type { InputPath, UserConfig } from './types.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /** Path to `kubb.config.js` */\n config?: string\n\n /** Enable watch mode for input files */\n watch?: boolean\n\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n\n /** Run Kubb with Bun */\n bun?: boolean\n}\n/**\n * Helper for defining a Kubb configuration.\n *\n * Accepts either:\n * - A config object or array of configs\n * - A function returning the config(s), optionally async,\n * receiving the CLI options as argument\n *\n * @example\n * export default defineConfig(({ logLevel }) => ({\n * root: 'src',\n * plugins: [myPlugin()],\n * }))\n */\nexport function defineConfig(\n config: PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>),\n): typeof config {\n return config\n}\n\n/**\n * Type guard to check if a given config has an `input.path`.\n */\nexport function isInputPath(config: UserConfig | undefined): config is UserConfig<InputPath> {\n return typeof config?.input === 'object' && config.input !== null && 'path' in config.input\n}\n","","import { version as nodeVersion } from 'node:process'\nimport { version as KubbVersion } from '../../package.json'\n\n/**\n * Get diagnostic information for debugging\n */\nexport function getDiagnosticInfo() {\n return {\n nodeVersion,\n KubbVersion,\n platform: process.platform,\n arch: process.arch,\n cwd: process.cwd(),\n } as const\n}\n","import { resolve } from 'node:path'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport { createFabric } from '@kubb/react-fabric'\nimport { typescriptParser } from '@kubb/react-fabric/parsers'\nimport { fsPlugin } from '@kubb/react-fabric/plugins'\nimport { isInputPath } from './config.ts'\nimport { BuildError } from './errors.ts'\nimport { clean, exists, getRelativePath, write } from './fs/index.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport type { Config, KubbEvents, Output, Plugin, UserConfig } from './types.ts'\nimport { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport { getDiagnosticInfo } from './utils/diagnostics.ts'\nimport { formatMs, getElapsedMs } from './utils/formatHrtime.ts'\nimport { URLPath } from './utils/URLPath.ts'\n\ntype BuildOptions = {\n config: UserConfig\n events?: AsyncEventEmitter<KubbEvents>\n}\n\ntype BuildOutput = {\n failedPlugins: Set<{ plugin: Plugin; error: Error }>\n fabric: Fabric\n files: Array<KubbFile.ResolvedFile>\n pluginManager: PluginManager\n pluginTimings: Map<string, number>\n error?: Error\n sources: Map<KubbFile.Path, string>\n}\n\ntype SetupResult = {\n events: AsyncEventEmitter<KubbEvents>\n fabric: Fabric\n pluginManager: PluginManager\n sources: Map<KubbFile.Path, string>\n}\n\nexport async function setup(options: BuildOptions): Promise<SetupResult> {\n const { config: userConfig, events = new AsyncEventEmitter<KubbEvents>() } = options\n\n const sources: Map<KubbFile.Path, string> = new Map<KubbFile.Path, string>()\n const diagnosticInfo = getDiagnosticInfo()\n\n if (Array.isArray(userConfig.input)) {\n await events.emit('warn', 'This feature is still under development — use with caution')\n }\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n 'Configuration:',\n ` • Name: ${userConfig.name || 'unnamed'}`,\n ` • Root: ${userConfig.root || process.cwd()}`,\n ` • Output: ${userConfig.output?.path || 'not specified'}`,\n ` • Plugins: ${userConfig.plugins?.length || 0}`,\n 'Output Settings:',\n ` • Write: ${userConfig.output?.write !== false ? 'enabled' : 'disabled'}`,\n ` • Formatter: ${userConfig.output?.format || 'none'}`,\n ` • Linter: ${userConfig.output?.lint || 'none'}`,\n 'Environment:',\n Object.entries(diagnosticInfo)\n .map(([key, value]) => ` • ${key}: ${value}`)\n .join('\\n'),\n ],\n })\n\n try {\n if (isInputPath(userConfig) && !new URLPath(userConfig.input.path).isURL) {\n await exists(userConfig.input.path)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Input file validated: ${userConfig.input.path}`],\n })\n }\n } catch (caughtError) {\n if (isInputPath(userConfig)) {\n const error = caughtError as Error\n\n throw new Error(\n `Cannot read file/URL defined in \\`input.path\\` or set with \\`kubb generate PATH\\` in the CLI of your Kubb config ${userConfig.input.path}`,\n {\n cause: error,\n },\n )\n }\n }\n\n const definedConfig: Config = {\n root: userConfig.root || process.cwd(),\n ...userConfig,\n output: {\n write: true,\n barrelType: 'named',\n extension: {\n '.ts': '.ts',\n },\n defaultBanner: 'simple',\n ...userConfig.output,\n },\n plugins: userConfig.plugins as Config['plugins'],\n }\n\n if (definedConfig.output.clean) {\n await events.emit('debug', {\n date: new Date(),\n logs: ['Cleaning output directories', ` • Output: ${definedConfig.output.path}`],\n })\n await clean(definedConfig.output.path)\n }\n\n const fabric = createFabric()\n fabric.use(fsPlugin)\n fabric.use(typescriptParser)\n\n fabric.context.on('files:processing:start', (files) => {\n events.emit('files:processing:start', files)\n events.emit('debug', {\n date: new Date(),\n logs: [`Writing ${files.length} files...`],\n })\n })\n\n fabric.context.on('file:processing:update', async (params) => {\n const { file, source } = params\n await events.emit('file:processing:update', {\n ...params,\n config: definedConfig,\n source,\n })\n\n if (source) {\n if (definedConfig.output.write) {\n await write(file.path, source, { sanity: false })\n }\n\n sources.set(file.path, source)\n }\n })\n\n fabric.context.on('files:processing:end', async (files) => {\n await events.emit('files:processing:end', files)\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ File write process completed for ${files.length} files`],\n })\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [\n '✓ Fabric initialized',\n ` • File writing: ${definedConfig.output.write ? 'enabled' : 'disabled (dry-run)'}`,\n ` • Barrel type: ${definedConfig.output.barrelType || 'none'}`,\n ],\n })\n\n const pluginManager = new PluginManager(definedConfig, {\n fabric,\n events,\n concurrency: 15, // Increased from 5 to 15 for better parallel plugin execution\n })\n\n return {\n events,\n fabric,\n pluginManager,\n sources,\n }\n}\n\nexport async function build(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, files, pluginManager, failedPlugins, pluginTimings, error, sources } = await safeBuild(options, overrides)\n\n if (error) {\n throw error\n }\n\n if (failedPlugins.size > 0) {\n const errors = [...failedPlugins].map(({ error }) => error)\n\n throw new BuildError(`Build Error with ${failedPlugins.size} failed plugins`, { errors })\n }\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n error: undefined,\n sources,\n }\n}\n\nexport async function safeBuild(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput> {\n const { fabric, pluginManager, events, sources } = overrides ? overrides : await setup(options)\n\n const failedPlugins = new Set<{ plugin: Plugin; error: Error }>()\n // in ms\n const pluginTimings = new Map<string, number>()\n const config = pluginManager.config\n\n try {\n for (const plugin of pluginManager.plugins) {\n const context = pluginManager.getContext(plugin)\n const hrStart = process.hrtime()\n\n const installer = plugin.install.bind(context)\n\n try {\n const timestamp = new Date()\n\n await events.emit('plugin:start', plugin)\n\n await events.emit('debug', {\n date: timestamp,\n logs: ['Installing plugin...', ` • Plugin Key: [${plugin.key.join(', ')}]`],\n })\n\n await installer(context)\n\n const duration = getElapsedMs(hrStart)\n pluginTimings.set(plugin.name, duration)\n\n await events.emit('plugin:end', plugin, { duration, success: true })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Plugin installed successfully (${formatMs(duration)})`],\n })\n } catch (caughtError) {\n const error = caughtError as Error\n const errorTimestamp = new Date()\n const duration = getElapsedMs(hrStart)\n\n await events.emit('plugin:end', plugin, {\n duration,\n success: false,\n error,\n })\n\n await events.emit('debug', {\n date: errorTimestamp,\n logs: [\n '✗ Plugin installation failed',\n ` • Plugin Key: ${JSON.stringify(plugin.key)}`,\n ` • Error: ${error.constructor.name} - ${error.message}`,\n ' • Stack Trace:',\n error.stack || 'No stack trace available',\n ],\n })\n\n failedPlugins.add({ plugin, error })\n }\n }\n\n if (config.output.barrelType) {\n const root = resolve(config.root)\n const rootPath = resolve(root, config.output.path, 'index.ts')\n\n await events.emit('debug', {\n date: new Date(),\n logs: ['Generating barrel file', ` • Type: ${config.output.barrelType}`, ` • Path: ${rootPath}`],\n })\n\n const barrelFiles = fabric.files.filter((file) => {\n return file.sources.some((source) => source.isIndexable)\n })\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`Found ${barrelFiles.length} indexable files for barrel export`],\n })\n\n // Build a Map of plugin keys to plugins for efficient lookups\n const pluginKeyMap = new Map<string, Plugin>()\n for (const plugin of pluginManager.plugins) {\n pluginKeyMap.set(JSON.stringify(plugin.key), plugin)\n }\n\n const rootFile: KubbFile.File = {\n path: rootPath,\n baseName: 'index.ts',\n exports: barrelFiles\n .flatMap((file) => {\n const containsOnlyTypes = file.sources?.every((source) => source.isTypeOnly)\n\n return file.sources\n ?.map((source) => {\n if (!file.path || !source.isIndexable) {\n return undefined\n }\n\n // validate of the file is coming from plugin x, needs pluginKey on every file TODO update typing\n const meta = file.meta as any\n const plugin = meta?.pluginKey ? pluginKeyMap.get(JSON.stringify(meta.pluginKey)) : undefined\n const pluginOptions = plugin?.options as {\n output?: Output<any>\n }\n\n if (!pluginOptions || pluginOptions?.output?.barrelType === false) {\n return undefined\n }\n\n return {\n name: config.output.barrelType === 'all' ? undefined : [source.name],\n path: getRelativePath(rootPath, file.path),\n isTypeOnly: config.output.barrelType === 'all' ? containsOnlyTypes : source.isTypeOnly,\n } as KubbFile.Export\n })\n .filter(Boolean)\n })\n .filter(Boolean),\n sources: [],\n imports: [],\n meta: {},\n }\n\n await fabric.upsertFile(rootFile)\n\n await events.emit('debug', {\n date: new Date(),\n logs: [`✓ Generated barrel file (${rootFile.exports?.length || 0} exports)`],\n })\n }\n\n const files = [...fabric.files]\n\n await fabric.write({ extension: config.output.extension })\n\n return {\n failedPlugins,\n fabric,\n files,\n pluginManager,\n pluginTimings,\n sources,\n }\n } catch (error) {\n return {\n failedPlugins,\n fabric,\n files: [],\n pluginManager,\n pluginTimings,\n error: error as Error,\n sources,\n }\n }\n}\n","import type { Logger, LoggerOptions, UserLogger } from './types.ts'\n\nexport function defineLogger<Options extends LoggerOptions = LoggerOptions>(logger: UserLogger<Options>): Logger<Options> {\n return {\n ...logger,\n }\n}\n","import type { PluginFactoryOptions, UserPluginWithLifeCycle } from './types.ts'\n\ntype PluginBuilder<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>\n\n/**\n * Wraps a plugin builder to make the options parameter optional.\n */\nexport function definePlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(\n build: PluginBuilder<T>,\n): (options?: T['options']) => UserPluginWithLifeCycle<T> {\n return (options) => build(options ?? ({} as T['options']))\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport * as pkg from 'empathic/package'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/index.ts'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n const lastChar = directory[directory.length - 1]\n if (lastChar && !this.#SLASHES.has(lastChar)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() === 'win32') {\n location = pathToFileURL(location).href\n }\n\n const module = await import(location)\n\n return module?.default ?? module\n } catch (error) {\n console.error(error)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = pkg.up({\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...(packageJSON['dependencies'] || {}),\n ...(packageJSON['devDependencies'] || {}),\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n return false\n }\n\n return satisfies(semVer, version)\n }\n}\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Fabric } from '@kubb/react-fabric'\nimport type { KubbEvents } from './Kubb.ts'\nimport type { PluginManager } from './PluginManager.ts'\nimport type { AsyncEventEmitter } from './utils/AsyncEventEmitter.ts'\nimport type { PossiblePromise } from './utils/types.ts'\n\ndeclare global {\n namespace Kubb {\n interface PluginContext {}\n }\n}\n\n/**\n * Config used in `kubb.config.ts`\n *\n * @example\n * import { defineConfig } from '@kubb/core'\n * export default defineConfig({\n * ...\n * })\n */\nexport type UserConfig<TInput = Input> = Omit<Config<TInput>, 'root' | 'plugins'> & {\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root?: string\n /**\n * An array of Kubb plugins used for generation. Each plugin may have additional configurable options (defined within the plugin itself). If a plugin relies on another plugin, an error will occur if the required dependency is missing. Refer to “pre” for more details.\n */\n // inject needs to be omitted because else we have a clash with the PluginManager instance\n plugins?: Array<Omit<UnknownUserPlugin, 'inject'>>\n}\n\nexport type InputPath = {\n /**\n * Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.\n */\n path: string\n}\n\nexport type InputData = {\n /**\n * A `string` or `object` that contains your Swagger/OpenAPI data.\n */\n data: string | unknown\n}\n\ntype Input = InputPath | InputData | Array<InputPath>\n\nexport type BarrelType = 'all' | 'named' | 'propagate'\n\n/**\n * @private\n */\nexport type Config<TInput = Input> = {\n /**\n * The name to display in the CLI output.\n */\n name?: string\n /**\n * The project root directory, which can be either an absolute path or a path relative to the location of your `kubb.config.ts` file.\n * @default process.cwd()\n */\n root: string\n /**\n * You can use either `input.path` or `input.data`, depending on your specific needs.\n */\n input: TInput\n output: {\n /**\n * The path where all generated files receives exported.\n * This can be an absolute path or a path relative to the specified root option.\n */\n path: string\n /**\n * Clean the output directory before each build.\n */\n clean?: boolean\n /**\n * Save files to the file system.\n * @default true\n */\n write?: boolean\n /**\n * Specifies the formatting tool to be used.\n * - 'auto' automatically detects and uses biome or prettier (in that order of preference).\n * - 'prettier' uses Prettier for code formatting.\n * - 'biome' uses Biome for code formatting.\n * - 'oxfmt' uses Oxfmt for code formatting.\n * - false disables code formatting.\n * @default 'prettier'\n */\n format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false\n /**\n * Specifies the linter that should be used to analyze the code.\n * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).\n * - 'eslint' uses ESLint for linting.\n * - 'biome' uses Biome for linting.\n * - 'oxlint' uses Oxlint for linting.\n * - false disables linting.\n * @default 'auto'\n */\n lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false\n /**\n * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.\n * @default { '.ts': '.ts'}\n */\n extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>\n /**\n * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).\n * @default 'named'\n */\n barrelType?: Exclude<BarrelType, 'propagate'> | false\n /**\n * Adds a default banner to the start of every generated file indicating it was generated by Kubb.\n * - 'simple' adds banner with link to Kubb.\n * - 'full' adds source, title, description, and OpenAPI version.\n * - false disables banner generation.\n * @default 'simple'\n */\n defaultBanner?: 'simple' | 'full' | false\n /**\n * Whether to override existing external files if they already exist.\n * When setting the option in the global configuration, all plugins inherit the same behavior by default.\n * However, all plugins also have an `output.override` option, which can be used to override the behavior for a specific plugin.\n * @default false\n */\n override?: boolean\n }\n /**\n * An array of Kubb plugins that used in the generation.\n * Each plugin may include additional configurable options(defined in the plugin itself).\n * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.\n */\n plugins?: Array<Plugin>\n /**\n * Hooks triggered when a specific action occurs in Kubb.\n */\n hooks?: {\n /**\n * Hook that triggers at the end of all executions.\n * Useful for running Prettier or ESLint to format/lint your code.\n */\n done?: string | Array<string>\n }\n}\n\n// plugin\n\nexport type PluginFactoryOptions<\n /**\n * Name to be used for the plugin, this will also be used for they key.\n */\n TName extends string = string,\n /**\n * Options of the plugin.\n */\n TOptions extends object = object,\n /**\n * Options of the plugin that can be used later on, see `options` inside your plugin config.\n */\n TResolvedOptions extends object = TOptions,\n /**\n * Context that you want to expose to other plugins.\n */\n TContext = any,\n /**\n * When calling `resolvePath` you can specify better types.\n */\n TResolvePathOptions extends object = object,\n> = {\n name: TName\n /**\n * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`\n */\n key: PluginKey<TName | string>\n options: TOptions\n resolvedOptions: TResolvedOptions\n context: TContext\n resolvePathOptions: TResolvePathOptions\n}\n\nexport type PluginKey<TName> = [name: TName, identifier?: string | number]\n\nexport type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never\n\nexport type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>\n\ntype UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>\n\nexport type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: TOptions['name']\n /**\n * Internal key used when a developer uses more than one of the same plugin\n * @private\n */\n key: TOptions['key']\n /**\n * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.\n * Can be used to validate dependent plugins.\n */\n pre?: Array<string>\n /**\n * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.\n */\n post?: Array<string>\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options: TOptions['resolvedOptions']\n\n install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).\n */\n inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context']\n}\n\nexport type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>\n\nexport type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Start of the lifecycle of a plugin.\n * @type hookParallel\n */\n install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>\n /**\n * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).\n * Options can als be included.\n * @type hookFirst\n * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'\n */\n resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path\n /**\n * Resolve to a name based on a string.\n * Useful when converting to PascalCase or camelCase.\n * @type hookFirst\n * @example ('pet') => 'Pet'\n */\n resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n}\n\nexport type PluginLifecycleHooks = keyof PluginLifecycle\n\nexport type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>\n\nexport type ResolvePathParams<TOptions = object> = {\n pluginKey?: Plugin['key']\n baseName: KubbFile.BaseName\n mode?: KubbFile.Mode\n /**\n * Options to be passed to 'resolvePath' 3th parameter\n */\n options?: TOptions\n}\n\nexport type ResolveNameParams = {\n name: string\n pluginKey?: Plugin['key']\n /**\n * Specifies the type of entity being named.\n * - 'file' customizes the name of the created file (uses camelCase).\n * - 'function' customizes the exported function names (uses camelCase).\n * - 'type' customizes TypeScript types (uses PascalCase).\n * - 'const' customizes variable names (uses camelCase).\n * @default undefined\n */\n type?: 'file' | 'function' | 'type' | 'const'\n}\n\nexport type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n fabric: Fabric\n config: Config\n pluginManager: PluginManager\n /**\n * Only add when the file does not exist yet\n */\n addFile: (...file: Array<KubbFile.File>) => Promise<void>\n /**\n * merging multiple sources into the same output file\n */\n upsertFile: (...file: Array<KubbFile.File>) => Promise<void>\n events: AsyncEventEmitter<KubbEvents>\n mode: KubbFile.Mode\n /**\n * Current plugin\n */\n plugin: Plugin<TOptions>\n} & Kubb.PluginContext\n/**\n * Specify the export location for the files and define the behavior of the output\n */\nexport type Output<TOptions> = {\n /**\n * Path to the output folder or file that will contain the generated code\n */\n path: string\n /**\n * Define what needs to be exported, here you can also disable the export of barrel files\n * @default 'named'\n */\n barrelType?: BarrelType | false\n /**\n * Add a banner text in the beginning of every file\n */\n banner?: string | ((options: TOptions) => string)\n /**\n * Add a footer text in the beginning of every file\n */\n footer?: string | ((options: TOptions) => string)\n /**\n * Whether to override existing external files if they already exist.\n * @default false\n */\n override?: boolean\n}\n\ntype GroupContext = {\n group: string\n}\n\nexport type Group = {\n /**\n * Defines the type where to group the files.\n * - 'tag' groups files by OpenAPI tags.\n * - 'path' groups files by OpenAPI paths.\n * @default undefined\n */\n type: 'tag' | 'path'\n /**\n * Return the name of a group based on the group name, this used for the file and name generation\n */\n name?: (context: GroupContext) => string\n}\n\nexport const LogLevel = {\n silent: Number.NEGATIVE_INFINITY,\n error: 0,\n warn: 1,\n info: 3,\n verbose: 4,\n debug: 5,\n} as const\n\nexport type LoggerOptions = {\n /**\n * @default 3\n */\n logLevel: (typeof LogLevel)[keyof typeof LogLevel]\n}\n\n/**\n * Shared context passed to all plugins, parsers, and Fabric internals.\n */\nexport interface LoggerContext extends AsyncEventEmitter<KubbEvents> {}\n\ntype Install<TOptions = unknown> = (context: LoggerContext, options?: TOptions) => void | Promise<void>\n\nexport type Logger<TOptions extends LoggerOptions = LoggerOptions> = {\n name: string\n install: Install<TOptions>\n}\n\nexport type UserLogger<TOptions extends LoggerOptions = LoggerOptions> = Omit<Logger<TOptions>, 'logLevel'>\n\nexport type { KubbEvents } from './Kubb.ts'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,IAAsB,gBAAtB,MAA4E;CAC1E,WAAqB,EAAE;CACvB,WAAqB,EAAE;CAEvB,YAAY,SAAoB,SAAoB;AAClD,MAAI,QACF,OAAA,UAAgB;AAGlB,MAAI,QACF,OAAA,UAAgB;AAGlB,SAAO;;CAGT,IAAI,UAAoB;AACtB,SAAO,MAAA;;CAGT,IAAI,UAAoB;AACtB,SAAO,MAAA;;CAGT,IAAI,QAAQ,SAAmB;AAC7B,QAAA,UAAgB;GAAE,GAAG,MAAA;GAAe,GAAG;GAAS;;;;;;;;;;;;;;;;;;;ACWpD,SAAgB,aACd,QACe;AACf,QAAO;;;;;AAMT,SAAgB,YAAY,QAAiE;AAC3F,QAAO,OAAO,QAAQ,UAAU,YAAY,OAAO,UAAU,QAAQ,UAAU,OAAO;;;;;;;;;;AE5CxF,SAAgB,oBAAoB;AAClC,QAAO;EACL,aAAA;EACA,aAAA;EACA,UAAU,QAAQ;EAClB,MAAM,QAAQ;EACd,KAAK,QAAQ,KAAK;EACnB;;;;ACyBH,eAAsB,MAAM,SAA6C;CACvE,MAAM,EAAE,QAAQ,YAAY,SAAS,I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CAAC,YACH;AAGF,SAAO,MAAA,MAAY,aAAa,WAAW;;CAG7C,eAAe,YAAoE;AACjF,MAAI,OAAO,eAAe,YAAY,gBAAA,MAAsB,YAC1D,QAAO,gBAAA,MAAsB;EAG/B,MAAM,cAAc,KAAK,oBAAoB;AAE7C,MAAI,CAAC,YACH;AAGF,SAAO,MAAA,MAAY,aAAa,WAAW;;CAG7C,MAAM,QAAQ,YAAqC,SAA8C;EAC/F,MAAM,iBAAiB,MAAM,KAAK,WAAW,WAAW;AAExD,MAAI,CAAC,eACH,QAAO;AAGT,MAAI,mBAAmB,QACrB,QAAO;EAGT,MAAM,SAAS,OAAO,eAAe;AAErC,MAAI,CAAC,OACH,QAAO;AAGT,SAAO,UAAU,QAAQ,QAAQ;;CAEnC,YAAY,YAAqC,SAAqC;EACpF,MAAM,iBAAiB,KAAK,eAAe,WAAW;AAEtD,MAAI,CAAC,eACH,QAAO;AAGT,MAAI,mBAAmB,QACrB,QAAO;EAGT,MAAM,SAAS,OAAO,eAAe;AAErC,MAAI,CAAC,OACH,QAAO;AAGT,SAAO,UAAU,QAAQ,QAAQ;;;;;ACmLrC,MAAa,WAAW;CACtB,QAAQ,OAAO;CACf,OAAO;CACP,MAAM;CACN,MAAM;CACN,SAAS;CACT,OAAO;CACR"}
@@ -1,5 +1,5 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { E as PossiblePromise, S as UserConfig, f as Plugin, o as InputPath, t as BarrelType } from "./types-CiePC9Y3.js";
1
+ import { t as __name } from "./chunk--u3MIqq1.js";
2
+ import { E as PossiblePromise, S as UserConfig, f as Plugin, o as InputPath, t as BarrelType } from "./types-f_no0d7G.js";
3
3
  import { KubbFile } from "@kubb/fabric-core/types";
4
4
 
5
5
  //#region src/config.d.ts
@@ -79,4 +79,4 @@ interface PackageManagerInfo {
79
79
  declare function detectPackageManager(cwd?: string): PackageManagerInfo;
80
80
  //#endregion
81
81
  export { getBarrelFiles as a, isInputPath as c, FileMetaBase as i, PackageManagerName as n, CLIOptions as o, detectPackageManager as r, defineConfig as s, PackageManagerInfo as t };
82
- //# sourceMappingURL=packageManager-B7KCmp2R.d.ts.map
82
+ //# sourceMappingURL=packageManager-_7I0WFQU.d.ts.map