@hey-api/openapi-ts
Version:
🌀 OpenAPI to TypeScript code generator. Generate API clients, SDKs, validators, and more.
1 lines • 74.5 kB
Source Map (JSON)
{"version":3,"file":"src-novPNOHw.mjs","names":["path","isexe","sync","fs","path","checkStat","isexe","sync","fs","path","isexe","sync","path","path","which","path","resolveCommand","path","fs","readShebang","path","isWin","parse","cp","formatters: Record<Formatters, OutputProcessor>","path","linters: Record<Linters, OutputProcessor>","module","result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'>","path","queryParams: Array<string>","lines: Array<string>","createClient","watches: ReadonlyArray<WatchValues>","context: Context | undefined","data","lines: Array<string>","event: LoggerEvent | undefined","event: LoggerEvent","result: StoredEventResult","configs: Configs | undefined","result","pCreateClient"],"sources":["../src/config/engine.ts","../src/generate/output.ts","../src/openApi/shared/utils/patch.ts","../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js","../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js","../../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js","../../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js","../../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js","../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js","../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js","../../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js","../../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js","../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js","../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js","../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js","../../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js","../src/processOutput.ts","../src/createClient.ts","../src/utils/cli.ts","../src/utils/logger.ts","../src/generate.ts","../src/utils/exports.ts","../src/index.ts"],"sourcesContent":["import { ConfigError } from '~/error';\n\nexport const checkNodeVersion = () => {\n if (typeof Bun !== 'undefined') {\n const [major] = Bun.version.split('.').map(Number);\n if (major! < 1) {\n throw new ConfigError(\n `Unsupported Bun version ${Bun.version}. Please use Bun 1.0.0 or newer.`,\n );\n }\n } else if (typeof process !== 'undefined' && process.versions?.node) {\n const [major] = process.versions.node.split('.').map(Number);\n if (major! < 20) {\n throw new ConfigError(\n `Unsupported Node version ${process.versions.node}. Please use Node 20 or newer.`,\n );\n }\n }\n};\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { Context } from '~/ir/context';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\n\nimport { generateClientBundle } from './client';\n\nexport const generateOutput = async ({ context }: { context: Context }) => {\n const outputPath = path.resolve(context.config.output.path);\n\n if (context.config.output.clean) {\n if (fs.existsSync(outputPath)) {\n fs.rmSync(outputPath, { force: true, recursive: true });\n }\n }\n\n const client = getClientPlugin(context.config);\n if (\n 'bundle' in client.config &&\n client.config.bundle &&\n !context.config.dryRun\n ) {\n // not proud of this one\n // @ts-expect-error\n context.config._FRAGILE_CLIENT_BUNDLE_RENAMED = generateClientBundle({\n meta: {\n importFileExtension: context.config.output.importFileExtension,\n },\n outputPath,\n // @ts-expect-error\n plugin: client,\n project: context.gen,\n });\n }\n\n for (const plugin of context.registerPlugins()) {\n await plugin.run();\n }\n\n for (const file of context.gen.render()) {\n const filePath = path.resolve(outputPath, file.path);\n const dir = path.dirname(filePath);\n if (!context.config.dryRun) {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(filePath, file.content, { encoding: 'utf8' });\n }\n }\n};\n","import type { OpenApi } from '~/openApi/types';\n\nimport type { Patch } from '../../../types/parser';\n\nexport const patchOpenApiSpec = ({\n patchOptions,\n spec: _spec,\n}: {\n patchOptions: Patch | undefined;\n spec: unknown;\n}) => {\n if (!patchOptions) {\n return;\n }\n\n const spec = _spec as OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X;\n\n if ('swagger' in spec) {\n if (patchOptions.version && spec.swagger) {\n spec.swagger = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.swagger)\n ) as typeof spec.swagger;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (patchOptions.schemas && spec.definitions) {\n for (const key in patchOptions.schemas) {\n const schema = spec.definitions[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n return;\n }\n\n if (patchOptions.version && spec.openapi) {\n spec.openapi = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.openapi)\n ) as typeof spec.openapi;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (spec.components) {\n if (patchOptions.schemas && spec.components.schemas) {\n for (const key in patchOptions.schemas) {\n const schema = spec.components.schemas[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema as Parameters<typeof patchFn>[0]);\n }\n }\n\n if (patchOptions.parameters && spec.components.parameters) {\n for (const key in patchOptions.parameters) {\n const schema = spec.components.parameters[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.parameters[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.requestBodies && spec.components.requestBodies) {\n for (const key in patchOptions.requestBodies) {\n const schema = spec.components.requestBodies[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.requestBodies[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.responses && spec.components.responses) {\n for (const key in patchOptions.responses) {\n const schema = spec.components.responses[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.responses[key]!;\n patchFn(schema);\n }\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n};\n","module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction checkPathExt (path, options) {\n var pathext = options.pathExt !== undefined ?\n options.pathExt : process.env.PATHEXT\n\n if (!pathext) {\n return true\n }\n\n pathext = pathext.split(';')\n if (pathext.indexOf('') !== -1) {\n return true\n }\n for (var i = 0; i < pathext.length; i++) {\n var p = pathext[i].toLowerCase()\n if (p && path.substr(-p.length).toLowerCase() === p) {\n return true\n }\n }\n return false\n}\n\nfunction checkStat (stat, path, options) {\n if (!stat.isSymbolicLink() && !stat.isFile()) {\n return false\n }\n return checkPathExt(path, options)\n}\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, path, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), path, options)\n}\n","module.exports = isexe\nisexe.sync = sync\n\nvar fs = require('fs')\n\nfunction isexe (path, options, cb) {\n fs.stat(path, function (er, stat) {\n cb(er, er ? false : checkStat(stat, options))\n })\n}\n\nfunction sync (path, options) {\n return checkStat(fs.statSync(path), options)\n}\n\nfunction checkStat (stat, options) {\n return stat.isFile() && checkMode(stat, options)\n}\n\nfunction checkMode (stat, options) {\n var mod = stat.mode\n var uid = stat.uid\n var gid = stat.gid\n\n var myUid = options.uid !== undefined ?\n options.uid : process.getuid && process.getuid()\n var myGid = options.gid !== undefined ?\n options.gid : process.getgid && process.getgid()\n\n var u = parseInt('100', 8)\n var g = parseInt('010', 8)\n var o = parseInt('001', 8)\n var ug = u | g\n\n var ret = (mod & o) ||\n (mod & g) && gid === myGid ||\n (mod & u) && uid === myUid ||\n (mod & ug) && myUid === 0\n\n return ret\n}\n","var fs = require('fs')\nvar core\nif (process.platform === 'win32' || global.TESTING_WINDOWS) {\n core = require('./windows.js')\n} else {\n core = require('./mode.js')\n}\n\nmodule.exports = isexe\nisexe.sync = sync\n\nfunction isexe (path, options, cb) {\n if (typeof options === 'function') {\n cb = options\n options = {}\n }\n\n if (!cb) {\n if (typeof Promise !== 'function') {\n throw new TypeError('callback not provided')\n }\n\n return new Promise(function (resolve, reject) {\n isexe(path, options || {}, function (er, is) {\n if (er) {\n reject(er)\n } else {\n resolve(is)\n }\n })\n })\n }\n\n core(path, options || {}, function (er, is) {\n // ignore EACCES because that just means we aren't allowed to run it\n if (er) {\n if (er.code === 'EACCES' || options && options.ignoreErrors) {\n er = null\n is = false\n }\n }\n cb(er, is)\n })\n}\n\nfunction sync (path, options) {\n // my kingdom for a filtered catch\n try {\n return core.sync(path, options || {})\n } catch (er) {\n if (options && options.ignoreErrors || er.code === 'EACCES') {\n return false\n } else {\n throw er\n }\n }\n}\n","const isWindows = process.platform === 'win32' ||\n process.env.OSTYPE === 'cygwin' ||\n process.env.OSTYPE === 'msys'\n\nconst path = require('path')\nconst COLON = isWindows ? ';' : ':'\nconst isexe = require('isexe')\n\nconst getNotFoundError = (cmd) =>\n Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })\n\nconst getPathInfo = (cmd, opt) => {\n const colon = opt.colon || COLON\n\n // If it has a slash, then we don't bother searching the pathenv.\n // just check the file itself, and that's it.\n const pathEnv = cmd.match(/\\//) || isWindows && cmd.match(/\\\\/) ? ['']\n : (\n [\n // windows always checks the cwd first\n ...(isWindows ? [process.cwd()] : []),\n ...(opt.path || process.env.PATH ||\n /* istanbul ignore next: very unusual */ '').split(colon),\n ]\n )\n const pathExtExe = isWindows\n ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'\n : ''\n const pathExt = isWindows ? pathExtExe.split(colon) : ['']\n\n if (isWindows) {\n if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')\n pathExt.unshift('')\n }\n\n return {\n pathEnv,\n pathExt,\n pathExtExe,\n }\n}\n\nconst which = (cmd, opt, cb) => {\n if (typeof opt === 'function') {\n cb = opt\n opt = {}\n }\n if (!opt)\n opt = {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n const step = i => new Promise((resolve, reject) => {\n if (i === pathEnv.length)\n return opt.all && found.length ? resolve(found)\n : reject(getNotFoundError(cmd))\n\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n resolve(subStep(p, i, 0))\n })\n\n const subStep = (p, i, ii) => new Promise((resolve, reject) => {\n if (ii === pathExt.length)\n return resolve(step(i + 1))\n const ext = pathExt[ii]\n isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {\n if (!er && is) {\n if (opt.all)\n found.push(p + ext)\n else\n return resolve(p + ext)\n }\n return resolve(subStep(p, i, ii + 1))\n })\n })\n\n return cb ? step(0).then(res => cb(null, res), cb) : step(0)\n}\n\nconst whichSync = (cmd, opt) => {\n opt = opt || {}\n\n const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)\n const found = []\n\n for (let i = 0; i < pathEnv.length; i ++) {\n const ppRaw = pathEnv[i]\n const pathPart = /^\".*\"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw\n\n const pCmd = path.join(pathPart, cmd)\n const p = !pathPart && /^\\.[\\\\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd\n : pCmd\n\n for (let j = 0; j < pathExt.length; j ++) {\n const cur = p + pathExt[j]\n try {\n const is = isexe.sync(cur, { pathExt: pathExtExe })\n if (is) {\n if (opt.all)\n found.push(cur)\n else\n return cur\n }\n } catch (ex) {}\n }\n }\n\n if (opt.all && found.length)\n return found\n\n if (opt.nothrow)\n return null\n\n throw getNotFoundError(cmd)\n}\n\nmodule.exports = which\nwhich.sync = whichSync\n","'use strict';\n\nconst pathKey = (options = {}) => {\n\tconst environment = options.env || process.env;\n\tconst platform = options.platform || process.platform;\n\n\tif (platform !== 'win32') {\n\t\treturn 'PATH';\n\t}\n\n\treturn Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';\n};\n\nmodule.exports = pathKey;\n// TODO: Remove this for the next major release\nmodule.exports.default = pathKey;\n","'use strict';\n\nconst path = require('path');\nconst which = require('which');\nconst getPathKey = require('path-key');\n\nfunction resolveCommandAttempt(parsed, withoutPathExt) {\n const env = parsed.options.env || process.env;\n const cwd = process.cwd();\n const hasCustomCwd = parsed.options.cwd != null;\n // Worker threads do not have process.chdir()\n const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;\n\n // If a custom `cwd` was specified, we need to change the process cwd\n // because `which` will do stat calls but does not support a custom cwd\n if (shouldSwitchCwd) {\n try {\n process.chdir(parsed.options.cwd);\n } catch (err) {\n /* Empty */\n }\n }\n\n let resolved;\n\n try {\n resolved = which.sync(parsed.command, {\n path: env[getPathKey({ env })],\n pathExt: withoutPathExt ? path.delimiter : undefined,\n });\n } catch (e) {\n /* Empty */\n } finally {\n if (shouldSwitchCwd) {\n process.chdir(cwd);\n }\n }\n\n // If we successfully resolved, ensure that an absolute path is returned\n // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it\n if (resolved) {\n resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);\n }\n\n return resolved;\n}\n\nfunction resolveCommand(parsed) {\n return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);\n}\n\nmodule.exports = resolveCommand;\n","'use strict';\n\n// See http://www.robvanderwoude.com/escapechars.php\nconst metaCharsRegExp = /([()\\][%!^\"`<>&|;, *?])/g;\n\nfunction escapeCommand(arg) {\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n return arg;\n}\n\nfunction escapeArgument(arg, doubleEscapeMetaChars) {\n // Convert to string\n arg = `${arg}`;\n\n // Algorithm below is based on https://qntm.org/cmd\n // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input\n // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information\n\n // Sequence of backslashes followed by a double quote:\n // double up all the backslashes and escape the double quote\n arg = arg.replace(/(?=(\\\\+?)?)\\1\"/g, '$1$1\\\\\"');\n\n // Sequence of backslashes followed by the end of the string\n // (which will become a double quote later):\n // double up all the backslashes\n arg = arg.replace(/(?=(\\\\+?)?)\\1$/, '$1$1');\n\n // All other backslashes occur literally\n\n // Quote the whole thing:\n arg = `\"${arg}\"`;\n\n // Escape meta chars\n arg = arg.replace(metaCharsRegExp, '^$1');\n\n // Double escape meta chars if necessary\n if (doubleEscapeMetaChars) {\n arg = arg.replace(metaCharsRegExp, '^$1');\n }\n\n return arg;\n}\n\nmodule.exports.command = escapeCommand;\nmodule.exports.argument = escapeArgument;\n","'use strict';\nmodule.exports = /^#!(.*)/;\n","'use strict';\nconst shebangRegex = require('shebang-regex');\n\nmodule.exports = (string = '') => {\n\tconst match = string.match(shebangRegex);\n\n\tif (!match) {\n\t\treturn null;\n\t}\n\n\tconst [path, argument] = match[0].replace(/#! ?/, '').split(' ');\n\tconst binary = path.split('/').pop();\n\n\tif (binary === 'env') {\n\t\treturn argument;\n\t}\n\n\treturn argument ? `${binary} ${argument}` : binary;\n};\n","'use strict';\n\nconst fs = require('fs');\nconst shebangCommand = require('shebang-command');\n\nfunction readShebang(command) {\n // Read the first 150 bytes from the file\n const size = 150;\n const buffer = Buffer.alloc(size);\n\n let fd;\n\n try {\n fd = fs.openSync(command, 'r');\n fs.readSync(fd, buffer, 0, size, 0);\n fs.closeSync(fd);\n } catch (e) { /* Empty */ }\n\n // Attempt to extract shebang (null is returned if not a shebang)\n return shebangCommand(buffer.toString());\n}\n\nmodule.exports = readShebang;\n","'use strict';\n\nconst path = require('path');\nconst resolveCommand = require('./util/resolveCommand');\nconst escape = require('./util/escape');\nconst readShebang = require('./util/readShebang');\n\nconst isWin = process.platform === 'win32';\nconst isExecutableRegExp = /\\.(?:com|exe)$/i;\nconst isCmdShimRegExp = /node_modules[\\\\/].bin[\\\\/][^\\\\/]+\\.cmd$/i;\n\nfunction detectShebang(parsed) {\n parsed.file = resolveCommand(parsed);\n\n const shebang = parsed.file && readShebang(parsed.file);\n\n if (shebang) {\n parsed.args.unshift(parsed.file);\n parsed.command = shebang;\n\n return resolveCommand(parsed);\n }\n\n return parsed.file;\n}\n\nfunction parseNonShell(parsed) {\n if (!isWin) {\n return parsed;\n }\n\n // Detect & add support for shebangs\n const commandFile = detectShebang(parsed);\n\n // We don't need a shell if the command filename is an executable\n const needsShell = !isExecutableRegExp.test(commandFile);\n\n // If a shell is required, use cmd.exe and take care of escaping everything correctly\n // Note that `forceShell` is an hidden option used only in tests\n if (parsed.options.forceShell || needsShell) {\n // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`\n // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument\n // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,\n // we need to double escape them\n const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);\n\n // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\\bar)\n // This is necessary otherwise it will always fail with ENOENT in those cases\n parsed.command = path.normalize(parsed.command);\n\n // Escape command & arguments\n parsed.command = escape.command(parsed.command);\n parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));\n\n const shellCommand = [parsed.command].concat(parsed.args).join(' ');\n\n parsed.args = ['/d', '/s', '/c', `\"${shellCommand}\"`];\n parsed.command = process.env.comspec || 'cmd.exe';\n parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped\n }\n\n return parsed;\n}\n\nfunction parse(command, args, options) {\n // Normalize arguments, similar to nodejs\n if (args && !Array.isArray(args)) {\n options = args;\n args = null;\n }\n\n args = args ? args.slice(0) : []; // Clone array to avoid changing the original\n options = Object.assign({}, options); // Clone object to avoid changing the original\n\n // Build our parsed object\n const parsed = {\n command,\n args,\n options,\n file: undefined,\n original: {\n command,\n args,\n },\n };\n\n // Delegate further parsing to shell or non-shell\n return options.shell ? parsed : parseNonShell(parsed);\n}\n\nmodule.exports = parse;\n","'use strict';\n\nconst isWin = process.platform === 'win32';\n\nfunction notFoundError(original, syscall) {\n return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {\n code: 'ENOENT',\n errno: 'ENOENT',\n syscall: `${syscall} ${original.command}`,\n path: original.command,\n spawnargs: original.args,\n });\n}\n\nfunction hookChildProcess(cp, parsed) {\n if (!isWin) {\n return;\n }\n\n const originalEmit = cp.emit;\n\n cp.emit = function (name, arg1) {\n // If emitting \"exit\" event and exit code is 1, we need to check if\n // the command exists and emit an \"error\" instead\n // See https://github.com/IndigoUnited/node-cross-spawn/issues/16\n if (name === 'exit') {\n const err = verifyENOENT(arg1, parsed);\n\n if (err) {\n return originalEmit.call(cp, 'error', err);\n }\n }\n\n return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params\n };\n}\n\nfunction verifyENOENT(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawn');\n }\n\n return null;\n}\n\nfunction verifyENOENTSync(status, parsed) {\n if (isWin && status === 1 && !parsed.file) {\n return notFoundError(parsed.original, 'spawnSync');\n }\n\n return null;\n}\n\nmodule.exports = {\n hookChildProcess,\n verifyENOENT,\n verifyENOENTSync,\n notFoundError,\n};\n","'use strict';\n\nconst cp = require('child_process');\nconst parse = require('./lib/parse');\nconst enoent = require('./lib/enoent');\n\nfunction spawn(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);\n\n // Hook into child process \"exit\" event to emit an error if the command\n // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n enoent.hookChildProcess(spawned, parsed);\n\n return spawned;\n}\n\nfunction spawnSync(command, args, options) {\n // Parse the arguments\n const parsed = parse(command, args, options);\n\n // Spawn the child process\n const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);\n\n // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16\n result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);\n\n return result;\n}\n\nmodule.exports = spawn;\nmodule.exports.spawn = spawn;\nmodule.exports.sync = spawnSync;\n\nmodule.exports._parse = parse;\nmodule.exports._enoent = enoent;\n","import { sync } from 'cross-spawn';\n\nimport type { Config } from '~/types/config';\nimport type { Formatters, Linters } from '~/types/output';\n\ntype OutputProcessor = {\n args: (path: string) => ReadonlyArray<string>;\n command: string;\n name: string;\n};\n\n/**\n * Map of supported formatters\n */\nconst formatters: Record<Formatters, OutputProcessor> = {\n biome: {\n args: (path) => ['format', '--write', path],\n command: 'biome',\n name: 'Biome (Format)',\n },\n prettier: {\n args: (path) => [\n '--ignore-unknown',\n path,\n '--write',\n '--ignore-path',\n './.prettierignore',\n ],\n command: 'prettier',\n name: 'Prettier',\n },\n};\n\n/**\n * Map of supported linters\n */\nconst linters: Record<Linters, OutputProcessor> = {\n biome: {\n args: (path) => ['lint', '--apply', path],\n command: 'biome',\n name: 'Biome (Lint)',\n },\n eslint: {\n args: (path) => [path, '--fix'],\n command: 'eslint',\n name: 'ESLint',\n },\n oxlint: {\n args: (path) => ['--fix', path],\n command: 'oxlint',\n name: 'oxlint',\n },\n};\n\nexport const processOutput = ({ config }: { config: Config }) => {\n if (config.output.lint) {\n const module = linters[config.output.lint];\n console.log(`✨ Running ${module.name}`);\n sync(module.command, module.args(config.output.path));\n }\n\n if (config.output.format) {\n const module = formatters[config.output.format];\n console.log(`✨ Running ${module.name}`);\n sync(module.command, module.args(config.output.path));\n }\n};\n","import path from 'node:path';\n\nimport { $RefParser } from '@hey-api/json-schema-ref-parser';\nimport colors from 'ansi-colors';\n\nimport { generateOutput } from '~/generate/output';\nimport { getSpec } from '~/getSpec';\nimport type { Context } from '~/ir/context';\nimport { parseOpenApiSpec } from '~/openApi';\nimport { buildGraph } from '~/openApi/shared/utils/graph';\nimport { patchOpenApiSpec } from '~/openApi/shared/utils/patch';\nimport { processOutput } from '~/processOutput';\nimport type { Config } from '~/types/config';\nimport type { Input } from '~/types/input';\nimport type { WatchValues } from '~/types/types';\nimport type { Logger } from '~/utils/logger';\n\nexport const compileInputPath = (input: Omit<Input, 'watch'>) => {\n const result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'> = {\n ...input,\n path: '',\n };\n\n if (\n input.path &&\n (typeof input.path !== 'string' || input.registry !== 'hey-api')\n ) {\n result.path = input.path;\n return result;\n }\n\n const [basePath, baseQuery] = input.path.split('?');\n const queryParts = (baseQuery || '').split('&');\n const queryPath = queryParts.map((part) => part.split('='));\n\n let path = basePath || '';\n if (path.endsWith('/')) {\n path = path.slice(0, path.length - 1);\n }\n\n const [, pathUrl] = path.split('://');\n const [baseUrl, organization, project] = (pathUrl || '').split('/');\n result.organization = organization || input.organization;\n result.project = project || input.project;\n\n const queryParams: Array<string> = [];\n\n const kApiKey = 'api_key';\n result.api_key =\n queryPath.find(([key]) => key === kApiKey)?.[1] ||\n input.api_key ||\n process.env.HEY_API_TOKEN;\n if (result.api_key) {\n queryParams.push(`${kApiKey}=${result.api_key}`);\n }\n\n const kBranch = 'branch';\n result.branch =\n queryPath.find(([key]) => key === kBranch)?.[1] || input.branch;\n if (result.branch) {\n queryParams.push(`${kBranch}=${result.branch}`);\n }\n\n const kCommitSha = 'commit_sha';\n result.commit_sha =\n queryPath.find(([key]) => key === kCommitSha)?.[1] || input.commit_sha;\n if (result.commit_sha) {\n queryParams.push(`${kCommitSha}=${result.commit_sha}`);\n }\n\n const kTags = 'tags';\n result.tags =\n queryPath.find(([key]) => key === kTags)?.[1]?.split(',') || input.tags;\n if (result.tags?.length) {\n queryParams.push(`${kTags}=${result.tags.join(',')}`);\n }\n\n const kVersion = 'version';\n result.version =\n queryPath.find(([key]) => key === kVersion)?.[1] || input.version;\n if (result.version) {\n queryParams.push(`${kVersion}=${result.version}`);\n }\n\n if (!result.organization) {\n throw new Error(\n 'missing organization - from which Hey API Platform organization do you want to generate your output?',\n );\n }\n\n if (!result.project) {\n throw new Error(\n 'missing project - from which Hey API Platform project do you want to generate your output?',\n );\n }\n\n const query = queryParams.join('&');\n const platformUrl = baseUrl || 'get.heyapi.dev';\n const isLocalhost = platformUrl.startsWith('localhost');\n const platformUrlWithProtocol = [\n isLocalhost ? 'http' : 'https',\n platformUrl,\n ].join('://');\n const compiledPath = isLocalhost\n ? [\n platformUrlWithProtocol,\n 'v1',\n 'get',\n result.organization,\n result.project,\n ].join('/')\n : [platformUrlWithProtocol, result.organization, result.project].join('/');\n result.path = query ? `${compiledPath}?${query}` : compiledPath;\n\n return result;\n};\n\nconst logInputPaths = (\n inputPaths: ReadonlyArray<ReturnType<typeof compileInputPath>>,\n jobIndex: number,\n) => {\n const lines: Array<string> = [];\n\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n const count = inputPaths.length;\n const baseString = colors.cyan(\n `Generating from ${count} ${count === 1 ? 'input' : 'inputs'}:`,\n );\n lines.push(`${jobPrefix}⏳ ${baseString}`);\n\n inputPaths.forEach((inputPath, index) => {\n const itemPrefixStr = ` [${index + 1}] `;\n const itemPrefix = colors.cyan(itemPrefixStr);\n const detailIndent = ' '.repeat(itemPrefixStr.length);\n\n if (typeof inputPath.path !== 'string') {\n lines.push(`${jobPrefix}${itemPrefix}raw OpenAPI specification`);\n return;\n }\n\n switch (inputPath.registry) {\n case 'hey-api': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n if (inputPath.branch) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('branch:')} ${colors.green(\n inputPath.branch,\n )}`,\n );\n }\n if (inputPath.commit_sha) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('commit:')} ${colors.green(\n inputPath.commit_sha,\n )}`,\n );\n }\n if (inputPath.tags?.length) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('tags:')} ${colors.green(\n inputPath.tags.join(', '),\n )}`,\n );\n }\n if (inputPath.version) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('version:')} ${colors.green(\n inputPath.version,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Hey API')}`,\n );\n break;\n }\n case 'readme': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n if (!baseInput) {\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n } else {\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n }\n // @ts-expect-error\n if (inputPath.uuid) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('uuid:')} ${colors.green(\n // @ts-expect-error\n inputPath.uuid,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('ReadMe')}`,\n );\n break;\n }\n case 'scalar': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Scalar')}`,\n );\n break;\n }\n default:\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n break;\n }\n });\n\n for (const line of lines) {\n console.log(line);\n }\n};\n\nexport const createClient = async ({\n config,\n dependencies,\n jobIndex,\n logger,\n watches: _watches,\n}: {\n config: Config;\n dependencies: Record<string, string>;\n jobIndex: number;\n logger: Logger;\n /**\n * Always undefined on the first run, defined on subsequent runs.\n */\n watches?: ReadonlyArray<WatchValues>;\n}): Promise<Context | undefined> => {\n const watches: ReadonlyArray<WatchValues> =\n _watches ||\n Array.from({ length: config.input.length }, () => ({\n headers: new Headers(),\n }));\n\n const inputPaths = config.input.map((input) => compileInputPath(input));\n\n // on first run, print the message as soon as possible\n if (config.logs.level !== 'silent' && !_watches) {\n logInputPaths(inputPaths, jobIndex);\n }\n\n const getSpecData = async (input: Input, index: number) => {\n const eventSpec = logger.timeEvent('spec');\n const { arrayBuffer, error, resolvedInput, response } = await getSpec({\n fetchOptions: input.fetch,\n inputPath: inputPaths[index]!.path,\n timeout: input.watch.timeout,\n watch: watches[index]!,\n });\n eventSpec.timeEnd();\n\n // throw on first run if there's an error to preserve user experience\n // if in watch mode, subsequent errors won't throw to gracefully handle\n // cases where server might be reloading\n if (error && !_watches) {\n throw new Error(\n `Request failed with status ${response.status}: ${response.statusText}`,\n );\n }\n\n return { arrayBuffer, resolvedInput };\n };\n const specData = (\n await Promise.all(\n config.input.map((input, index) => getSpecData(input, index)),\n )\n ).filter((data) => data.arrayBuffer || data.resolvedInput);\n\n let context: Context | undefined;\n\n if (specData.length) {\n const refParser = new $RefParser();\n const data =\n specData.length > 1\n ? await refParser.bundleMany({\n arrayBuffer: specData.map((data) => data.arrayBuffer!),\n pathOrUrlOrSchemas: [],\n resolvedInputs: specData.map((data) => data.resolvedInput!),\n })\n : await refParser.bundle({\n arrayBuffer: specData[0]!.arrayBuffer,\n pathOrUrlOrSchema: undefined,\n resolvedInput: specData[0]!.resolvedInput,\n });\n\n // on subsequent runs in watch mode, print the message only if we know we're\n // generating the output\n if (config.logs.level !== 'silent' && _watches) {\n console.clear();\n logInputPaths(inputPaths, jobIndex);\n }\n\n const eventInputPatch = logger.timeEvent('input.patch');\n patchOpenApiSpec({ patchOptions: config.parser.patch, spec: data });\n eventInputPatch.timeEnd();\n\n const eventParser = logger.timeEvent('parser');\n context = parseOpenApiSpec({ config, dependencies, logger, spec: data });\n context.graph = buildGraph(context.ir, logger).graph;\n eventParser.timeEnd();\n\n const eventGenerator = logger.timeEvent('generator');\n await generateOutput({ context });\n eventGenerator.timeEnd();\n\n const eventPostprocess = logger.timeEvent('postprocess');\n if (!config.dryRun) {\n processOutput({ config });\n\n if (config.logs.level !== 'silent') {\n const outputPath = process.env.INIT_CWD\n ? `./${path.relative(process.env.INIT_CWD, config.output.path)}`\n : config.output.path;\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n console.log(\n `${jobPrefix}${colors.green('✅ Done!')} Your output is in ${colors.cyanBright(outputPath)}`,\n );\n }\n }\n eventPostprocess.timeEnd();\n }\n\n const watchedInput = config.input.find(\n (input, index) =>\n input.watch.enabled && typeof inputPaths[index]!.path === 'string',\n );\n\n if (watchedInput) {\n setTimeout(() => {\n createClient({\n config,\n dependencies,\n jobIndex,\n logger,\n watches,\n });\n }, watchedInput.watch.interval);\n }\n\n return context;\n};\n","import colors from 'ansi-colors';\n\nimport { loadPackageJson } from '~/generate/tsConfig';\n\nconst textAscii = `\n888 | e 888~-_ 888\n888___| e88~~8e Y88b / d8b 888 \\\\ 888\n888 | d888 88b Y888/ /Y88b 888 | 888\n888 | 8888__888 Y8/ / Y88b 888 / 888\n888 | Y888 , Y /____Y88b 888_-~ 888\n888 | \"88___/ / / Y88b 888 888\n _/\n`;\n\nconst asciiToLines = (\n ascii: string,\n options?: {\n padding?: number;\n },\n) => {\n const lines: Array<string> = [];\n const padding = Array.from<string>({ length: options?.padding ?? 0 }).fill(\n '',\n );\n lines.push(...padding);\n let maxLineLength = 0;\n let line = '';\n for (const char of ascii) {\n if (char === '\\n') {\n if (line) {\n lines.push(line);\n maxLineLength = Math.max(maxLineLength, line.length);\n line = '';\n }\n } else {\n line += char;\n }\n }\n lines.push(...padding);\n return { lines, maxLineLength };\n};\n\nexport function printCliIntro() {\n const packageJson = loadPackageJson();\n const text = asciiToLines(textAscii, { padding: 1 });\n for (const line of text.lines) {\n console.log(colors.cyan(line));\n }\n console.log(colors.gray(`${packageJson.name} v${packageJson.version}`));\n console.log('');\n}\n","import colors from 'ansi-colors';\n\ninterface LoggerEvent {\n end?: PerformanceMark;\n events: Array<LoggerEvent>;\n id: string; // unique internal key\n name: string;\n start: PerformanceMark;\n}\n\ninterface Severity {\n color: colors.StyleFunction;\n type: 'duration' | 'percentage';\n}\n\ninterface StoredEventResult {\n position: ReadonlyArray<number>;\n}\n\nlet loggerCounter = 0;\nconst nameToId = (name: string) => `${name}-${loggerCounter++}`;\nconst idEnd = (id: string) => `${id}-end`;\nconst idLength = (id: string) => `${id}-length`;\nconst idStart = (id: string) => `${id}-start`;\n\nconst getSeverity = (\n duration: number,\n percentage: number,\n): Severity | undefined => {\n if (duration > 200) {\n return {\n color: colors.red,\n type: 'duration',\n };\n }\n if (percentage > 30) {\n return {\n color: colors.red,\n type: 'percentage',\n };\n }\n if (duration > 50) {\n return {\n color: colors.yellow,\n type: 'duration',\n };\n }\n if (percentage > 10) {\n return {\n color: colors.yellow,\n type: 'percentage',\n };\n }\n return;\n};\n\nexport class Logger {\n private events: Array<LoggerEvent> = [];\n\n private end(result: StoredEventResult): void {\n let event: LoggerEvent | undefined;\n let events = this.events;\n for (const index of result.position) {\n event = events[index];\n if (event?.events) {\n events = event.events;\n }\n }\n if (event && !event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n }\n\n /**\n * Recursively end all unended events in the event tree.\n * This ensures all events have end marks before measuring.\n */\n private endAllEvents(events: Array<LoggerEvent>): void {\n for (const event of events) {\n if (!event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n if (event.events.length > 0) {\n this.endAllEvents(event.events);\n }\n }\n }\n\n report(print: boolean = true): PerformanceMeasure | undefined {\n const firstEvent = this.events[0];\n if (!firstEvent) return;\n\n // Ensure all events are ended before reporting\n this.endAllEvents(this.events);\n\n const lastEvent = this.events[this.events.length - 1]!;\n const name = 'root';\n const id = nameToId(name);\n\n try {\n const measure = performance.measure(\n idLength(id),\n idStart(firstEvent.id),\n idEnd(lastEvent.id),\n );\n if (print) {\n this.reportEvent({\n end: lastEvent.end,\n events: this.events,\n id,\n indent: 0,\n measure,\n name,\n start: firstEvent!.start,\n });\n }\n return measure;\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip reporting\n // to avoid crashing the application\n return;\n }\n }\n\n private reportEvent({\n indent,\n ...parent\n }: LoggerEvent & {\n indent: number;\n measure: PerformanceMeasure;\n }): void {\n const color = !indent ? colors.cyan : colors.gray;\n const lastIndex = parent.events.length - 1;\n\n parent.events.forEach((event, index) => {\n try {\n const measure = performance.measure(\n idLength(event.id),\n idStart(event.id),\n idEnd(event.id),\n );\n const duration = Math.ceil(measure.duration * 100) / 100;\n const percentage =\n Math.ceil((measure.duration / parent.measure.duration) * 100 * 100) /\n 100;\n const severity = indent ? getSeverity(duration, percentage) : undefined;\n\n let durationLabel = `${duration.toFixed(2).padStart(8)}ms`;\n if (severity?.type === 'duration') {\n durationLabel = severity.color(durationLabel);\n }\n\n const branch = index === lastIndex ? '└─ ' : '├─ ';\n const prefix = !indent ? '' : '│ '.repeat(indent - 1) + branch;\n const maxLength = 38 - prefix.length;\n\n const percentageBranch = !indent ? '' : '↳ ';\n const percentagePrefix = indent\n ? ' '.repeat(indent - 1) + percentageBranch\n : '';\n let percentageLabel = `${percentagePrefix}${percentage.toFixed(2)}%`;\n if (severity?.type === 'percentage') {\n percentageLabel = severity.color(percentageLabel);\n }\n const jobPrefix = colors.gray('[root] ');\n console.log(\n `${jobPrefix}${colors.gray(prefix)}${color(\n `${event.name.padEnd(maxLength)} ${durationLabel} (${percentageLabel})`,\n )}`,\n );\n this.reportEvent({ ...event, indent: indent + 1, measure });\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip this event\n // to avoid crashing the application\n }\n });\n }\n\n private start(id: string): PerformanceMark {\n return performance.mark(idStart(id));\n }\n\n private storeEvent({\n result,\n ...event\n }: Pick<LoggerEvent, 'events' | 'id' | 'name' | 'start'> & {\n result: StoredEventResult;\n }): void {\n const lastEventIndex = event.events.length - 1;\n const lastEvent = event.events[lastEventIndex];\n if (lastEvent && !lastEvent.end) {\n result.position = [...result.position, lastEventIndex];\n this.storeEvent({ ...event, events: lastEvent.events, result });\n return;\n }\n const length = event.events.push({ ...event, events: [] });\n result.position = [...result.position, length - 1];\n }\n\n timeEvent(name: string) {\n const id = nameToId(name);\n const start = this.start(id);\n const event: LoggerEvent = {\n events: this.events,\n id,\n name,\n start,\n };\n const result: StoredEventResult = {\n position: [],\n };\n this.storeEvent({ ...event, result });\n return {\n mark: start,\n timeEnd: () => this.end(result),\n };\n }\n}\n","import { checkNodeVersion } from '~/config/engine';\nimport type { Configs } from '~/config/init';\nimport { initConfigs } from '~/config/init';\nimport { getLogs } from '~/config/logs';\nimport { createClient as pCreateClient } from '~/createClient';\nimport {\n ConfigValidationError,\n JobError,\n logCrashReport,\n openGitHubIssueWithCrashReport,\n printCrashReport,\n shouldReportCrash,\n} from '~/error';\nimport type { Context } from '~/ir/context';\nimport type { UserConfig } from '~/types/config';\nimport type { LazyOrAsync, MaybeArray } from '~/types/utils';\nimport { printCliIntro } from '~/utils/cli';\nimport { Logger } from '~/utils/logger';\n\n/**\n * Generate a client from the provided configuration.\n *\n * @param userConfig User provided {@link UserConfig} configuration(s).\n */\nexport const createClient = async (\n userConfig?: LazyOrAsync<MaybeArray<UserConfig>>,\n logger = new Logger(),\n): Promise<ReadonlyArray<Context>> => {\n const resolvedConfig =\n typeof userConfig === 'function' ? await userConfig() : userConfig;\n const userConfigs = resolvedConfig\n ? resolvedConfig instanceof Array\n ? resolvedConfig\n : [resolvedConfig]\n : [];\n\n let rawLogs = userConfigs.find(\n (config) => getLogs(config).level !== 'silent',\n )?.logs;\n if (typeof rawLogs === 'string') {\n rawLogs = getLogs({ logs: rawLogs });\n }\n\n let configs: Configs | undefined;\n\n try {\n checkNodeVersion();\n\n const eventCreateClient = logger.timeEvent('createClient');\n\n const eventConfig = logger.timeEvent('config');\n configs = await initConfigs({ logger, userConfigs });\n const printIntro = configs.results.some(\n (result) => result.config.logs.level !== 'silent',\n );\n if (printIntro) {\n printCliIntro();\n }\n eventConfig.timeEnd();\n\n const allConfigErrors = configs.results.flatMap((result) =>\n result.errors.map((error) => ({ error, jobIndex: result.jobIndex })),\n );\n if (allConfigErrors.length) {\n throw new ConfigValidationError(allConfigErrors);\n }\n\n const clients = await Promise.all(\n configs.results.map(async (result) => {\n try {\n return await pCreateClient({\n config: result.config,\n dependencies: configs!.dependencies,\n jobIndex: result.jobIndex,\n logger,\n });\n } catch (error) {\n throw new JobError('', {\n error,\n jobIndex: result.jobIndex,\n });\n }\n }),\n );\n const result = clients.filter((client) =>\n Boolean(client),\n ) as ReadonlyArray<Context>;\n\n eventCreateClient.timeEnd();\n\n const printLogs = configs.results.some(\n (result) => result.config.logs.level === 'debug',\n );\n logger.report(printLogs);\n\n return result;\n } catch (error) {\n const results = configs?.results ?? [];\n\n const logs =\n results.find((result) => result.config.logs.level !== 'silent')?.config\n .logs ??\n results[0]?.config.logs ??\n rawLogs;\n const dryRun =\n results.some((result) => result.config.dryRun) ??\n userConfigs.some((config) => config.dryRun) ??\n false;\n const logPath =\n logs?.file && !dryRun\n ? logCrashReport(error, logs.path ?? '')\n : undefined;\n if (!logs || logs.level !== 'silent') {\n printCrashReport({ error, logPath });\n const isInteractive =\n results.some((result) => result.config.interactive) ??\n userConfigs.some((config) => config.interactive) ??\n false;\n if (await shouldReportCrash({ error, isInteractive })) {\n await openGitHubIssueWithCrashReport(error);\n }\n }\n\n throw error;\n }\n};\n","import { stringCase } from './stringCase';\n\n// publicly exposed utils\nexport const utils = {\n stringCase,\n};\n","// OVERRIDES\n// hard-coded here because build process doesn't pick up overrides from separate files\nimport '@hey-api/codegen-core';\n\ndeclare module '@hey-api/codegen-core' {\n interface ProjectRenderMeta {\n /**\n * If specified, this will be the file extension used when importing\n * other modules. By default, we don't add a file extension and let the\n * runtime resolve it.\n *\n * @default null\n */\n importFileExtension?: (string & {}) | null;\n }\n\n interface SymbolMeta {\n categor