@kubb/core 1.10.0-canary.20231007T144632 → 1.10.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.
- package/dist/index.cjs +62 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -14
- package/dist/index.d.ts +29 -14
- package/dist/index.js +60 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/managers/fileManager/FileManager.ts","../src/utils/isPromise.ts","../src/utils/write.ts","../src/utils/cache.ts","../src/utils/read.ts","../src/utils/createFunctionParams.ts","../src/utils/nameSorter.ts","../src/utils/jsdoc.ts","../src/utils/getUniqueName.ts","../src/utils/timeout.ts","../src/utils/Queue.ts","../src/utils/transformers/escape.ts","../src/utils/transformers/transformReservedWord.ts","../src/utils/transformers/combineCodes.ts","../src/utils/renderTemplate.ts","../src/utils/clean.ts","../src/utils/TreeNode.ts","../src/utils/uniqueIdFactory.ts","../src/utils/importModule.ts","../src/utils/throttle.ts","../src/utils/SummaryError.ts","../src/utils/Warning.ts","../src/utils/logger.ts","../src/utils/randomColour.ts","../src/utils/URLPath.ts","../src/managers/fileManager/utils.ts","../src/plugin.ts","../src/managers/pluginManager/ParallelPluginError.ts","../src/managers/pluginManager/PluginError.ts","../src/utils/EventEmitter.ts","../src/managers/pluginManager/pluginParser.ts","../src/managers/pluginManager/PluginManager.ts","../src/managers/pluginManager/validate.ts","../src/build.ts","../src/types.ts","../src/config.ts","../src/generators/Generator.ts","../src/generators/SchemaGenerator.ts","../src/index.ts"],"names":["crypto","pathParser","fs","switcher","require","timeout","default","pc","camelCase","camelCaseTransformMerge","files","name","pluginName","plugin"],"mappings":";AAAA,OAAOA,aAAY;;;ACEZ,SAAS,UAAa,QAAkD;AAC7E,SAAO,OAAQ,QAA6B,SAAS;AACvD;AAEO,SAAS,yBAAsC,QAA4E;AAChI,SAAO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AA,IAC7B;AAAA,EACF,CAAC;AAED,QAAM,cAAc,aAA+B;AAAA,IACjD,UAAU;AAAA,IACV,YAAY,CAAC,OAAO;AAAA,EACtB,CAAC;AAED,QAAM,cAAc,aAAa;AAAA,IAC/B,UAAU;AAAA,IACV,YAAY,CAAC,MAAM;AAAA,EACrB,CAAC;AAED,QAAM,cAAc,aAAa,EAAE,UAAU,WAAW,CAAC;AAEzD,SAAO,EAAE,OAAO,YAAY,MAAM,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,QAAQ,iBAAiB,IAAI,EAAE,EAAE,GAAG,cAAc;AAChH;;;AEjHO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;;;ACZO,IAAe,YAAf,MAA2D;AAAA,EACxD,WAAqB,CAAC;AAAA,EAE9B,YAAY,UAAoB,CAAC,GAAe;AAC9C,QAAI,SAAS;AACX,WAAK,WAAW;AAAA,QACd,GAAG,KAAK;AAAA,QACR,GAAG;AAAA,MACL;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,UAAoB;AACtB,WAAO,KAAK;AAAA,EACd;AAGF;;;ACjBO,IAAe,kBAAf,cAAiF,UAAoB;AAE5G;;;ACIA,IAAO,cAAQ","sourcesContent":["import crypto from 'node:crypto'\n\nimport { read, write } from '../../utils/index.ts'\nimport type { Extension } from './utils.ts'\nimport { extensions } from './utils.ts'\n\nimport type { Queue, QueueJob } from '../../utils/index.ts'\nimport type { File, ResolvedFile, CacheItem, UUID } from './types.ts'\nimport type { Path } from '../../types.ts'\n\nexport class FileManager {\n private cache: Map<Path, CacheItem[]> = new Map()\n\n private task?: QueueJob<ResolvedFile>\n\n private queue?: Queue\n\n constructor(options?: { queue?: Queue; task?: QueueJob<ResolvedFile> }) {\n if (options) {\n this.task = options.task\n this.queue = options.queue\n }\n }\n get extensions(): Extension[] {\n return extensions\n }\n\n get files(): File[] {\n const files: File[] = []\n this.cache.forEach((item) => {\n files.push(...item.flat(1))\n })\n\n return files\n }\n get isExecuting(): boolean {\n return this.queue?.hasJobs ?? false\n }\n\n async add(file: File): Promise<ResolvedFile> {\n const controller = new AbortController()\n const resolvedFile: ResolvedFile = { id: crypto.randomUUID(), ...file }\n\n this.cache.set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }])\n\n if (this.queue) {\n try {\n await this.queue.run(\n async () => {\n return this.task?.(resolvedFile)\n },\n { controller },\n )\n } catch {\n return resolvedFile\n }\n }\n\n return resolvedFile\n }\n\n addOrAppend(file: File): Promise<ResolvedFile> {\n // if (!file.path.endsWith(file.fileName)) {\n // console.warn(`Path ${file.path}(file.path) should end with the fileName ${file.fileName}(file.filename)`)\n // }\n\n const previousCaches = this.cache.get(file.path)\n const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : undefined\n\n if (previousCache) {\n this.cache.delete(previousCache.path)\n\n return this.add({\n ...file,\n source: previousCache.source && file.source ? `${previousCache.source}\\n${file.source}` : '',\n imports: [...(previousCache.imports || []), ...(file.imports || [])],\n exports: [...(previousCache.exports || []), ...(file.exports || [])],\n env: { ...(previousCache.env || {}), ...(file.env || {}) },\n })\n }\n return this.add(file)\n }\n\n private append(path: Path, file: ResolvedFile): void {\n const previousFiles = this.cache.get(path) || []\n\n this.cache.set(path, [...previousFiles, file])\n }\n\n getCacheByUUID(UUID: UUID): File | undefined {\n let cache: File | undefined\n\n this.cache.forEach((files) => {\n cache = files.find((item) => item.id === UUID)\n })\n return cache\n }\n\n get(path: Path): File[] | undefined {\n return this.cache.get(path)\n }\n\n remove(path: Path): void {\n const cacheItem = this.get(path)\n if (!cacheItem) {\n return\n }\n\n this.cache.delete(path)\n }\n\n async write(...params: Parameters<typeof write>): Promise<void> {\n if (this.queue) {\n return this.queue.run(async () => {\n return write(...params)\n })\n }\n\n return write(...params)\n }\n\n async read(...params: Parameters<typeof read>): Promise<string> {\n if (this.queue) {\n return this.queue.run(async () => {\n return read(...params)\n })\n }\n\n return read(...params)\n }\n}\n","import type { PossiblePromise } from '../types.ts'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","import fs from 'fs-extra'\nimport pathParser from 'node:path'\nimport { switcher } from 'js-runtime'\n\nasync function saveCreateDirectory(path: string): Promise<void> {\n // resolve the full path and get just the directory, ignoring the file and extension\n const passedPath = pathParser.dirname(pathParser.resolve(path))\n // make the directory, recursively. Theoretically, if every directory in the path exists, this won't do anything.\n await fs.mkdir(passedPath, { recursive: true })\n}\n\nconst writer = switcher(\n {\n node: async (path: string, data: string) => {\n try {\n await fs.stat(path)\n const oldContent = await fs.readFile(path, { encoding: 'utf-8' })\n if (oldContent?.toString() === data) {\n return\n }\n } catch (_err) {\n /* empty */\n }\n\n await saveCreateDirectory(path)\n return fs.writeFile(pathParser.resolve(path), data, { encoding: 'utf-8' })\n },\n bun: async (path: string, data: string) => {\n try {\n await saveCreateDirectory(path)\n\n await Bun.write(pathParser.resolve(path), data)\n } catch (e) {\n console.log(e, pathParser.resolve(path))\n }\n },\n },\n 'node',\n)\n\nexport async function write(data: string, path: string): Promise<void> {\n return writer(path, data)\n}\n","import type { PluginCache } from '../types'\n\nexport interface Cache<TStore extends object = object> {\n delete(id: keyof TStore): boolean\n get(id: keyof TStore): TStore[keyof TStore] | null\n has(id: keyof TStore): boolean\n set(id: keyof TStore, value: unknown): void\n}\n\nexport function createPluginCache<TStore extends PluginCache>(Store: TStore = Object.create(null) as TStore): Cache<TStore> {\n return {\n set(id, value): void {\n Store[id] = [0, value] as TStore[keyof TStore]\n },\n get(id): TStore[keyof TStore] | null {\n const item = Store[id]\n if (!item) {\n return null\n }\n item[0] = 0\n return item[1] as TStore[keyof TStore]\n },\n has(id): boolean {\n const item = Store[id]\n if (!item) {\n return false\n }\n item[0] = 0\n return true\n },\n delete(id: keyof TStore): boolean {\n return delete Store[id]\n },\n }\n}\n","import pathParser from 'node:path'\nimport fs from 'fs-extra'\n\nimport { switcher } from 'js-runtime'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n }\n\n // windows\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = pathParser.relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const path = slash(relativePath, platform)\n\n if (path.startsWith('../')) {\n return path.replace(pathParser.basename(path), pathParser.basename(path, pathParser.extname(filePath)))\n }\n\n return `./${path.replace(pathParser.basename(path), pathParser.basename(path, pathParser.extname(filePath)))}`\n}\n\nexport type PathMode = 'file' | 'directory'\n\nexport function getPathMode(path: string | undefined | null): PathMode {\n if (!path) {\n return 'directory'\n }\n return pathParser.extname(path) ? 'file' : 'directory'\n}\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n","import { camelCase, camelCaseTransformMerge } from 'change-case'\nimport { orderBy } from 'natural-orderby'\n\ntype FunctionParamsAst = {\n name: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\n/**\n * Convert an string array to a string of parameters that can be used inside a function\n * The parameter name is converted to `camelcase`\n */\nexport function createFunctionParams(data: FunctionParamsAst[]): string {\n const sortedData = orderBy(data, [(v) => v.default, (v) => v.required ?? true], ['desc', 'desc'])\n\n return sortedData\n .filter(({ enabled = true }) => enabled)\n .reduce((acc, { name, type, required = true, ...rest }) => {\n const parameterName = camelCase(name, { delimiter: '', transform: camelCaseTransformMerge })\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }, [] as string[])\n .join(', ')\n}\n","export function nameSorter<T extends { name: string }>(a: T, b: T): 0 | 1 | -1 {\n if (a.name < b.name) {\n return -1\n }\n if (a.name > b.name) {\n return 1\n }\n return 0\n}\n","export function createJSDocBlockText({ comments }: { comments: Array<string> }): string {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return ''\n }\n\n return `/**\\n * ${filteredComments.join('\\n * ')}\\n */`\n}\n","export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n","import crypto from 'node:crypto'\nimport { performance } from 'node:perf_hooks'\n\nexport type QueueJob<T = unknown> = {\n (...args: unknown[]): Promise<T> | Promise<void>\n}\n\ntype RunOptions = {\n controller?: AbortController\n name?: string\n description?: string\n}\n\ntype QueueItem = {\n reject: <T>(reason?: T) => void\n resolve: <T>(value: T | PromiseLike<T>) => void\n job: QueueJob<unknown>\n} & Required<RunOptions>\n\nexport class Queue {\n private queue: QueueItem[] = []\n\n private workerCount = 0\n\n private maxParallel: number\n private debug = false\n\n constructor(maxParallel: number, debug = false) {\n this.maxParallel = maxParallel\n this.debug = debug\n }\n\n run<T>(job: QueueJob<T>, options: RunOptions = { controller: new AbortController(), name: crypto.randomUUID(), description: '' }): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const item = { reject, resolve, job, name: options.name, description: options.description || options.name } as QueueItem\n\n options.controller?.signal.addEventListener('abort', () => {\n this.queue = this.queue.filter((queueItem) => queueItem.name === item.name)\n\n reject('Aborted')\n })\n\n this.queue.push(item)\n this.work()\n })\n }\n\n runSync<T>(job: QueueJob<T>, options: RunOptions = { controller: new AbortController(), name: crypto.randomUUID(), description: '' }): void {\n new Promise<T>((resolve, reject) => {\n const item = { reject, resolve, job, name: options.name, description: options.description || options.name } as QueueItem\n\n options.controller?.signal.addEventListener('abort', () => {\n this.queue = this.queue.filter((queueItem) => queueItem.name === item.name)\n })\n\n this.queue.push(item)\n this.work()\n })\n }\n\n get hasJobs(): boolean {\n return this.workerCount > 0 || this.queue.length > 0\n }\n\n private work(): void {\n if (this.workerCount >= this.maxParallel) {\n return\n }\n this.workerCount++\n\n let entry: QueueItem | undefined\n while ((entry = this.queue.shift())) {\n const { reject, resolve, job, name, description } = entry\n if (this.debug) {\n performance.mark(name + '_start')\n }\n\n job()\n .then((result) => {\n resolve(result)\n\n if (this.debug) {\n performance.mark(name + '_stop')\n performance.measure(description, name + '_start', name + '_stop')\n }\n })\n .catch((err) => reject(err))\n }\n\n this.workerCount--\n }\n}\n","export function escape(text?: string): string {\n return text ? text.replaceAll('`', '\\\\`') : ''\n}\n\n/**\n * Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on\n * @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n * @link https://github.com/joliss/js-string-escape/blob/master/index.js\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function jsStringEscape(input: any): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return '\\\\' + character\n // Four possible LineTerminator characters need to be escaped:\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n","/**\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = [\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n\n 'Array',\n 'Date',\n 'eval',\n 'function',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n]\n\nexport function transformReservedWord(word: string): string {\n if ((word && reservedWords.includes(word)) || word?.match(/^\\d/)) {\n return `_${word}`\n }\n\n return word\n}\n","export function combineCodes(codes: string[]): string {\n return codes.join('\\n')\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const value = data[curr.split(/{{|}}/).filter(Boolean)[0].trim()]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","import { remove } from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return remove(path)\n}\n","import dirTree from 'directory-tree'\n\nimport { getPathMode } from '../utils/read.ts'\n\nimport type { DirectoryTree, DirectoryTreeOptions } from 'directory-tree'\n\nexport type TreeNodeOptions = DirectoryTreeOptions\n\nexport class TreeNode<T = unknown> {\n public data: T\n\n public parent?: TreeNode<T>\n\n public children: Array<TreeNode<T>> = []\n\n constructor(data: T, parent?: TreeNode<T>) {\n this.data = data\n this.parent = parent\n return this\n }\n\n addChild(data: T): TreeNode<T> {\n const child = new TreeNode(data, this)\n if (!this.children) {\n this.children = []\n }\n this.children.push(child)\n return child\n }\n\n find(data?: T): TreeNode<T> | null {\n if (!data) {\n return null\n }\n\n if (data === this.data) {\n return this\n }\n\n if (this.children?.length) {\n for (let i = 0, { length } = this.children, target: TreeNode<T> | null = null; i < length; i++) {\n target = this.children[i].find(data)\n if (target) {\n return target\n }\n }\n }\n\n return null\n }\n\n get leaves(): TreeNode<T>[] {\n if (!this.children || this.children.length === 0) {\n // this is a leaf\n return [this]\n }\n\n // if not a leaf, return all children's leaves recursively\n const leaves: TreeNode<T>[] = []\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n // eslint-disable-next-line prefer-spread\n leaves.push.apply(leaves, this.children[i].leaves)\n }\n }\n return leaves\n }\n\n get root(): TreeNode<T> {\n if (!this.parent) {\n return this\n }\n return this.parent.root\n }\n\n forEach(callback: (treeNode: TreeNode<T>) => void): this {\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n // run this node through function\n callback(this)\n\n // do the same for all children\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n this.children[i].forEach(callback)\n }\n }\n\n return this\n }\n\n public static build<T = unknown>(path: string, options: TreeNodeOptions = {}): TreeNode<T> | null {\n try {\n const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean)\n const filteredTree = dirTree(path, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] })\n\n if (!filteredTree) {\n return null\n }\n\n const treeNode = new TreeNode({ name: filteredTree.name, path: filteredTree.path, type: filteredTree.type || getPathMode(filteredTree.path) })\n\n const recurse = (node: typeof treeNode, item: DirectoryTree) => {\n const subNode = node.addChild({ name: item.name, path: item.path, type: item.type || getPathMode(item.path) })\n\n if (item.children?.length) {\n item.children?.forEach((child) => {\n recurse(subNode, child)\n })\n }\n }\n\n filteredTree.children?.forEach((child) => recurse(treeNode, child))\n\n return treeNode as TreeNode<T>\n } catch (e) {\n throw new Error('Something went wrong with creating index files with the TreehNode class', { cause: e })\n }\n }\n}\n","export const uniqueIdFactory =\n (counter: number) =>\n (str = ''): string =>\n `${str}${++counter}`\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport mod from 'node:module'\nimport { pathToFileURL } from 'node:url'\nimport os from 'node:os'\n\nconst SLASHES = new Set(['/', '\\\\'])\n\n/**\n * Normalizes directories to have a trailing slash.\n * Resolve is pretty finicky -- if the directory name doesn't have\n * a trailing slash then it tries to look in the parent directory.\n * i.e., if the directory is \"/usr/nzakas/foo\" it will start the\n * search in /usr/nzakas. However, if the directory is \"/user/nzakas/foo/\",\n * then it will start the search in /user/nzakas/foo.\n * @param {string} directory The directory to check.\n * @returns {string} The normalized directory.\n */\nexport function normalizeDirectory(directory: string): string {\n if (!SLASHES.has(directory[directory.length - 1])) {\n return `${directory}/`\n }\n\n return directory\n}\n\nexport function getLocation(path: string, cwd?: string): string {\n let location = path\n\n if (cwd) {\n const require = mod.createRequire(normalizeDirectory(cwd))\n location = require.resolve(path)\n }\n\n return location\n}\n\nexport async function importModule(path: string, cwd?: string): Promise<any | undefined> {\n try {\n let location = getLocation(path, cwd)\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\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n}\n","export const throttle = <R, A extends any[]>(fn: (...args: A) => R, delay: number): [(...args: A) => R | undefined, () => void] => {\n let wait = false\n let timeout: NodeJS.Timeout\n let cancelled = false\n\n return [\n (...args: A) => {\n if (cancelled) {\n return undefined\n }\n if (wait) {\n return undefined\n }\n\n const val = fn(...args)\n\n wait = true\n\n timeout = setTimeout(() => {\n wait = false\n }, delay)\n\n return val\n },\n () => {\n cancelled = true\n clearTimeout(timeout)\n },\n ]\n}\n","export class SummaryError extends Error {\n public summary: string[]\n\n constructor(message: string, options: { cause: Error; summary?: string[] }) {\n super(message, { cause: options.cause })\n\n this.name = 'SummaryError'\n this.summary = options.summary || []\n }\n}\n","/**\n * Behaves as an Error to log a warning in the console(still stops the execution)\n */\nexport class Warning extends Error {\n constructor(message?: string, options?: { cause: Error }) {\n super(message, { cause: options?.cause })\n\n this.name = 'Warning'\n }\n}\n","import type { Ora } from 'ora'\nimport pc from 'picocolors'\n\nexport type LogType = 'error' | 'info' | 'warning'\n\nexport type Logger = {\n log: (message: string | null) => void\n error: (message: string | null) => void\n info: (message: string | null) => void\n warn: (message: string | null) => void\n spinner?: Ora\n logs: string[]\n}\n\nexport function createLogger(spinner?: Ora): Logger {\n const logs: string[] = []\n const log: Logger['log'] = (message) => {\n if (message && spinner) {\n spinner.text = message\n logs.push(message)\n }\n }\n\n const error: Logger['error'] = (message) => {\n if (message) {\n throw new Error(message || 'Something went wrong')\n }\n }\n\n const warn: Logger['warn'] = (message) => {\n if (message && spinner) {\n spinner.warn(pc.yellow(message))\n logs.push(message)\n }\n }\n\n const info: Logger['warn'] = (message) => {\n if (message && spinner) {\n spinner.info(message)\n logs.push(message)\n }\n }\n\n const logger: Logger = {\n log,\n error,\n warn,\n info,\n spinner,\n logs,\n }\n\n return logger\n}\n\nexport { default as pc } from 'picocolors'\n","import seedrandom from 'seedrandom'\nimport pc from 'picocolors'\nimport type { Formatter } from 'picocolors/types'\n\nexport const defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const\n\nexport function randomColour(text?: string, colours = defaultColours): string {\n if (!text) {\n return 'white'\n }\n\n const random = seedrandom(text)\n const colour = colours.at(Math.floor(random() * colours.length)) || 'white'\n\n return colour\n}\n\nexport function randomPicoColour(text?: string, colors = defaultColours): string {\n const colours = pc.createColors(true)\n\n if (!text) {\n return colours.white(text)\n }\n\n const colour = randomColour(text, colors)\n const isDark = colour.includes('dark')\n const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours\n const formatter: Formatter = colours[key] as Formatter\n\n if (isDark) {\n return pc.bold(formatter(text))\n }\n\n if (typeof formatter !== 'function') {\n throw new Error('Formatter for picoColor is not of type function/Formatter')\n }\n return formatter(text)\n}\n","import { camelCase, camelCaseTransformMerge } from 'change-case'\n\nexport class URLPath {\n path: string\n\n constructor(path: string) {\n this.path = path\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isUrl(): boolean {\n return URLPath.isURL(this.path)\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString(): string {\n return URLPath.toTemplateString(this.path)\n }\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n static toTemplateString(path: string): string {\n const regex = /{(\\w|-)*}/g\n const found = path.match(regex)\n let newPath = path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, curr) => {\n const replacement = `\\${${camelCase(curr, { delimiter: '', transform: camelCaseTransformMerge })}}`\n\n return prev.replace(curr, replacement)\n }, path)\n }\n\n return `\\`${newPath}\\``\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return URLPath.toURLPath(this.path)\n }\n\n static toURLPath(path: string): string {\n return path.replaceAll('{', ':').replaceAll('}', '')\n }\n\n static isURL(path: string): boolean {\n try {\n const url = new URL(path)\n if (url?.href) {\n return true\n }\n } catch (error) {\n return false\n }\n return false\n }\n}\n","import pathParser from 'node:path'\n\nimport { createExportDeclaration, createImportDeclaration, print } from '@kubb/ts-codegen'\n\nimport { TreeNode } from '../../utils/index.ts'\n\nimport type { Path } from '../../types.ts'\nimport type { PathMode, TreeNodeOptions } from '../../utils/index.ts'\nimport type { Import, Export, File } from './types.ts'\nimport isEqual from 'lodash.isequal'\n\ntype TreeNodeData = { type: PathMode; path: Path; name: string }\n\nexport function getIndexes(root: string, options: TreeNodeOptions = {}): File[] | null {\n const tree = TreeNode.build<TreeNodeData>(root, { extensions: /\\.ts/, ...options })\n\n if (!tree) {\n return null\n }\n\n const fileReducer = (files: File[], currentTree: typeof tree) => {\n if (!currentTree.children) {\n return []\n }\n\n if (currentTree.children?.length > 1) {\n const path = pathParser.resolve(currentTree.data.path, 'index.ts')\n const exports = currentTree.children\n .map((file) => {\n if (!file) {\n return undefined\n }\n\n const importPath: string = file.data.type === 'directory' ? `./${file.data.name}` : `./${file.data.name.replace(/\\.[^.]*$/, '')}`\n\n // TODO weird hacky fix\n if (importPath.includes('index') && path.includes('index')) {\n return undefined\n }\n\n return { path: importPath }\n })\n .filter(Boolean)\n\n files.push({\n path,\n fileName: 'index.ts',\n source: '',\n exports,\n })\n } else {\n currentTree.children?.forEach((child) => {\n const path = pathParser.resolve(currentTree.data.path, 'index.ts')\n const importPath = child.data.type === 'directory' ? `./${child.data.name}` : `./${child.data.name.replace(/\\.[^.]*$/, '')}`\n\n files.push({\n path,\n fileName: 'index.ts',\n source: '',\n exports: [{ path: importPath }],\n })\n })\n }\n\n currentTree.children.forEach((childItem) => {\n fileReducer(files, childItem)\n })\n\n return files\n }\n\n const files = fileReducer([], tree)\n\n return files\n}\n\nexport function combineFiles(files: Array<File | null>): File[] {\n return files.filter(Boolean).reduce((acc, curr: File) => {\n const prevIndex = acc.findIndex((item) => item.path === curr.path)\n\n if (prevIndex !== -1) {\n const prev = acc[prevIndex]\n acc[prevIndex] = {\n ...curr,\n source: prev.source && curr.source ? `${prev.source}\\n${curr.source}` : '',\n imports: [...(prev.imports || []), ...(curr.imports || [])],\n exports: [...(prev.exports || []), ...(curr.exports || [])],\n env: { ...(prev.env || {}), ...(curr.env || {}) },\n }\n } else {\n acc.push(curr)\n }\n\n return acc\n }, [] as File[])\n}\n/**\n * Support for js, ts and tsx(React)\n */\nexport type Extension = '.ts' | '.js' | '.tsx'\nexport const extensions: Array<Extension> = ['.js', '.ts', '.tsx']\n\nexport function isExtensionAllowed(fileName: string): boolean {\n return extensions.some((extension) => fileName.endsWith(extension))\n}\n\nexport function combineExports(exports: Export[]): Export[] {\n return exports.reduce((prev, curr) => {\n const name = curr.name\n const prevByPath = prev.findLast((imp) => imp.path === curr.path)\n const uniquePrev = prev.findLast(\n (imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias,\n )\n\n if (uniquePrev || (Array.isArray(name) && !name.length) || (prevByPath?.asAlias && !curr.asAlias)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name: Array.isArray(name) ? [...new Set(name)] : name,\n },\n ]\n }\n\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...curr.name])]\n\n return prev\n }\n\n return [...prev, curr]\n }, [] as Export[])\n}\n\nexport function combineImports(imports: Import[], exports: Export[], source: string): Import[] {\n return imports.reduce((prev, curr) => {\n let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name\n\n const hasImportInSource = (importName: string) => {\n const checker = (name?: string) => name && !!source.includes(`${name}`)\n return checker(importName) || exports.some(({ name }) => (Array.isArray(name) ? name.some(checker) : checker(name)))\n }\n\n if (Array.isArray(name)) {\n name = name.filter((item) => hasImportInSource(item))\n }\n\n const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly)\n const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly)\n\n if (uniquePrev || (Array.isArray(name) && !name.length)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name,\n },\n ]\n }\n\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...name])]\n\n return prev\n }\n\n if (!Array.isArray(name) && name && !hasImportInSource(name)) {\n return prev\n }\n\n return [...prev, curr]\n }, [] as Import[])\n}\n\nexport function createFileSource(file: File): string {\n let { source } = file\n\n if (!isExtensionAllowed(file.fileName)) {\n return file.source\n }\n\n const exports = file.exports ? combineExports(file.exports) : []\n const imports = file.imports ? combineImports(file.imports, exports, source) : []\n\n const importNodes = imports.map((item) => createImportDeclaration({ name: item.name, path: item.path, isTypeOnly: item.isTypeOnly }))\n const importSource = print(importNodes)\n\n const exportNodes = exports.map((item) => createExportDeclaration({ name: item.name, path: item.path, isTypeOnly: item.isTypeOnly, asAlias: item.asAlias }))\n const exportSource = print(exportNodes)\n\n // need to after `combineImports`\n source = getEnvSource(file.source, file.env)\n\n if (importSource) {\n source = `${importSource}\\n${source}`\n }\n\n if (exportSource) {\n source = `${exportSource}\\n${source}`\n }\n\n return source\n}\n\ntype SearchAndReplaceOptions = {\n text: string\n replaceBy: string\n prefix?: string\n key: string\n searchValues?: (prefix: string, key: string) => Array<RegExp | string>\n}\n\nfunction searchAndReplace(options: SearchAndReplaceOptions): string {\n const { text, replaceBy, prefix = '', key } = options\n\n const searchValues = options.searchValues?.(prefix, key) || [\n `${prefix}[\"${key}\"]`,\n `${prefix}['${key}']`,\n `${prefix}[\\`${key}\\`]`,\n `${prefix}\"${key}\"`,\n `${prefix}'${key}'`,\n `${prefix}\\`${key}\\``,\n new RegExp(`${prefix}${key}`, 'g'),\n ]\n\n return searchValues.reduce((prev, searchValue) => {\n return prev.toString().replaceAll(searchValue, replaceBy)\n }, text) as string\n}\n\nfunction getEnvSource(source: string, env: NodeJS.ProcessEnv | undefined): string {\n if (!env) {\n return source\n }\n\n const keys = Object.keys(env)\n\n if (!keys.length) {\n return source\n }\n\n return keys.reduce((prev, key: string) => {\n const environmentValue = env[key]\n const replaceBy = environmentValue ? `'${environmentValue.replaceAll('\"', '')?.replaceAll(\"'\", '')}'` : 'undefined'\n\n if (key.toUpperCase() !== key) {\n throw new TypeError(`Environment should be in upperCase for ${key}`)\n }\n\n if (typeof replaceBy === 'string') {\n prev = searchAndReplace({ text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: 'process.env', key })\n // removes `declare const ...`\n prev = searchAndReplace({ text: prev.replaceAll(new RegExp(`(declare const).*\\n`, 'ig'), ''), replaceBy, key })\n }\n\n return prev\n }, source)\n}\n","import pathParser from 'node:path'\n\nimport { createPluginCache, transformReservedWord } from './utils/index.ts'\n\nimport type { FileManager } from './managers/fileManager/FileManager.ts'\nimport type { KubbPlugin, KubbUserPlugin, PluginContext, PluginFactoryOptions } from './types.ts'\n\ntype KubbPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (\n options: T['options'],\n) => T['nested'] extends true ? Array<KubbUserPlugin<T>> : KubbUserPlugin<T>\n\nexport function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: KubbPluginFactory<T>) {\n return (options: T['options']): ReturnType<KubbPluginFactory<T>> => {\n const plugin = factory(options)\n if (Array.isArray(plugin)) {\n throw new Error('Not implemented')\n }\n\n // default transform\n if (!plugin.transform) {\n plugin.transform = function transform(code) {\n return code\n }\n }\n\n return plugin\n }\n}\n\ntype Options = {\n config: PluginContext['config']\n fileManager: FileManager\n resolvePath: PluginContext['resolvePath']\n resolveName: PluginContext['resolveName']\n logger: PluginContext['logger']\n getPlugins: () => KubbPlugin[]\n}\n\n// not publicly exported\nexport type CorePluginOptions = PluginFactoryOptions<'core', Options, false, PluginContext>\n\nexport const pluginName: CorePluginOptions['name'] = 'core' as const\n\nexport const definePlugin = createPlugin<CorePluginOptions>((options) => {\n const { fileManager, resolvePath, resolveName, logger } = options\n\n return {\n name: pluginName,\n options,\n api() {\n // TODO watch out, typing is incorrect, `this` will be `null` with that core is normally the `this`\n return {\n get config() {\n return options.config\n },\n get plugins() {\n return options.getPlugins()\n },\n logger,\n fileManager,\n async addFile(...files) {\n return Promise.all(\n files.map((file) => {\n if (file.override) {\n return fileManager.add(file)\n }\n\n return fileManager.addOrAppend(file)\n }),\n )\n },\n resolvePath,\n resolveName: (params) => {\n const name = resolveName(params)\n\n return transformReservedWord(name)\n },\n cache: createPluginCache(),\n }\n },\n resolvePath(fileName) {\n const root = pathParser.resolve(this.config.root, this.config.output.path)\n\n return pathParser.resolve(root, fileName)\n },\n resolveName(name) {\n return name\n },\n }\n})\n","import type { PluginError } from './PluginError.ts'\nimport type { PluginManager } from './PluginManager'\n\nexport class ParallelPluginError extends Error {\n public errors: PluginError[] = []\n\n public pluginManager: PluginManager\n\n constructor(message: string, options: { cause?: Error; errors: PluginError[]; pluginManager: PluginManager }) {\n super(message, { cause: options.cause })\n\n this.name = 'ParallelPluginError'\n this.errors = options.errors\n this.pluginManager = options.pluginManager\n }\n\n findError<T extends Error = Error>(searchError: T | undefined): T | undefined {\n if (!searchError) {\n return undefined\n }\n\n return this.errors.find((error) => {\n if (error.cause) {\n if (error.cause.name == searchError.name) {\n return true\n }\n\n return !!this.findError(error.cause)\n }\n return error.name === searchError.name\n })?.cause as T\n }\n}\n","import type { PluginManager } from './PluginManager'\n\nexport class PluginError extends Error {\n public pluginManager: PluginManager\n public cause: Error\n\n constructor(message: string, options: { cause: Error; pluginManager: PluginManager }) {\n super(message, { cause: options.cause })\n\n this.name = 'PluginError'\n this.cause = options.cause\n this.pluginManager = options.pluginManager\n }\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport { EventEmitter as NodeEventEmitter } from 'node:events'\nexport class EventEmitter<TEvents extends Record<string, any>> {\n private emitter = new NodeEventEmitter()\n\n emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void {\n this.emitter.emit(eventName, ...(eventArg as []))\n }\n\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.emitter.on(eventName, handler as any)\n }\n\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.emitter.off(eventName, handler as any)\n }\n}\n","import type { CorePluginOptions } from '../../plugin.ts'\nimport type { KubbPlugin, KubbUserPlugin } from '../../types.ts'\n\nexport function pluginParser(plugin: KubbUserPlugin, context: CorePluginOptions['api'] | undefined): KubbPlugin | null {\n if (plugin.api && typeof plugin.api === 'function') {\n // eslint-disable-next-line @typescript-eslint/ban-types\n const api = (plugin.api as Function).call(context) as typeof plugin.api\n\n return {\n ...plugin,\n api,\n }\n }\n\n return null\n}\n","/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/no-unsafe-argument */\n\nimport { definePlugin } from '../../plugin.ts'\nimport { isPromise, isPromiseRejectedResult } from '../../utils/isPromise.ts'\nimport { Queue } from '../../utils/Queue.ts'\nimport { FileManager } from '../fileManager/FileManager.ts'\nimport { ParallelPluginError } from './ParallelPluginError.ts'\nimport { PluginError } from './PluginError.ts'\n\nimport { EventEmitter } from '../../utils/EventEmitter.ts'\n\nimport type { CorePluginOptions } from '../../plugin.ts'\nimport type {\n KubbConfig,\n KubbPlugin,\n PossiblePromise,\n PluginContext,\n PluginLifecycle,\n PluginLifecycleHooks,\n ResolveNameParams,\n ResolvePathParams,\n OptionalPath,\n} from '../../types.ts'\nimport type { QueueJob } from '../../utils/Queue.ts'\nimport type { Argument0, Executer, ParseResult, SafeParseResult, Strategy } from './types.ts'\nimport type { Logger } from '../../utils/logger.ts'\nimport type { ResolvedFile } from '../fileManager/types.ts'\nimport { pluginParser } from './pluginParser.ts'\n\n// inspired by: https://github.com/rollup/rollup/blob/master/src/utils/PluginDriver.ts#\n\n// This will make sure no input hook is omitted\nconst hookNames: {\n [P in PluginLifecycleHooks]: 1\n} = {\n validate: 1,\n buildStart: 1,\n resolvePath: 1,\n resolveName: 1,\n load: 1,\n transform: 1,\n writeFile: 1,\n buildEnd: 1,\n}\nexport const hooks = Object.keys(hookNames) as [PluginLifecycleHooks]\n\ntype Options = { debug?: boolean; task: QueueJob<ResolvedFile>; logger: Logger }\n\ntype Events = {\n execute: [executer: Executer]\n executed: [executer: Executer]\n error: [pluginError: PluginError]\n}\n\nexport class PluginManager {\n public plugins: KubbPlugin[]\n\n public readonly fileManager: FileManager\n\n private readonly core: KubbPlugin<CorePluginOptions>\n\n public queue: Queue\n\n public executed: Executer[] = []\n public logger: Logger\n private eventEmitter: EventEmitter<Events> = new EventEmitter()\n\n constructor(config: KubbConfig, options: Options) {\n // TODO use logger for all warnings/errors\n this.logger = options.logger\n this.queue = new Queue(100, options.debug)\n this.fileManager = new FileManager({ task: options.task, queue: this.queue })\n\n const core = definePlugin({\n config,\n logger: this.logger,\n fileManager: this.fileManager,\n resolvePath: this.resolvePath.bind(this),\n resolveName: this.resolveName.bind(this),\n getPlugins: this.getSortedPlugins.bind(this),\n }) as KubbPlugin<CorePluginOptions> & {\n api: (this: Omit<PluginContext, 'addFile'>) => CorePluginOptions['api']\n }\n\n this.core = pluginParser(core, core.api.call(null as any)) as KubbPlugin<CorePluginOptions>\n\n this.plugins = [this.core, ...(config.plugins || [])].reduce((prev, plugin) => {\n // TODO HACK to be sure that this is equal to the `core.api` logic.\n\n const convertedApi = pluginParser(plugin, this.core?.api)\n\n if (convertedApi) {\n return [...prev, convertedApi]\n }\n\n return [...prev, plugin]\n }, [] as KubbPlugin[])\n }\n\n resolvePath = (params: ResolvePathParams): OptionalPath => {\n if (params.pluginName) {\n return this.hookForPluginSync({\n pluginName: params.pluginName,\n hookName: 'resolvePath',\n parameters: [params.fileName, params.directory, params.options],\n })\n }\n return this.hookFirstSync({\n hookName: 'resolvePath',\n parameters: [params.fileName, params.directory, params.options],\n }).result\n }\n\n resolveName = (params: ResolveNameParams): string => {\n if (params.pluginName) {\n return (\n this.hookForPluginSync({\n pluginName: params.pluginName,\n hookName: 'resolveName',\n parameters: [params.name],\n }) || params.name\n )\n }\n return this.hookFirstSync({\n hookName: 'resolveName',\n parameters: [params.name],\n }).result\n }\n\n on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void {\n this.eventEmitter.on(eventName, handler as any)\n }\n\n /**\n *\n * Run only hook for a specific plugin name\n */\n hookForPlugin<H extends PluginLifecycleHooks>({\n pluginName,\n hookName,\n parameters,\n }: {\n pluginName: string\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n }): Promise<ReturnType<ParseResult<H>> | null> | null {\n const plugin = this.getPlugin(hookName, pluginName)\n\n return this.execute({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n }\n\n hookForPluginSync<H extends PluginLifecycleHooks>({\n pluginName,\n hookName,\n parameters,\n }: {\n pluginName: string\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n }): ReturnType<ParseResult<H>> | null {\n const plugin = this.getPlugin(hookName, pluginName)\n\n return this.executeSync({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n }\n\n /**\n *\n * Chains, first non-null result stops and returns\n */\n hookFirst<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n }: {\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n skipped?: ReadonlySet<KubbPlugin> | null\n }): Promise<SafeParseResult<H>> {\n let promise: Promise<SafeParseResult<H>> = Promise.resolve(null as unknown as SafeParseResult<H>)\n\n for (const plugin of this.getSortedPlugins()) {\n if (skipped && skipped.has(plugin)) {\n continue\n }\n promise = promise.then(async (parseResult) => {\n if (parseResult?.result != null) {\n return parseResult\n }\n const value = await this.execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n\n return Promise.resolve({\n plugin,\n result: value,\n } as typeof parseResult)\n })\n }\n\n return promise\n }\n\n /**\n *\n * Chains, first non-null result stops and returns\n */\n hookFirstSync<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n }: {\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n skipped?: ReadonlySet<KubbPlugin> | null\n }): SafeParseResult<H> {\n let parseResult: SafeParseResult<H> = null as unknown as SafeParseResult<H>\n\n for (const plugin of this.getSortedPlugins()) {\n if (skipped && skipped.has(plugin)) {\n continue\n }\n\n parseResult = {\n result: this.executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n }),\n plugin,\n } as SafeParseResult<H>\n\n if (parseResult?.result != null) {\n break\n }\n }\n return parseResult\n }\n\n /**\n *\n * Parallel, runs all plugins\n */\n async hookParallel<H extends PluginLifecycleHooks, TOuput = void>({\n hookName,\n parameters,\n }: {\n hookName: H\n parameters?: Parameters<PluginLifecycle[H]> | undefined\n }): Promise<Awaited<TOuput>[]> {\n const parallelPromises: Promise<TOuput>[] = []\n\n for (const plugin of this.getSortedPlugins()) {\n // TODO implement sequential with `buildStart` as an object({ sequential: boolean; handler: PluginContext[\"buildStart\"] })\n // if ((plugin[hookName] as { sequential?: boolean })?.sequential) {\n // await Promise.all(parallelPromises)\n // parallelPromises.length = 0\n // await this.execute({\n // strategy: 'hookParallel',\n // hookName,\n // parameters,\n // plugin,\n // })\n // }\n const promise: Promise<TOuput> | null = this.execute({ strategy: 'hookParallel', hookName, parameters, plugin })\n\n if (promise) {\n parallelPromises.push(promise)\n }\n }\n const results = await Promise.allSettled(parallelPromises)\n\n const errors = results\n .map((result) => {\n // needs `cause` because Warning and other errors will then not be added, only PluginError is possible here\n if (isPromiseRejectedResult<PluginError>(result) && result.reason instanceof PluginError) {\n return result.reason\n }\n return undefined\n })\n .filter(Boolean)\n\n if (errors.length) {\n throw new ParallelPluginError('Error', { errors, pluginManager: this })\n }\n\n return results.filter((result) => result.status === 'fulfilled').map((result) => (result as PromiseFulfilledResult<Awaited<TOuput>>).value)\n }\n\n /**\n *\n * Chains, reduces returned value, handling the reduced value as the first hook argument\n */\n hookReduceArg0<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n reduce,\n }: {\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise<Argument0<H> | null>\n }): Promise<Argument0<H>> {\n const [argument0, ...rest] = parameters\n\n let promise: Promise<Argument0<H>> = Promise.resolve(argument0)\n for (const plugin of this.getSortedPlugins()) {\n promise = promise\n .then((arg0) => {\n const value = this.execute({\n strategy: 'hookReduceArg0',\n hookName,\n parameters: [arg0, ...rest] as Parameters<PluginLifecycle[H]>,\n plugin,\n })\n return value\n })\n .then((result) => reduce.call(this.core.api, argument0, result as ReturnType<ParseResult<H>>, plugin)) as Promise<Argument0<H>>\n }\n return promise\n }\n\n /**\n * Chains plugins\n */\n hookSeq<H extends PluginLifecycleHooks>({ hookName, parameters }: { hookName: H; parameters?: Parameters<PluginLifecycle[H]> }): Promise<void> {\n let promise: Promise<void | null> = Promise.resolve()\n for (const plugin of this.getSortedPlugins()) {\n promise = promise.then(() =>\n this.execute({\n strategy: 'hookSeq',\n hookName,\n parameters,\n plugin,\n }),\n )\n }\n return promise.then(noReturn)\n }\n\n private getSortedPlugins(hookName?: keyof PluginLifecycle): KubbPlugin[] {\n const plugins = [...this.plugins].filter((plugin) => plugin.name !== 'core')\n\n if (hookName) {\n return plugins.filter((item) => item[hookName])\n }\n\n return plugins\n }\n\n public getPlugin(hookName: keyof PluginLifecycle, pluginName: string): KubbPlugin {\n const plugins = [...this.plugins]\n\n const pluginByPluginName = plugins.find((item) => item.name === pluginName && item[hookName])\n if (!pluginByPluginName) {\n // fallback on the core plugin when there is no match\n\n return this.core\n }\n return pluginByPluginName\n }\n\n private addExecutedToCallStack(executer: Executer | undefined) {\n if (executer) {\n this.eventEmitter.emit('execute', executer)\n this.executed.push(executer)\n }\n }\n\n /**\n * Run an async plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The actual pluginObject to run.\n */\n // Implementation signature\n private execute<H extends PluginLifecycleHooks, TResult = void>({\n strategy,\n hookName,\n parameters,\n plugin,\n }: {\n strategy: Strategy\n hookName: H\n parameters: unknown[] | undefined\n plugin: KubbPlugin\n }): Promise<TResult> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.eventEmitter.emit('execute', { strategy, hookName, parameters, plugin })\n\n const task = Promise.resolve()\n .then(() => {\n if (typeof hook === 'function') {\n const possiblePromiseResult = (hook as Function).apply(this.core.api, parameters) as TResult\n\n if (isPromise(possiblePromiseResult)) {\n return Promise.resolve(possiblePromiseResult)\n }\n return possiblePromiseResult\n }\n\n return hook\n })\n .then((result) => {\n output = result\n\n return result\n })\n .catch((e: Error) => {\n this.catcher<H>(e, plugin, hookName)\n\n return null as TResult\n })\n .finally(() => {\n this.addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n })\n })\n\n return task\n }\n\n /**\n * Run a sync plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be in `PluginHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The acutal plugin\n * @param replaceContext When passed, the plugin context can be overridden.\n */\n private executeSync<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n }: {\n strategy: Strategy\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n plugin: KubbPlugin\n }): ReturnType<ParseResult<H>> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.eventEmitter.emit('execute', { strategy, hookName, parameters, plugin })\n\n try {\n if (typeof hook === 'function') {\n const fn = (hook as Function).apply(this.core.api, parameters) as ReturnType<ParseResult<H>>\n\n output = fn\n return fn\n }\n\n output = hook\n return hook\n } catch (e) {\n this.catcher<H>(e as Error, plugin, hookName)\n\n return null as ReturnType<ParseResult<H>>\n } finally {\n this.addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n })\n }\n }\n\n private catcher<H extends PluginLifecycleHooks>(e: Error, plugin: KubbPlugin, hookName: H) {\n const text = `${e.message} (plugin: ${plugin.name}, hook: ${hookName})\\n`\n const pluginError = new PluginError(text, { cause: e, pluginManager: this })\n\n this.eventEmitter.emit('error', pluginError)\n\n throw pluginError\n }\n}\n\nfunction noReturn() {}\n","import type { KubbPlugin } from '../../types.ts'\n\nexport class ValidationPluginError extends Error {}\n\nexport function getDependedPlugins<TPlugins extends KubbPlugin[]>(plugins: KubbPlugin[], dependedPluginNames: string | string[]): TPlugins {\n let pluginNames: string[] = []\n if (typeof dependedPluginNames === 'string') {\n pluginNames = [dependedPluginNames]\n } else {\n pluginNames = dependedPluginNames\n }\n\n return pluginNames.map((pluginName) => {\n const plugin = plugins.find((plugin) => plugin.name === pluginName)\n if (!plugin) {\n throw new ValidationPluginError(`This plugin depends on the ${pluginName} plugin.`)\n }\n return plugin\n }) as TPlugins\n}\n","import { createFileSource } from './managers/fileManager/index.ts'\nimport { PluginManager } from './managers/pluginManager/index.ts'\nimport { clean, createLogger, URLPath, randomPicoColour, read } from './utils/index.ts'\nimport { isPromise } from './utils/isPromise.ts'\nimport pc from 'picocolors'\n\nimport type { File, ResolvedFile } from './managers/fileManager/index.ts'\nimport { LogLevel } from './types.ts'\nimport type { BuildOutput, KubbPlugin, PluginContext, TransformResult } from './types.ts'\nimport type { QueueJob, Logger } from './utils/index.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n logLevel?: LogLevel\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n\n _plugin: KubbPlugin,\n): Promise<string | null> {\n return result\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const { config, logLevel, logger = createLogger() } = options\n\n try {\n if (!URLPath.isURL(config.input.path)) {\n await read(config.input.path)\n }\n } catch (e) {\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 ' + pc.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const queueTask = async (file: File) => {\n const { path } = file\n\n let code: string | null = createFileSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n code = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n code = loadedResult\n }\n\n if (code) {\n const transformedCode = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [code, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n await pluginManager.hookParallel({\n hookName: 'writeFile',\n parameters: [transformedCode, path],\n })\n }\n }\n }\n\n const pluginManager = new PluginManager(config, { debug: logLevel === LogLevel.debug, logger, task: queueTask as QueueJob<ResolvedFile> })\n const { plugins, fileManager } = pluginManager\n\n pluginManager.on('execute', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n const messsage = `${randomPicoColour(plugin.name)} Executing ${hookName}`\n\n if (logLevel === LogLevel.info) {\n if (logger.spinner) {\n logger.spinner.suffixText = messsage\n }\n }\n\n if (logLevel === LogLevel.debug) {\n logger.info(messsage)\n const logs = [\n parameters && `${pc.bgWhite(`Parameters`)} ${randomPicoColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${pc.bgWhite('Output')} ${randomPicoColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n console.log(logs.join('\\n'))\n }\n })\n\n await pluginManager.hookParallel<'validate', true>({\n hookName: 'validate',\n parameters: [plugins],\n })\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n return { files: fileManager.files.map((file) => ({ ...file, source: createFileSource(file) })), pluginManager }\n}\n","import type { Logger } from './utils/logger.ts'\nimport type { File, FileManager } from './managers/fileManager/index.ts'\nimport type { PluginManager } from './managers/index.ts'\nimport type { Cache } from './utils/cache.ts'\n\n/**\n * @deprecated\n */\nexport interface Register {}\n\nexport type PossiblePromise<T> = Promise<T> | T\n\n/**\n * Config used in `kubb.config.js`\n *\n * @example import { defineConfig } from '@kubb/core'\n * export default defineConfig({\n * ...\n * })\n */\nexport type KubbUserConfig = Omit<KubbConfig, 'root' | 'plugins'> & {\n /**\n * Project root directory. Can be an absolute path, or a path relative from\n * the location of the config file itself.\n * @default process.cwd()\n */\n root?: string\n /**\n * Plugin type can be KubbJSONPlugin or KubbPlugin\n * Example: ['@kubb/swagger', { output: false }]\n * Or: createSwagger({ output: false })\n */\n plugins?: KubbPlugin[] | KubbJSONPlugins[] | KubbObjectPlugins\n}\n\n/**\n * Global/internal config used through out the full generation.\n */\nexport type KubbConfig = {\n /**\n * Project root directory. Can be an absolute path, or a path relative from\n * the location of the config file itself.\n * @default process.cwd()\n */\n root: string\n input: {\n /**\n * Path to be used as the input. Can be an absolute path, or a path relative from\n * the defined root option.\n */\n path: string\n }\n output: {\n /**\n * Path to be used to export all generated files. Can be an absolute path, or a path relative based of the defined root option.\n */\n path: string\n /**\n * Remove previous generated files and folders.\n */\n clean?: boolean\n /**\n * Enabled or disable the writing to the filesystem. This is being used for the playground.\n * @default true\n */\n write?: boolean\n }\n /**\n * Array of Kubb plugins to use.\n * The plugin/package can forsee some options that you need to pass through.\n * Sometimes a plugin is depended on another plugin, if that's the case you will get an error back from the plugin you installed.\n */\n plugins?: KubbPlugin[]\n /**\n * Hooks that will be called when a specific action is triggered in Kubb.\n */\n hooks?: {\n /**\n * Hook that will be triggerend at the end of all executions.\n * Useful for running Prettier or ESLint to use your own linting structure.\n */\n done?: string | string[]\n }\n}\n\nexport type CLIOptions = {\n /**\n * Path to `kubb.config.js`\n */\n config?: string\n /**\n * Watch changes on input\n */\n watch?: string\n\n /**\n * Log level to report when using the CLI\n *\n * `silent` will hide all information that is not relevant\n *\n * `info` will show all information possible(not related to the PluginManager)\n *\n * `debug` will show all information possible(related to the PluginManager), handy for seeing logs\n * @default `silent`\n */\n logLevel?: LogLevel\n}\n\nexport type BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n}\n\n// plugin\n\nexport type KubbPluginKind = 'schema' | 'controller'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type KubbJSONPlugins = [plugin: keyof Kubb.OptionsPlugins | (string & {}), options: Kubb.OptionsPlugins[keyof Kubb.OptionsPlugins]]\n\nexport type KubbObjectPlugin = keyof Kubb.OptionsPlugins\nexport type KubbObjectPlugins = {\n [K in keyof Kubb.OptionsPlugins]: Kubb.OptionsPlugins[K] | object\n}\n\nexport type KubbUserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: PluginFactoryOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options?: TOptions['options']\n /**\n * Kind/type for the plugin\n * Type 'schema' can be used for JSON schema's, TypeScript types, ...\n * Type 'controller' can be used to create generate API calls, React-Query hooks, Axios controllers, ...\n * @default undefined\n */\n kind?: KubbPluginKind\n /**\n * Define an api that can be used by other plugins, see `PluginManager' where we convert from `KubbUserPlugin` to `KubbPlugin`(used when calling `createPlugin`).\n */\n api?: (this: Omit<PluginContext, 'addFile'>) => TOptions['api']\n} & Partial<PluginLifecycle<TOptions>>\n\nexport type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: PluginFactoryOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options?: TOptions['options']\n /**\n * Kind/type for the plugin\n * Type 'schema' can be used for JSON schema's, TypeScript types, ...\n * Type 'controller' can be used to create generate API calls, React-Query hooks, Axios controllers, ...\n * @default undefined\n */\n kind?: KubbPluginKind\n /**\n * Define an api that can be used by other plugins, see `PluginManager' where we convert from `KubbUserPlugin` to `KubbPlugin`(used when calling `createPlugin`).\n */\n api?: TOptions['api']\n} & Partial<PluginLifecycle<TOptions>>\n\n// use of type objects\n\nexport type PluginFactoryOptions<Name = string, Options = unknown, Nested extends boolean = false, API = any, resolvePathOptions = Record<string, unknown>> = {\n name: Name\n options: Options\n nested: Nested\n api: API\n resolvePathOptions: resolvePathOptions\n}\n\nexport type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Valdiate all plugins to see if their depended plugins are installed and configured.\n * @type hookParallel\n */\n validate: (this: Omit<PluginContext, 'addFile'>, plugins: KubbPlugin[]) => PossiblePromise<true>\n /**\n * Start of the lifecycle of a plugin.\n * @type hookParallel\n */\n buildStart: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise<void>\n /**\n * Resolve to a Path based on a fileName(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, fileName: string, directory?: string, options?: TOptions['resolvePathOptions']) => OptionalPath\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, name: string) => string\n /**\n * Makes it possible to run async logic to override the path defined previously by `resolvePath`.\n * @type hookFirst\n */\n load: (this: Omit<PluginContext, 'addFile'>, path: Path) => PossiblePromise<TransformResult | null>\n /**\n * Transform the source-code.\n * @type hookReduceArg0\n */\n transform: (this: Omit<PluginContext, 'addFile'>, source: string, path: Path) => PossiblePromise<TransformResult>\n /**\n * Write the result to the file-system based on the id(defined by `resolvePath` or changed by `load`).\n * @type hookParallel\n */\n writeFile: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: Path) => PossiblePromise<void>\n /**\n * End of the plugin lifecycle.\n * @type hookParallel\n */\n buildEnd: (this: PluginContext) => PossiblePromise<void>\n}\n\nexport type PluginLifecycleHooks = keyof PluginLifecycle\n\nexport type PluginCache = Record<string, [number, unknown]>\n\nexport type ResolvePathParams<TOptions = Record<string, unknown>> = {\n /**\n * When set, resolvePath will only call resolvePath of the name of the plugin set here.\n * If not defined it will fall back on the resolvePath of the core plugin.\n */\n pluginName?: string\n fileName: string\n directory?: string | undefined\n /**\n * Options to be passed to 'resolvePath' 3th parameter\n */\n options?: TOptions\n}\n\nexport type ResolveNameParams = {\n /**\n * When set, resolvePath will only call resolvePath of the name of the plugin set here.\n * If not defined it will fall back on the resolvePath of the core plugin.\n */\n pluginName?: string\n name: string\n}\n\nexport type PluginContext<TOptions = Record<string, unknown>> = {\n config: KubbConfig\n cache: Cache<PluginCache>\n fileManager: FileManager\n addFile: (...file: File[]) => Promise<File[]>\n resolvePath: (params: ResolvePathParams<TOptions>) => OptionalPath\n resolveName: (params: ResolveNameParams) => string\n logger: Logger\n plugins: KubbPlugin[]\n}\n\n// null will mean clear the watcher for this key\nexport type TransformResult = string | null\n\n/**\n * @description Computing the name of a file or directory together with its position in relation to other directories traced back in a line to the root\n */\nexport type Path = string\nexport type OptionalPath = Path | null | undefined\nexport type FileName = string | null | undefined\n\nexport const LogLevel = {\n silent: 'silent',\n info: 'info',\n debug: 'debug',\n} as const\n\nexport type LogLevel = keyof typeof LogLevel\n","import type { CLIOptions, KubbUserConfig, PossiblePromise } 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>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<KubbUserConfig>),\n): typeof options {\n return options\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 extends object = object> {\n private _options: TOptions = {} as TOptions\n\n constructor(options: TOptions = {} as TOptions) {\n if (options) {\n this._options = {\n ...this._options,\n ...options,\n }\n }\n return this\n }\n\n get options(): TOptions {\n return this._options\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import { Generator } from './Generator.ts'\n\n/**\n * Abstract class that contains the building blocks for plugins to create their own SchemaGenerator\n */\nexport abstract class SchemaGenerator<TOptions extends object, TInput, TOutput> extends Generator<TOptions> {\n abstract build(schema: TInput, name: string, description?: string): TOutput\n}\n","import { build } from './build.ts'\n\nexport * from './config.ts'\nexport * from './build.ts'\nexport * from './types.ts'\nexport { createPlugin, pluginName, pluginName as name } from './plugin.ts'\n\nexport * from './utils/index.ts'\nexport * from './managers/index.ts'\nexport * from './generators/index.ts'\n\nexport default build\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/build.ts","../src/managers/fileManager/FileManager.ts","../src/utils/isPromise.ts","../src/utils/write.ts","../src/utils/cache.ts","../src/utils/read.ts","../src/utils/createFunctionParams.ts","../src/utils/nameSorter.ts","../src/utils/jsdoc.ts","../src/utils/getUniqueName.ts","../src/utils/timeout.ts","../src/utils/Queue.ts","../src/utils/transformers/escape.ts","../src/utils/transformers/transformReservedWord.ts","../src/utils/transformers/combineCodes.ts","../src/utils/renderTemplate.ts","../src/utils/clean.ts","../src/utils/TreeNode.ts","../src/utils/uniqueIdFactory.ts","../src/utils/importModule.ts","../src/utils/throttle.ts","../src/utils/SummaryError.ts","../src/utils/Warning.ts","../src/utils/logger.ts","../src/utils/randomColour.ts","../src/utils/URLPath.ts","../src/managers/fileManager/utils.ts","../src/plugin.ts","../src/utils/EventEmitter.ts","../src/managers/pluginManager/ParallelPluginError.ts","../src/managers/pluginManager/PluginError.ts","../src/managers/pluginManager/pluginParser.ts","../src/managers/pluginManager/PluginManager.ts","../src/managers/pluginManager/validate.ts","../src/types.ts","../src/config.ts","../src/generators/Generator.ts","../src/generators/SchemaGenerator.ts","../src/index.ts"],"names":["pc","crypto","pathParser","fs","switcher","require","timeout","default","camelCase","camelCaseTransformMerge","files","name","pluginName","plugin"],"mappings":";AAAA,OAAOA,SAAQ;;;ACAf,OAAOC,aAAY;;;ACEZ,SAAS,UAAa,QAAkD;AAC7E,SAAO,OAAQ,QAA6B,SAAS;AACvD;AAEO,SAAS,yBAAsC,QAA4E;AAChI,SAAO,OAAO,WAAW;AAC3B;AAEO,SAAS,wBAA2B,QAAwG;AACjJ,SAAO,OAAO,WAAW;AAC3B;;;ACZA,OAAO,gBAAgB;AAEvB,OAAO,QAAQ;AACf,SAAS,gBAAgB;AAEzB,eAAe,oBAAoB,MAA6B;AAE9D,QAAM,aAAa,WAAW,QAAQ,WAAW,QAAQ,IAAI,CAAC;AAE9D,QAAM,GAAG,MAAM,YAAY,EAAE,WAAW,KAAK,CAAC;AAChD;AAEA,IAAM,SAAS;AAAA,EACb;AAAA,IACE,MAAM,OAAO,MAAc,SAAiB;AAC1C,UAAI;AAC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C,UAAU,EAAE,GAAG,MAAM,QAAQ,iBAAiB,IAAI,EAAE,EAAE,GAAG,cAAc;AAChH;;;AmClHO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;;;ACZO,IAAe,YAAf,MAA2D;AAAA,EACxD,WAAqB,CAAC;AAAA,EAE9B,YAAY,UAAoB,CAAC,GAAe;AAC9C,QAAI,SAAS;AACX,WAAK,WAAW;AAAA,QACd,GAAG,KAAK;AAAA,QACR,GAAG;AAAA,MACL;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,UAAoB;AACtB,WAAO,KAAK;AAAA,EACd;AAGF;;;ACjBO,IAAe,kBAAf,cAAiF,UAAoB;AAE5G;;;ACIA,IAAO,cAAQ","sourcesContent":["import pc from 'picocolors'\n\nimport { createFileSource } from './managers/fileManager/index.ts'\nimport { PluginManager } from './managers/pluginManager/index.ts'\nimport { LogLevel } from './types.ts'\nimport { clean, createLogger, randomPicoColour, read, URLPath } from './utils/index.ts'\nimport { isPromise } from './utils/isPromise.ts'\n\nimport type { File, ResolvedFile } from './managers/fileManager/index.ts'\nimport type { BuildOutput, KubbPlugin, PluginContext, TransformResult } from './types.ts'\nimport type { Logger, QueueJob } from './utils/index.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n logLevel?: LogLevel\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n\n _plugin: KubbPlugin,\n): Promise<string | null> {\n return result\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const { config, logLevel, logger = createLogger() } = options\n\n try {\n if (!URLPath.isURL(config.input.path)) {\n await read(config.input.path)\n }\n } catch (e) {\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 ' + pc.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const queueTask = async (file: File) => {\n const { path } = file\n\n let code: string | null = createFileSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n code = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n code = loadedResult\n }\n\n if (code) {\n const transformedCode = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [code, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n await pluginManager.hookParallel({\n hookName: 'writeFile',\n parameters: [transformedCode, path],\n })\n }\n }\n }\n\n const pluginManager = new PluginManager(config, { debug: logLevel === LogLevel.debug, logger, task: queueTask as QueueJob<ResolvedFile> })\n const { plugins, fileManager } = pluginManager\n\n pluginManager.on('execute', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n const messsage = `${randomPicoColour(plugin.name)} Executing ${hookName}`\n\n if (logLevel === LogLevel.info) {\n if (logger.spinner) {\n logger.spinner.suffixText = messsage\n }\n }\n\n if (logLevel === LogLevel.debug) {\n logger.info(messsage)\n const logs = [\n parameters && `${pc.bgWhite(`Parameters`)} ${randomPicoColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${pc.bgWhite('Output')} ${randomPicoColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n console.log(logs.join('\\n'))\n }\n })\n\n await pluginManager.hookParallel<'validate', true>({\n hookName: 'validate',\n parameters: [plugins],\n })\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n return { files: fileManager.files.map((file) => ({ ...file, source: createFileSource(file) })), pluginManager }\n}\n","import crypto from 'node:crypto'\n\nimport { read, write } from '../../utils/index.ts'\nimport { extensions } from './utils.ts'\n\nimport type { Path } from '../../types.ts'\nimport type { Queue, QueueJob } from '../../utils/index.ts'\nimport type { CacheItem, File, ResolvedFile, UUID } from './types.ts'\nimport type { Extension } from './utils.ts'\n\nexport class FileManager {\n private cache: Map<Path, CacheItem[]> = new Map()\n\n private task?: QueueJob<ResolvedFile>\n\n private queue?: Queue\n\n constructor(options?: { queue?: Queue; task?: QueueJob<ResolvedFile> }) {\n if (options) {\n this.task = options.task\n this.queue = options.queue\n }\n }\n get extensions(): Extension[] {\n return extensions\n }\n\n get files(): File[] {\n const files: File[] = []\n this.cache.forEach((item) => {\n files.push(...item.flat(1))\n })\n\n return files\n }\n get isExecuting(): boolean {\n return this.queue?.hasJobs ?? false\n }\n\n async add(file: File): Promise<ResolvedFile> {\n const controller = new AbortController()\n const resolvedFile: ResolvedFile = { id: crypto.randomUUID(), ...file }\n\n this.cache.set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }])\n\n if (this.queue) {\n try {\n await this.queue.run(\n async () => {\n return this.task?.(resolvedFile)\n },\n { controller },\n )\n } catch {\n return resolvedFile\n }\n }\n\n return resolvedFile\n }\n\n addOrAppend(file: File): Promise<ResolvedFile> {\n // if (!file.path.endsWith(file.fileName)) {\n // console.warn(`Path ${file.path}(file.path) should end with the fileName ${file.fileName}(file.filename)`)\n // }\n\n const previousCaches = this.cache.get(file.path)\n const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : undefined\n\n if (previousCache) {\n this.cache.delete(previousCache.path)\n\n return this.add({\n ...file,\n source: previousCache.source && file.source ? `${previousCache.source}\\n${file.source}` : '',\n imports: [...(previousCache.imports || []), ...(file.imports || [])],\n exports: [...(previousCache.exports || []), ...(file.exports || [])],\n env: { ...(previousCache.env || {}), ...(file.env || {}) },\n })\n }\n return this.add(file)\n }\n\n private append(path: Path, file: ResolvedFile): void {\n const previousFiles = this.cache.get(path) || []\n\n this.cache.set(path, [...previousFiles, file])\n }\n\n getCacheByUUID(UUID: UUID): File | undefined {\n let cache: File | undefined\n\n this.cache.forEach((files) => {\n cache = files.find((item) => item.id === UUID)\n })\n return cache\n }\n\n get(path: Path): File[] | undefined {\n return this.cache.get(path)\n }\n\n remove(path: Path): void {\n const cacheItem = this.get(path)\n if (!cacheItem) {\n return\n }\n\n this.cache.delete(path)\n }\n\n async write(...params: Parameters<typeof write>): Promise<void> {\n if (this.queue) {\n return this.queue.run(async () => {\n return write(...params)\n })\n }\n\n return write(...params)\n }\n\n async read(...params: Parameters<typeof read>): Promise<string> {\n if (this.queue) {\n return this.queue.run(async () => {\n return read(...params)\n })\n }\n\n return read(...params)\n }\n}\n","import type { PossiblePromise } from '../types.ts'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","import pathParser from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nasync function saveCreateDirectory(path: string): Promise<void> {\n // resolve the full path and get just the directory, ignoring the file and extension\n const passedPath = pathParser.dirname(pathParser.resolve(path))\n // make the directory, recursively. Theoretically, if every directory in the path exists, this won't do anything.\n await fs.mkdir(passedPath, { recursive: true })\n}\n\nconst writer = switcher(\n {\n node: async (path: string, data: string) => {\n try {\n await fs.stat(path)\n const oldContent = await fs.readFile(path, { encoding: 'utf-8' })\n if (oldContent?.toString() === data) {\n return\n }\n } catch (_err) {\n /* empty */\n }\n\n await saveCreateDirectory(path)\n return fs.writeFile(pathParser.resolve(path), data, { encoding: 'utf-8' })\n },\n bun: async (path: string, data: string) => {\n try {\n await saveCreateDirectory(path)\n\n await Bun.write(pathParser.resolve(path), data)\n } catch (e) {\n console.log(e, pathParser.resolve(path))\n }\n },\n },\n 'node',\n)\n\nexport async function write(data: string, path: string): Promise<void> {\n return writer(path, data)\n}\n","import type { PluginCache } from '../types'\n\nexport interface Cache<TStore extends object = object> {\n delete(id: keyof TStore): boolean\n get(id: keyof TStore): TStore[keyof TStore] | null\n has(id: keyof TStore): boolean\n set(id: keyof TStore, value: unknown): void\n}\n\nexport function createPluginCache<TStore extends PluginCache>(Store: TStore = Object.create(null) as TStore): Cache<TStore> {\n return {\n set(id, value): void {\n Store[id] = [0, value] as TStore[keyof TStore]\n },\n get(id): TStore[keyof TStore] | null {\n const item = Store[id]\n if (!item) {\n return null\n }\n item[0] = 0\n return item[1] as TStore[keyof TStore]\n },\n has(id): boolean {\n const item = Store[id]\n if (!item) {\n return false\n }\n item[0] = 0\n return true\n },\n delete(id: keyof TStore): boolean {\n return delete Store[id]\n },\n }\n}\n","import pathParser from 'node:path'\n\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n }\n\n // windows\n return path.replaceAll(/\\\\/g, '/').replace('../', '').trimEnd()\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = pathParser.relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const path = slash(relativePath, platform)\n\n if (path.startsWith('../')) {\n return path.replace(pathParser.basename(path), pathParser.basename(path, pathParser.extname(filePath)))\n }\n\n return `./${path.replace(pathParser.basename(path), pathParser.basename(path, pathParser.extname(filePath)))}`\n}\n\nexport type PathMode = 'file' | 'directory'\n\nexport function getPathMode(path: string | undefined | null): PathMode {\n if (!path) {\n return 'directory'\n }\n return pathParser.extname(path) ? 'file' : 'directory'\n}\n\nconst reader = switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n)\n\nexport async function read(path: string): Promise<string> {\n return reader(path)\n}\n","import { camelCase, camelCaseTransformMerge } from 'change-case'\nimport { orderBy } from 'natural-orderby'\n\ntype FunctionParamsAst = {\n name: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\n/**\n * Convert an string array to a string of parameters that can be used inside a function\n * The parameter name is converted to `camelcase`\n */\nexport function createFunctionParams(data: FunctionParamsAst[]): string {\n const sortedData = orderBy(data, [(v) => v.default, (v) => v.required ?? true], ['desc', 'desc'])\n\n return sortedData\n .filter(({ enabled = true }) => enabled)\n .reduce((acc, { name, type, required = true, ...rest }) => {\n const parameterName = camelCase(name, { delimiter: '', transform: camelCaseTransformMerge })\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }, [] as string[])\n .join(', ')\n}\n","export function nameSorter<T extends { name: string }>(a: T, b: T): 0 | 1 | -1 {\n if (a.name < b.name) {\n return -1\n }\n if (a.name > b.name) {\n return 1\n }\n return 0\n}\n","export function createJSDocBlockText({ comments }: { comments: Array<string> }): string {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return ''\n }\n\n return `/**\\n * ${filteredComments.join('\\n * ')}\\n */`\n}\n","export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n","import crypto from 'node:crypto'\nimport { performance } from 'node:perf_hooks'\n\nexport type QueueJob<T = unknown> = {\n (...args: unknown[]): Promise<T> | Promise<void>\n}\n\ntype RunOptions = {\n controller?: AbortController\n name?: string\n description?: string\n}\n\ntype QueueItem = {\n reject: <T>(reason?: T) => void\n resolve: <T>(value: T | PromiseLike<T>) => void\n job: QueueJob<unknown>\n} & Required<RunOptions>\n\nexport class Queue {\n private queue: QueueItem[] = []\n\n private workerCount = 0\n\n private maxParallel: number\n private debug = false\n\n constructor(maxParallel: number, debug = false) {\n this.maxParallel = maxParallel\n this.debug = debug\n }\n\n run<T>(job: QueueJob<T>, options: RunOptions = { controller: new AbortController(), name: crypto.randomUUID(), description: '' }): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const item = { reject, resolve, job, name: options.name, description: options.description || options.name } as QueueItem\n\n options.controller?.signal.addEventListener('abort', () => {\n this.queue = this.queue.filter((queueItem) => queueItem.name === item.name)\n\n reject('Aborted')\n })\n\n this.queue.push(item)\n this.work()\n })\n }\n\n runSync<T>(job: QueueJob<T>, options: RunOptions = { controller: new AbortController(), name: crypto.randomUUID(), description: '' }): void {\n new Promise<T>((resolve, reject) => {\n const item = { reject, resolve, job, name: options.name, description: options.description || options.name } as QueueItem\n\n options.controller?.signal.addEventListener('abort', () => {\n this.queue = this.queue.filter((queueItem) => queueItem.name === item.name)\n })\n\n this.queue.push(item)\n this.work()\n })\n }\n\n get hasJobs(): boolean {\n return this.workerCount > 0 || this.queue.length > 0\n }\n\n private work(): void {\n if (this.workerCount >= this.maxParallel) {\n return\n }\n this.workerCount++\n\n let entry: QueueItem | undefined\n while ((entry = this.queue.shift())) {\n const { reject, resolve, job, name, description } = entry\n if (this.debug) {\n performance.mark(name + '_start')\n }\n\n job()\n .then((result) => {\n resolve(result)\n\n if (this.debug) {\n performance.mark(name + '_stop')\n performance.measure(description, name + '_start', name + '_stop')\n }\n })\n .catch((err) => reject(err))\n }\n\n this.workerCount--\n }\n}\n","export function escape(text?: string): string {\n return text ? text.replaceAll('`', '\\\\`') : ''\n}\n\n/**\n * Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on\n * @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n * @link https://github.com/joliss/js-string-escape/blob/master/index.js\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function jsStringEscape(input: any): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return '\\\\' + character\n // Four possible LineTerminator characters need to be escaped:\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n","/**\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = [\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n\n 'Array',\n 'Date',\n 'eval',\n 'function',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n]\n\nexport function transformReservedWord(word: string): string {\n if ((word && reservedWords.includes(word)) || word?.match(/^\\d/)) {\n return `_${word}`\n }\n\n return word\n}\n","export function combineCodes(codes: string[]): string {\n return codes.join('\\n')\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const value = data[curr.split(/{{|}}/).filter(Boolean)[0].trim()]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","import { remove } from 'fs-extra'\n\nexport async function clean(path: string): Promise<void> {\n return remove(path)\n}\n","import dirTree from 'directory-tree'\n\nimport { getPathMode } from '../utils/read.ts'\n\nimport type { DirectoryTree, DirectoryTreeOptions } from 'directory-tree'\n\nexport type TreeNodeOptions = DirectoryTreeOptions\n\nexport class TreeNode<T = unknown> {\n public data: T\n\n public parent?: TreeNode<T>\n\n public children: Array<TreeNode<T>> = []\n\n constructor(data: T, parent?: TreeNode<T>) {\n this.data = data\n this.parent = parent\n return this\n }\n\n addChild(data: T): TreeNode<T> {\n const child = new TreeNode(data, this)\n if (!this.children) {\n this.children = []\n }\n this.children.push(child)\n return child\n }\n\n find(data?: T): TreeNode<T> | null {\n if (!data) {\n return null\n }\n\n if (data === this.data) {\n return this\n }\n\n if (this.children?.length) {\n for (let i = 0, { length } = this.children, target: TreeNode<T> | null = null; i < length; i++) {\n target = this.children[i].find(data)\n if (target) {\n return target\n }\n }\n }\n\n return null\n }\n\n get leaves(): TreeNode<T>[] {\n if (!this.children || this.children.length === 0) {\n // this is a leaf\n return [this]\n }\n\n // if not a leaf, return all children's leaves recursively\n const leaves: TreeNode<T>[] = []\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n // eslint-disable-next-line prefer-spread\n leaves.push.apply(leaves, this.children[i].leaves)\n }\n }\n return leaves\n }\n\n get root(): TreeNode<T> {\n if (!this.parent) {\n return this\n }\n return this.parent.root\n }\n\n forEach(callback: (treeNode: TreeNode<T>) => void): this {\n if (typeof callback !== 'function') {\n throw new TypeError('forEach() callback must be a function')\n }\n\n // run this node through function\n callback(this)\n\n // do the same for all children\n if (this.children) {\n for (let i = 0, { length } = this.children; i < length; i++) {\n this.children[i].forEach(callback)\n }\n }\n\n return this\n }\n\n public static build<T = unknown>(path: string, options: TreeNodeOptions = {}): TreeNode<T> | null {\n try {\n const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean)\n const filteredTree = dirTree(path, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] })\n\n if (!filteredTree) {\n return null\n }\n\n const treeNode = new TreeNode({ name: filteredTree.name, path: filteredTree.path, type: filteredTree.type || getPathMode(filteredTree.path) })\n\n const recurse = (node: typeof treeNode, item: DirectoryTree) => {\n const subNode = node.addChild({ name: item.name, path: item.path, type: item.type || getPathMode(item.path) })\n\n if (item.children?.length) {\n item.children?.forEach((child) => {\n recurse(subNode, child)\n })\n }\n }\n\n filteredTree.children?.forEach((child) => recurse(treeNode, child))\n\n return treeNode as TreeNode<T>\n } catch (e) {\n throw new Error('Something went wrong with creating index files with the TreehNode class', { cause: e })\n }\n }\n}\n","export const uniqueIdFactory =\n (counter: number) =>\n (str = ''): string =>\n `${str}${++counter}`\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nconst SLASHES = new Set(['/', '\\\\'])\n\n/**\n * Normalizes directories to have a trailing slash.\n * Resolve is pretty finicky -- if the directory name doesn't have\n * a trailing slash then it tries to look in the parent directory.\n * i.e., if the directory is \"/usr/nzakas/foo\" it will start the\n * search in /usr/nzakas. However, if the directory is \"/user/nzakas/foo/\",\n * then it will start the search in /user/nzakas/foo.\n * @param {string} directory The directory to check.\n * @returns {string} The normalized directory.\n */\nexport function normalizeDirectory(directory: string): string {\n if (!SLASHES.has(directory[directory.length - 1])) {\n return `${directory}/`\n }\n\n return directory\n}\n\nexport function getLocation(path: string, cwd?: string): string {\n let location = path\n\n if (cwd) {\n const require = mod.createRequire(normalizeDirectory(cwd))\n location = require.resolve(path)\n }\n\n return location\n}\n\nexport async function importModule(path: string, cwd?: string): Promise<any | undefined> {\n try {\n let location = getLocation(path, cwd)\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\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n}\n","export const throttle = <R, A extends any[]>(fn: (...args: A) => R, delay: number): [(...args: A) => R | undefined, () => void] => {\n let wait = false\n let timeout: NodeJS.Timeout\n let cancelled = false\n\n return [\n (...args: A) => {\n if (cancelled) {\n return undefined\n }\n if (wait) {\n return undefined\n }\n\n const val = fn(...args)\n\n wait = true\n\n timeout = setTimeout(() => {\n wait = false\n }, delay)\n\n return val\n },\n () => {\n cancelled = true\n clearTimeout(timeout)\n },\n ]\n}\n","export class SummaryError extends Error {\n public summary: string[]\n\n constructor(message: string, options: { cause: Error; summary?: string[] }) {\n super(message, { cause: options.cause })\n\n this.name = 'SummaryError'\n this.summary = options.summary || []\n }\n}\n","/**\n * Behaves as an Error to log a warning in the console(still stops the execution)\n */\nexport class Warning extends Error {\n constructor(message?: string, options?: { cause: Error }) {\n super(message, { cause: options?.cause })\n\n this.name = 'Warning'\n }\n}\n","import pc from 'picocolors'\n\nimport type { Ora } from 'ora'\n\nexport type LogType = 'error' | 'info' | 'warning'\n\nexport type Logger = {\n log: (message: string | null) => void\n error: (message: string | null) => void\n info: (message: string | null) => void\n warn: (message: string | null) => void\n spinner?: Ora\n logs: string[]\n}\n\nexport function createLogger(spinner?: Ora): Logger {\n const logs: string[] = []\n const log: Logger['log'] = (message) => {\n if (message && spinner) {\n spinner.text = message\n logs.push(message)\n }\n }\n\n const error: Logger['error'] = (message) => {\n if (message) {\n throw new Error(message || 'Something went wrong')\n }\n }\n\n const warn: Logger['warn'] = (message) => {\n if (message && spinner) {\n spinner.warn(pc.yellow(message))\n logs.push(message)\n }\n }\n\n const info: Logger['warn'] = (message) => {\n if (message && spinner) {\n spinner.info(message)\n logs.push(message)\n }\n }\n\n const logger: Logger = {\n log,\n error,\n warn,\n info,\n spinner,\n logs,\n }\n\n return logger\n}\n\nexport { default as pc } from 'picocolors'\n","import pc from 'picocolors'\nimport seedrandom from 'seedrandom'\n\nimport type { Formatter } from 'picocolors/types'\n\nexport const defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const\n\nexport function randomColour(text?: string, colours = defaultColours): string {\n if (!text) {\n return 'white'\n }\n\n const random = seedrandom(text)\n const colour = colours.at(Math.floor(random() * colours.length)) || 'white'\n\n return colour\n}\n\nexport function randomPicoColour(text?: string, colors = defaultColours): string {\n const colours = pc.createColors(true)\n\n if (!text) {\n return colours.white(text)\n }\n\n const colour = randomColour(text, colors)\n const isDark = colour.includes('dark')\n const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours\n const formatter: Formatter = colours[key] as Formatter\n\n if (isDark) {\n return pc.bold(formatter(text))\n }\n\n if (typeof formatter !== 'function') {\n throw new Error('Formatter for picoColor is not of type function/Formatter')\n }\n return formatter(text)\n}\n","import { camelCase, camelCaseTransformMerge } from 'change-case'\n\ntype URLObject = {\n url: string\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n type?: 'path' | 'template'\n replacer?: (pathParam: string) => string\n stringify?: boolean\n}\n\nexport class URLPath {\n path: string\n\n constructor(path: string) {\n this.path = path\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isUrl(): boolean {\n return URLPath.isURL(this.path)\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n get object(): URLObject | string {\n return this.toObject()\n }\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n toObject(options: ObjectOptions = {}): URLObject | string {\n return URLPath.toObject(this.path, options)\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString(replacer?: (pathParam: string) => string): string {\n return URLPath.toTemplateString(this.path, replacer)\n }\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n static toTemplateString(path: string, replacer?: (pathParam: string) => string): string {\n const regex = /{(\\w|-)*}/g\n const found = path.match(regex)\n let newPath = path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, curr) => {\n const pathParam = replacer\n ? replacer(camelCase(curr, { delimiter: '', transform: camelCaseTransformMerge }))\n : camelCase(curr, { delimiter: '', transform: camelCaseTransformMerge })\n const replacement = `\\${${pathParam}}`\n\n return prev.replace(curr, replacement)\n }, path)\n }\n\n return `\\`${newPath}\\``\n }\n\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n return URLPath.getParams(this.path, replacer)\n }\n\n static getParams(path: string, replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const regex = /{(\\w|-)*}/g\n const found = path.match(regex)\n\n if (!found) {\n return undefined\n }\n\n const params: Record<string, string> = {}\n found.forEach((item) => {\n item = item.replaceAll('{', '').replaceAll('}', '')\n\n const pathParam = replacer\n ? replacer(camelCase(item, { delimiter: '', transform: camelCaseTransformMerge }))\n : camelCase(item, { delimiter: '', transform: camelCaseTransformMerge })\n\n params[pathParam] = pathParam\n }, path)\n\n return params\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return URLPath.toURLPath(this.path)\n }\n\n static toURLPath(path: string): string {\n return path.replaceAll('{', ':').replaceAll('}', '')\n }\n\n static toObject(path: string, { type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? URLPath.toURLPath(path) : URLPath.toTemplateString(path, replacer),\n params: URLPath.getParams(path),\n }\n\n if (stringify) {\n if (type !== 'template') {\n throw new Error('Type should be `template` when using stringiyf')\n }\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n return object\n }\n\n static isURL(path: string): boolean {\n try {\n const url = new URL(path)\n if (url?.href) {\n return true\n }\n } catch (error) {\n return false\n }\n return false\n }\n}\n","import pathParser from 'node:path'\n\nimport { createExportDeclaration, createImportDeclaration, print } from '@kubb/ts-codegen'\n\nimport isEqual from 'lodash.isequal'\n\nimport { TreeNode } from '../../utils/index.ts'\n\nimport type { Path } from '../../types.ts'\nimport type { PathMode, TreeNodeOptions } from '../../utils/index.ts'\nimport type { Export, File, Import } from './types.ts'\n\ntype TreeNodeData = { type: PathMode; path: Path; name: string }\n\nexport function getIndexes(root: string, options: TreeNodeOptions = {}): File[] | null {\n const tree = TreeNode.build<TreeNodeData>(root, { extensions: /\\.ts/, ...options })\n\n if (!tree) {\n return null\n }\n\n const fileReducer = (files: File[], currentTree: typeof tree) => {\n if (!currentTree.children) {\n return []\n }\n\n if (currentTree.children?.length > 1) {\n const path = pathParser.resolve(currentTree.data.path, 'index.ts')\n const exports = currentTree.children\n .map((file) => {\n if (!file) {\n return undefined\n }\n\n const importPath: string = file.data.type === 'directory' ? `./${file.data.name}` : `./${file.data.name.replace(/\\.[^.]*$/, '')}`\n\n // TODO weird hacky fix\n if (importPath.includes('index') && path.includes('index')) {\n return undefined\n }\n\n return { path: importPath }\n })\n .filter(Boolean)\n\n files.push({\n path,\n fileName: 'index.ts',\n source: '',\n exports,\n })\n } else {\n currentTree.children?.forEach((child) => {\n const path = pathParser.resolve(currentTree.data.path, 'index.ts')\n const importPath = child.data.type === 'directory' ? `./${child.data.name}` : `./${child.data.name.replace(/\\.[^.]*$/, '')}`\n\n files.push({\n path,\n fileName: 'index.ts',\n source: '',\n exports: [{ path: importPath }],\n })\n })\n }\n\n currentTree.children.forEach((childItem) => {\n fileReducer(files, childItem)\n })\n\n return files\n }\n\n const files = fileReducer([], tree)\n\n return files\n}\n\nexport function combineFiles(files: Array<File | null>): File[] {\n return files.filter(Boolean).reduce((acc, curr: File) => {\n const prevIndex = acc.findIndex((item) => item.path === curr.path)\n\n if (prevIndex !== -1) {\n const prev = acc[prevIndex]\n acc[prevIndex] = {\n ...curr,\n source: prev.source && curr.source ? `${prev.source}\\n${curr.source}` : '',\n imports: [...(prev.imports || []), ...(curr.imports || [])],\n exports: [...(prev.exports || []), ...(curr.exports || [])],\n env: { ...(prev.env || {}), ...(curr.env || {}) },\n }\n } else {\n acc.push(curr)\n }\n\n return acc\n }, [] as File[])\n}\n/**\n * Support for js, ts and tsx(React)\n */\nexport type Extension = '.ts' | '.js' | '.tsx'\nexport const extensions: Array<Extension> = ['.js', '.ts', '.tsx']\n\nexport function isExtensionAllowed(fileName: string): boolean {\n return extensions.some((extension) => fileName.endsWith(extension))\n}\n\nexport function combineExports(exports: Export[]): Export[] {\n return exports.reduce((prev, curr) => {\n const name = curr.name\n const prevByPath = prev.findLast((imp) => imp.path === curr.path)\n const uniquePrev = prev.findLast(\n (imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias,\n )\n\n if (uniquePrev || (Array.isArray(name) && !name.length) || (prevByPath?.asAlias && !curr.asAlias)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name: Array.isArray(name) ? [...new Set(name)] : name,\n },\n ]\n }\n\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...curr.name])]\n\n return prev\n }\n\n return [...prev, curr]\n }, [] as Export[])\n}\n\nexport function combineImports(imports: Import[], exports: Export[], source: string): Import[] {\n return imports.reduce((prev, curr) => {\n let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name\n\n const hasImportInSource = (importName: string) => {\n const checker = (name?: string) => name && !!source.includes(`${name}`)\n return checker(importName) || exports.some(({ name }) => (Array.isArray(name) ? name.some(checker) : checker(name)))\n }\n\n if (Array.isArray(name)) {\n name = name.filter((item) => hasImportInSource(item))\n }\n\n const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly)\n const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly)\n\n if (uniquePrev || (Array.isArray(name) && !name.length)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name,\n },\n ]\n }\n\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...name])]\n\n return prev\n }\n\n if (!Array.isArray(name) && name && !hasImportInSource(name)) {\n return prev\n }\n\n return [...prev, curr]\n }, [] as Import[])\n}\n\nexport function createFileSource(file: File): string {\n let { source } = file\n\n if (!isExtensionAllowed(file.fileName)) {\n return file.source\n }\n\n const exports = file.exports ? combineExports(file.exports) : []\n const imports = file.imports ? combineImports(file.imports, exports, source) : []\n\n const importNodes = imports.map((item) => createImportDeclaration({ name: item.name, path: item.path, isTypeOnly: item.isTypeOnly }))\n const importSource = print(importNodes)\n\n const exportNodes = exports.map((item) => createExportDeclaration({ name: item.name, path: item.path, isTypeOnly: item.isTypeOnly, asAlias: item.asAlias }))\n const exportSource = print(exportNodes)\n\n // need to after `combineImports`\n source = getEnvSource(file.source, file.env)\n\n if (importSource) {\n source = `${importSource}\\n${source}`\n }\n\n if (exportSource) {\n source = `${exportSource}\\n${source}`\n }\n\n return source\n}\n\ntype SearchAndReplaceOptions = {\n text: string\n replaceBy: string\n prefix?: string\n key: string\n searchValues?: (prefix: string, key: string) => Array<RegExp | string>\n}\n\nfunction searchAndReplace(options: SearchAndReplaceOptions): string {\n const { text, replaceBy, prefix = '', key } = options\n\n const searchValues = options.searchValues?.(prefix, key) || [\n `${prefix}[\"${key}\"]`,\n `${prefix}['${key}']`,\n `${prefix}[\\`${key}\\`]`,\n `${prefix}\"${key}\"`,\n `${prefix}'${key}'`,\n `${prefix}\\`${key}\\``,\n new RegExp(`${prefix}${key}`, 'g'),\n ]\n\n return searchValues.reduce((prev, searchValue) => {\n return prev.toString().replaceAll(searchValue, replaceBy)\n }, text) as string\n}\n\nfunction getEnvSource(source: string, env: NodeJS.ProcessEnv | undefined): string {\n if (!env) {\n return source\n }\n\n const keys = Object.keys(env)\n\n if (!keys.length) {\n return source\n }\n\n return keys.reduce((prev, key: string) => {\n const environmentValue = env[key]\n const replaceBy = environmentValue ? `'${environmentValue.replaceAll('\"', '')?.replaceAll(\"'\", '')}'` : 'undefined'\n\n if (key.toUpperCase() !== key) {\n throw new TypeError(`Environment should be in upperCase for ${key}`)\n }\n\n if (typeof replaceBy === 'string') {\n prev = searchAndReplace({ text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: 'process.env', key })\n // removes `declare const ...`\n prev = searchAndReplace({ text: prev.replaceAll(new RegExp(`(declare const).*\\n`, 'ig'), ''), replaceBy, key })\n }\n\n return prev\n }, source)\n}\n","import pathParser from 'node:path'\n\nimport { createPluginCache, transformReservedWord } from './utils/index.ts'\n\nimport type { FileManager } from './managers/fileManager/FileManager.ts'\nimport type { KubbPlugin, KubbUserPlugin, PluginContext, PluginFactoryOptions } from './types.ts'\n\ntype KubbPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (\n options: T['options'],\n) => T['nested'] extends true ? Array<KubbUserPlugin<T>> : KubbUserPlugin<T>\n\nexport function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: KubbPluginFactory<T>) {\n return (options: T['options']): ReturnType<KubbPluginFactory<T>> => {\n const plugin = factory(options)\n if (Array.isArray(plugin)) {\n throw new Error('Not implemented')\n }\n\n // default transform\n if (!plugin.transform) {\n plugin.transform = function transform(code) {\n return code\n }\n }\n\n return plugin\n }\n}\n\ntype Options = {\n config: PluginContext['config']\n fileManager: FileManager\n resolvePath: PluginContext['resolvePath']\n resolveName: PluginContext['resolveName']\n logger: PluginContext['logger']\n getPlugins: () => KubbPlugin[]\n}\n\n// not publicly exported\nexport type CorePluginOptions = PluginFactoryOptions<'core', Options, false, PluginContext>\n\nexport const pluginName: CorePluginOptions['name'] = 'core' as const\n\nexport const definePlugin = createPlugin<CorePluginOptions>((options) => {\n const { fileManager, resolvePath, resolveName, logger } = options\n\n return {\n name: pluginName,\n options,\n api() {\n // TODO watch out, typing is incorrect, `this` will be `null` with that core is normally the `this`\n return {\n get config() {\n return options.config\n },\n get plugins() {\n return options.getPlugins()\n },\n logger,\n fileManager,\n async addFile(...files) {\n return Promise.all(\n files.map((file) => {\n if (file.override) {\n return fileManager.add(file)\n }\n\n return fileManager.addOrAppend(file)\n }),\n )\n },\n resolvePath,\n resolveName: (params) => {\n const name = resolveName(params)\n\n return transformReservedWord(name)\n },\n cache: createPluginCache(),\n }\n },\n resolvePath(fileName) {\n const root = pathParser.resolve(this.config.root, this.config.output.path)\n\n return pathParser.resolve(root, fileName)\n },\n resolveName(name) {\n return name\n },\n }\n})\n","/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport { EventEmitter as NodeEventEmitter } from 'node:events'\n\nexport class EventEmitter<TEvents extends Record<string, any>> {\n private emitter = new NodeEventEmitter()\n\n emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void {\n this.emitter.emit(eventName, ...(eventArg as []))\n }\n\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.emitter.on(eventName, handler as any)\n }\n\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.emitter.off(eventName, handler as any)\n }\n}\n","import type { PluginError } from './PluginError.ts'\nimport type { PluginManager } from './PluginManager'\n\nexport class ParallelPluginError extends Error {\n public errors: PluginError[] = []\n\n public pluginManager: PluginManager\n\n constructor(message: string, options: { cause?: Error; errors: PluginError[]; pluginManager: PluginManager }) {\n super(message, { cause: options.cause })\n\n this.name = 'ParallelPluginError'\n this.errors = options.errors\n this.pluginManager = options.pluginManager\n }\n\n findError<T extends Error = Error>(searchError: T | undefined): T | undefined {\n if (!searchError) {\n return undefined\n }\n\n return this.errors.find((error) => {\n if (error.cause) {\n if (error.cause.name == searchError.name) {\n return true\n }\n\n return !!this.findError(error.cause)\n }\n return error.name === searchError.name\n })?.cause as T\n }\n}\n","import type { PluginManager } from './PluginManager'\n\nexport class PluginError extends Error {\n public pluginManager: PluginManager\n public cause: Error\n\n constructor(message: string, options: { cause: Error; pluginManager: PluginManager }) {\n super(message, { cause: options.cause })\n\n this.name = 'PluginError'\n this.cause = options.cause\n this.pluginManager = options.pluginManager\n }\n}\n","import type { CorePluginOptions } from '../../plugin.ts'\nimport type { KubbPlugin, KubbUserPlugin } from '../../types.ts'\n\nexport function pluginParser(plugin: KubbUserPlugin, context: CorePluginOptions['api'] | undefined): KubbPlugin | null {\n if (plugin.api && typeof plugin.api === 'function') {\n // eslint-disable-next-line @typescript-eslint/ban-types\n const api = (plugin.api as Function).call(context) as typeof plugin.api\n\n return {\n ...plugin,\n api,\n }\n }\n\n return null\n}\n","/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/no-unsafe-argument */\n\nimport { definePlugin } from '../../plugin.ts'\nimport { EventEmitter } from '../../utils/EventEmitter.ts'\nimport { isPromise, isPromiseRejectedResult } from '../../utils/isPromise.ts'\nimport { Queue } from '../../utils/Queue.ts'\nimport { FileManager } from '../fileManager/FileManager.ts'\nimport { ParallelPluginError } from './ParallelPluginError.ts'\nimport { PluginError } from './PluginError.ts'\nimport { pluginParser } from './pluginParser.ts'\n\nimport type { CorePluginOptions } from '../../plugin.ts'\nimport type {\n KubbConfig,\n KubbPlugin,\n OptionalPath,\n PluginContext,\n PluginLifecycle,\n PluginLifecycleHooks,\n PossiblePromise,\n ResolveNameParams,\n ResolvePathParams,\n} from '../../types.ts'\nimport type { Logger } from '../../utils/logger.ts'\nimport type { QueueJob } from '../../utils/Queue.ts'\nimport type { ResolvedFile } from '../fileManager/types.ts'\nimport type { Argument0, Executer, ParseResult, SafeParseResult, Strategy } from './types.ts'\n\n// inspired by: https://github.com/rollup/rollup/blob/master/src/utils/PluginDriver.ts#\n\n// This will make sure no input hook is omitted\nconst hookNames: {\n [P in PluginLifecycleHooks]: 1\n} = {\n validate: 1,\n buildStart: 1,\n resolvePath: 1,\n resolveName: 1,\n load: 1,\n transform: 1,\n writeFile: 1,\n buildEnd: 1,\n}\nexport const hooks = Object.keys(hookNames) as [PluginLifecycleHooks]\n\ntype Options = { debug?: boolean; task: QueueJob<ResolvedFile>; logger: Logger }\n\ntype Events = {\n execute: [executer: Executer]\n executed: [executer: Executer]\n error: [pluginError: PluginError]\n}\n\nexport class PluginManager {\n public plugins: KubbPlugin[]\n\n public readonly fileManager: FileManager\n\n private readonly core: KubbPlugin<CorePluginOptions>\n\n public queue: Queue\n\n public executed: Executer[] = []\n public logger: Logger\n private eventEmitter: EventEmitter<Events> = new EventEmitter()\n\n constructor(config: KubbConfig, options: Options) {\n // TODO use logger for all warnings/errors\n this.logger = options.logger\n this.queue = new Queue(100, options.debug)\n this.fileManager = new FileManager({ task: options.task, queue: this.queue })\n\n const core = definePlugin({\n config,\n logger: this.logger,\n fileManager: this.fileManager,\n resolvePath: this.resolvePath.bind(this),\n resolveName: this.resolveName.bind(this),\n getPlugins: this.getSortedPlugins.bind(this),\n }) as KubbPlugin<CorePluginOptions> & {\n api: (this: Omit<PluginContext, 'addFile'>) => CorePluginOptions['api']\n }\n\n this.core = pluginParser(core, core.api.call(null as any)) as KubbPlugin<CorePluginOptions>\n\n this.plugins = [this.core, ...(config.plugins || [])].reduce((prev, plugin) => {\n // TODO HACK to be sure that this is equal to the `core.api` logic.\n\n const convertedApi = pluginParser(plugin, this.core?.api)\n\n if (convertedApi) {\n return [...prev, convertedApi]\n }\n\n return [...prev, plugin]\n }, [] as KubbPlugin[])\n }\n\n resolvePath = (params: ResolvePathParams): OptionalPath => {\n if (params.pluginName) {\n return this.hookForPluginSync({\n pluginName: params.pluginName,\n hookName: 'resolvePath',\n parameters: [params.fileName, params.directory, params.options],\n })\n }\n return this.hookFirstSync({\n hookName: 'resolvePath',\n parameters: [params.fileName, params.directory, params.options],\n }).result\n }\n\n resolveName = (params: ResolveNameParams): string => {\n if (params.pluginName) {\n return (\n this.hookForPluginSync({\n pluginName: params.pluginName,\n hookName: 'resolveName',\n parameters: [params.name],\n }) || params.name\n )\n }\n return this.hookFirstSync({\n hookName: 'resolveName',\n parameters: [params.name],\n }).result\n }\n\n on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void {\n this.eventEmitter.on(eventName, handler as any)\n }\n\n /**\n *\n * Run only hook for a specific plugin name\n */\n hookForPlugin<H extends PluginLifecycleHooks>({\n pluginName,\n hookName,\n parameters,\n }: {\n pluginName: string\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n }): Promise<ReturnType<ParseResult<H>> | null> | null {\n const plugin = this.getPlugin(hookName, pluginName)\n\n return this.execute({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n }\n\n hookForPluginSync<H extends PluginLifecycleHooks>({\n pluginName,\n hookName,\n parameters,\n }: {\n pluginName: string\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n }): ReturnType<ParseResult<H>> | null {\n const plugin = this.getPlugin(hookName, pluginName)\n\n return this.executeSync({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n }\n\n /**\n *\n * Chains, first non-null result stops and returns\n */\n hookFirst<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n }: {\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n skipped?: ReadonlySet<KubbPlugin> | null\n }): Promise<SafeParseResult<H>> {\n let promise: Promise<SafeParseResult<H>> = Promise.resolve(null as unknown as SafeParseResult<H>)\n\n for (const plugin of this.getSortedPlugins()) {\n if (skipped && skipped.has(plugin)) {\n continue\n }\n promise = promise.then(async (parseResult) => {\n if (parseResult?.result != null) {\n return parseResult\n }\n const value = await this.execute<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n })\n\n return Promise.resolve({\n plugin,\n result: value,\n } as typeof parseResult)\n })\n }\n\n return promise\n }\n\n /**\n *\n * Chains, first non-null result stops and returns\n */\n hookFirstSync<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n skipped,\n }: {\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n skipped?: ReadonlySet<KubbPlugin> | null\n }): SafeParseResult<H> {\n let parseResult: SafeParseResult<H> = null as unknown as SafeParseResult<H>\n\n for (const plugin of this.getSortedPlugins()) {\n if (skipped && skipped.has(plugin)) {\n continue\n }\n\n parseResult = {\n result: this.executeSync<H>({\n strategy: 'hookFirst',\n hookName,\n parameters,\n plugin,\n }),\n plugin,\n } as SafeParseResult<H>\n\n if (parseResult?.result != null) {\n break\n }\n }\n return parseResult\n }\n\n /**\n *\n * Parallel, runs all plugins\n */\n async hookParallel<H extends PluginLifecycleHooks, TOuput = void>({\n hookName,\n parameters,\n }: {\n hookName: H\n parameters?: Parameters<PluginLifecycle[H]> | undefined\n }): Promise<Awaited<TOuput>[]> {\n const parallelPromises: Promise<TOuput>[] = []\n\n for (const plugin of this.getSortedPlugins()) {\n // TODO implement sequential with `buildStart` as an object({ sequential: boolean; handler: PluginContext[\"buildStart\"] })\n // if ((plugin[hookName] as { sequential?: boolean })?.sequential) {\n // await Promise.all(parallelPromises)\n // parallelPromises.length = 0\n // await this.execute({\n // strategy: 'hookParallel',\n // hookName,\n // parameters,\n // plugin,\n // })\n // }\n const promise: Promise<TOuput> | null = this.execute({ strategy: 'hookParallel', hookName, parameters, plugin })\n\n if (promise) {\n parallelPromises.push(promise)\n }\n }\n const results = await Promise.allSettled(parallelPromises)\n\n const errors = results\n .map((result) => {\n // needs `cause` because Warning and other errors will then not be added, only PluginError is possible here\n if (isPromiseRejectedResult<PluginError>(result) && result.reason instanceof PluginError) {\n return result.reason\n }\n return undefined\n })\n .filter(Boolean)\n\n if (errors.length) {\n throw new ParallelPluginError('Error', { errors, pluginManager: this })\n }\n\n return results.filter((result) => result.status === 'fulfilled').map((result) => (result as PromiseFulfilledResult<Awaited<TOuput>>).value)\n }\n\n /**\n *\n * Chains, reduces returned value, handling the reduced value as the first hook argument\n */\n hookReduceArg0<H extends PluginLifecycleHooks>({\n hookName,\n parameters,\n reduce,\n }: {\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise<Argument0<H> | null>\n }): Promise<Argument0<H>> {\n const [argument0, ...rest] = parameters\n\n let promise: Promise<Argument0<H>> = Promise.resolve(argument0)\n for (const plugin of this.getSortedPlugins()) {\n promise = promise\n .then((arg0) => {\n const value = this.execute({\n strategy: 'hookReduceArg0',\n hookName,\n parameters: [arg0, ...rest] as Parameters<PluginLifecycle[H]>,\n plugin,\n })\n return value\n })\n .then((result) => reduce.call(this.core.api, argument0, result as ReturnType<ParseResult<H>>, plugin)) as Promise<Argument0<H>>\n }\n return promise\n }\n\n /**\n * Chains plugins\n */\n hookSeq<H extends PluginLifecycleHooks>({ hookName, parameters }: { hookName: H; parameters?: Parameters<PluginLifecycle[H]> }): Promise<void> {\n let promise: Promise<void | null> = Promise.resolve()\n for (const plugin of this.getSortedPlugins()) {\n promise = promise.then(() =>\n this.execute({\n strategy: 'hookSeq',\n hookName,\n parameters,\n plugin,\n }),\n )\n }\n return promise.then(noReturn)\n }\n\n private getSortedPlugins(hookName?: keyof PluginLifecycle): KubbPlugin[] {\n const plugins = [...this.plugins].filter((plugin) => plugin.name !== 'core')\n\n if (hookName) {\n return plugins.filter((item) => item[hookName])\n }\n\n return plugins\n }\n\n public getPlugin(hookName: keyof PluginLifecycle, pluginName: string): KubbPlugin {\n const plugins = [...this.plugins]\n\n const pluginByPluginName = plugins.find((item) => item.name === pluginName && item[hookName])\n if (!pluginByPluginName) {\n // fallback on the core plugin when there is no match\n\n return this.core\n }\n return pluginByPluginName\n }\n\n private addExecutedToCallStack(executer: Executer | undefined) {\n if (executer) {\n this.eventEmitter.emit('execute', executer)\n this.executed.push(executer)\n }\n }\n\n /**\n * Run an async plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The actual pluginObject to run.\n */\n // Implementation signature\n private execute<H extends PluginLifecycleHooks, TResult = void>({\n strategy,\n hookName,\n parameters,\n plugin,\n }: {\n strategy: Strategy\n hookName: H\n parameters: unknown[] | undefined\n plugin: KubbPlugin\n }): Promise<TResult> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.eventEmitter.emit('execute', { strategy, hookName, parameters, plugin })\n\n const task = Promise.resolve()\n .then(() => {\n if (typeof hook === 'function') {\n const possiblePromiseResult = (hook as Function).apply(this.core.api, parameters) as TResult\n\n if (isPromise(possiblePromiseResult)) {\n return Promise.resolve(possiblePromiseResult)\n }\n return possiblePromiseResult\n }\n\n return hook\n })\n .then((result) => {\n output = result\n\n return result\n })\n .catch((e: Error) => {\n this.catcher<H>(e, plugin, hookName)\n\n return null as TResult\n })\n .finally(() => {\n this.addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n })\n })\n\n return task\n }\n\n /**\n * Run a sync plugin hook and return the result.\n * @param hookName Name of the plugin hook. Must be in `PluginHooks`.\n * @param args Arguments passed to the plugin hook.\n * @param plugin The acutal plugin\n * @param replaceContext When passed, the plugin context can be overridden.\n */\n private executeSync<H extends PluginLifecycleHooks>({\n strategy,\n hookName,\n parameters,\n plugin,\n }: {\n strategy: Strategy\n hookName: H\n parameters: Parameters<PluginLifecycle[H]>\n plugin: KubbPlugin\n }): ReturnType<ParseResult<H>> | null {\n const hook = plugin[hookName]\n let output: unknown\n\n if (!hook) {\n return null\n }\n\n this.eventEmitter.emit('execute', { strategy, hookName, parameters, plugin })\n\n try {\n if (typeof hook === 'function') {\n const fn = (hook as Function).apply(this.core.api, parameters) as ReturnType<ParseResult<H>>\n\n output = fn\n return fn\n }\n\n output = hook\n return hook\n } catch (e) {\n this.catcher<H>(e as Error, plugin, hookName)\n\n return null as ReturnType<ParseResult<H>>\n } finally {\n this.addExecutedToCallStack({\n parameters,\n output,\n strategy,\n hookName,\n plugin,\n })\n }\n }\n\n private catcher<H extends PluginLifecycleHooks>(e: Error, plugin: KubbPlugin, hookName: H) {\n const text = `${e.message} (plugin: ${plugin.name}, hook: ${hookName})\\n`\n const pluginError = new PluginError(text, { cause: e, pluginManager: this })\n\n this.eventEmitter.emit('error', pluginError)\n\n throw pluginError\n }\n}\n\nfunction noReturn() {}\n","import type { KubbPlugin } from '../../types.ts'\n\nexport class ValidationPluginError extends Error {}\n\nexport function getDependedPlugins<TPlugins extends KubbPlugin[]>(plugins: KubbPlugin[], dependedPluginNames: string | string[]): TPlugins {\n let pluginNames: string[] = []\n if (typeof dependedPluginNames === 'string') {\n pluginNames = [dependedPluginNames]\n } else {\n pluginNames = dependedPluginNames\n }\n\n return pluginNames.map((pluginName) => {\n const plugin = plugins.find((plugin) => plugin.name === pluginName)\n if (!plugin) {\n throw new ValidationPluginError(`This plugin depends on the ${pluginName} plugin.`)\n }\n return plugin\n }) as TPlugins\n}\n","import type { File, FileManager } from './managers/fileManager/index.ts'\nimport type { PluginManager } from './managers/index.ts'\nimport type { Cache } from './utils/cache.ts'\nimport type { Logger } from './utils/logger.ts'\n\n/**\n * @deprecated\n */\nexport interface Register {}\n\nexport type PossiblePromise<T> = Promise<T> | T\n\n/**\n * Config used in `kubb.config.js`\n *\n * @example import { defineConfig } from '@kubb/core'\n * export default defineConfig({\n * ...\n * })\n */\nexport type KubbUserConfig = Omit<KubbConfig, 'root' | 'plugins'> & {\n /**\n * Project root directory. Can be an absolute path, or a path relative from\n * the location of the config file itself.\n * @default process.cwd()\n */\n root?: string\n /**\n * Plugin type can be KubbJSONPlugin or KubbPlugin\n * Example: ['@kubb/swagger', { output: false }]\n * Or: createSwagger({ output: false })\n */\n plugins?: KubbPlugin[] | KubbJSONPlugins[] | KubbObjectPlugins\n}\n\n/**\n * Global/internal config used through out the full generation.\n */\nexport type KubbConfig = {\n /**\n * Project root directory. Can be an absolute path, or a path relative from\n * the location of the config file itself.\n * @default process.cwd()\n */\n root: string\n input: {\n /**\n * Path to be used as the input. Can be an absolute path, or a path relative from\n * the defined root option.\n */\n path: string\n }\n output: {\n /**\n * Path to be used to export all generated files. Can be an absolute path, or a path relative based of the defined root option.\n */\n path: string\n /**\n * Remove previous generated files and folders.\n */\n clean?: boolean\n /**\n * Enabled or disable the writing to the filesystem. This is being used for the playground.\n * @default true\n */\n write?: boolean\n }\n /**\n * Array of Kubb plugins to use.\n * The plugin/package can forsee some options that you need to pass through.\n * Sometimes a plugin is depended on another plugin, if that's the case you will get an error back from the plugin you installed.\n */\n plugins?: KubbPlugin[]\n /**\n * Hooks that will be called when a specific action is triggered in Kubb.\n */\n hooks?: {\n /**\n * Hook that will be triggerend at the end of all executions.\n * Useful for running Prettier or ESLint to use your own linting structure.\n */\n done?: string | string[]\n }\n}\n\nexport type CLIOptions = {\n /**\n * Path to `kubb.config.js`\n */\n config?: string\n /**\n * Watch changes on input\n */\n watch?: string\n\n /**\n * Log level to report when using the CLI\n *\n * `silent` will hide all information that is not relevant\n *\n * `info` will show all information possible(not related to the PluginManager)\n *\n * `debug` will show all information possible(related to the PluginManager), handy for seeing logs\n * @default `silent`\n */\n logLevel?: LogLevel\n}\n\nexport type BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n}\n\n// plugin\n\nexport type KubbPluginKind = 'schema' | 'controller'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type KubbJSONPlugins = [plugin: keyof Kubb.OptionsPlugins | (string & {}), options: Kubb.OptionsPlugins[keyof Kubb.OptionsPlugins]]\n\nexport type KubbObjectPlugin = keyof Kubb.OptionsPlugins\nexport type KubbObjectPlugins = {\n [K in keyof Kubb.OptionsPlugins]: Kubb.OptionsPlugins[K] | object\n}\n\nexport type KubbUserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: PluginFactoryOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options?: TOptions['options']\n /**\n * Kind/type for the plugin\n * Type 'schema' can be used for JSON schema's, TypeScript types, ...\n * Type 'controller' can be used to create generate API calls, React-Query hooks, Axios controllers, ...\n * @default undefined\n */\n kind?: KubbPluginKind\n /**\n * Define an api that can be used by other plugins, see `PluginManager' where we convert from `KubbUserPlugin` to `KubbPlugin`(used when calling `createPlugin`).\n */\n api?: (this: Omit<PluginContext, 'addFile'>) => TOptions['api']\n} & Partial<PluginLifecycle<TOptions>>\n\nexport type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Unique name used for the plugin\n * @example @kubb/typescript\n */\n name: PluginFactoryOptions['name']\n /**\n * Options set for a specific plugin(see kubb.config.js), passthrough of options.\n */\n options?: TOptions['options']\n /**\n * Kind/type for the plugin\n * Type 'schema' can be used for JSON schema's, TypeScript types, ...\n * Type 'controller' can be used to create generate API calls, React-Query hooks, Axios controllers, ...\n * @default undefined\n */\n kind?: KubbPluginKind\n /**\n * Define an api that can be used by other plugins, see `PluginManager' where we convert from `KubbUserPlugin` to `KubbPlugin`(used when calling `createPlugin`).\n */\n api?: TOptions['api']\n} & Partial<PluginLifecycle<TOptions>>\n\n// use of type objects\n\nexport type PluginFactoryOptions<Name = string, Options = unknown, Nested extends boolean = false, API = any, resolvePathOptions = Record<string, unknown>> = {\n name: Name\n options: Options\n nested: Nested\n api: API\n resolvePathOptions: resolvePathOptions\n}\n\nexport type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {\n /**\n * Valdiate all plugins to see if their depended plugins are installed and configured.\n * @type hookParallel\n */\n validate: (this: Omit<PluginContext, 'addFile'>, plugins: KubbPlugin[]) => PossiblePromise<true>\n /**\n * Start of the lifecycle of a plugin.\n * @type hookParallel\n */\n buildStart: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise<void>\n /**\n * Resolve to a Path based on a fileName(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, fileName: string, directory?: string, options?: TOptions['resolvePathOptions']) => OptionalPath\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, name: string) => string\n /**\n * Makes it possible to run async logic to override the path defined previously by `resolvePath`.\n * @type hookFirst\n */\n load: (this: Omit<PluginContext, 'addFile'>, path: Path) => PossiblePromise<TransformResult | null>\n /**\n * Transform the source-code.\n * @type hookReduceArg0\n */\n transform: (this: Omit<PluginContext, 'addFile'>, source: string, path: Path) => PossiblePromise<TransformResult>\n /**\n * Write the result to the file-system based on the id(defined by `resolvePath` or changed by `load`).\n * @type hookParallel\n */\n writeFile: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: Path) => PossiblePromise<void>\n /**\n * End of the plugin lifecycle.\n * @type hookParallel\n */\n buildEnd: (this: PluginContext) => PossiblePromise<void>\n}\n\nexport type PluginLifecycleHooks = keyof PluginLifecycle\n\nexport type PluginCache = Record<string, [number, unknown]>\n\nexport type ResolvePathParams<TOptions = Record<string, unknown>> = {\n /**\n * When set, resolvePath will only call resolvePath of the name of the plugin set here.\n * If not defined it will fall back on the resolvePath of the core plugin.\n */\n pluginName?: string\n fileName: string\n directory?: string | undefined\n /**\n * Options to be passed to 'resolvePath' 3th parameter\n */\n options?: TOptions\n}\n\nexport type ResolveNameParams = {\n /**\n * When set, resolvePath will only call resolvePath of the name of the plugin set here.\n * If not defined it will fall back on the resolvePath of the core plugin.\n */\n pluginName?: string\n name: string\n}\n\nexport type PluginContext<TOptions = Record<string, unknown>> = {\n config: KubbConfig\n cache: Cache<PluginCache>\n fileManager: FileManager\n addFile: (...file: File[]) => Promise<File[]>\n resolvePath: (params: ResolvePathParams<TOptions>) => OptionalPath\n resolveName: (params: ResolveNameParams) => string\n logger: Logger\n plugins: KubbPlugin[]\n}\n\n// null will mean clear the watcher for this key\nexport type TransformResult = string | null\n\n/**\n * @description Computing the name of a file or directory together with its position in relation to other directories traced back in a line to the root\n */\nexport type Path = string\nexport type OptionalPath = Path | null | undefined\nexport type FileName = string | null | undefined\n\nexport const LogLevel = {\n silent: 'silent',\n info: 'info',\n debug: 'debug',\n} as const\n\nexport type LogLevel = keyof typeof LogLevel\n","import type { CLIOptions, KubbUserConfig, PossiblePromise } 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>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<KubbUserConfig>),\n): typeof options {\n return options\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 extends object = object> {\n private _options: TOptions = {} as TOptions\n\n constructor(options: TOptions = {} as TOptions) {\n if (options) {\n this._options = {\n ...this._options,\n ...options,\n }\n }\n return this\n }\n\n get options(): TOptions {\n return this._options\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import { Generator } from './Generator.ts'\n\n/**\n * Abstract class that contains the building blocks for plugins to create their own SchemaGenerator\n */\nexport abstract class SchemaGenerator<TOptions extends object, TInput, TOutput> extends Generator<TOptions> {\n abstract build(schema: TInput, name: string, description?: string): TOutput\n}\n","import { build } from './build.ts'\n\nexport * from './config.ts'\nexport * from './build.ts'\nexport * from './types.ts'\nexport { createPlugin, pluginName, pluginName as name } from './plugin.ts'\n\nexport * from './utils/index.ts'\nexport * from './managers/index.ts'\nexport * from './generators/index.ts'\n\nexport default build\n"]}
|