{"version":3,"file":"compiler-gOwpTlN-.mjs","names":["path","fs","main","main","path","main"],"sources":["../src/cache-store/file-system-cache-store.ts","../src/cache-store/memory-cache-store.ts","../src/cache-store/null-cache-store.ts","../src/cache-store/namespaced-cache-store.ts","../src/utils/matcher.ts","../src/exceptions/config-not-found.exception.ts","../src/compiler/tasks/setup/utils/find-nearest-package-json.ts","../src/compiler/tasks/setup/utils/get-project-module-system.ts","../src/types/address.ts","../src/utils/is-valid-url.ts","../src/types/runtime-config.ts","../src/compiler/tasks/setup/utils/parse-runtime-config.ts","../src/compiler/tasks/setup/index.ts","../src/compiler/tasks/download/validate-spec.ts","../src/compiler/tasks/download/index.ts","../src/compiler/tasks/persist/index.ts","../src/compiler/tasks/compile/index.ts","../src/compiler/intercepter/print-information.ts","../src/compiler/intercepter/perfect-error-message.ts","../src/compiler/compiler.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs-extra'\nimport { createHash } from 'crypto'\nimport type { CacheStore, CacheSetOptions } from './types/index.js'\n\ninterface StoredEntry<T = unknown> {\n  value: T\n  expiresAt: number | null\n  createdAt: number\n}\n\nexport class FileSystemCacheStore implements CacheStore {\n  private cacheDir: string\n  /** Fallback TTL to prevent cache files from accumulating indefinitely when callers omit ttl */\n  private readonly maxTtl = 7 * 24 * 60 * 60 * 1000\n\n  constructor(cacheDir: string) {\n    this.cacheDir = cacheDir\n  }\n\n  async get<T = unknown>(key: string): Promise<T | undefined> {\n    const filepath = this.keyToPath(key)\n    try {\n      const raw = await fs.readFile(filepath, 'utf-8')\n      const entry: StoredEntry<T> = JSON.parse(raw)\n\n      if (entry.expiresAt !== null && Date.now() > entry.expiresAt) {\n        await fs.remove(filepath).catch(() => {})\n        return undefined\n      }\n\n      return entry.value\n    } catch {\n      return undefined\n    }\n  }\n\n  async set<T = unknown>(key: string, value: T, options?: CacheSetOptions): Promise<void> {\n    const filepath = this.keyToPath(key)\n    await fs.ensureDir(path.dirname(filepath))\n\n    const effectiveTtl = options?.ttl ? Math.min(options.ttl, this.maxTtl) : this.maxTtl\n\n    const entry: StoredEntry<T> = {\n      value,\n      expiresAt: Date.now() + effectiveTtl,\n      createdAt: Date.now(),\n    }\n\n    await fs.writeFile(filepath, JSON.stringify(entry), 'utf-8')\n  }\n\n  async has(key: string): Promise<boolean> {\n    const result = await this.get(key)\n    return result !== undefined\n  }\n\n  async delete(key: string): Promise<void> {\n    const filepath = this.keyToPath(key)\n    await fs.remove(filepath).catch(() => {})\n  }\n\n  async clear(): Promise<void> {\n    await fs.remove(this.cacheDir).catch(() => {})\n  }\n\n  private keyToPath(key: string): string {\n    const hash = createHash('sha256').update(key)\n      .digest('hex')\n    return path.join(this.cacheDir, `${hash}.json`)\n  }\n}\n","/* eslint-disable @typescript-eslint/require-await */\nimport type { CacheStore, CacheSetOptions } from './types/index.js'\n\ninterface MemoryEntry<T = unknown> {\n  value: T\n  expiresAt: number | null\n}\n\nexport class MemoryCacheStore implements CacheStore {\n  private store = new Map<string, MemoryEntry>()\n\n  async get<T = unknown>(key: string): Promise<T | undefined> {\n    const entry = this.store.get(key)\n    if (!entry) return undefined\n\n    if (entry.expiresAt !== null && Date.now() > entry.expiresAt) {\n      this.store.delete(key)\n      return undefined\n    }\n\n    return entry.value as T\n  }\n\n  async set<T = unknown>(key: string, value: T, options?: CacheSetOptions): Promise<void> {\n    this.store.set(key, {\n      value,\n      expiresAt: options?.ttl ? Date.now() + options.ttl : null,\n    })\n  }\n\n  async has(key: string): Promise<boolean> {\n    const result = await this.get(key)\n    return result !== undefined\n  }\n\n  async delete(key: string): Promise<void> {\n    this.store.delete(key)\n  }\n\n  async clear(): Promise<void> {\n    this.store.clear()\n  }\n}\n","/* eslint-disable @typescript-eslint/require-await */\nimport type { CacheStore, CacheSetOptions } from './types/index.js'\n\nexport class NullCacheStore implements CacheStore {\n  async get<T = unknown>(): Promise<T | undefined> {\n    return undefined\n  }\n\n  async set<T = unknown>(_key: string, _value: T, _options?: CacheSetOptions): Promise<void> {}\n\n  async has(): Promise<boolean> {\n    return false\n  }\n\n  async delete(): Promise<void> {}\n\n  async clear(): Promise<void> {}\n}\n","import type { CacheStore, CacheSetOptions } from './types/index.js'\n\nexport class NamespacedCacheStore implements CacheStore {\n  constructor(\n    private inner: CacheStore,\n    private namespace: string,\n  ) {}\n\n  private prefixKey(key: string): string {\n    return `${this.namespace}:${key}`\n  }\n\n  async get<T = unknown>(key: string): Promise<T | undefined> {\n    return this.inner.get<T>(this.prefixKey(key))\n  }\n\n  async set<T = unknown>(key: string, value: T, options?: CacheSetOptions): Promise<void> {\n    return this.inner.set(this.prefixKey(key), value, options)\n  }\n\n  async has(key: string): Promise<boolean> {\n    return this.inner.has(this.prefixKey(key))\n  }\n\n  async delete(key: string): Promise<void> {\n    return this.inner.delete(this.prefixKey(key))\n  }\n\n  async clear(): Promise<void> {\n    return this.inner.clear()\n  }\n}\n","import * as R from 'ramda'\nimport fs from 'fs-extra'\nimport picomatch from 'picomatch'\nimport { OperationDefinition, ModuleDefinition } from '~/models/index.js'\n\n\nconst ALL_HTTP_METHODS = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options']\n\nexport interface FilterRule {\n  persist: boolean\n  deny: boolean\n  moduleName: string\n  operationMethod: string\n  operationPathname: string\n  /** Lines (comment or blank) that appear before this rule in the file */\n  leadingComments?: string[]\n  /** Inline comment at end of the rule line, e.g. `# some note` */\n  inlineComment?: string\n}\n\ninterface FilterMeta {\n  preambleComments?: string[]\n  trailingComments?: string[]\n}\n\nfunction deduplicateRules(rules: FilterRule[]): FilterRule[] {\n  const sorted = R.sortBy(R.prop('deny'), rules)\n  return R.uniqWith(\n    (a, b) => a.moduleName === b.moduleName && a.operationMethod === b.operationMethod && a.operationPathname === b.operationPathname,\n    sorted,\n  )\n}\n\nfunction sortRulesForOutput(rules: FilterRule[]): FilterRule[] {\n  return [...rules].sort((a, b) => {\n    if (a.moduleName === '*' && b.moduleName !== '*') return -1\n    if (a.moduleName !== '*' && b.moduleName === '*') return 1\n    if (a.moduleName !== b.moduleName) return a.moduleName.localeCompare(b.moduleName)\n    if (a.operationMethod === '*' && b.operationMethod !== '*') return -1\n    if (a.operationMethod !== '*' && b.operationMethod === '*') return 1\n    if (a.operationMethod !== b.operationMethod) return a.operationMethod.localeCompare(b.operationMethod)\n    return a.operationPathname.localeCompare(b.operationPathname)\n  })\n}\n\nfunction renderBlock(section: 'deny' | 'allow', rules: FilterRule[]): string {\n  if (rules.length === 0) return ''\n  const maxMethodLen = Math.max(...rules.map((r) => r.operationMethod.toUpperCase().length))\n  const lines: string[] = []\n  for (const r of rules) {\n    if (r.leadingComments && r.leadingComments.length > 0) {\n      lines.push(...r.leadingComments)\n    }\n    const ruleLine = `${r.operationMethod.toUpperCase().padEnd(maxMethodLen + 2)}${r.moduleName}:${r.operationPathname}`\n    lines.push(r.inlineComment ? `${ruleLine}  ${r.inlineComment}` : ruleLine)\n  }\n  return `[${section}]\\n${lines.join('\\n')}`\n}\n\n\ninterface CompiledRule {\n  rule: FilterRule\n  matchModuleName: (s: string) => boolean\n  matchMethod: (s: string) => boolean\n  matchPathname: (s: string) => boolean\n}\n\nfunction compileRule(rule: FilterRule): CompiledRule {\n  return {\n    rule,\n    matchModuleName: picomatch(rule.moduleName),\n    matchMethod: picomatch(rule.operationMethod),\n    matchPathname: picomatch(rule.operationPathname),\n  }\n}\n\n\n/**\n * Matches API operations and modules against `.keqfilter` rules to determine\n * which should be denied (excluded) or allowed during code generation.\n * Supports glob patterns (via picomatch) for module names, HTTP methods, and pathnames.\n */\nexport class Matcher {\n  private compiled: CompiledRule[]\n  private preambleComments: string[]\n  private trailingComments: string[]\n\n  constructor(rules: FilterRule[], meta: FilterMeta = {}) {\n    this.compiled = rules.map(compileRule)\n    this.preambleComments = meta.preambleComments ?? []\n    this.trailingComments = meta.trailingComments ?? []\n  }\n\n  private get rules(): FilterRule[] {\n    return this.compiled.map((c) => c.rule)\n  }\n\n  /**\n   * Parse `.keqfilter` file content into a Matcher instance.\n   *\n   * File format:\n   * ```\n   * [deny]\n   * GET     petStore:/pets\n   * *       userService:/**\n   *\n   * [allow]\n   * GET     petStore:/pets/details\n   * ```\n   *\n   * Line format: `METHOD module:/pathname`\n   * - method: HTTP method or `*`, case-insensitive\n   * - module:/pathname: module name + `:` + path pattern (glob supported)\n   */\n  static parse(content: string): Matcher {\n    const normalized = content\n      .replace(/\\r\\n/g, '\\n')\n      .replace(/\\r/g, '\\n')\n\n    const rules: FilterRule[] = []\n    let currentDeny: boolean | null = null\n    let firstSectionSeen = false\n    let preambleComments: string[] = []\n    const pendingComments: string[] = []\n\n    for (const rawLine of normalized.split('\\n')) {\n      const line = rawLine.replace(/#.*$/, '').trim()\n\n      if (!line) {\n        // blank line or comment-only line — buffer it\n        pendingComments.push(rawLine)\n        continue\n      }\n\n      if (line === '[deny]') {\n        if (!firstSectionSeen) {\n          preambleComments = [...pendingComments]\n          pendingComments.length = 0\n          firstSectionSeen = true\n        } else {\n          while (pendingComments.length > 0 && pendingComments[0].trim() === '') {\n            pendingComments.shift()\n          }\n        }\n        currentDeny = true\n        continue\n      }\n      if (line === '[allow]') {\n        if (!firstSectionSeen) {\n          preambleComments = [...pendingComments]\n          pendingComments.length = 0\n          firstSectionSeen = true\n        } else {\n          while (pendingComments.length > 0 && pendingComments[0].trim() === '') {\n            pendingComments.shift()\n          }\n        }\n        currentDeny = false\n        continue\n      }\n      if (currentDeny === null) continue\n\n      const matched = line.match(/^([^\\s]+)\\s+([^:\\s]+):(.*)$/)\n      if (!matched) throw new Error(`Invalid filter rule: \"${line}\"`)\n\n      const [, operationMethod, moduleName, operationPathname] = matched\n\n      // extract inline comment from the original raw line (whitespace + # + text at end)\n      const inlineCommentMatch = rawLine.match(/\\s+(#.*)$/)\n      const inlineComment = inlineCommentMatch ? inlineCommentMatch[1] : undefined\n\n      rules.push({\n        persist: true,\n        deny: currentDeny,\n        moduleName,\n        operationMethod: operationMethod.toLowerCase(),\n        operationPathname,\n        leadingComments: pendingComments.length > 0 ? [...pendingComments] : undefined,\n        inlineComment,\n      })\n      pendingComments.length = 0\n    }\n\n    const trailingComments = [...pendingComments]\n    // strip trailing empty strings that are artifacts of the file's trailing newline\n    while (trailingComments.length > 0 && trailingComments[trailingComments.length - 1].trim() === '') {\n      trailingComments.pop()\n    }\n    // strip trailing empty strings from preamble for the same reason\n    while (preambleComments.length > 0 && preambleComments[preambleComments.length - 1].trim() === '') {\n      preambleComments.pop()\n    }\n    return new Matcher(deduplicateRules(rules), { preambleComments, trailingComments })\n  }\n\n  static async read(filepath: string): Promise<Matcher> {\n    const content = await fs.readFile(filepath, 'utf-8')\n    return Matcher.parse(content)\n  }\n\n  async write(filepath: string): Promise<void> {\n    const persistRules: FilterRule[] = R.compose(\n      R.reverse,\n      R.uniqWith<FilterRule>(\n        (a, b) => a.moduleName === b.moduleName && a.operationMethod === b.operationMethod && a.operationPathname === b.operationPathname,\n      ),\n      R.filter((rule: FilterRule) => rule.persist),\n    )(this.rules) as FilterRule[]\n\n    const denyRules = sortRulesForOutput(persistRules.filter((r) => r.deny))\n    const allowRules = sortRulesForOutput(persistRules.filter((r) => !r.deny))\n\n    const blocks = [\n      renderBlock('deny', denyRules),\n      renderBlock('allow', allowRules),\n    ].filter(Boolean)\n\n    if (blocks.length === 0) return\n\n    const blockContent = blocks.join('\\n\\n')\n\n    // prepend preamble comments (file-level comments before the first section)\n    const mainContent = this.preambleComments.length > 0\n      ? `${this.preambleComments.join('\\n')}\\n${blockContent}`\n      : blockContent\n\n    // append trailing comments (after the last rule)\n    const output = this.trailingComments.length > 0\n      ? `${mainContent}\\n\\n${this.trailingComments.join('\\n')}`\n      : mainContent\n\n    await fs.writeFile(filepath, output, 'utf-8')\n  }\n\n  append(rule: FilterRule): void {\n    this.compiled.unshift(compileRule(rule))\n  }\n\n  isOperationDenied(operationDefinition: OperationDefinition): boolean {\n    const moduleName = operationDefinition.module.name\n    const operationMethod = operationDefinition.method.toLowerCase()\n    const operationPathname = operationDefinition.pathname\n\n    for (const { rule, matchModuleName, matchMethod, matchPathname } of this.compiled) {\n      if (!matchModuleName(moduleName)) continue\n      if (!matchMethod(operationMethod)) continue\n      if (!matchPathname(operationPathname)) continue\n\n      return rule.deny\n    }\n\n    return false\n  }\n\n  isModuleDenied(moduleDefinition: ModuleDefinition): boolean {\n    const moduleName = moduleDefinition.name\n\n    for (const { rule, matchModuleName, matchMethod, matchPathname } of this.compiled) {\n      if (!matchModuleName(moduleName)) continue\n\n      if (!rule.deny) return false\n\n      if (!ALL_HTTP_METHODS.every((m) => matchMethod(m))) continue\n      if (!matchPathname('/a/b/c/d')) continue\n\n      return true\n    }\n\n    return false\n  }\n}\n","import { CONFIG_FILENAMES } from '~/constants/index.js'\n\nexport class ConfigNotFoundException extends Error {\n  constructor(searchDir: string) {\n    const filenames = CONFIG_FILENAMES.map((f) => `  - ${f}`).join('\\n')\n    super(\n      'Cannot find keq config file.\\n\\n'\n      + `Searched from: ${searchDir}\\n\\n`\n      + `Expected one of:\\n${filenames}\\n\\n`\n      + 'To create a config file, run: keq init\\n'\n      + 'Or specify an explicit path with: --config <path>',\n    )\n    this.name = 'ConfigNotFoundException'\n  }\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nexport interface PackageJsonInfo {\n  json: any\n  path: string\n}\n\n\nexport function findNearestPackageJson(startDir = process.cwd()): PackageJsonInfo | null {\n  let dir = startDir\n  // 向上遍历直到磁盘根目录\n  while (true) {\n    const pkgPath = path.join(dir, 'package.json')\n    if (fs.existsSync(pkgPath)) {\n      const json = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))\n      return { json, path: pkgPath }\n    }\n    const parent = path.dirname(dir)\n    if (parent === dir) break\n    dir = parent\n  }\n  return null\n}\n","import { PackageJsonInfo } from './find-nearest-package-json.js'\n\ntype ModuleSystem = 'esm' | 'cjs'\n\nexport function getProjectModuleSystem(pkgInfo: PackageJsonInfo): ModuleSystem {\n  if (!pkgInfo?.json) return 'cjs'\n  const { json } = pkgInfo\n\n  if (json.type === 'module') return 'esm'\n  return 'cjs'\n}\n","import { Static, Type } from '@sinclair/typebox'\n\n\nexport const Address = Type.Object({\n  url: Type.String(),\n  headers: Type.Optional(Type.Record(Type.String(), Type.String(), { default: {} })),\n  encoding: Type.Optional(\n    Type.Union([\n      Type.Literal('utf8'),\n      Type.Literal('ascii'),\n    ], { default: 'utf8' }),\n  ),\n})\n\nexport type Address = Static<typeof Address>\n","/**\n * 通用 URL 验证正则表达式，支持任意协议\n *\n * 格式: protocol://[user:password@][host][:port][/path][?query][#fragment]\n *\n * 支持的协议示例:\n * - http://, https://\n * - file:// (支持 file:///path 和 file://host/path 两种格式)\n * - ftp://, sftp://\n * - ws://, wss://\n * - 以及任何其他自定义协议\n */\nconst URL_REGEX = /^[a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/(?:[^\\s@]+@)?[^\\s/:?#]*(?::\\d+)?(?:\\/[^\\s?#]*)?(?:\\?[^\\s#]*)?(?:#[^\\s]*)?$/\n\n/**\n * 验证是否为有效的 URL\n *\n * @param url - 待验证的 URL 字符串\n * @returns 如果是有效的 URL 返回 true，否则返回 false\n *\n * @example\n * ```typescript\n * isValidURL('http://example.com') // true\n * isValidURL('https://example.com:8080/path?query=1#fragment') // true\n * isValidURL('file:///path/to/file.json') // true\n * isValidURL('not a url') // false\n * ```\n */\nexport function isValidURL(url: string): boolean {\n  return URL_REGEX.test(url)\n}\n","import * as R from 'ramda'\nimport { StaticDecode, StaticEncode, Type } from '@sinclair/typebox'\nimport { FileNamingStyle } from '../constants/file-naming-style.js'\nimport { Plugin } from './plugin.js'\nimport { Address } from './address.js'\nimport { isValidURL } from '../utils/is-valid-url.js'\nimport { Translator } from './index.js'\nimport type { CacheStore } from '~/cache-store/index.js'\n\n\nconst Modules = Type.Transform(\n  Type.Record(\n    Type.String(),\n    Type.Union([Type.String(), Address]),\n  ),\n)\n  .Decode((value): Record<string, Address> => {\n    const keys = Object.keys(value)\n\n    for (const key of keys) {\n      if (!/^[A-Za-z_][A-Za-z0-9_$]*$/.test(key)) {\n        throw new Error(`Module name \"${key}\" is not valid. It must start with a letter or underscore, and can only contain letters, numbers, and underscores.`)\n      }\n    }\n\n    const keysGroupByLowerCase = R.groupBy(R.toLower, keys)\n\n    for (const groupKey in keysGroupByLowerCase) {\n      const keys = keysGroupByLowerCase[groupKey] || []\n      if (keys.length > 1) {\n        throw new Error(`Module names ${keys.map((name) => `\"${name}\"`).join(', ')} are case-insensitively duplicated.`)\n      }\n    }\n\n    for (const key in value) {\n      const url = typeof value[key] === 'string' ? value[key] : value[key].url\n\n      if (isValidURL(url)) continue\n\n      throw new Error(`The ${JSON.stringify(url)} of module \"${key}\" is not a valid URL.`)\n    }\n\n    return R.map(\n      (item: string | Address): Address => (typeof item !== 'string' ? item : { url: item, headers: {}, encoding: 'utf8' }),\n      value,\n    )\n  })\n  .Encode((value) => value)\n\n\nexport const RawConfig = Type.Object({\n  /**\n   * Output directory for generated files\n   */\n  outdir: Type.String({ default: './api' }),\n\n  /**\n   * Rendering options that directly control code generation output\n   */\n  rendering: Type.Object({\n    /**\n     * Whether to generate ES Module code\n     *\n     * If not specified, the module system will be inferred from the nearest package.json \"type\" field\n     * or defaults to \"cjs\" if no package.json is found.\n     */\n    esm: Type.Optional(Type.Boolean({ default: false })),\n\n    /**\n     * File naming style for generated files\n     */\n    fileNamingStyle: Type.Enum(FileNamingStyle, { default: FileNamingStyle.raw }),\n\n    /**\n     * Controls how `additionalProperties: true` (or undefined) is rendered in generated TypeScript types.\n     *\n     * - `'unknown'` (default): renders as `unknown`, which is stricter and type-safe\n     * - `'any'`: renders as `any`, which is more permissive\n     */\n    additionalPropertiesType: Type.Optional(\n      Type.Union([Type.Literal('unknown'), Type.Literal('any')], { default: 'unknown' }),\n    ),\n\n    /**\n     * Whether to generate entrypoint (index) files that re-export all generated modules.\n     *\n     * When enabled, entrypoint files are always generated. If a directory has no\n     * exportable content, the entrypoint contains `export {}` so the file still\n     * exists and remains a valid module.\n     *\n     * Disable this to avoid merge conflicts in multi-branch collaborative development,\n     * as auto-generated index files change frequently.\n     */\n    entrypoint: Type.Optional(Type.Boolean({ default: false })),\n\n    /**\n     * Controls how empty request body is handled for application/json requests\n     * when all body properties are optional and none are provided.\n     *\n     * - `'strict'` (default): Always renders `req.type(\"application/json\")`, no body fallback\n     * - `'omit'`: Skips `req.type(\"application/json\")`; `req.send()` auto-sets Content-Type when needed\n     * - `'empty-object'`: Sends `req.send({})` when no body properties are provided\n     * - `'null'`: Sends `req.send(null)` when no body properties are provided\n     */\n    emptyJsonRequestBodyMode: Type.Optional(\n      Type.Union([\n        Type.Literal('strict'),\n        Type.Literal('omit'),\n        Type.Literal('empty-object'),\n        Type.Literal('null'),\n      ], { default: 'strict' }),\n    ),\n\n    /**\n     * @deprecated This option exists solely for backward compatibility with v2 generated code.\n     * It will be removed in a future major version.\n     *\n     * When enabled, emits `.option('module', { name, pathname, method })` in generated micro-functions.\n     */\n    v2Compat: Type.Optional(Type.Boolean({ default: false })),\n  }, { default: {} }),\n\n  /**\n   * OpenAPI/Swagger document sources\n   *\n   * A map of module names to their document URLs or Address objects.\n   * The module name must be a valid JavaScript identifier.\n   */\n  modules: Modules,\n\n  /**\n   * Enable debug mode to output detailed logs during compilation\n   */\n  debug: Type.Optional(Type.Boolean({ default: false })),\n\n  /**\n   * Whether to tolerate wrong openapi/swagger structure\n   */\n  tolerant: Type.Optional(Type.Boolean({ default: false })),\n\n  /**\n   * Translators to transform generated code\n   *\n   * Used to customize the code generation process for different frameworks or patterns.\n   * Can be a single translator or an array of translators.\n   */\n  translators: Type.Optional(\n    Type.Transform(\n      Type.Union([\n        Type.Unsafe<Translator>(Type.Any()),\n        Type.Array(Type.Unsafe<Translator>(Type.Any())),\n      ], { default: [] }),\n    )\n      .Decode((value): Translator[] => {\n        if (value === undefined) return []\n        if (Array.isArray(value)) return value\n        return [value]\n      })\n      .Encode((value) => value),\n  ),\n\n  /**\n   * Plugins to extend code generation functionality\n   *\n   * An array of plugin instances that can hook into various stages of the compilation process,\n   * such as code transformation, formatting, linting, or custom file generation.\n   */\n  plugins: Type.Optional(Type.Array(Type.Unsafe<Plugin>(Type.Any()), { default: [] })),\n\n  /**\n   * Cache store for download and compilation caching.\n   *\n   * Set to a CacheStore instance to enable caching, or `false` to disable.\n   * If not set, defaults to FileSystemCacheStore in the OS cache directory.\n   */\n  cache: Type.Optional(Type.Unsafe<CacheStore | false>(Type.Any())),\n})\n\nexport type RawConfig = StaticEncode<typeof RawConfig>\nexport type RuntimeConfig = StaticDecode<typeof RawConfig>\n","import { Value } from '@sinclair/typebox/value'\nimport { RawConfig, RuntimeConfig, Plugin, Translator } from '~/types/index.js'\n\n\nexport function parseRuntimeConfig(data: unknown): RuntimeConfig {\n  try {\n    const record = typeof data === 'object' && data !== null\n      ? data as Record<string, unknown>\n      : undefined\n\n    const originalPlugins = record && 'plugins' in record ? record.plugins : undefined\n    const originalTranslators = record && 'translators' in record ? record.translators : undefined\n\n    const sanitized = record ? { ...record } : data\n    if (record) {\n      delete (sanitized as Record<string, unknown>).plugins\n      delete (sanitized as Record<string, unknown>).translators\n    }\n\n    const parsed = Value.Parse(RawConfig, sanitized)\n\n    if (originalPlugins !== undefined) {\n      parsed.plugins = originalPlugins as Plugin[]\n    }\n\n    if (originalTranslators !== undefined) {\n      parsed.translators = originalTranslators as Translator[]\n    }\n\n    return parsed\n  } catch (error) {\n    if (error instanceof Error) {\n      error.message = `Invalid Config: ${error.message}`\n    }\n    throw error\n  }\n}\n","import fs from 'fs-extra'\nimport path from 'path'\nimport { CosmiconfigResult } from 'cosmiconfig'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { ListrTask } from 'listr2'\nimport { Matcher, FilterRule } from '~/utils/matcher.js'\nimport { ConfigNotFoundException } from '~/exceptions/index.js'\nimport { findNearestPackageJson, getProjectModuleSystem } from './utils/index.js'\nimport type { BaseTaskOptions } from '../types/base-task-options.js'\nimport type { Compiler } from '../../compiler.js'\nimport { CompilerContext } from '../../types/index.js'\nimport { parseRuntimeConfig } from './utils/parse-runtime-config.js'\nimport { MicroFunctionTranslator } from '~/translators/micro-function.translator.js'\n\n\nexport interface SetupTaskOptions {\n  config?: string\n  debug?: boolean\n  tolerant?: boolean\n\n  filter?: false | {\n    rules: FilterRule[]\n  }\n}\n\nconst explore = cosmiconfig('keq')\n\n\nfunction main(compiler: Compiler, options: SetupTaskOptions): ListrTask<CompilerContext> {\n  return {\n    task: async (context, task) => {\n      const result: CosmiconfigResult = options?.config\n        ? await explore.load(options.config)\n        : await explore.search()\n\n      if (!result || ('isEmpty' in result && result.isEmpty)) {\n        throw new ConfigNotFoundException(options?.config ?? process.cwd())\n      }\n\n      context.workdir = path.dirname(result.filepath)\n\n      const rc = parseRuntimeConfig(result.config)\n\n      rc.outdir = path.isAbsolute(rc.outdir)\n        ? rc.outdir\n        : path.resolve(context.workdir, rc.outdir)\n\n      if (options?.debug) {\n        await fs.ensureDir(path.resolve(context.workdir, '.keq'))\n        rc.debug = true\n      }\n\n      rc.tolerant = Boolean(rc.tolerant || options?.tolerant)\n\n      if (!rc.translators || !rc.translators.length) {\n        rc.translators = [new MicroFunctionTranslator()]\n      }\n\n      const packageJsonInfo = findNearestPackageJson()\n      if (packageJsonInfo) {\n        const moduleSystem = getProjectModuleSystem(packageJsonInfo)\n        rc.rendering.esm = moduleSystem === 'esm'\n      }\n\n      context.rc = rc\n\n\n      // Setup Matcher\n\n      let matcher: Matcher = new Matcher([])\n      // filter === false means skip .keqfilter file loading entirely (e.g. --all flag)\n      if (options.filter !== false && result.filepath) {\n        const filterFilepath = path.resolve(path.dirname(result.filepath), '.keqfilter')\n        if (await fs.exists(filterFilepath)) {\n          matcher = await Matcher.read(filterFilepath)\n        }\n      }\n\n      const filterRules = options.filter === false ? [] : options.filter?.rules || []\n      for (const rule of filterRules) {\n        matcher.append({\n          persist: !!rule.persist,\n          deny: rule.deny,\n          moduleName: rule.moduleName,\n          operationMethod: rule.operationMethod,\n          operationPathname: rule.operationPathname,\n        })\n      }\n\n      context.matcher = matcher\n\n      await compiler.hooks.setup.promise(task)\n    },\n  }\n}\n\nexport function createSetupTask(compiler: Compiler, options: SetupTaskOptions & BaseTaskOptions): ListrTask<CompilerContext> {\n  return {\n    title: 'Setup',\n    enabled: options?.enabled,\n    skip: options?.skip,\n    task: (context, task) => task.newListr(\n      [\n        main(compiler, options),\n        {\n          task: (context, task) => compiler.hooks.afterSetup\n            .promise(task),\n        },\n      ],\n      {\n        concurrent: false,\n      },\n    ),\n  }\n}\n","import { validate } from '@scalar/openapi-parser'\nimport { ModuleDefinition } from '~/models/index.js'\nimport { Exception } from '~/exception.js'\n\ninterface ValidateSpecOptions {\n  moduleDefinition: ModuleDefinition\n  tolerant: boolean\n}\n\ninterface ValidateSpecResult {\n  valid: boolean\n  warning?: string\n}\n\nexport async function validateSpec(\n  spec: object,\n  options: ValidateSpecOptions,\n): Promise<ValidateSpecResult> {\n  const { valid, errors } = await validate(spec)\n  if (valid) return { valid: true }\n\n  const errorLines = errors?.map((e) => {\n    const path = (e as { path?: string }).path\n    if (path) {\n      const readablePath = path.replace(/~1/g, '/').replace(/~0/g, '~')\n      return `  - ${e.message}\\n    at: ${readablePath}`\n    }\n    return `  - ${e.message}`\n  }).join('\\n')\n\n  let message = `${options.moduleDefinition.name} module openapi/swagger file does not conform to the openapi specifications or have grammatical errors, which may cause unexpected errors: \\n${errorLines}`\n\n  const hasInvalidRef = errors?.some((e) => e.message?.includes('Error-ModelName'))\n  if (hasInvalidRef) {\n    message += '\\n\\n  [Hint] \"Error-ModelName\" in $ref indicates that SpringDoc failed to resolve a Java class. Check that the referenced class (e.g. cn.dotfashion.soa.api.vo.Response) is on the classpath and properly annotated with @Schema.'\n  }\n\n  const hasExtensionsError = errors?.some((e) => e.message?.includes('Property extensions is not expected to be here'))\n  if (hasExtensionsError) {\n    message += '\\n\\n  [Hint] \"Property extensions is not expected to be here\" is typically caused by SpringDoc/Swagger wrapping x- extensions in an \"extensions\" object. Add SpringdocCompatPlugin to your config plugins to fix this automatically.'\n  }\n\n  if (options.tolerant) {\n    return { valid: false, warning: message }\n  }\n\n  throw new Exception(options.moduleDefinition, message)\n}\n","import { ListrTask, PRESET_TIMER } from 'listr2'\nimport { ModuleDefinition, ApiDocumentV3_1 } from '~/models/index.js'\nimport { BaseTaskOptions } from '../types/base-task-options.js'\nimport type { Compiler } from '~/compiler/compiler.js'\nimport { CompilerContext } from '~/compiler/index.js'\nimport { Exception } from '~/exception.js'\nimport { OpenapiUtils } from '~/utils/openapi-utils/index.js'\nimport { validateSpec } from './validate-spec.js'\n\n\ninterface DownloadTaskOptions {\n  skipFilteredModules?: boolean\n}\n\nfunction main(compiler: Compiler, options?: DownloadTaskOptions): ListrTask<CompilerContext> {\n  return {\n    task: (context, task) => {\n      if (!context.rc || !context.matcher) {\n        throw new Error('Please run setup task first.')\n      }\n\n      const rc = context.rc\n      const matcher = context.matcher\n\n      context.documents = []\n\n      return task.newListr(\n        Object.entries(rc.modules)\n          .map(([moduleName, address]) => new ModuleDefinition(moduleName, address))\n          .map((moduleDefinition): ListrTask<CompilerContext> => ({\n            title: moduleDefinition.name,\n            task: async (ctx, task) => {\n              if (options?.skipFilteredModules && matcher.isModuleDenied(moduleDefinition)) {\n                task.skip(`(${moduleDefinition.name}) is filtered`)\n                return\n              }\n\n              task.output = `Downloaded from ${moduleDefinition.address.url}`\n\n              const result = await compiler.hooks.download.promise(moduleDefinition.address, moduleDefinition, task)\n\n              if (!result) {\n                throw new Exception(moduleDefinition, `Cannot download document from ${moduleDefinition.address.url}`)\n              }\n\n              const { content, fingerprint } = result\n              const spec = JSON.parse(content)\n\n              await compiler.hooks.beforeValidate.promise(spec, moduleDefinition)\n\n              const validation = await validateSpec(spec, {\n                moduleDefinition,\n                tolerant: !!compiler.options.tolerant,\n              })\n              if (validation.warning) {\n                task.output = validation.warning\n              }\n\n              OpenapiUtils.dereferenceOperation(spec)\n\n              const document = new ApiDocumentV3_1(\n                spec,\n                moduleDefinition,\n                fingerprint,\n              )\n\n              ctx.documents?.push(document)\n            },\n          })),\n        {\n          concurrent: true,\n          exitOnError: !compiler.options.tolerant,\n          collectErrors: compiler.options.tolerant ? 'minimal' : false,\n          rendererOptions: {\n            collapseSubtasks: false,\n            suffixSkips: true,\n            timer: PRESET_TIMER,\n          },\n        },\n      )\n    },\n  }\n}\n\nexport function createDownloadTask(compiler: Compiler, options?: DownloadTaskOptions & BaseTaskOptions): ListrTask<CompilerContext> {\n  return {\n    title: 'Download',\n    enabled: options?.enabled,\n    skip: options?.skip,\n    task: (_, task) => task.newListr(\n      [\n        main(compiler, options),\n        {\n          task: (context, task) => compiler.hooks.afterDownload\n            .promise(task),\n        },\n      ],\n      {\n        concurrent: false,\n      },\n    ),\n  }\n}\n","import * as path from 'path'\nimport fs from 'fs-extra'\nimport { ListrTask } from 'listr2'\nimport { BaseTaskOptions } from '../types/base-task-options.js'\nimport type { Compiler, CompilerContext } from '~/compiler/index.js'\nimport { Asset } from '~/models/index.js'\n\n\nfunction createPersistArtifactTask(): ListrTask<CompilerContext> {\n  return {\n    title: 'Write files',\n    task: async (context, task) => {\n      if (!context.rc) throw new Error('Please run setup task first.')\n      if (!context.workdir) throw new Error('Please run setup task first.')\n      if (!context.artifacts || context.artifacts.length === 0) {\n        task.skip('No compiled artifacts to persist.')\n        return\n      }\n\n      const rc = context.rc\n      const artifacts = context.artifacts\n\n      const total = artifacts.length\n      let completed = 0\n\n      const files = await Promise.all(artifacts.map(async (artifact): Promise<Asset> => {\n        const realpath = path.join(rc.outdir, artifact.filepath)\n        await fs.ensureFile(realpath)\n        await fs.writeFile(realpath, artifact.renderer())\n\n        completed += 1\n        task.output = `Persisted ${completed}/${total} files`\n\n        return new Asset(path.resolve(realpath))\n      }))\n\n      context.assets = files\n    },\n  }\n}\n\nfunction createPersistFilterTask(): ListrTask<CompilerContext> {\n  return {\n    title: 'Update .keqfilter',\n    task: async (context, task) => {\n      if (!context.matcher) throw new Error('Please run setup task first.')\n      if (!context.workdir) throw new Error('Please run setup task first.')\n\n      const matcher = context.matcher\n      const filterPath = path.resolve(context.workdir, '.keqfilter')\n      await matcher.write(filterPath)\n    },\n  }\n}\n\n\nfunction main(): ListrTask<CompilerContext> {\n  return {\n    task: (context, task) => task.newListr(\n      [\n        createPersistArtifactTask(),\n        createPersistFilterTask(),\n      ],\n      {\n        concurrent: true,\n        rendererOptions: {\n          collapseSubtasks: true,\n        },\n      },\n    ),\n  }\n}\n\nexport function createPersistTask(compiler: Compiler, options?: BaseTaskOptions): ListrTask<CompilerContext> {\n  return {\n    title: 'Persist',\n    enabled: options?.enabled,\n    skip: options?.skip,\n    task: (context, task) => task.newListr(\n      [\n        {\n          task: (context, task) => compiler.hooks.beforePersist\n            .promise(task),\n        },\n        main(),\n        {\n          task: (context, task) => compiler.hooks.afterPersist\n            .promise(task),\n        },\n      ],\n      {\n        concurrent: false,\n      },\n    ),\n  }\n}\n","import { ListrTask } from 'listr2'\nimport { BaseTaskOptions } from '../types/base-task-options.js'\nimport type { Compiler } from '~/compiler/compiler.js'\nimport { CompilerContext } from '~/compiler/index.js'\n// import { RequestGenerator } from '~/generators/index.js'\n\n\nfunction main(compiler: Compiler): ListrTask<CompilerContext> {\n  return {\n    task: async (context, task) => {\n      if (!context.rc) throw new Error('Please run setup task first.')\n      if (!context.documents) throw new Error('Please run shaking task first.')\n\n      context.artifacts = []\n\n      await compiler.hooks.compile.promise(task)\n    },\n  }\n}\n\nexport function createCompileTask(compiler: Compiler, options?: BaseTaskOptions): ListrTask<CompilerContext> {\n  return {\n    title: 'Compile',\n    enabled: options?.enabled,\n    skip: options?.skip,\n    task: (context, task) => task.newListr(\n      [\n        {\n          task: (context, task) => compiler.hooks.beforeCompile\n            .promise(task),\n        },\n        main(compiler),\n        {\n          task: (context, task) => compiler.hooks.afterCompile\n            .promise(task),\n        },\n      ],\n      {\n        concurrent: false,\n      },\n    ),\n  }\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport { FullTap, HookInterceptor } from 'tapable'\nimport { TaskWrapper } from '../tasks/index.js'\n\n\nexport function proxyTaskWrapper(pluginName: string, task: TaskWrapper): TaskWrapper {\n  return new Proxy(task, {\n    set(target, prop, value) {\n      if (prop !== 'output') {\n        return Reflect.set(target, prop, value)\n      }\n\n      target.output = `[Plugin: ${pluginName}] ${value}`\n      return true\n    },\n  })\n}\n\n\nexport function printInformation(taskIndex: number): HookInterceptor<unknown, unknown> {\n  return {\n    register: <T extends FullTap>(tap: T): T => {\n      const fn = tap.fn\n\n      if (tap.type === 'promise') {\n        tap.fn = (...args: any[]) => {\n          const task = args[taskIndex] as TaskWrapper\n          const proxyTask = proxyTaskWrapper(tap.name, task)\n          args[taskIndex] = proxyTask\n          proxyTask.output = 'Processing...'\n          return fn(...args)\n        }\n      }\n\n      if (tap.type === 'sync') {\n        tap.fn = (...args: any[]) => {\n          const task = args[taskIndex] as TaskWrapper\n          const proxyTask = proxyTaskWrapper(tap.name, task)\n          args[taskIndex] = proxyTask\n          proxyTask.output = 'Processing...'\n          return fn(...args)\n        }\n      }\n\n      if (tap.type === 'async') {\n        tap.fn = (...args: any[]) => {\n          const task = args[taskIndex] as TaskWrapper\n          const proxyTask = proxyTaskWrapper(tap.name, task)\n          args[taskIndex] = proxyTask\n          proxyTask.output = 'Processing...'\n          return fn(...args)\n        }\n      }\n\n      return tap\n    },\n  }\n}\n\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport * as R from 'ramda'\nimport { FullTap, HookInterceptor, InnerCallback } from 'tapable'\n\nexport function perfectErrorMessage(): HookInterceptor<unknown, unknown> {\n  return {\n    register: <T extends FullTap>(tap: T): T => {\n      const fn = tap.fn\n\n      function prefix(err: unknown): void {\n        if (err instanceof Error) {\n          err.message = `[Plugin: ${tap.name}] ${err.message}`\n        }\n      }\n\n      if (tap.type === 'promise') {\n        tap.fn = async (...args: any[]) => {\n          try {\n            return await fn(...args)\n          } catch (err) {\n            prefix(err)\n            throw err\n          }\n        }\n      }\n\n      if (tap.type === 'sync') {\n        tap.fn = (...args: any[]) => {\n          try {\n            return fn(...args)\n          } catch (err) {\n            prefix(err)\n            throw err\n          }\n        }\n      }\n\n      if (tap.type === 'async') {\n        tap.fn = (...args: any[]) => {\n          const callback = R.last(args) as InnerCallback<Error, any>\n\n          return fn(...R.init(args), (err: Error | null, result: any) => {\n            prefix(err)\n            return callback(err, result)\n          })\n        }\n      }\n\n      return tap\n    },\n  }\n}\n","\n\nimport { Listr } from 'listr2'\nimport { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } from 'tapable'\nimport { CompilerHooks, CompilerContext } from './types/index.js'\nimport {\n  ModuleDefinition,\n} from '~/models/index.js'\nimport {\n  createCompileTask,\n  createDownloadTask,\n  createPersistTask,\n  createSetupTask,\n  SetupTaskOptions,\n  TaskWrapper,\n} from './tasks/index.js'\nimport {\n  perfectErrorMessage,\n  printInformation,\n} from './intercepter/index.js'\nimport {\n  InitializePlugin,\n  TerminalSelectPluginOptions,\n} from '~/plugins/index.js'\nimport { Address } from '~/types/index.js'\nimport { NamespacedCacheStore, NullCacheStore } from '~/cache-store/index.js'\nimport type { CacheStore } from '~/cache-store/index.js'\nimport type { DownloadResult } from '~/types/index.js'\n\n\ninterface Options extends SetupTaskOptions {\n  build: boolean\n  persist?: boolean\n  silent?: boolean\n  fresh?: boolean\n  interactive?: boolean | TerminalSelectPluginOptions\n  cacheStore?: CacheStore\n}\n\n\nexport class Compiler {\n  context: CompilerContext = {}\n  private _cacheStore: CacheStore\n\n  hooks: CompilerHooks = {\n    setup: new AsyncParallelHook<[TaskWrapper]>(['task']),\n    afterSetup: new AsyncSeriesHook<[TaskWrapper]>(['task']),\n\n    beforeDownload: new AsyncSeriesHook<[TaskWrapper]>(['task']),\n    download: new AsyncSeriesBailHook<[Address, ModuleDefinition, TaskWrapper], DownloadResult | undefined>(['address', 'moduleDefinition', 'task']),\n    beforeValidate: new AsyncSeriesHook<[object, ModuleDefinition]>(['spec', 'moduleDefinition']),\n    afterDownload: new AsyncSeriesHook<[TaskWrapper]>(['task']),\n\n    beforeCompile: new AsyncSeriesHook<[TaskWrapper]>(['task']),\n    compile: new AsyncParallelHook<[TaskWrapper]>(['task']),\n    afterCompile: new AsyncSeriesHook<[TaskWrapper]>(['task']),\n\n    beforePersist: new AsyncSeriesHook<[TaskWrapper]>(['task']),\n    persist: new AsyncParallelHook<[TaskWrapper]>(['task']),\n    afterPersist: new AsyncSeriesHook<[TaskWrapper]>(['task']),\n\n    done: new SyncHook<[]>(),\n  }\n\n  constructor(\n    public options: Options,\n  ) {\n    this._cacheStore = options.cacheStore ?? new NullCacheStore()\n\n    for (const hook of Object.values(this.hooks)) {\n      hook.intercept(perfectErrorMessage())\n    }\n\n    this.hooks.afterSetup.intercept(printInformation(0))\n    this.hooks.afterPersist.intercept(printInformation(0))\n\n    new InitializePlugin({\n      build: options.build,\n      fresh: options.fresh,\n      interactive: options.interactive,\n    }).apply(this)\n  }\n\n  getCacheStore(namespace: string): CacheStore {\n    return new NamespacedCacheStore(this._cacheStore, namespace)\n  }\n\n  async run(): Promise<void> {\n    const options = this.options\n\n    const tasks = new Listr<CompilerContext, 'default' | 'silent'>(\n      [\n        createSetupTask(this, options),\n        createDownloadTask(this, { skipFilteredModules: !options.interactive }),\n        createCompileTask(this, { enabled: !!options.build }),\n        createPersistTask(this, { enabled: !!options.persist }),\n      ],\n      {\n        concurrent: false,\n        renderer: options.silent ? 'silent' : 'default',\n        rendererOptions: {\n          suffixSkips: true,\n          collapseSubtasks: false,\n          collapseErrors: false,\n        },\n      },\n    )\n\n    await tasks.run(this.context)\n\n    await this.hooks.done.promise()\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,IAAa,uBAAb,MAAwD;CACtD;;CAEA,SAA0B,QAAc,KAAK;CAE7C,YAAY,UAAkB;AAC5B,OAAK,WAAW;;CAGlB,MAAM,IAAiB,KAAqC;EAC1D,MAAM,WAAW,KAAK,UAAU,IAAI;AACpC,MAAI;GACF,MAAM,MAAM,MAAM,GAAG,SAAS,UAAU,QAAQ;GACh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