@kubb/core 2.4.0 → 2.5.0

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 (61) hide show
  1. package/dist/{chunk-OYDUQYAK.cjs → chunk-3J25BT5A.cjs} +15 -41
  2. package/dist/chunk-3J25BT5A.cjs.map +1 -0
  3. package/dist/{chunk-HI4PB2AG.js → chunk-DJBEBMX6.js} +10 -36
  4. package/dist/chunk-DJBEBMX6.js.map +1 -0
  5. package/dist/chunk-GLL5G5KY.js +30 -0
  6. package/dist/chunk-GLL5G5KY.js.map +1 -0
  7. package/dist/{chunk-BRWCAKW5.cjs → chunk-LDKM6T7X.cjs} +4 -4
  8. package/dist/{chunk-65OHDKQD.cjs → chunk-N7XIQXXQ.cjs} +28 -5
  9. package/dist/chunk-N7XIQXXQ.cjs.map +1 -0
  10. package/dist/{chunk-JSJ3NRBQ.cjs → chunk-SSD2TXQZ.cjs} +51 -32
  11. package/dist/chunk-SSD2TXQZ.cjs.map +1 -0
  12. package/dist/{chunk-37XMXECQ.js → chunk-STP2UI5Q.js} +2 -2
  13. package/dist/{chunk-V6AVJEQC.js → chunk-W3NDP3K4.js} +52 -34
  14. package/dist/chunk-W3NDP3K4.js.map +1 -0
  15. package/dist/index.cjs +47 -47
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +54 -56
  18. package/dist/index.d.ts +54 -56
  19. package/dist/index.js +19 -20
  20. package/dist/index.js.map +1 -1
  21. package/dist/logger-wryz32Ex.d.cts +44 -0
  22. package/dist/logger-wryz32Ex.d.ts +44 -0
  23. package/dist/logger.cjs +5 -5
  24. package/dist/logger.d.cts +2 -32
  25. package/dist/logger.d.ts +2 -32
  26. package/dist/logger.js +1 -1
  27. package/dist/mocks.cjs +7 -13
  28. package/dist/mocks.cjs.map +1 -1
  29. package/dist/mocks.d.cts +1 -1
  30. package/dist/mocks.d.ts +1 -1
  31. package/dist/mocks.js +6 -12
  32. package/dist/mocks.js.map +1 -1
  33. package/dist/transformers.cjs +10 -5
  34. package/dist/transformers.cjs.map +1 -1
  35. package/dist/transformers.d.cts +13 -3
  36. package/dist/transformers.d.ts +13 -3
  37. package/dist/transformers.js +4 -3
  38. package/dist/transformers.js.map +1 -1
  39. package/dist/utils.cjs +4 -4
  40. package/dist/utils.js +2 -2
  41. package/package.json +3 -3
  42. package/src/FileManager.ts +2 -2
  43. package/src/PluginManager.ts +39 -39
  44. package/src/build.ts +11 -13
  45. package/src/config.ts +5 -5
  46. package/src/index.ts +3 -15
  47. package/src/kubb.ts +11 -0
  48. package/src/logger.ts +37 -37
  49. package/src/plugin.ts +5 -5
  50. package/src/transformers/casing.ts +33 -5
  51. package/src/transformers/index.ts +3 -2
  52. package/src/types.ts +23 -23
  53. package/dist/chunk-65OHDKQD.cjs.map +0 -1
  54. package/dist/chunk-HI4PB2AG.js.map +0 -1
  55. package/dist/chunk-JSJ3NRBQ.cjs.map +0 -1
  56. package/dist/chunk-MASAFU3G.js +0 -15
  57. package/dist/chunk-MASAFU3G.js.map +0 -1
  58. package/dist/chunk-OYDUQYAK.cjs.map +0 -1
  59. package/dist/chunk-V6AVJEQC.js.map +0 -1
  60. /package/dist/{chunk-37XMXECQ.js.map → chunk-LDKM6T7X.cjs.map} +0 -0
  61. /package/dist/{chunk-BRWCAKW5.cjs.map → chunk-STP2UI5Q.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js","../../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js"],"names":["path","fileURLToPath","toPath","fs","fsPromises","require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAiE;AAC3F,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,eACA,QACA,SACwB;AACxB,SAAO;AACT;AAEA,eAAe,MAAM,SAA+C;AAClE,QAAM,EAAE,QAAQ,SAAS,aAAa,EAAE,UAAU,SAAS,OAAO,CAAC,EAAE,IAAI;AACzE,MAAI,QAAQ;AAEZ,MAAI;AACF,QAAI,YAAY,MAAM,KAAK,CAAC,IAAI,QAAQ,OAAO,MAAM,IAAI,EAAE,OAAO;AAChE,YAAM,KAAK,OAAO,MAAM,IAAI;AAAA,IAC9B;AAAA,EACF,SAAS,GAAG;AACV,QAAI,YAAY,MAAM,GAAG;AACvB,YAAM,IAAI;AAAA,QACR,kHAAkH,EAAE,IAAI,OAAO,MAAM,IAAI;AAAA,QACzI;AAAA,UACE,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO,OAAO,OAAO;AACvB,UAAM,MAAM,OAAO,OAAO,IAAI;AAAA,EAChC;AAEA,QAAM,OAAO,OAAO,SAAgE;AAClF,UAAM,EAAE,MAAAA,MAAK,IAAI;AAEjB,QAAI,SAAwB,YAAY,UAAU,IAAI;AAEtD,UAAM,EAAE,QAAQ,aAAa,IAAI,MAAM,cAAc,UAAU;AAAA,MAC7D,UAAU;AAAA,MACV,YAAY,CAACA,KAAI;AAAA,IACnB,CAAC;AACD,QAAI,gBAAgB,UAAU,YAAY,GAAG;AAC3C,eAAS,MAAM;AAAA,IACjB;AACA,QAAI,gBAAgB,CAAC,UAAU,YAAY,GAAG;AAC5C,eAAS;AAAA,IACX;AAEA,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K,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AJQP,IAAO,cAAQ","sourcesContent":["import { build } from './build.ts'\n\nimport type { ObjValueTuple, TupleToUnion } from '@kubb/types'\n\nexport { build, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type * from './types.ts'\n\nexport interface _Register {}\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n\nexport default build\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { KubbPlugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: KubbPlugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\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 ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile' && logger.spinner) {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.debug(`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`)\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && count === 0) {\n logger.spinner?.start(`💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.debug(logs.join('\\n'))\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info && logger.spinner) {\n logger.spinner.suffixText = ''\n logger.spinner.succeed(`💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info && logger.spinner) {\n logger.spinner.suffixText = ''\n logger.spinner.succeed(`💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, InputPath, KubbConfig, KubbUserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link KubbConfig} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: KubbConfig | undefined): result is KubbConfig<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\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 Generator<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 mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\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 if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\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 = findUpSync(['package.json'], {\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 throw new Error(`${packageVersion} is not valid`)\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 const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import path from 'node:path';\nimport {locatePath, locatePathSync} from 'locate-path';\nimport {toPath} from 'unicorn-magic';\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt ?? root));\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt) ?? root);\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","import pLimit from 'p-limit';\n\nclass EndError extends Error {\n\tconstructor(value) {\n\t\tsuper();\n\t\tthis.value = value;\n\t}\n}\n\n// The input can also be a promise, so we await it.\nconst testElement = async (element, tester) => tester(await element);\n\n// The input can also be a promise, so we `Promise.all()` them both.\nconst finder = async element => {\n\tconst values = await Promise.all(element);\n\tif (values[1] === true) {\n\t\tthrow new EndError(values[0]);\n\t}\n\n\treturn false;\n};\n\nexport default async function pLocate(\n\titerable,\n\ttester,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tpreserveOrder = true,\n\t} = {},\n) {\n\tconst limit = pLimit(concurrency);\n\n\t// Start all the promises concurrently with optional limit.\n\tconst items = [...iterable].map(element => [element, limit(testElement, element, tester)]);\n\n\t// Check the promises either serially or concurrently.\n\tconst checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);\n\n\ttry {\n\t\tawait Promise.all(items.map(element => checkLimit(finder, element)));\n\t} catch (error) {\n\t\tif (error instanceof EndError) {\n\t\t\treturn error.value;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (fn, resolve, args) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => fn(...args))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (fn, resolve, args) => {\n\t\tqueue.enqueue(run.bind(undefined, fn, resolve, args));\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (fn, ...args) => new Promise(resolve => {\n\t\tenqueue(fn, resolve, args);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue: () => {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import {fileURLToPath} from 'node:url';\n\nexport function toPath(urlOrPath) {\n\treturn urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n}\n\nexport * from './default.js';\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js","../../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js","../src/kubb.ts"],"names":["path","fileURLToPath","toPath","fs","fsPromises","require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAyD;AACnF,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,eACA,QACA,SACwB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AC,gBAAgB;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,mBAAmB,SAAS;AAC9B,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AAAA,EACA,YAAY,YAAqC,SAAqC;AACpF,UAAM,iBAAiB,KAAK,eAAe,UAAU;AAErD,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA,IACT;AACA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AApKS;AAEP;AACA;AAqFA;AAAA,WAAM,SAAC,aAA0B,YAAyD;AACxF,QAAM,eAAe;AAAA,IACnB,GAAG,YAAY,cAAc,KAAK,CAAC;AAAA,IACnC,GAAG,YAAY,iBAAiB,KAAK,CAAC;AAAA,EACxC;AAEA,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AQlBP;AAAA","sourcesContent":["export { build, build as default, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type { CLIOptions, Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams, UserConfig } from './types.ts'\n\nexport interface _Register {}\n\nexport * as Kubb from './kubb.ts'\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { Plugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: Plugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\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 ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile') {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.emit('debug', [`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`])\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (count === 0) {\n logger.emit('start', `💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.emit('debug', logs as string[])\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, Config, InputPath, UserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link Config} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<UserConfig | Array<UserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<UserConfig | Array<UserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: Config | undefined): result is Config<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\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 Generator<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 mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\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 if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\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 = findUpSync(['package.json'], {\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 throw new Error(`${packageVersion} is not valid`)\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 const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import path from 'node:path';\nimport {locatePath, locatePathSync} from 'locate-path';\nimport {toPath} from 'unicorn-magic';\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt ?? root));\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt) ?? root);\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","import pLimit from 'p-limit';\n\nclass EndError extends Error {\n\tconstructor(value) {\n\t\tsuper();\n\t\tthis.value = value;\n\t}\n}\n\n// The input can also be a promise, so we await it.\nconst testElement = async (element, tester) => tester(await element);\n\n// The input can also be a promise, so we `Promise.all()` them both.\nconst finder = async element => {\n\tconst values = await Promise.all(element);\n\tif (values[1] === true) {\n\t\tthrow new EndError(values[0]);\n\t}\n\n\treturn false;\n};\n\nexport default async function pLocate(\n\titerable,\n\ttester,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tpreserveOrder = true,\n\t} = {},\n) {\n\tconst limit = pLimit(concurrency);\n\n\t// Start all the promises concurrently with optional limit.\n\tconst items = [...iterable].map(element => [element, limit(testElement, element, tester)]);\n\n\t// Check the promises either serially or concurrently.\n\tconst checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);\n\n\ttry {\n\t\tawait Promise.all(items.map(element => checkLimit(finder, element)));\n\t} catch (error) {\n\t\tif (error instanceof EndError) {\n\t\t\treturn error.value;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (fn, resolve, args) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => fn(...args))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (fn, resolve, args) => {\n\t\tqueue.enqueue(run.bind(undefined, fn, resolve, args));\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (fn, ...args) => new Promise(resolve => {\n\t\tenqueue(fn, resolve, args);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue: () => {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import {fileURLToPath} from 'node:url';\n\nexport function toPath(urlOrPath) {\n\treturn urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n}\n\nexport * from './default.js';\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import type { ObjValueTuple, TupleToUnion } from '@kubb/types'\nimport type { _Register } from './index.ts'\n\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n"]}
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import PQueue from 'p-queue';
2
2
  import { w as write, r as read } from './write-A6VgHkYA.cjs';
3
- import { PossiblePromise, GreaterThan, TupleToUnion, ObjValueTuple } from '@kubb/types';
3
+ import { TupleToUnion, ObjValueTuple, PossiblePromise, GreaterThan } from '@kubb/types';
4
4
  import { DirectoryTreeOptions } from 'directory-tree';
5
- import { Logger, LogLevel } from './logger.cjs';
5
+ import { E as EventEmitter, L as Logger, a as LogLevel } from './logger-wryz32Ex.cjs';
6
6
  import 'ora';
7
7
 
8
8
  type BarrelManagerOptions = {
@@ -14,13 +14,20 @@ type BarrelManagerOptions = {
14
14
  extName?: KubbFile.Extname;
15
15
  };
16
16
 
17
- declare class EventEmitter<TEvents extends Record<string, any>> {
18
- #private;
19
- constructor();
20
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
21
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
22
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
23
- removeAll(): void;
17
+ type Plugins = _Register;
18
+ type OptionsPlugins = {
19
+ [K in keyof Plugins]: Plugins[K]['options'];
20
+ };
21
+ type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
22
+ type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
23
+ type Plugin$1 = keyof Plugins;
24
+
25
+ type kubb_OptionsOfPlugin<K extends keyof Plugins> = OptionsOfPlugin<K>;
26
+ type kubb_OptionsPlugins = OptionsPlugins;
27
+ type kubb_PluginUnion = PluginUnion;
28
+ type kubb_Plugins = Plugins;
29
+ declare namespace kubb {
30
+ export type { kubb_OptionsOfPlugin as OptionsOfPlugin, kubb_OptionsPlugins as OptionsPlugins, Plugin$1 as Plugin, kubb_PluginUnion as PluginUnion, kubb_Plugins as Plugins };
24
31
  }
25
32
 
26
33
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
@@ -33,14 +40,14 @@ type Strategy$1 = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceAr
33
40
  type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
34
41
  strategy: Strategy$1;
35
42
  hookName: H;
36
- plugin: KubbPlugin;
43
+ plugin: Plugin;
37
44
  parameters?: unknown[] | undefined;
38
45
  output?: unknown;
39
46
  };
40
47
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
41
48
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
42
49
  result: Result;
43
- plugin: KubbPlugin;
50
+ plugin: Plugin;
44
51
  };
45
52
  type Options$2 = {
46
53
  logger: Logger;
@@ -56,14 +63,14 @@ type Events = {
56
63
  };
57
64
  declare class PluginManager {
58
65
  #private;
59
- readonly plugins: KubbPluginWithLifeCycle[];
66
+ readonly plugins: PluginWithLifeCycle[];
60
67
  readonly fileManager: FileManager;
61
68
  readonly events: EventEmitter<Events>;
62
- readonly config: KubbConfig;
69
+ readonly config: Config;
63
70
  readonly executed: Array<Executer>;
64
71
  readonly logger: Logger;
65
72
  readonly queue: PQueue;
66
- constructor(config: KubbConfig, options: Options$2);
73
+ constructor(config: Config, options: Options$2);
67
74
  resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
68
75
  resolveName: (params: ResolveNameParams) => string;
69
76
  /**
@@ -74,7 +81,7 @@ declare class PluginManager {
74
81
  * Run a specific hookName for plugin x.
75
82
  */
76
83
  hookForPlugin<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
77
- pluginKey: KubbPlugin['key'];
84
+ pluginKey: Plugin['key'];
78
85
  hookName: H;
79
86
  parameters: PluginParameter<H>;
80
87
  }): Promise<Array<ReturnType<ParseResult<H>> | null>> | null;
@@ -82,7 +89,7 @@ declare class PluginManager {
82
89
  * Run a specific hookName for plugin x.
83
90
  */
84
91
  hookForPluginSync<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
85
- pluginKey: KubbPlugin['key'];
92
+ pluginKey: Plugin['key'];
86
93
  hookName: H;
87
94
  parameters: PluginParameter<H>;
88
95
  }): Array<ReturnType<ParseResult<H>>> | null;
@@ -92,7 +99,7 @@ declare class PluginManager {
92
99
  hookFirst<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
93
100
  hookName: H;
94
101
  parameters: PluginParameter<H>;
95
- skipped?: ReadonlySet<KubbPlugin> | null;
102
+ skipped?: ReadonlySet<Plugin> | null;
96
103
  }): Promise<SafeParseResult<H>>;
97
104
  /**
98
105
  * First non-null result stops and will return it's value.
@@ -100,7 +107,7 @@ declare class PluginManager {
100
107
  hookFirstSync<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
101
108
  hookName: H;
102
109
  parameters: PluginParameter<H>;
103
- skipped?: ReadonlySet<KubbPlugin> | null;
110
+ skipped?: ReadonlySet<Plugin> | null;
104
111
  }): SafeParseResult<H>;
105
112
  /**
106
113
  * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
@@ -115,7 +122,7 @@ declare class PluginManager {
115
122
  hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
116
123
  hookName: H;
117
124
  parameters: PluginParameter<H>;
118
- reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise<Argument0<H> | null>;
125
+ reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: Plugin) => PossiblePromise<Argument0<H> | null>;
119
126
  }): Promise<Argument0<H>>;
120
127
  /**
121
128
  * Chains plugins
@@ -124,8 +131,8 @@ declare class PluginManager {
124
131
  hookName: H;
125
132
  parameters?: PluginParameter<H>;
126
133
  }): Promise<void>;
127
- getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: KubbPlugin['key']): KubbPlugin[];
128
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1: KubbPlugin<T1>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>, T3: KubbPlugin<T3>]>(plugins: Array<KubbPlugin>, dependedPluginNames: string | string[]): TOutput;
134
+ getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: Plugin['key']): Plugin[];
135
+ static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>] : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>]>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
129
136
  static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
130
137
  }
131
138
 
@@ -144,7 +151,7 @@ interface Cache<TStore extends object = object> {
144
151
  * ...
145
152
  * })
146
153
  */
147
- type KubbUserConfig = Omit<KubbConfig, 'root' | 'plugins'> & {
154
+ type UserConfig = Omit<Config, 'root' | 'plugins'> & {
148
155
  /**
149
156
  * Project root directory. Can be an absolute path, or a path relative from
150
157
  * the location of the config file itself.
@@ -152,11 +159,11 @@ type KubbUserConfig = Omit<KubbConfig, 'root' | 'plugins'> & {
152
159
  */
153
160
  root?: string;
154
161
  /**
155
- * Plugin type can be KubbJSONPlugin or KubbPlugin
162
+ * Plugin type can be KubbJSONPlugin or Plugin
156
163
  * Example: ['@kubb/swagger', { output: false }]
157
164
  * Or: createSwagger({ output: false })
158
165
  */
159
- plugins?: Array<Omit<UnknownKubbUserPlugin, 'api'> | KubbUnionPlugins | [name: string, options: object]>;
166
+ plugins?: Array<Omit<UnknownUserPlugin, 'api'> | UnionPlugins | [name: string, options: object]>;
160
167
  };
161
168
  type InputPath = {
162
169
  /**
@@ -174,7 +181,7 @@ type Input = InputPath | InputData;
174
181
  /**
175
182
  * @private
176
183
  */
177
- type KubbConfig<TInput = Input> = {
184
+ type Config<TInput = Input> = {
178
185
  /**
179
186
  * Optional config name to show in CLI output
180
187
  */
@@ -208,7 +215,7 @@ type KubbConfig<TInput = Input> = {
208
215
  * The plugin/package can forsee some options that you need to pass through.
209
216
  * Sometimes a plugin is depended on another plugin, if that's the case you will get an error back from the plugin you installed.
210
217
  */
211
- plugins?: Array<KubbPlugin>;
218
+ plugins?: Array<Plugin>;
212
219
  /**
213
220
  * Hooks that will be called when a specific action is triggered in Kubb.
214
221
  */
@@ -241,8 +248,7 @@ type CLIOptions = {
241
248
  */
242
249
  logLevel?: LogLevel;
243
250
  };
244
- type KubbUnionPlugins = PluginUnion;
245
- type KubbObjectPlugin = keyof OptionsPlugins;
251
+ type UnionPlugins = PluginUnion;
246
252
  type PluginFactoryOptions<
247
253
  /**
248
254
  * Name to be used for the plugin, this will also be used for they key.
@@ -280,11 +286,10 @@ TAppMeta = unknown> = {
280
286
  resolvePathOptions: TResolvePathOptions;
281
287
  appMeta: {
282
288
  pluginManager: PluginManager;
283
- plugin: KubbPlugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions, TAppMeta>>;
289
+ plugin: Plugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions, TAppMeta>>;
284
290
  } & TAppMeta;
285
291
  };
286
- type GetPluginFactoryOptions<TPlugin extends KubbUserPlugin> = TPlugin extends KubbUserPlugin<infer X> ? X : never;
287
- type KubbUserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
292
+ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
288
293
  /**
289
294
  * Unique name used for the plugin
290
295
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
@@ -309,9 +314,9 @@ type KubbUserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions
309
314
  } : {
310
315
  api: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['api'];
311
316
  });
312
- type KubbUserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = KubbUserPlugin<TOptions> & PluginLifecycle<TOptions>;
313
- type UnknownKubbUserPlugin = KubbUserPlugin<PluginFactoryOptions<any, any, any, any, any, any>>;
314
- type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
317
+ type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
318
+ type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any, any>>;
319
+ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
315
320
  /**
316
321
  * Unique name used for the plugin
317
322
  * @example @kubb/typescript
@@ -340,13 +345,13 @@ type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
340
345
  } : {
341
346
  api: TOptions['api'];
342
347
  });
343
- type KubbPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = KubbPlugin<TOptions> & PluginLifecycle<TOptions>;
348
+ type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
344
349
  type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
345
350
  /**
346
351
  * Start of the lifecycle of a plugin.
347
352
  * @type hookParallel
348
353
  */
349
- buildStart?: (this: PluginContext<TOptions>, kubbConfig: KubbConfig) => PossiblePromise<void>;
354
+ buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
350
355
  /**
351
356
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
352
357
  * Options can als be included.
@@ -386,7 +391,7 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
386
391
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
387
392
  type PluginCache = Record<string, [number, unknown]>;
388
393
  type ResolvePathParams<TOptions = object> = {
389
- pluginKey?: KubbPlugin['key'];
394
+ pluginKey?: Plugin['key'];
390
395
  baseName: string;
391
396
  directory?: string | undefined;
392
397
  /**
@@ -396,7 +401,7 @@ type ResolvePathParams<TOptions = object> = {
396
401
  };
397
402
  type ResolveNameParams = {
398
403
  name: string;
399
- pluginKey?: KubbPlugin['key'];
404
+ pluginKey?: Plugin['key'];
400
405
  /**
401
406
  * `file` will be used to customize the name of the created file(use of camelCase)
402
407
  * `function` can be used used to customize the exported functions(use of camelCase)
@@ -405,7 +410,7 @@ type ResolveNameParams = {
405
410
  type?: 'file' | 'function' | 'type';
406
411
  };
407
412
  type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
408
- config: KubbConfig;
413
+ config: Config;
409
414
  cache: Cache<PluginCache>;
410
415
  fileManager: FileManager;
411
416
  pluginManager: PluginManager;
@@ -416,11 +421,11 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
416
421
  /**
417
422
  * All plugins
418
423
  */
419
- plugins: KubbPlugin[];
424
+ plugins: Plugin[];
420
425
  /**
421
426
  * Current plugin
422
427
  */
423
- plugin: KubbPlugin<TOptions>;
428
+ plugin: Plugin<TOptions>;
424
429
  };
425
430
  type TransformResult = string | null;
426
431
 
@@ -496,7 +501,7 @@ declare namespace KubbFile {
496
501
  type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
497
502
  type OptionalPath = Path | undefined | null;
498
503
  type FileMetaBase = {
499
- pluginKey?: KubbPlugin['key'];
504
+ pluginKey?: Plugin['key'];
500
505
  };
501
506
  type File<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = {
502
507
  /**
@@ -605,13 +610,13 @@ declare function safeBuild(options: BuildOptions): Promise<BuildOutput>;
605
610
 
606
611
  /**
607
612
  * Type helper to make it easier to use kubb.config.js
608
- * accepts a direct {@link KubbConfig} object, or a function that returns it.
613
+ * accepts a direct {@link Config} object, or a function that returns it.
609
614
  * The function receives a {@link ConfigEnv} object that exposes two properties:
610
615
  */
611
- declare function defineConfig(options: PossiblePromise<KubbUserConfig | Array<KubbUserConfig>> | ((
616
+ declare function defineConfig(options: PossiblePromise<UserConfig | Array<UserConfig>> | ((
612
617
  /** The options derived from the CLI flags */
613
- cliOptions: CLIOptions) => PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>)): typeof options;
614
- declare function isInputPath(result: KubbConfig | undefined): result is KubbConfig<InputPath>;
618
+ cliOptions: CLIOptions) => PossiblePromise<UserConfig | Array<UserConfig>>)): typeof options;
619
+ declare function isInputPath(result: Config | undefined): result is Config<InputPath>;
615
620
 
616
621
  /**
617
622
  * Behaves as an Error to log a warning in the console(still stops the execution)
@@ -658,8 +663,8 @@ declare class PackageManager {
658
663
  isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean;
659
664
  }
660
665
 
661
- type KubbPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => KubbUserPluginWithLifeCycle<T>;
662
- declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: KubbPluginFactory<T>): (options: T['options']) => ReturnType<KubbPluginFactory<T>>;
666
+ type PluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>;
667
+ declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: PluginFactory<T>): (options: T['options']) => ReturnType<PluginFactory<T>>;
663
668
  declare const pluginName = "core";
664
669
 
665
670
  type PromiseFunc$1<T = unknown, T2 = never> = (state?: T) => T2 extends never ? Promise<T> : Promise<T> | T2;
@@ -682,12 +687,5 @@ declare class PromiseManager<TState = any> {
682
687
 
683
688
  interface _Register {
684
689
  }
685
- type Plugins = _Register;
686
- type OptionsPlugins = {
687
- [K in keyof Plugins]: Plugins[K]['options'];
688
- };
689
- type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
690
- type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
691
- type Plugin = keyof Plugins;
692
690
 
693
- export { type CLIOptions, FileManager, Generator, type GetPluginFactoryOptions, type InputData, type InputPath, type KubbConfig, KubbFile, type KubbObjectPlugin, type KubbPlugin, type KubbPluginWithLifeCycle, type KubbUnionPlugins, type KubbUserConfig, type KubbUserPlugin, type KubbUserPluginWithLifeCycle, type OptionsOfPlugin, type OptionsPlugins, PackageManager, type Plugin, type PluginCache, type PluginContext, type PluginFactoryOptions, type PluginLifecycle, type PluginLifecycleHooks, PluginManager, type PluginParameter, type PluginUnion, type Plugins, PromiseManager, type ResolveNameParams, type ResolvePathParams, type TransformResult, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
691
+ export { type CLIOptions, type Config, FileManager, Generator, kubb as Kubb, KubbFile, PackageManager, type Plugin, type PluginFactoryOptions, PluginManager, PromiseManager, type ResolveNameParams, type ResolvePathParams, type UserConfig, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };