{"version":3,"file":"run-Z_y-m4dQ.cjs","names":["styleText","existsSync","logLevelMap","randomUUID","runHook","toError","process","memoryStorage","Diagnostics","formatters","detectTool","FORMATTER_PREFERENCE","linters","LINTER_PREFERENCE","runPostGenerate","createKubb","sendTelemetry","buildTelemetryEvent","version","KUBB_NPM_PACKAGE_URL","UPDATE_CHECK_TIMEOUT_MS","isNewerVersion","Hookable","getConfigs","setupReporters","cliReporter","selectReporters","path","getInputKind","startWatcher","logInfo","logError"],"sources":["../src/runners/generate/run.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\nimport { existsSync } from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport { toError } from '@internals/utils'\nimport {\n  Hookable,\n  type CLIOptions,\n  cliReporter,\n  type Config,\n  createKubb,\n  type Diagnostic,\n  Diagnostics,\n  getInputKind,\n  type KubbHooks,\n  logLevel as logLevelMap,\n  memoryStorage,\n  type ProblemDiagnostic,\n  type ReporterName,\n} from '@kubb/core'\nimport { version } from '../../../package.json'\nimport { KUBB_NPM_PACKAGE_URL, UPDATE_CHECK_TIMEOUT_MS } from '../../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../../Telemetry.ts'\nimport setupReporters, { selectReporters } from '../../loggers/utils.ts'\nimport { logError, logInfo, logStep } from '../../loggers/output.ts'\nimport { getConfigs, isNewerVersion, runHook, runPostGenerate, startWatcher } from './utils.ts'\nimport { FORMATTER_PREFERENCE, LINTER_PREFERENCE } from '@internals/utils'\nimport { detectTool, formatters, linters } from '../../tools.ts'\n\ntype GenerateProps = {\n  input?: string\n  config: Config\n  hooks: Hookable<KubbHooks>\n  logLevel: number\n  /**\n   * When `true`, generates in memory instead of writing to disk, and skips formatting, linting,\n   * and post-generate commands.\n   */\n  dryRun?: boolean\n}\n\ntype ToolMap = typeof formatters | typeof linters\n\n/**\n * Static description of one output tool: its command table, the label and messages the pass logs,\n * and how to auto-detect it. Format and lint differ only in these values.\n */\ntype Tool = {\n  label: string\n  map: ToolMap\n  detect: () => Promise<string | null>\n  successPrefix: string\n  noToolMessage: string\n}\n\ntype RunToolPassOptions = {\n  toolValue: string\n  tool: Tool\n  outputPath: string\n  logLevel: number\n  hooks: Hookable<KubbHooks>\n  onStart: () => Promise<void> | void\n  onEnd: () => Promise<void> | void\n}\n\n/**\n * Runs one formatter or linter pass over the output directory. Returns the failure instead of\n * throwing, so the caller can turn it into a coded diagnostic. Failures never render here:\n * the caller emits them through `Diagnostics.emit`, like every other diagnostic.\n */\nasync function runToolPass({ toolValue, tool, outputPath, logLevel, hooks, onStart, onEnd }: RunToolPassOptions): Promise<Error | null> {\n  await onStart()\n\n  let resolvedTool = toolValue\n  if (resolvedTool === 'auto') {\n    const detected = await tool.detect()\n    if (!detected) {\n      await hooks.callHook('kubb:warn', { message: tool.noToolMessage })\n    } else {\n      resolvedTool = detected\n      await hooks.callHook('kubb:info', { message: `Auto-detected ${tool.label}: ${styleText('dim', resolvedTool)}` })\n    }\n  }\n\n  let toolError: Error | null = null\n\n  // Nothing to lint or format when the output dir was never written. Skip so the tool\n  // (e.g. oxlint with --no-ignore) doesn't fail with \"No files found to lint\".\n  if (resolvedTool && resolvedTool !== 'auto' && resolvedTool in tool.map && existsSync(outputPath)) {\n    const toolConfig = tool.map[resolvedTool as keyof ToolMap]\n\n    const successMessage = [\n      `${tool.successPrefix} with ${styleText('dim', resolvedTool)}`,\n      logLevel >= logLevelMap.info ? `on ${styleText('dim', outputPath)}` : undefined,\n      'successfully',\n    ]\n      .filter(Boolean)\n      .join(' ')\n\n    try {\n      const hookId = randomUUID()\n      const hookArgs = toolConfig.args(outputPath)\n      const commandWithArgs = [toolConfig.command, ...hookArgs].join(' ')\n\n      await hooks.callHook('kubb:hook:start', { id: hookId, command: toolConfig.command, args: hookArgs })\n\n      const result = await runHook({ id: hookId, command: toolConfig.command, args: hookArgs, commandWithArgs, hooks })\n\n      if (result.success) {\n        await hooks.callHook('kubb:success', { message: successMessage })\n      } else {\n        toolError = result.error ?? new Error(toolConfig.errorMessage)\n      }\n    } catch (caughtError) {\n      toolError = toError(caughtError)\n    }\n  }\n\n  await onEnd()\n\n  return toolError\n}\n\nasync function generate(options: GenerateProps): Promise<boolean> {\n  const { input, hooks, logLevel, dryRun = false } = options\n\n  const hrStart = process.hrtime()\n  const inputPath = input ?? (typeof options.config.input === 'string' ? options.config.input : undefined)\n\n  const config: Config = {\n    ...options.config,\n    input: input ?? options.config.input,\n    // Dry-run never touches disk, regardless of the config's own storage driver.\n    storage: dryRun ? memoryStorage() : options.config.storage,\n    // Also keeps core's `hasOutputPasses` false, so dry-run skips the output manifest write too.\n    output: dryRun ? { ...options.config.output, format: false, lint: false, postGenerate: [] } : options.config.output,\n  }\n\n  // The formatter, linter, and post-generate commands run after a successful build. Collect their\n  // failures as coded diagnostics so they reach the summary, the json report, and the exit code.\n  const processOutput = async ({ config: resolvedConfig, outputPath }: { config: Config; outputPath: string }): Promise<Array<Diagnostic>> => {\n    if (dryRun) return []\n\n    const outputDiagnostics: Array<Diagnostic> = []\n    const reportOutputFailure = async (code: ProblemDiagnostic['code'], label: string, error: Error) => {\n      const diagnostic = outputDiagnostic(code, label, error)\n      outputDiagnostics.push(diagnostic)\n      await Diagnostics.emit(hooks, diagnostic)\n    }\n\n    // Format and lint are the same pass over the output directory, differing only in the tool\n    // table and the hooks they announce themselves with, so run them from one descriptor list.\n    const toolPasses = [\n      {\n        value: resolvedConfig.output.format,\n        code: Diagnostics.code.formatFailed,\n        tool: {\n          label: 'formatter',\n          map: formatters,\n          detect: () => detectTool(FORMATTER_PREFERENCE),\n          successPrefix: 'Formatting',\n          noToolMessage: `No formatter found (${FORMATTER_PREFERENCE.join(', ')}). Skipping formatting.`,\n        },\n        onStart: () => hooks.callHook('kubb:format:start'),\n        onEnd: () => hooks.callHook('kubb:format:end'),\n      },\n      {\n        value: resolvedConfig.output.lint,\n        code: Diagnostics.code.lintFailed,\n        tool: {\n          label: 'linter',\n          map: linters,\n          detect: () => detectTool(LINTER_PREFERENCE),\n          successPrefix: 'Linting',\n          noToolMessage: `No linter found (${LINTER_PREFERENCE.join(', ')}). Skipping linting.`,\n        },\n        onStart: () => hooks.callHook('kubb:lint:start'),\n        onEnd: () => hooks.callHook('kubb:lint:end'),\n      },\n    ]\n\n    for (const pass of toolPasses) {\n      if (!pass.value) continue\n      const error = await runToolPass({\n        toolValue: pass.value,\n        tool: pass.tool,\n        onStart: pass.onStart,\n        onEnd: pass.onEnd,\n        outputPath,\n        logLevel,\n        hooks,\n      })\n      if (error) await reportOutputFailure(pass.code, pass.tool.label, error)\n    }\n\n    if (resolvedConfig.output.postGenerate?.length) {\n      await hooks.callHook('kubb:hooks:start')\n      const hookResults = await runPostGenerate({ commands: resolvedConfig.output.postGenerate, hooks })\n      for (const hookResult of hookResults) {\n        if (hookResult.success) continue\n        await reportOutputFailure(Diagnostics.code.postGenerateFailed, 'Post-generate command', hookResult.error ?? new Error('Post-generate command failed'))\n      }\n      await hooks.callHook('kubb:hooks:end')\n    }\n\n    return outputDiagnostics\n  }\n\n  hooks.hook('kubb:generation:end', ({ status }) => {\n    if (status === 'success') return hooks.callHook('kubb:success', { message: 'Generation succeeded', info: inputPath })\n  })\n\n  const kubb = createKubb(config, { hooks })\n  const result = await kubb.generate({ processOutput })\n\n  if (dryRun) {\n    await hooks.callHook('kubb:info', { message: 'Dry run: no files were written', info: `${result.files.length} file(s) would be generated` })\n  }\n\n  const telemetryPlugins = Array.from(kubb.driver.plugins.values(), (p) => ({ name: p.name, options: p.options as Record<string, unknown> }))\n  await sendTelemetry(\n    buildTelemetryEvent({\n      command: 'generate',\n      kubbVersion: version,\n      plugins: telemetryPlugins,\n      hrStart,\n      filesCreated: result.files.length,\n      status: result.success ? 'success' : 'failed',\n    }),\n  )\n\n  return result.success\n}\n\n/**\n * Builds a coded diagnostic for an output-phase failure (formatter, linter, or `done` hook).\n */\nfunction outputDiagnostic(code: ProblemDiagnostic['code'], label: string, caughtError: unknown): ProblemDiagnostic {\n  const error = toError(caughtError)\n  return {\n    code,\n    severity: 'error',\n    message: `${label} failed: ${error.message}`,\n    help: 'Check that the tool is installed and that the command and its config are correct.',\n    location: { kind: 'config' },\n    cause: error,\n  }\n}\n\ntype GenerateCommandOptions = {\n  input?: string\n  configPath?: string\n  logLevel: string\n  watch: boolean\n  reporters?: Array<ReporterName>\n  dryRun?: boolean\n}\n\nasync function checkForUpdate(hooks: Hookable<KubbHooks>): Promise<void> {\n  try {\n    const res = await fetch(KUBB_NPM_PACKAGE_URL, { signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS) })\n    const data = (await res.json()) as { version: string }\n    if (data.version && isNewerVersion(version, data.version)) {\n      await Diagnostics.emit(hooks, Diagnostics.update({ currentVersion: version, latestVersion: data.version }))\n    }\n  } catch {\n    // Ignore network errors\n  }\n}\n\n/**\n * Runs the full Kubb generation lifecycle for the given CLI options.\n * Loads configs, sets up the reporters (CLI `--reporter` picks which of `config.reporters` to trigger),\n * checks for a newer version, and calls `generate` for each config entry.\n */\nexport async function run({ input, configPath, logLevel: logLevelKey, watch, reporters: cliReporters, dryRun }: GenerateCommandOptions): Promise<void> {\n  const logLevel = logLevelMap[logLevelKey as keyof typeof logLevelMap] ?? logLevelMap.info\n  const hooks = new Hookable<KubbHooks>()\n\n  // Load the config first so `config.reporters` can pick the reporters. A failure here has no\n  // reporter installed yet, so fall back to the default `cli` reporter to surface it.\n  let configs: Array<Config>\n  let resolvedConfigPath: string\n  try {\n    const loaded = await getConfigs({\n      configPath,\n      input,\n      watch,\n      logLevel: logLevelKey as CLIOptions['logLevel'],\n    })\n    configs = loaded.configs\n    resolvedConfigPath = loaded.configPath\n  } catch (error) {\n    await setupReporters(hooks, { logLevel, reporters: [cliReporter] })\n    await hooks.callHook('kubb:error', { error: toError(error) })\n    process.exit(1)\n  }\n\n  // CLI `--reporter` selects which reporters to trigger by name, defaulting to `cli`. The config\n  // always carries the available reporters (defineConfig registers the built-ins).\n  const requestedNames: Array<ReporterName> = cliReporters?.length ? cliReporters : ['cli']\n  const available = configs[0]?.reporters ?? []\n  const reporters = selectReporters(available, requestedNames)\n  await setupReporters(hooks, { logLevel, reporters })\n\n  await hooks.callHook('kubb:lifecycle:start', { version })\n\n  await checkForUpdate(hooks)\n\n  try {\n    const relativeConfigPath = path.relative(process.cwd(), resolvedConfigPath)\n\n    await hooks.callHook('kubb:info', { message: 'Config loaded', info: relativeConfigPath })\n    await hooks.callHook('kubb:success', { message: 'Config loaded successfully', info: relativeConfigPath })\n\n    let anyFailed = false\n    for (const config of configs) {\n      const effectiveInput = input ?? config.input\n      const watchPath = typeof effectiveInput === 'string' && getInputKind(effectiveInput) === 'file' ? effectiveInput : undefined\n      if (watchPath && watch) {\n        const watchedPaths = [watchPath]\n        // Don't removeAll() between builds, that would also drop logger and lifecycle\n        // listeners. Plugin listeners are already disposed by safeBuild's dispose()\n        // in its finally block, so re-running generate() on the same hooks emitter is safe.\n        const build = async (paths: Array<string>) => {\n          await generate({ input, config, logLevel, hooks, dryRun })\n          logStep(styleText('yellow', `Watching for changes in ${paths.join(' and ')}`))\n        }\n\n        // The watcher ignores chokidar's startup events, so run the first build here. A failing\n        // first build keeps watching, since the user can fix the input and save.\n        try {\n          await build(watchedPaths)\n        } catch (buildError) {\n          await hooks.callHook('kubb:error', { error: toError(buildError) })\n        }\n\n        await startWatcher(watchedPaths, build, { info: logInfo, error: logError })\n      } else {\n        try {\n          const succeeded = await generate({ input, config, logLevel, hooks, dryRun })\n          if (!succeeded) anyFailed = true\n        } catch (configError) {\n          await hooks.callHook('kubb:error', { error: toError(configError) })\n          anyFailed = true\n        }\n      }\n    }\n\n    await hooks.callHook('kubb:lifecycle:end')\n\n    if (anyFailed) {\n      process.exit(1)\n    }\n  } catch (error) {\n    await hooks.callHook('kubb:error', { error: toError(error) })\n    process.exit(1)\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuEA,eAAe,YAAY,EAAE,WAAW,MAAM,YAAY,UAAU,OAAO,SA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