@kubb/core 2.6.6 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NGM34FB2.cjs → chunk-2JNTDAI2.cjs} +17 -17
- package/dist/{chunk-NGM34FB2.cjs.map → chunk-2JNTDAI2.cjs.map} +1 -1
- package/dist/{chunk-IAM2TSOD.js → chunk-3HKED6KQ.js} +59 -23
- package/dist/chunk-3HKED6KQ.js.map +1 -0
- package/dist/{chunk-DZ63TRO3.js → chunk-6453B5D6.js} +13 -5
- package/dist/chunk-6453B5D6.js.map +1 -0
- package/dist/{chunk-DDBPI6U7.js → chunk-7LKI2367.js} +12 -7
- package/dist/chunk-7LKI2367.js.map +1 -0
- package/dist/{chunk-FEAY5FTX.cjs → chunk-AMVMOCJ4.cjs} +23 -22
- package/dist/{chunk-O6KGDMGN.cjs → chunk-BCD4E3IZ.cjs} +303 -298
- package/dist/chunk-BCD4E3IZ.cjs.map +1 -0
- package/dist/{chunk-QUL3TACU.js → chunk-DUZFWQUE.js} +13 -8
- package/dist/chunk-DUZFWQUE.js.map +1 -0
- package/dist/{chunk-RVIZ52LV.js → chunk-E4QOZYOP.js} +24 -10
- package/dist/chunk-E4QOZYOP.js.map +1 -0
- package/dist/chunk-EFAVSUDO.cjs +19 -0
- package/dist/{chunk-XMJY6AMI.js → chunk-HTCJOTLL.js} +11 -7
- package/dist/chunk-HTCJOTLL.js.map +1 -0
- package/dist/{chunk-DNFR6EDG.cjs → chunk-JWYPCGK5.cjs} +14 -13
- package/dist/{chunk-DZZXW555.cjs → chunk-KRX65PCH.cjs} +32 -29
- package/dist/{chunk-B3FP7HMI.cjs → chunk-M5H5RXTY.cjs} +12 -9
- package/dist/{chunk-JQBPOWRF.cjs → chunk-PHI4BK5K.cjs} +162 -124
- package/dist/{chunk-7QEHTZ4T.js → chunk-QDUQWRFO.js} +8 -4
- package/dist/chunk-QDUQWRFO.js.map +1 -0
- package/dist/{chunk-MCUCYURB.js → chunk-VCS7BATE.js} +10 -5
- package/dist/chunk-VCS7BATE.js.map +1 -0
- package/dist/{chunk-CPVVYFYJ.cjs → chunk-WCUXF325.cjs} +8 -7
- package/dist/{chunk-P5VTO36N.cjs → chunk-WDKUUZXN.cjs} +21 -17
- package/dist/chunk-YFNYSIDY.js +15 -0
- package/dist/chunk-YFNYSIDY.js.map +1 -0
- package/dist/{chunk-5TWA5OHW.js → chunk-YNFGR7GL.js} +10 -4
- package/dist/chunk-YNFGR7GL.js.map +1 -0
- package/dist/fs.cjs +21 -28
- package/dist/fs.js +21 -5
- package/dist/fs.js.map +1 -1
- package/dist/index.cjs +189 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +61 -19
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +14 -25
- package/dist/logger.js +14 -4
- package/dist/logger.js.map +1 -1
- package/dist/mocks.cjs +14 -12
- package/dist/mocks.js +15 -11
- package/dist/mocks.js.map +1 -1
- package/dist/transformers.cjs +40 -54
- package/dist/transformers.js +30 -8
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +34 -36
- package/dist/utils.js +25 -8
- package/dist/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/FileManager.ts +14 -4
- package/src/index.ts +1 -1
- package/dist/chunk-33K7PH2K.cjs +0 -15
- package/dist/chunk-CPVVYFYJ.cjs.map +0 -1
- package/dist/chunk-DDBPI6U7.js.map +0 -1
- package/dist/chunk-DNFR6EDG.cjs.map +0 -1
- package/dist/chunk-DZ63TRO3.js.map +0 -1
- package/dist/chunk-IAM2TSOD.js.map +0 -1
- package/dist/chunk-MCUCYURB.js.map +0 -1
- package/dist/chunk-O6KGDMGN.cjs.map +0 -1
- package/dist/chunk-QUL3TACU.js.map +0 -1
- package/dist/chunk-RVIZ52LV.js.map +0 -1
- package/dist/chunk-XMJY6AMI.js.map +0 -1
- package/dist/chunk-YETB7TYW.js +0 -12
- package/dist/chunk-YETB7TYW.js.map +0 -1
- /package/dist/{chunk-FEAY5FTX.cjs.map → chunk-AMVMOCJ4.cjs.map} +0 -0
- /package/dist/{chunk-33K7PH2K.cjs.map → chunk-EFAVSUDO.cjs.map} +0 -0
- /package/dist/{chunk-5TWA5OHW.js.map → chunk-JWYPCGK5.cjs.map} +0 -0
- /package/dist/{chunk-DZZXW555.cjs.map → chunk-KRX65PCH.cjs.map} +0 -0
- /package/dist/{chunk-B3FP7HMI.cjs.map → chunk-M5H5RXTY.cjs.map} +0 -0
- /package/dist/{chunk-JQBPOWRF.cjs.map → chunk-PHI4BK5K.cjs.map} +0 -0
- /package/dist/{chunk-7QEHTZ4T.js.map → chunk-WCUXF325.cjs.map} +0 -0
- /package/dist/{chunk-P5VTO36N.cjs.map → chunk-WDKUUZXN.cjs.map} +0 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js","../../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js","../src/kubb.ts"],"names":["path","fileURLToPath","toPath","fs","fsPromises","require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAyD;AACnF,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,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WAAW,UAAU;AAEvD,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,mBAAmB,SAAS;AAC9B,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AAAA,EACA,YAAY,YAAqC,SAAqC;AACpF,UAAM,iBAAiB,KAAK,eAAe,UAAU;AAErD,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA,IACT;AACA,UAAM,SAAS,OAAO,cAAc;AAEpC,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AApKS;AAEP;AACA;AAqFA;AAAA,WAAM,SAAC,aAA0B,YAAyD;AACxF,QAAM,eAAe;AAAA,IACnB,GAAG,YAAY,cAAc,KAAK,CAAC;AAAA,IACnC,GAAG,YAAY,iBAAiB,KAAK,CAAC;AAAA,EACxC;AAEA,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AQlBP;AAAA","sourcesContent":["export { build, build as default, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type { CLIOptions, Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams, UserConfig } from './types.ts'\n\nexport interface _Register {}\n\nexport * as Kubb from './kubb.ts'\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { Plugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: Plugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile') {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.emit('debug', [`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`])\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (count === 0) {\n logger.emit('start', `💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.emit('debug', logs as string[])\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, Config, InputPath, UserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link Config} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<UserConfig | Array<UserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<UserConfig | Array<UserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: Config | undefined): result is Config<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import path from 'node:path';\nimport {locatePath, locatePathSync} from 'locate-path';\nimport {toPath} from 'unicorn-magic';\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt ?? root));\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt) ?? root);\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","import pLimit from 'p-limit';\n\nclass EndError extends Error {\n\tconstructor(value) {\n\t\tsuper();\n\t\tthis.value = value;\n\t}\n}\n\n// The input can also be a promise, so we await it.\nconst testElement = async (element, tester) => tester(await element);\n\n// The input can also be a promise, so we `Promise.all()` them both.\nconst finder = async element => {\n\tconst values = await Promise.all(element);\n\tif (values[1] === true) {\n\t\tthrow new EndError(values[0]);\n\t}\n\n\treturn false;\n};\n\nexport default async function pLocate(\n\titerable,\n\ttester,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tpreserveOrder = true,\n\t} = {},\n) {\n\tconst limit = pLimit(concurrency);\n\n\t// Start all the promises concurrently with optional limit.\n\tconst items = [...iterable].map(element => [element, limit(testElement, element, tester)]);\n\n\t// Check the promises either serially or concurrently.\n\tconst checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);\n\n\ttry {\n\t\tawait Promise.all(items.map(element => checkLimit(finder, element)));\n\t} catch (error) {\n\t\tif (error instanceof EndError) {\n\t\t\treturn error.value;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (fn, resolve, args) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => fn(...args))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (fn, resolve, args) => {\n\t\tqueue.enqueue(run.bind(undefined, fn, resolve, args));\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (fn, ...args) => new Promise(resolve => {\n\t\tenqueue(fn, resolve, args);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue: () => {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import {fileURLToPath} from 'node:url';\n\nexport function toPath(urlOrPath) {\n\treturn urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n}\n\nexport * from './default.js';\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import type { ObjValueTuple, TupleToUnion } from '@kubb/types'\nimport type { _Register } from './index.ts'\n\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js","../../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js","../../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js","../../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js","../../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js","../../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js","../src/kubb.ts"],"names":["path","fileURLToPath","toPath","fs","fsPromises","require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAyD;AACnF,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,eACA,QACA,SACwB;AACxB,SAAO;AACT;AAEA,eAAe,MAAM,SAA+C;AAClE,QAAM,EAAE,QAAQ,SAAS,aAAa,EAAE,UAAU,SAAS,OAAO,CAAC,EAAE,IAAI;AACzE,MAAI,QAAQ;AAEZ,MAAI;AACF,QAAI,YAAY,MAAM,KAAK,CAAC,IAAI,QAAQ,OAAO,MAAM,IAAI,EAAE,OAAO;AAChE,YAAM,KAAK,OAAO,MAAM,IAAI;AAAA,IAC9B;AAAA,EACF,SAAS,GAAG;AACV,QAAI,YAAY,MAAM,GAAG;AACvB,YAAM,IAAI;AAAA,QACR,kHAAkH,EAAE,IAAI,OAAO,MAAM,IAAI;AAAA,QACzI;AAAA,UACE,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AAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AApKS;AAEP;AACA;AAqFA;AAAA,WAAM,SAAC,aAA0B,YAAyD;AACxF,QAAM,eAAe;AAAA,IACnB,GAAG,YAAY,cAAc,KAAK,CAAC;AAAA,IACnC,GAAG,YAAY,iBAAiB,KAAK,CAAC;AAAA,EACxC;AAEA,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AQlBP;AAAA","sourcesContent":["export { build, build as default, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type * from './types.ts'\n\nexport interface _Register {}\n\nexport * as Kubb from './kubb.ts'\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { Plugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: Plugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile') {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.emit('debug', [`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`])\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (count === 0) {\n logger.emit('start', `💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.emit('debug', logs as string[])\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, Config, InputPath, UserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link Config} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<UserConfig | Array<UserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<UserConfig | Array<UserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: Config | undefined): result is Config<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import path from 'node:path';\nimport {locatePath, locatePathSync} from 'locate-path';\nimport {toPath} from 'unicorn-magic';\n\nexport const findUpStop = Symbol('findUpStop');\n\nexport async function findUpMultiple(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt ?? root));\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = async locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePath(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = await name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePath([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// eslint-disable-next-line no-await-in-loop\n\t\tconst foundPath = await runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport function findUpMultipleSync(name, options = {}) {\n\tlet directory = path.resolve(toPath(options.cwd) ?? '');\n\tconst {root} = path.parse(directory);\n\tconst stopAt = path.resolve(directory, toPath(options.stopAt) ?? root);\n\tconst limit = options.limit ?? Number.POSITIVE_INFINITY;\n\tconst paths = [name].flat();\n\n\tconst runMatcher = locateOptions => {\n\t\tif (typeof name !== 'function') {\n\t\t\treturn locatePathSync(paths, locateOptions);\n\t\t}\n\n\t\tconst foundPath = name(locateOptions.cwd);\n\t\tif (typeof foundPath === 'string') {\n\t\t\treturn locatePathSync([foundPath], locateOptions);\n\t\t}\n\n\t\treturn foundPath;\n\t};\n\n\tconst matches = [];\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\tconst foundPath = runMatcher({...options, cwd: directory});\n\n\t\tif (foundPath === findUpStop) {\n\t\t\tbreak;\n\t\t}\n\n\t\tif (foundPath) {\n\t\t\tmatches.push(path.resolve(directory, foundPath));\n\t\t}\n\n\t\tif (directory === stopAt || matches.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\n\t\tdirectory = path.dirname(directory);\n\t}\n\n\treturn matches;\n}\n\nexport async function findUp(name, options = {}) {\n\tconst matches = await findUpMultiple(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport function findUpSync(name, options = {}) {\n\tconst matches = findUpMultipleSync(name, {...options, limit: 1});\n\treturn matches[0];\n}\n\nexport {\n\tpathExists,\n\tpathExistsSync,\n} from 'path-exists';\n","import process from 'node:process';\nimport path from 'node:path';\nimport fs, {promises as fsPromises} from 'node:fs';\nimport {fileURLToPath} from 'node:url';\nimport pLocate from 'p-locate';\n\nconst typeMappings = {\n\tdirectory: 'isDirectory',\n\tfile: 'isFile',\n};\n\nfunction checkType(type) {\n\tif (Object.hasOwnProperty.call(typeMappings, type)) {\n\t\treturn;\n\t}\n\n\tthrow new Error(`Invalid type specified: ${type}`);\n}\n\nconst matchType = (type, stat) => stat[typeMappings[type]]();\n\nconst toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n\nexport async function locatePath(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t\tconcurrency,\n\t\tpreserveOrder,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;\n\n\treturn pLocate(paths, async path_ => {\n\t\ttry {\n\t\t\tconst stat = await statFunction(path.resolve(cwd, path_));\n\t\t\treturn matchType(type, stat);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}, {concurrency, preserveOrder});\n}\n\nexport function locatePathSync(\n\tpaths,\n\t{\n\t\tcwd = process.cwd(),\n\t\ttype = 'file',\n\t\tallowSymlinks = true,\n\t} = {},\n) {\n\tcheckType(type);\n\tcwd = toPath(cwd);\n\n\tconst statFunction = allowSymlinks ? fs.statSync : fs.lstatSync;\n\n\tfor (const path_ of paths) {\n\t\ttry {\n\t\t\tconst stat = statFunction(path.resolve(cwd, path_), {\n\t\t\t\tthrowIfNoEntry: false,\n\t\t\t});\n\n\t\t\tif (!stat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (matchType(type, stat)) {\n\t\t\t\treturn path_;\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n","import pLimit from 'p-limit';\n\nclass EndError extends Error {\n\tconstructor(value) {\n\t\tsuper();\n\t\tthis.value = value;\n\t}\n}\n\n// The input can also be a promise, so we await it.\nconst testElement = async (element, tester) => tester(await element);\n\n// The input can also be a promise, so we `Promise.all()` them both.\nconst finder = async element => {\n\tconst values = await Promise.all(element);\n\tif (values[1] === true) {\n\t\tthrow new EndError(values[0]);\n\t}\n\n\treturn false;\n};\n\nexport default async function pLocate(\n\titerable,\n\ttester,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tpreserveOrder = true,\n\t} = {},\n) {\n\tconst limit = pLimit(concurrency);\n\n\t// Start all the promises concurrently with optional limit.\n\tconst items = [...iterable].map(element => [element, limit(testElement, element, tester)]);\n\n\t// Check the promises either serially or concurrently.\n\tconst checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);\n\n\ttry {\n\t\tawait Promise.all(items.map(element => checkLimit(finder, element)));\n\t} catch (error) {\n\t\tif (error instanceof EndError) {\n\t\t\treturn error.value;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (fn, resolve, args) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => fn(...args))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (fn, resolve, args) => {\n\t\tqueue.enqueue(run.bind(undefined, fn, resolve, args));\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (fn, ...args) => new Promise(resolve => {\n\t\tenqueue(fn, resolve, args);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue: () => {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n","import {fileURLToPath} from 'node:url';\n\nexport function toPath(urlOrPath) {\n\treturn urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;\n}\n\nexport * from './default.js';\n","import fs, {promises as fsPromises} from 'node:fs';\n\nexport async function pathExists(path) {\n\ttry {\n\t\tawait fsPromises.access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function pathExistsSync(path) {\n\ttry {\n\t\tfs.accessSync(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import type { ObjValueTuple, TupleToUnion } from '@kubb/types'\nimport type { _Register } from './index.ts'\n\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -249,6 +249,7 @@ type CLIOptions = {
|
|
|
249
249
|
logLevel?: LogLevel;
|
|
250
250
|
};
|
|
251
251
|
type UnionPlugins = PluginUnion;
|
|
252
|
+
type ObjectPlugin = keyof OptionsPlugins;
|
|
252
253
|
type PluginFactoryOptions<
|
|
253
254
|
/**
|
|
254
255
|
* Name to be used for the plugin, this will also be used for they key.
|
|
@@ -289,6 +290,7 @@ TAppMeta = unknown> = {
|
|
|
289
290
|
plugin: Plugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions, TAppMeta>>;
|
|
290
291
|
} & TAppMeta;
|
|
291
292
|
};
|
|
293
|
+
type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never;
|
|
292
294
|
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
293
295
|
/**
|
|
294
296
|
* Unique name used for the plugin
|
|
@@ -536,6 +538,10 @@ declare namespace KubbFile {
|
|
|
536
538
|
* This will override `process.env[key]` inside the `source`, see `getFileSource`.
|
|
537
539
|
*/
|
|
538
540
|
env?: NodeJS.ProcessEnv;
|
|
541
|
+
/**
|
|
542
|
+
* The name of the language being used. This can be TypeScript, JavaScript and still have another ext.
|
|
543
|
+
*/
|
|
544
|
+
language?: string;
|
|
539
545
|
};
|
|
540
546
|
type ResolvedFile<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = KubbFile.File<TMeta, TBaseName> & {
|
|
541
547
|
/**
|
|
@@ -587,7 +593,7 @@ declare class FileManager {
|
|
|
587
593
|
static combineFiles<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(files: Array<KubbFile.File<TMeta> | null>): Array<KubbFile.File<TMeta>>;
|
|
588
594
|
static getMode(path: string | undefined | null): KubbFile.Mode;
|
|
589
595
|
static get extensions(): Array<KubbFile.Extname>;
|
|
590
|
-
static
|
|
596
|
+
static isJavascript(baseName: string): boolean;
|
|
591
597
|
}
|
|
592
598
|
|
|
593
599
|
type BuildOptions = {
|
|
@@ -688,4 +694,4 @@ declare class PromiseManager<TState = any> {
|
|
|
688
694
|
interface _Register {
|
|
689
695
|
}
|
|
690
696
|
|
|
691
|
-
export { type CLIOptions, type Config, FileManager, Generator, kubb as Kubb, KubbFile, PackageManager, type Plugin, type PluginFactoryOptions, PluginManager, PromiseManager, type ResolveNameParams, type ResolvePathParams, type UserConfig, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
|
|
697
|
+
export { type CLIOptions, type Config, FileManager, Generator, type GetPluginFactoryOptions, type InputData, type InputPath, kubb as Kubb, KubbFile, type ObjectPlugin, PackageManager, type Plugin, type PluginCache, type PluginContext, type PluginFactoryOptions, type PluginLifecycle, type PluginLifecycleHooks, PluginManager, type PluginParameter, type PluginWithLifeCycle, PromiseManager, type ResolveNameParams, type ResolvePathParams, type TransformResult, type UnionPlugins, type UserConfig, type UserPlugin, type UserPluginWithLifeCycle, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
|
package/dist/index.d.ts
CHANGED
|
@@ -249,6 +249,7 @@ type CLIOptions = {
|
|
|
249
249
|
logLevel?: LogLevel;
|
|
250
250
|
};
|
|
251
251
|
type UnionPlugins = PluginUnion;
|
|
252
|
+
type ObjectPlugin = keyof OptionsPlugins;
|
|
252
253
|
type PluginFactoryOptions<
|
|
253
254
|
/**
|
|
254
255
|
* Name to be used for the plugin, this will also be used for they key.
|
|
@@ -289,6 +290,7 @@ TAppMeta = unknown> = {
|
|
|
289
290
|
plugin: Plugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions, TAppMeta>>;
|
|
290
291
|
} & TAppMeta;
|
|
291
292
|
};
|
|
293
|
+
type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never;
|
|
292
294
|
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
293
295
|
/**
|
|
294
296
|
* Unique name used for the plugin
|
|
@@ -536,6 +538,10 @@ declare namespace KubbFile {
|
|
|
536
538
|
* This will override `process.env[key]` inside the `source`, see `getFileSource`.
|
|
537
539
|
*/
|
|
538
540
|
env?: NodeJS.ProcessEnv;
|
|
541
|
+
/**
|
|
542
|
+
* The name of the language being used. This can be TypeScript, JavaScript and still have another ext.
|
|
543
|
+
*/
|
|
544
|
+
language?: string;
|
|
539
545
|
};
|
|
540
546
|
type ResolvedFile<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = KubbFile.File<TMeta, TBaseName> & {
|
|
541
547
|
/**
|
|
@@ -587,7 +593,7 @@ declare class FileManager {
|
|
|
587
593
|
static combineFiles<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(files: Array<KubbFile.File<TMeta> | null>): Array<KubbFile.File<TMeta>>;
|
|
588
594
|
static getMode(path: string | undefined | null): KubbFile.Mode;
|
|
589
595
|
static get extensions(): Array<KubbFile.Extname>;
|
|
590
|
-
static
|
|
596
|
+
static isJavascript(baseName: string): boolean;
|
|
591
597
|
}
|
|
592
598
|
|
|
593
599
|
type BuildOptions = {
|
|
@@ -688,4 +694,4 @@ declare class PromiseManager<TState = any> {
|
|
|
688
694
|
interface _Register {
|
|
689
695
|
}
|
|
690
696
|
|
|
691
|
-
export { type CLIOptions, type Config, FileManager, Generator, kubb as Kubb, KubbFile, PackageManager, type Plugin, type PluginFactoryOptions, PluginManager, PromiseManager, type ResolveNameParams, type ResolvePathParams, type UserConfig, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
|
|
697
|
+
export { type CLIOptions, type Config, FileManager, Generator, type GetPluginFactoryOptions, type InputData, type InputPath, kubb as Kubb, KubbFile, type ObjectPlugin, PackageManager, type Plugin, type PluginCache, type PluginContext, type PluginFactoryOptions, type PluginLifecycle, type PluginLifecycleHooks, PluginManager, type PluginParameter, type PluginWithLifeCycle, PromiseManager, type ResolveNameParams, type ResolvePathParams, type TransformResult, type UnionPlugins, type UserConfig, type UserPlugin, type UserPluginWithLifeCycle, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import {
|
|
2
|
+
URLPath
|
|
3
|
+
} from "./chunk-VCS7BATE.js";
|
|
4
|
+
import {
|
|
5
|
+
clean
|
|
6
|
+
} from "./chunk-YFNYSIDY.js";
|
|
7
|
+
import {
|
|
8
|
+
FileManager,
|
|
9
|
+
KubbFile,
|
|
10
|
+
PluginManager,
|
|
11
|
+
PromiseManager,
|
|
12
|
+
Warning,
|
|
13
|
+
createPlugin,
|
|
14
|
+
isPromise,
|
|
15
|
+
pluginName
|
|
16
|
+
} from "./chunk-3HKED6KQ.js";
|
|
17
|
+
import "./chunk-YNFGR7GL.js";
|
|
18
|
+
import "./chunk-QDUQWRFO.js";
|
|
19
|
+
import "./chunk-DUZFWQUE.js";
|
|
20
|
+
import {
|
|
21
|
+
LogLevel,
|
|
22
|
+
createLogger,
|
|
23
|
+
p,
|
|
24
|
+
randomCliColour
|
|
25
|
+
} from "./chunk-E4QOZYOP.js";
|
|
26
|
+
import {
|
|
27
|
+
read,
|
|
28
|
+
readSync
|
|
29
|
+
} from "./chunk-7LKI2367.js";
|
|
30
|
+
import "./chunk-HTCJOTLL.js";
|
|
31
|
+
import {
|
|
32
|
+
__privateAdd,
|
|
33
|
+
__privateGet,
|
|
34
|
+
__privateMethod,
|
|
35
|
+
__privateSet,
|
|
36
|
+
init_esm_shims
|
|
37
|
+
} from "./chunk-6453B5D6.js";
|
|
17
38
|
|
|
18
39
|
// src/index.ts
|
|
19
40
|
init_esm_shims();
|
|
@@ -121,6 +142,7 @@ ${code}`]);
|
|
|
121
142
|
const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
|
|
122
143
|
logger.spinner.suffixText = p.dim(text);
|
|
123
144
|
}
|
|
145
|
+
;
|
|
124
146
|
++count;
|
|
125
147
|
});
|
|
126
148
|
pluginManager.queue.on("completed", () => {
|
|
@@ -208,6 +230,11 @@ _context = new WeakMap();
|
|
|
208
230
|
|
|
209
231
|
// src/PackageManager.ts
|
|
210
232
|
init_esm_shims();
|
|
233
|
+
import mod from "module";
|
|
234
|
+
import os from "os";
|
|
235
|
+
import { pathToFileURL } from "url";
|
|
236
|
+
import { findUp, findUpSync } from "find-up";
|
|
237
|
+
import { coerce, satisfies } from "semver";
|
|
211
238
|
var _cache, _cwd, _SLASHES, _match, match_fn;
|
|
212
239
|
var _PackageManager = class _PackageManager {
|
|
213
240
|
constructor(workspace) {
|
|
@@ -342,7 +369,22 @@ var PackageManager = _PackageManager;
|
|
|
342
369
|
// src/kubb.ts
|
|
343
370
|
var kubb_exports = {};
|
|
344
371
|
init_esm_shims();
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
372
|
+
export {
|
|
373
|
+
FileManager,
|
|
374
|
+
Generator,
|
|
375
|
+
kubb_exports as Kubb,
|
|
376
|
+
KubbFile,
|
|
377
|
+
PackageManager,
|
|
378
|
+
PluginManager,
|
|
379
|
+
PromiseManager,
|
|
380
|
+
Warning,
|
|
381
|
+
build,
|
|
382
|
+
createPlugin,
|
|
383
|
+
build as default,
|
|
384
|
+
defineConfig,
|
|
385
|
+
isInputPath,
|
|
386
|
+
pluginName as name,
|
|
387
|
+
pluginName,
|
|
388
|
+
safeBuild
|
|
389
|
+
};
|
|
348
390
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../src/kubb.ts"],"names":["require"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAyD;AACnF,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,eACA,QACA,SACwB;AACxB,SAAO;AACT;AAEA,eAAe,MAAM,SAA+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X,YAAM,IAAI,MAAM,GAAG,cAAc,eAAe;AAAA,IAClD;AAEA,WAAO,UAAU,QAAQ,OAAO;AAAA,EAClC;AACF;AApKS;AAEP;AACA;AAqFA;AAAA,WAAM,SAAC,aAA0B,YAAyD;AACxF,QAAM,eAAe;AAAA,IACnB,GAAG,YAAY,cAAc,KAAK,CAAC;AAAA,IACnC,GAAG,YAAY,iBAAiB,KAAK,CAAC;AAAA,EACxC;AAEA,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AClBP;AAAA","sourcesContent":["export { build, build as default, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type { CLIOptions, Config, Plugin, PluginFactoryOptions, ResolveNameParams, ResolvePathParams, UserConfig } from './types.ts'\n\nexport interface _Register {}\n\nexport * as Kubb from './kubb.ts'\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { Plugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: Plugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile') {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.emit('debug', [`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`])\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (count === 0) {\n logger.emit('start', `💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.emit('debug', logs as string[])\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, Config, InputPath, UserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link Config} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<UserConfig | Array<UserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<UserConfig | Array<UserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: Config | undefined): result is Config<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import type { ObjValueTuple, TupleToUnion } from '@kubb/types'\nimport type { _Register } from './index.ts'\n\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/build.ts","../src/config.ts","../src/Generator.ts","../src/PackageManager.ts","../src/kubb.ts"],"sourcesContent":["export { build, build as default, safeBuild } from './build.ts'\nexport { defineConfig, isInputPath } from './config.ts'\nexport { Warning } from './errors.ts'\nexport { FileManager, KubbFile } from './FileManager.ts'\nexport { Generator } from './Generator.ts'\nexport { PackageManager } from './PackageManager.ts'\n// dprint-ignore\nexport { createPlugin, pluginName as name, pluginName } from './plugin.ts'\nexport { PluginManager } from './PluginManager.ts'\nexport { PromiseManager } from './PromiseManager.ts'\nexport type * from './types.ts'\n\nexport interface _Register {}\n\nexport * as Kubb from './kubb.ts'\n","import c from 'tinyrainbow'\n\nimport { clean } from './fs/clean.ts'\nimport { read } from './fs/read.ts'\nimport { URLPath } from './utils/URLPath.ts'\nimport { isInputPath } from './config.ts'\nimport { FileManager } from './FileManager.ts'\nimport { createLogger, LogLevel, randomCliColour } from './logger.ts'\nimport { PluginManager } from './PluginManager.ts'\nimport { isPromise } from './PromiseManager.ts'\n\nimport type { KubbFile } from './FileManager.ts'\nimport type { Logger } from './logger.ts'\nimport type { Plugin, PluginContext, PluginParameter, TransformResult } from './types.ts'\n\ntype BuildOptions = {\n config: PluginContext['config']\n /**\n * @default Logger without the spinner\n */\n logger?: Logger\n}\n\ntype BuildOutput = {\n files: FileManager['files']\n pluginManager: PluginManager\n /**\n * Only for safeBuild\n */\n error?: Error\n}\n\nasync function transformReducer(\n this: PluginContext,\n _previousCode: string,\n result: TransformResult | Promise<TransformResult>,\n _plugin: Plugin,\n): Promise<string | null> {\n return result\n}\n\nasync function setup(options: BuildOptions): Promise<PluginManager> {\n const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options\n let count = 0\n\n try {\n if (isInputPath(config) && !new URLPath(config.input.path).isURL) {\n await read(config.input.path)\n }\n } catch (e) {\n if (isInputPath(config)) {\n throw new Error(\n 'Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config ' + c.dim(config.input.path),\n {\n cause: e,\n },\n )\n }\n }\n\n if (config.output.clean) {\n await clean(config.output.path)\n }\n\n const task = async (file: KubbFile.ResolvedFile): Promise<KubbFile.ResolvedFile> => {\n const { path } = file\n\n let source: string | null = FileManager.getSource(file)\n\n const { result: loadedResult } = await pluginManager.hookFirst({\n hookName: 'load',\n parameters: [path],\n })\n if (loadedResult && isPromise(loadedResult)) {\n source = await loadedResult\n }\n if (loadedResult && !isPromise(loadedResult)) {\n source = loadedResult\n }\n\n if (source) {\n source = await pluginManager.hookReduceArg0({\n hookName: 'transform',\n parameters: [source, path],\n reduce: transformReducer,\n })\n\n if (config.output.write || config.output.write === undefined) {\n if (file.meta?.pluginKey) {\n // run only for pluginKey defined in the meta of the file\n await pluginManager.hookForPlugin({\n pluginKey: file.meta?.pluginKey,\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n\n await pluginManager.hookFirst({\n hookName: 'writeFile',\n parameters: [source, path],\n })\n }\n }\n\n return {\n ...file,\n source: source || '',\n }\n }\n\n const pluginManager = new PluginManager(config, { logger, task })\n\n pluginManager.on('execute', (executer) => {\n const { hookName, parameters, plugin } = executer\n\n if (hookName === 'writeFile') {\n const [code] = parameters as PluginParameter<'writeFile'>\n\n if (logger.logLevel === LogLevel.debug) {\n logger.emit('debug', [`PluginKey ${c.dim(JSON.stringify(plugin.key))} \\nwith source\\n\\n${code}`])\n }\n }\n })\n\n pluginManager.queue.on('add', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (count === 0) {\n logger.emit('start', `💾 Writing`)\n }\n })\n\n pluginManager.queue.on('active', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner && pluginManager.queue.size > 0) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n ;++count\n })\n\n pluginManager.queue.on('completed', () => {\n if (logger.logLevel !== LogLevel.info) {\n return\n }\n\n if (logger.spinner) {\n const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`\n\n logger.spinner.suffixText = c.dim(text)\n }\n })\n\n pluginManager.on('executed', (executer) => {\n const { hookName, plugin, output, parameters } = executer\n\n if (logger.logLevel === LogLevel.debug) {\n const logs = [\n `${randomCliColour(plugin.name)} Executing ${hookName}`,\n parameters && `${c.bgWhite(`Parameters`)} ${randomCliColour(plugin.name)} ${hookName}`,\n JSON.stringify(parameters, undefined, 2),\n output && `${c.bgWhite('Output')} ${randomCliColour(plugin.name)} ${hookName}`,\n output,\n ].filter(Boolean)\n\n logger.emit('debug', logs as string[])\n }\n })\n\n return pluginManager\n}\n\nexport async function build(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n\nexport async function safeBuild(options: BuildOptions): Promise<BuildOutput> {\n const pluginManager = await setup(options)\n\n const { fileManager, logger } = pluginManager\n\n try {\n await pluginManager.hookParallel({\n hookName: 'buildStart',\n parameters: [options.config],\n })\n\n await pluginManager.hookParallel({ hookName: 'buildEnd' })\n\n if (logger.logLevel === LogLevel.info) {\n logger.emit('end', `💾 Writing completed`)\n }\n } catch (e) {\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e as Error }\n }\n\n return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager }\n}\n","import type { PossiblePromise } from '@kubb/types'\nimport type { CLIOptions, Config, InputPath, UserConfig } from './types.ts'\n\n/**\n * Type helper to make it easier to use kubb.config.js\n * accepts a direct {@link Config} object, or a function that returns it.\n * The function receives a {@link ConfigEnv} object that exposes two properties:\n */\nexport function defineConfig(\n options:\n | PossiblePromise<UserConfig | Array<UserConfig>>\n | ((\n /** The options derived from the CLI flags */\n cliOptions: CLIOptions,\n ) => PossiblePromise<UserConfig | Array<UserConfig>>),\n): typeof options {\n return options\n}\n\nexport function isInputPath(result: Config | undefined): result is Config<InputPath> {\n return !!result && 'path' in (result as any)\n}\n","/**\n * Abstract class that contains the building blocks for plugins to create their own Generator\n * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137\n */\nexport abstract class Generator<TOptions = unknown, TContext = unknown> {\n #options: TOptions = {} as TOptions\n #context: TContext = {} as TContext\n\n constructor(options?: TOptions, context?: TContext) {\n if (context) {\n this.#context = context\n }\n\n if (options) {\n this.#options = options\n }\n\n return this\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n get context(): TContext {\n return this.#context\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n abstract build(...params: unknown[]): unknown\n}\n","import mod from 'node:module'\nimport os from 'node:os'\nimport { pathToFileURL } from 'node:url'\n\nimport { findUp, findUpSync } from 'find-up'\nimport { coerce, satisfies } from 'semver'\n\nimport { read, readSync } from './fs/read'\n\ntype PackageJSON = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n}\n\ntype DependencyName = string\n\ntype DependencyVersion = string\n\nexport class PackageManager {\n static #cache: Record<DependencyName, DependencyVersion> = {}\n\n #cwd?: string\n #SLASHES = new Set(['/', '\\\\'])\n constructor(workspace?: string) {\n if (workspace) {\n this.#cwd = workspace\n }\n\n return this\n }\n\n set workspace(workspace: string) {\n this.#cwd = workspace\n }\n\n get workspace(): string | undefined {\n return this.#cwd\n }\n\n normalizeDirectory(directory: string): string {\n if (!this.#SLASHES.has(directory[directory.length - 1]!)) {\n return `${directory}/`\n }\n\n return directory\n }\n\n getLocation(path: string): string {\n let location = path\n\n if (this.#cwd) {\n const require = mod.createRequire(this.normalizeDirectory(this.#cwd))\n location = require.resolve(path)\n }\n\n return location\n }\n\n async import(path: string): Promise<any | undefined> {\n try {\n let location = this.getLocation(path)\n\n if (os.platform() == 'win32') {\n location = pathToFileURL(location).href\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const module = await import(location)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return module?.default ?? module\n } catch (e) {\n console.log(e)\n return undefined\n }\n }\n\n async getPackageJSON(): Promise<PackageJSON | undefined> {\n const pkgPath = await findUp(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = await read(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n getPackageJSONSync(): PackageJSON | undefined {\n const pkgPath = findUpSync(['package.json'], {\n cwd: this.#cwd,\n })\n if (!pkgPath) {\n return undefined\n }\n\n const json = readSync(pkgPath)\n\n return JSON.parse(json) as PackageJSON\n }\n\n static setVersion(dependency: DependencyName, version: DependencyVersion): void {\n PackageManager.#cache[dependency] = version\n }\n\n #match(packageJSON: PackageJSON, dependency: DependencyName | RegExp): string | undefined {\n const dependencies = {\n ...packageJSON['dependencies'] || {},\n ...packageJSON['devDependencies'] || {},\n }\n\n if (typeof dependency === 'string' && dependencies[dependency]) {\n return dependencies[dependency]\n }\n\n const matchedDependency = Object.keys(dependencies).find(dep => dep.match(dependency))\n\n return matchedDependency ? dependencies[matchedDependency] : undefined\n }\n\n async getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined> {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = await this.getPackageJSON()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined {\n if (typeof dependency === 'string' && PackageManager.#cache[dependency]) {\n return PackageManager.#cache[dependency]\n }\n\n const packageJSON = this.getPackageJSONSync()\n\n if (!packageJSON) {\n return undefined\n }\n\n return this.#match(packageJSON, dependency)\n }\n\n async isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean> {\n const packageVersion = await this.getVersion(dependency)\n\n if (!packageVersion) {\n return false\n }\n\n if (packageVersion === version) {\n return true\n }\n\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean {\n const packageVersion = this.getVersionSync(dependency)\n\n if (!packageVersion) {\n return false\n }\n const semVer = coerce(packageVersion)\n\n if (!semVer) {\n throw new Error(`${packageVersion} is not valid`)\n }\n\n return satisfies(semVer, version)\n }\n}\n","import type { ObjValueTuple, TupleToUnion } from '@kubb/types'\nimport type { _Register } from './index.ts'\n\nexport type Plugins = _Register\nexport type OptionsPlugins = { [K in keyof Plugins]: Plugins[K]['options'] }\n\nexport type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options']\n\nexport type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>\n\nexport type Plugin = keyof Plugins\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAQO,SAAS,aACd,SAMgB;AAChB,SAAO;AACT;AAEO,SAAS,YAAY,QAAyD;AACnF,SAAO,CAAC,CAAC,UAAU,UAAW;AAChC;;;ADWA,eAAe,iBAEb,eACA,QACA,SACwB;AACxB,SAAO;AACT;AAEA,eAAe,MAAM,SAA+C;AAClE,QAAM,EAAE,QAAQ,SAAS,aAAa,EAAE,UAAU,SAAS,OAAO,CAAC,EAAE,IAAI;AACzE,MAAI,QAAQ;AAEZ,MAAI;AACF,QAAI,YAAY,MAAM,KAAK,CAAC,IAAI,QAAQ,OAAO,MAAM,IAAI,EAAE,OAAO;AAChE,YAAM,KAAK,OAAO,MAAM,IAAI;AAAA,IAC9B;AAAA,EACF,SAAS,GAAG;AACV,QAAI,Y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,MAAI,OAAO,eAAe,YAAY,aAAa,UAAU,GAAG;AAC9D,WAAO,aAAa,UAAU;AAAA,EAChC;AAEA,QAAM,oBAAoB,OAAO,KAAK,YAAY,EAAE,KAAK,SAAO,IAAI,MAAM,UAAU,CAAC;AAErF,SAAO,oBAAoB,aAAa,iBAAiB,IAAI;AAC/D;AArGA,aADW,iBACJ,QAAoD,CAAC;AADvD,IAAM,iBAAN;;;AClBP;AAAA;","names":["require"]}
|
package/dist/logger.cjs
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
get: function () { return chunkDZZXW555_cjs.createLogger; }
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "randomCliColour", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return chunkDZZXW555_cjs.randomCliColour; }
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(exports, "randomColour", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () { return chunkDZZXW555_cjs.randomColour; }
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=out.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkKRX65PCHcjs = require('./chunk-KRX65PCH.cjs');
|
|
7
|
+
require('./chunk-PHI4BK5K.cjs');
|
|
8
|
+
require('./chunk-2JNTDAI2.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.LogLevel = _chunkKRX65PCHcjs.LogLevel; exports.createLogger = _chunkKRX65PCHcjs.createLogger; exports.randomCliColour = _chunkKRX65PCHcjs.randomCliColour; exports.randomColour = _chunkKRX65PCHcjs.randomColour;
|
|
26
15
|
//# sourceMappingURL=logger.cjs.map
|
package/dist/logger.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
LogLevel,
|
|
3
|
+
createLogger,
|
|
4
|
+
randomCliColour,
|
|
5
|
+
randomColour
|
|
6
|
+
} from "./chunk-E4QOZYOP.js";
|
|
7
|
+
import "./chunk-HTCJOTLL.js";
|
|
8
|
+
import "./chunk-6453B5D6.js";
|
|
9
|
+
export {
|
|
10
|
+
LogLevel,
|
|
11
|
+
createLogger,
|
|
12
|
+
randomCliColour,
|
|
13
|
+
randomColour
|
|
14
|
+
};
|
|
5
15
|
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/mocks.cjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-BCD4E3IZ.cjs');
|
|
2
|
+
require('./chunk-JWYPCGK5.cjs');
|
|
3
|
+
require('./chunk-WCUXF325.cjs');
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
|
|
7
|
-
require('./chunk-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
5
|
+
|
|
6
|
+
var _chunkAMVMOCJ4cjs = require('./chunk-AMVMOCJ4.cjs');
|
|
7
|
+
require('./chunk-KRX65PCH.cjs');
|
|
8
|
+
require('./chunk-WDKUUZXN.cjs');
|
|
9
|
+
require('./chunk-PHI4BK5K.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunk2JNTDAI2cjs = require('./chunk-2JNTDAI2.cjs');
|
|
11
13
|
|
|
12
14
|
// mocks/index.ts
|
|
13
|
-
|
|
15
|
+
_chunk2JNTDAI2cjs.init_cjs_shims.call(void 0, );
|
|
14
16
|
var mockedPluginManager = {
|
|
15
17
|
resolveName: ({ name, type }) => {
|
|
16
18
|
if (type === "type") {
|
|
17
|
-
return
|
|
19
|
+
return _chunkAMVMOCJ4cjs.pascalCase.call(void 0, name);
|
|
18
20
|
}
|
|
19
21
|
return name;
|
|
20
22
|
},
|
|
@@ -29,6 +31,6 @@ var mockedPluginManager = {
|
|
|
29
31
|
}
|
|
30
32
|
};
|
|
31
33
|
|
|
34
|
+
|
|
32
35
|
exports.mockedPluginManager = mockedPluginManager;
|
|
33
|
-
//# sourceMappingURL=out.js.map
|
|
34
36
|
//# sourceMappingURL=mocks.cjs.map
|
package/dist/mocks.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import "./chunk-3HKED6KQ.js";
|
|
2
|
+
import "./chunk-YNFGR7GL.js";
|
|
3
|
+
import "./chunk-QDUQWRFO.js";
|
|
4
|
+
import {
|
|
5
|
+
pascalCase
|
|
6
|
+
} from "./chunk-DUZFWQUE.js";
|
|
7
|
+
import "./chunk-E4QOZYOP.js";
|
|
8
|
+
import "./chunk-7LKI2367.js";
|
|
9
|
+
import "./chunk-HTCJOTLL.js";
|
|
10
|
+
import {
|
|
11
|
+
init_esm_shims
|
|
12
|
+
} from "./chunk-6453B5D6.js";
|
|
9
13
|
|
|
10
14
|
// mocks/index.ts
|
|
11
15
|
init_esm_shims();
|
|
@@ -26,7 +30,7 @@ var mockedPluginManager = {
|
|
|
26
30
|
logLevel: "info"
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
export {
|
|
34
|
+
mockedPluginManager
|
|
35
|
+
};
|
|
32
36
|
//# sourceMappingURL=mocks.js.map
|
package/dist/mocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../mocks/index.ts"],"
|
|
1
|
+
{"version":3,"sources":["../mocks/index.ts"],"sourcesContent":["import { pascalCase } from '../src/transformers/casing.ts'\n\nimport { PluginManager } from '../src/PluginManager.ts'\nexport const mockedPluginManager = {\n resolveName: ({ name, type }) => {\n if (type === 'type') {\n return pascalCase(name)\n }\n\n return name\n },\n resolvePath: ({ baseName }) => baseName,\n logger: {\n emit(message) {\n console.log(message)\n },\n on(eventName, args) {},\n logLevel: 'info',\n },\n} as PluginManager\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAGO,IAAM,sBAAsB;AAAA,EACjC,aAAa,CAAC,EAAE,MAAM,KAAK,MAAM;AAC/B,QAAI,SAAS,QAAQ;AACnB,aAAO,WAAW,IAAI;AAAA,IACxB;AAEA,WAAO;AAAA,EACT;AAAA,EACA,aAAa,CAAC,EAAE,SAAS,MAAM;AAAA,EAC/B,QAAQ;AAAA,IACN,KAAK,SAAS;AACZ,cAAQ,IAAI,OAAO;AAAA,IACrB;AAAA,IACA,GAAG,WAAW,MAAM;AAAA,IAAC;AAAA,IACrB,UAAU;AAAA,EACZ;AACF;","names":[]}
|