@kubb/cli 5.15.1 → 5.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/{Telemetry-C7Qwy2s7.js → Telemetry-BTeqnqie.js} +2 -2
  2. package/dist/{Telemetry-C7Qwy2s7.js.map → Telemetry-BTeqnqie.js.map} +1 -1
  3. package/dist/{Telemetry-B52pKz9i.cjs → Telemetry-DuO34wMx.cjs} +2 -2
  4. package/dist/{Telemetry-B52pKz9i.cjs.map → Telemetry-DuO34wMx.cjs.map} +1 -1
  5. package/dist/{background-CK2gQtTU.cjs → background-CdE3TOkv.cjs} +2 -2
  6. package/dist/{background-CK2gQtTU.cjs.map → background-CdE3TOkv.cjs.map} +1 -1
  7. package/dist/{background-BJCuXYuB.js → background-DxK8rpi2.js} +2 -2
  8. package/dist/{background-BJCuXYuB.js.map → background-DxK8rpi2.js.map} +1 -1
  9. package/dist/{background-D4mZCg-4.js → background-TT-XsxC2.js} +1 -1
  10. package/dist/{configFile-CoEpHdXG.cjs → configFile-CVfWdtKh.cjs} +4 -40
  11. package/dist/configFile-CVfWdtKh.cjs.map +1 -0
  12. package/dist/{configFile-C0DIXNMD.js → configFile-IHj8fRIw.js} +3 -39
  13. package/dist/configFile-IHj8fRIw.js.map +1 -0
  14. package/dist/{spinner-BZaln7O8.js → fs-Cf1FSRh9.js} +20 -41
  15. package/dist/fs-Cf1FSRh9.js.map +1 -0
  16. package/dist/index.cjs +14 -14
  17. package/dist/index.js +14 -14
  18. package/dist/{installWithSpinner-DpnpxHq5.js → installWithSpinner-BAlTSQlE.js} +3 -3
  19. package/dist/{installWithSpinner-DpnpxHq5.js.map → installWithSpinner-BAlTSQlE.js.map} +1 -1
  20. package/dist/{installWithSpinner-ONGfIVUJ.cjs → installWithSpinner-X9J7yxiR.cjs} +3 -3
  21. package/dist/{installWithSpinner-ONGfIVUJ.cjs.map → installWithSpinner-X9J7yxiR.cjs.map} +1 -1
  22. package/dist/intro-DRl-pwVs.js +72 -0
  23. package/dist/intro-DRl-pwVs.js.map +1 -0
  24. package/dist/intro-DuyzJ3Rb.cjs +102 -0
  25. package/dist/intro-DuyzJ3Rb.cjs.map +1 -0
  26. package/dist/{intro-9PB8sE8z.js → log-B-1vLxF1.js} +2 -66
  27. package/dist/log-B-1vLxF1.js.map +1 -0
  28. package/dist/{intro-YPaf1Imr.cjs → log-wv1OxLiq.cjs} +1 -95
  29. package/dist/log-wv1OxLiq.cjs.map +1 -0
  30. package/dist/{mascot-JSA0j3Q_.cjs → mascot-CC-D4ON2.cjs} +2 -2
  31. package/dist/{mascot-JSA0j3Q_.cjs.map → mascot-CC-D4ON2.cjs.map} +1 -1
  32. package/dist/{mascot--q1xjKw1.js → mascot-CmUUHLlx.js} +2 -2
  33. package/dist/{mascot--q1xjKw1.js.map → mascot-CmUUHLlx.js.map} +1 -1
  34. package/dist/{mcp-CcseJJwh.cjs → mcp-DMCyJrkw.cjs} +2 -2
  35. package/dist/{mcp-CcseJJwh.cjs.map → mcp-DMCyJrkw.cjs.map} +1 -1
  36. package/dist/{mcp-DUTsS8tR.js → mcp-DNMDPZOo.js} +2 -2
  37. package/dist/{mcp-DUTsS8tR.js.map → mcp-DNMDPZOo.js.map} +1 -1
  38. package/dist/{package-B1hUUjio.cjs → package-Bc9heh-c.cjs} +2 -2
  39. package/dist/package-Bc9heh-c.cjs.map +1 -0
  40. package/dist/package-Bm6L1D0Q.js +5 -0
  41. package/dist/package-Bm6L1D0Q.js.map +1 -0
  42. package/dist/{registry-B3eYk4LN.js → registry-Cy48PGdh.js} +3 -2
  43. package/dist/registry-Cy48PGdh.js.map +1 -0
  44. package/dist/{registry-YE1pFWL-.cjs → registry-Q77p5TZp.cjs} +3 -2
  45. package/dist/registry-Q77p5TZp.cjs.map +1 -0
  46. package/dist/reporters-9MqdcKPp.js +1 -0
  47. package/dist/{reporters-BM430HdQ.js → reporters-B_USHwD6.js} +297 -33
  48. package/dist/reporters-B_USHwD6.js.map +1 -0
  49. package/dist/{reporters-2cgjvXwR.cjs → reporters-DyjE3BzZ.cjs} +318 -20
  50. package/dist/reporters-DyjE3BzZ.cjs.map +1 -0
  51. package/dist/{run-CXVhxFfC.js → run-B4pveKq5.js} +10 -10
  52. package/dist/{run-CXVhxFfC.js.map → run-B4pveKq5.js.map} +1 -1
  53. package/dist/{run-CLiHI99L.js → run-B7p16C0S.js} +4 -4
  54. package/dist/{run-CLiHI99L.js.map → run-B7p16C0S.js.map} +1 -1
  55. package/dist/{run-dMTJfs4_.cjs → run-BBzw9B1L.cjs} +4 -4
  56. package/dist/{run-dMTJfs4_.cjs.map → run-BBzw9B1L.cjs.map} +1 -1
  57. package/dist/{run-DUwX6Icx.js → run-CBB5Hlgy.js} +10 -9
  58. package/dist/{run-DUwX6Icx.js.map → run-CBB5Hlgy.js.map} +1 -1
  59. package/dist/{run-CrM4jsix.cjs → run-CfumUZCl.cjs} +7 -6
  60. package/dist/{run-CrM4jsix.cjs.map → run-CfumUZCl.cjs.map} +1 -1
  61. package/dist/{run-D-nn9-Wq.js → run-Cgy4_JPy.js} +14 -18
  62. package/dist/run-Cgy4_JPy.js.map +1 -0
  63. package/dist/{run-1H9TGT8v.js → run-Ch7Uuu-u.js} +4 -3
  64. package/dist/{run-1H9TGT8v.js.map → run-Ch7Uuu-u.js.map} +1 -1
  65. package/dist/{run-BsrNfFIl.js → run-CkNLuV4M.js} +44 -38
  66. package/dist/run-CkNLuV4M.js.map +1 -0
  67. package/dist/{run-CyzKy-0p.cjs → run-CoPzxsoM.cjs} +20 -20
  68. package/dist/{run-CyzKy-0p.cjs.map → run-CoPzxsoM.cjs.map} +1 -1
  69. package/dist/{run-DTqMrPS9.js → run-CrDbD50I.js} +2 -2
  70. package/dist/{run-DTqMrPS9.js.map → run-CrDbD50I.js.map} +1 -1
  71. package/dist/{run-LY_UAYyM.cjs → run-Cxf3s3Ap.cjs} +48 -42
  72. package/dist/run-Cxf3s3Ap.cjs.map +1 -0
  73. package/dist/{run-BYP_t9dR.cjs → run-DCggecSY.cjs} +19 -24
  74. package/dist/run-DCggecSY.cjs.map +1 -0
  75. package/dist/{run-BrM7-NSV.js → run-DHfFHNfG.js} +13 -17
  76. package/dist/run-DHfFHNfG.js.map +1 -0
  77. package/dist/{run-DBnSbwtU.cjs → run-DQdcGuXL.cjs} +47 -61
  78. package/dist/run-DQdcGuXL.cjs.map +1 -0
  79. package/dist/{run-CvFakE3B.cjs → run-DT4hTOR2.cjs} +16 -21
  80. package/dist/run-DT4hTOR2.cjs.map +1 -0
  81. package/dist/{run-FEiyv6_U.js → run-DcEE0-8W.js} +40 -53
  82. package/dist/run-DcEE0-8W.js.map +1 -0
  83. package/dist/{run-Bq6gcfkS.js → run-MGGga_wU.js} +1 -1
  84. package/dist/{run-CQORv7Gq.cjs → run-S6Hkmn-h.cjs} +13 -12
  85. package/dist/{run-CQORv7Gq.cjs.map → run-S6Hkmn-h.cjs.map} +1 -1
  86. package/dist/{run-uPA5s3rI.cjs → run-UXFhmzzO.cjs} +2 -2
  87. package/dist/{run-uPA5s3rI.cjs.map → run-UXFhmzzO.cjs.map} +1 -1
  88. package/dist/shared-DcDHRtZx.js +58 -0
  89. package/dist/shared-DcDHRtZx.js.map +1 -0
  90. package/dist/shared-KKRMm1xX.cjs +87 -0
  91. package/dist/shared-KKRMm1xX.cjs.map +1 -0
  92. package/dist/{snapshot-CPF9zyZj.cjs → snapshot-BHFRCLgH.cjs} +7 -7
  93. package/dist/{snapshot-CPF9zyZj.cjs.map → snapshot-BHFRCLgH.cjs.map} +1 -1
  94. package/dist/{snapshot-CiV08NJr.js → snapshot-NH1AFDwz.js} +6 -6
  95. package/dist/{snapshot-CiV08NJr.js.map → snapshot-NH1AFDwz.js.map} +1 -1
  96. package/dist/spinner-DxsAllRI.js +48 -0
  97. package/dist/spinner-DxsAllRI.js.map +1 -0
  98. package/dist/{spinner-CfB0sIPy.cjs → spinner-RfMb7fd6.cjs} +50 -21
  99. package/dist/spinner-RfMb7fd6.cjs.map +1 -0
  100. package/dist/{status-C066YA-4.cjs → status-3A7fVPqb.cjs} +3 -3
  101. package/dist/{status-C066YA-4.cjs.map → status-3A7fVPqb.cjs.map} +1 -1
  102. package/dist/{status-Dj8tivag.js → status-BeJwJ7Xa.js} +3 -3
  103. package/dist/{status-Dj8tivag.js.map → status-BeJwJ7Xa.js.map} +1 -1
  104. package/dist/{studio-B4XsXgKj.js → studio-B-1AM1My.js} +12 -12
  105. package/dist/{studio-B4XsXgKj.js.map → studio-B-1AM1My.js.map} +1 -1
  106. package/dist/{studio-D9_-mKee.cjs → studio-BUhnJl4S.cjs} +12 -12
  107. package/dist/{studio-D9_-mKee.cjs.map → studio-BUhnJl4S.cjs.map} +1 -1
  108. package/dist/studioWorker.js +2 -2
  109. package/dist/{summary-Clvl5Hxs.cjs → summary-B2Apv5KO.cjs} +17 -2
  110. package/dist/summary-B2Apv5KO.cjs.map +1 -0
  111. package/dist/{summary-CbmQKA8l.js → summary-BQWHL_Ca.js} +12 -3
  112. package/dist/summary-BQWHL_Ca.js.map +1 -0
  113. package/dist/{text-Ep3AulAS.cjs → text-DMiX2dcG.cjs} +10 -1
  114. package/dist/text-DMiX2dcG.cjs.map +1 -0
  115. package/dist/{text-BmiI4s6N.js → text-EoYn04SX.js} +5 -2
  116. package/dist/text-EoYn04SX.js.map +1 -0
  117. package/dist/{utils-CbJ6hS_t.js → utils-CeMUE4P0.js} +90 -70
  118. package/dist/utils-CeMUE4P0.js.map +1 -0
  119. package/dist/{utils-CO89mxRU.cjs → utils-uSJAZuvP.cjs} +101 -69
  120. package/dist/utils-uSJAZuvP.cjs.map +1 -0
  121. package/dist/{validate-C5fyNF4v.js → validate--AEg1yAB.js} +3 -3
  122. package/dist/{validate-C5fyNF4v.js.map → validate--AEg1yAB.js.map} +1 -1
  123. package/dist/{validate-B3tLWYJU.cjs → validate-BVNrsXe2.cjs} +3 -3
  124. package/dist/{validate-B3tLWYJU.cjs.map → validate-BVNrsXe2.cjs.map} +1 -1
  125. package/package.json +8 -7
  126. package/dist/configFile-C0DIXNMD.js.map +0 -1
  127. package/dist/configFile-CoEpHdXG.cjs.map +0 -1
  128. package/dist/intro-9PB8sE8z.js.map +0 -1
  129. package/dist/intro-YPaf1Imr.cjs.map +0 -1
  130. package/dist/package-B1hUUjio.cjs.map +0 -1
  131. package/dist/package-MYPMnnTX.js +0 -5
  132. package/dist/package-MYPMnnTX.js.map +0 -1
  133. package/dist/registry-B3eYk4LN.js.map +0 -1
  134. package/dist/registry-YE1pFWL-.cjs.map +0 -1
  135. package/dist/reporters-2cgjvXwR.cjs.map +0 -1
  136. package/dist/reporters-BM430HdQ.js.map +0 -1
  137. package/dist/run-BYP_t9dR.cjs.map +0 -1
  138. package/dist/run-BrM7-NSV.js.map +0 -1
  139. package/dist/run-BsrNfFIl.js.map +0 -1
  140. package/dist/run-CvFakE3B.cjs.map +0 -1
  141. package/dist/run-D-nn9-Wq.js.map +0 -1
  142. package/dist/run-DBnSbwtU.cjs.map +0 -1
  143. package/dist/run-FEiyv6_U.js.map +0 -1
  144. package/dist/run-LY_UAYyM.cjs.map +0 -1
  145. package/dist/shared-C0EtrdUm.cjs +0 -123
  146. package/dist/shared-C0EtrdUm.cjs.map +0 -1
  147. package/dist/shared-Ct9stKpp.js +0 -94
  148. package/dist/shared-Ct9stKpp.js.map +0 -1
  149. package/dist/spinner-BZaln7O8.js.map +0 -1
  150. package/dist/spinner-CfB0sIPy.cjs.map +0 -1
  151. package/dist/summary-CbmQKA8l.js.map +0 -1
  152. package/dist/summary-Clvl5Hxs.cjs.map +0 -1
  153. package/dist/text-BmiI4s6N.js.map +0 -1
  154. package/dist/text-Ep3AulAS.cjs.map +0 -1
  155. package/dist/utils-BdibacYq.js +0 -244
  156. package/dist/utils-BdibacYq.js.map +0 -1
  157. package/dist/utils-CO89mxRU.cjs.map +0 -1
  158. package/dist/utils-CbJ6hS_t.js.map +0 -1
  159. package/dist/utils-CcARPB45.cjs +0 -286
  160. package/dist/utils-CcARPB45.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"configFile-C0DIXNMD.js","names":[],"sources":["../../../internals/utils/src/casing.ts","../../../internals/shared/src/configFile/ast.ts","../../../internals/shared/src/configFile/types.ts","../../../internals/shared/src/configFile/rules.ts","../../../internals/shared/src/configFile/text.ts","../../../internals/shared/src/configFile/configFile.ts"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = new Map<string, string>()\nconst cacheLimit = 100_000\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n const cached = cache.get(key)\n if (cached !== undefined) return cached\n\n const result = convert(text, pascal)\n if (cache.size >= cacheLimit) cache.clear()\n cache.set(key, result)\n return result\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n","import { getErrorMessage } from '@internals/utils'\nimport { type Comment, type Expression, type Program, parse } from 'yuku-parser'\n\nexport type {\n ArrayExpression,\n AssignmentExpression,\n BindingProperty,\n CallExpression,\n Comment,\n Expression,\n ImportDeclaration,\n ObjectExpression,\n ObjectPropertyKind,\n Program,\n RestElement,\n SpreadElement,\n VariableDeclaration,\n} from 'yuku-parser'\n\n/** Node types the config editor reads from the yuku AST. */\nexport const nodeTypes = {\n arrayExpression: 'ArrayExpression',\n arrowFunctionExpression: 'ArrowFunctionExpression',\n assignmentExpression: 'AssignmentExpression',\n blockStatement: 'BlockStatement',\n callExpression: 'CallExpression',\n exportDefaultDeclaration: 'ExportDefaultDeclaration',\n expressionStatement: 'ExpressionStatement',\n functionExpression: 'FunctionExpression',\n identifier: 'Identifier',\n importDeclaration: 'ImportDeclaration',\n importSpecifier: 'ImportSpecifier',\n literal: 'Literal',\n memberExpression: 'MemberExpression',\n objectExpression: 'ObjectExpression',\n objectPattern: 'ObjectPattern',\n property: 'Property',\n returnStatement: 'ReturnStatement',\n spreadElement: 'SpreadElement',\n tSAsExpression: 'TSAsExpression',\n tSSatisfiesExpression: 'TSSatisfiesExpression',\n templateLiteral: 'TemplateLiteral',\n unaryExpression: 'UnaryExpression',\n variableDeclaration: 'VariableDeclaration',\n} as const\n\nexport const commentTypes = { line: 'Line' } as const\nexport const propertyKinds = { init: 'init' } as const\nexport const unaryOperators = { minus: '-', plus: '+' } as const\nconst diagnosticSeverities = { error: 'error' } as const\n\n/** A parsed file: its statements and every comment in it, or why it could not be parsed. */\ntype ParsedSource = { program: Program; comments: Array<Comment> } | { reason: string }\n\n/**\n * Parses `source` as a TypeScript module. Never throws: a syntax error, or a native parser that\n * cannot load on this platform, comes back as a `reason`.\n */\nexport function parseSource(source: string): ParsedSource {\n try {\n // Parentheses are dropped, so `export default (defineConfig({}))` reads as the call itself.\n const { program, comments, diagnostics } = parse(source, { lang: 'ts', sourceType: 'module', preserveParens: false })\n if (diagnostics.some((diagnostic) => diagnostic.severity === diagnosticSeverities.error)) return { reason: 'the config file could not be parsed' }\n return { program, comments }\n } catch (error) {\n return { reason: `the config parser could not load on this platform: ${getErrorMessage(error)}` }\n }\n}\n\n/** Parses `source` as one expression, such as a commented-out `pluginTs({ ... })` call. */\nexport function parseExpression(source: string): Expression | undefined {\n const parsed = parseSource(source)\n if ('reason' in parsed) return undefined\n const [statement] = parsed.program.body\n return parsed.program.body.length === 1 && statement?.type === nodeTypes.expressionStatement ? statement.expression : undefined\n}\n","import type { ExtensionKind, ExtensionManifest } from '@kubb/core'\n\n/** Which `defineConfig(...)` entry an edit targets: its index or `name`, the first entry when omitted. */\nexport type ConfigRef = string | number\n\n/** A literal option value that survives a JSON round trip. */\nexport type OptionValue = string | number | boolean | null | Array<OptionValue> | { [key: string]: OptionValue }\n\nexport const extensionKinds = { plugin: 'plugin', adapter: 'adapter', parser: 'parser' } as const satisfies Record<string, ExtensionKind>\n\nexport const ConfigEditOperation = {\n SET_OPTION: 'set-option',\n REMOVE_OPTION: 'remove-option',\n ADD_PLUGIN: 'add-plugin',\n REMOVE_EXTENSION: 'remove-extension',\n DISABLE_PLUGIN: 'disable-plugin',\n ENABLE_PLUGIN: 'enable-plugin',\n SET_INPUT: 'set-input',\n SET_OUTPUT: 'set-output',\n REMOVE_OUTPUT: 'remove-output',\n} as const\nexport type ConfigEditOperation = (typeof ConfigEditOperation)[keyof typeof ConfigEditOperation]\n\n/**\n * One change to `kubb.config.ts`. `plugin` is the package name, and `kind` picks the `plugins` entry\n * (default), the `adapter`, or a `parsers` entry. `path` walks nested option objects.\n */\nexport type ConfigEdit =\n | { operation: typeof ConfigEditOperation.SET_OPTION; config?: ConfigRef; kind?: ExtensionKind; plugin: string; path: Array<string>; value: unknown }\n | { operation: typeof ConfigEditOperation.REMOVE_OPTION; config?: ConfigRef; kind?: ExtensionKind; plugin: string; path: Array<string> }\n /** With `kind: 'parser'`, adds to `parsers`. A config without `parsers` gets the defaults written next to it, so they keep running. */\n | {\n operation: typeof ConfigEditOperation.ADD_PLUGIN\n config?: ConfigRef\n kind?: typeof extensionKinds.plugin | typeof extensionKinds.parser\n plugin: string\n options?: Record<string, unknown>\n }\n /** Deletes every call of a plugin, or a parser with `kind: 'parser'`, a disabled block included, and the imports nothing else uses. */\n | {\n operation: typeof ConfigEditOperation.REMOVE_EXTENSION\n config?: ConfigRef\n kind?: typeof extensionKinds.plugin | typeof extensionKinds.parser\n plugin: string\n }\n | { operation: typeof ConfigEditOperation.DISABLE_PLUGIN; config?: ConfigRef; plugin: string }\n | { operation: typeof ConfigEditOperation.ENABLE_PLUGIN; config?: ConfigRef; plugin: string }\n | { operation: typeof ConfigEditOperation.SET_INPUT; config?: ConfigRef; input: string }\n | { operation: typeof ConfigEditOperation.SET_OUTPUT; config?: ConfigRef; path: Array<string>; value: unknown }\n | { operation: typeof ConfigEditOperation.REMOVE_OUTPUT; config?: ConfigRef; path: Array<string> }\n\n/** Option keys, each with whether Studio may write it. `locked` lists the code paths inside a partly literal object. */\nexport type OptionsView = Record<string, { literal: boolean; value?: OptionValue; locked?: Array<Array<string>> }>\n\n/** A factory call in `plugins`, `adapter`, or `parsers`. `importName` is the local name, alias included. */\nexport type PluginView = {\n importName: string\n packageName: string\n options: OptionsView\n /** The call is commented out by `disable-plugin`. */\n disabled?: true\n}\n\nexport type ConfigView = {\n name?: string\n plugins: Array<PluginView>\n adapter?: PluginView\n parsers?: Array<PluginView>\n /** The root `output` members Studio may set, absent when `output` is not an object literal. */\n output?: OptionsView\n}\n\n/** The config file as Studio may edit it, or why it cannot. */\nexport type ConfigFileView = { managed: true; configs: Array<ConfigView> } | { managed: false; reason: string }\n\nexport type ConfigEditOutcome = {\n edit: ConfigEdit\n applied: boolean\n reason?: string\n}\n\nexport type ExtensionEntry = {\n package: string\n version: string\n manifest: ExtensionManifest\n /** Ships with `kubb` at its version, so updating `kubb` updates it and `kubb update` cannot. */\n bundled?: true\n}\n\n/** Installed extensions by package name, the only ones Studio may import besides `@kubb/plugin-*`. */\nexport type InstalledExtensions = ReadonlyMap<string, ExtensionEntry>\n","import { type ExtensionKind, isPackageName } from '@kubb/core'\nimport { camelCase } from '@internals/utils'\nimport { extensionKinds, type InstalledExtensions, type OptionValue } from './types.ts'\n\n/** `@kubb/plugin-ts` becomes `plugin-ts`, the `name` Kubb plugin factories use. */\nexport function toPluginName(packageName: string): string {\n return packageName.split('/').pop() ?? packageName\n}\n\n/** `@kubb/plugin-react-query` becomes `pluginReactQuery`, the export a plugin package uses by convention. */\nexport function toExportName(packageName: string): string {\n return camelCase(toPluginName(packageName))\n}\n\nconst KUBB_PLUGIN_SPECIFIER = /^@kubb\\/plugin-[\\w.-]+$/\n\n/** Only a `@kubb/plugin-*` package or an installed extension of `kind` may be imported, never a path or URL. */\nexport function isAllowedPlugin({\n packageName,\n extensions,\n kind = extensionKinds.plugin,\n}: {\n packageName: string\n extensions: InstalledExtensions\n kind?: ExtensionKind\n}): boolean {\n if (!isPackageName(packageName)) return false\n return (kind === extensionKinds.plugin && KUBB_PLUGIN_SPECIFIER.test(packageName)) || extensions.get(packageName)?.manifest.kind === kind\n}\n\nconst UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\n/** Whether `key` can be an option key without reaching the object's prototype. */\nexport function isSafeKey(key: string): boolean {\n return !UNSAFE_KEYS.has(key)\n}\n\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null) return false\n const prototype = Object.getPrototypeOf(value)\n return prototype === null || prototype === Object.prototype\n}\n\n/** Whether `value` survives a JSON round trip, so an edit never writes a lossy copy into the file. */\nexport function isOptionValue(value: unknown): value is OptionValue {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true\n if (typeof value === 'number') return Number.isFinite(value)\n if (Array.isArray(value)) return value.every(isOptionValue)\n if (isPlainObject(value)) return Object.entries(value).every(([key, entry]) => isSafeKey(key) && isOptionValue(entry))\n\n return false\n}\n\n/** The root `output` members Studio may set, with the values each takes. */\nconst OUTPUT_VALUES: Record<string, (value: unknown) => boolean> = {\n barrel: (value) => value === false || (isPlainObject(value) && Object.keys(value).length === 1 && (value.type === 'named' || value.type === 'all')),\n format: (value) => value === false || ['auto', 'prettier', 'biome', 'oxfmt'].includes(value as string),\n lint: (value) => value === false || ['auto', 'eslint', 'biome', 'oxlint'].includes(value as string),\n clean: (value) => typeof value === 'boolean',\n defaultBanner: (value) => value === false || value === 'simple' || value === 'full',\n}\n\nexport function isOutputKey(key: string): boolean {\n return Object.hasOwn(OUTPUT_VALUES, key)\n}\n\nexport function isOutputValue({ key, value }: { key: string; value: unknown }): boolean {\n return isOutputKey(key) && OUTPUT_VALUES[key]!(value)\n}\n\nexport function pickOutput<T>(output: Record<string, T>): Record<string, T> {\n return Object.fromEntries(Object.entries(output).filter(([key]) => isOutputKey(key)))\n}\n","import { type ArrayExpression, nodeTypes, type ObjectExpression } from './ast.ts'\nimport type { OptionValue } from './types.ts'\n\n/**\n * A valid JavaScript identifier, so an import name can only ever print as `import { name } from`,\n * never as source that breaks out of the import statement.\n */\nexport const IDENTIFIER_PATTERN = /^[A-Za-z_$][\\w$]*$/\n\nexport const quotes = { single: `'`, double: `\"` } as const\nexport type Quote = (typeof quotes)[keyof typeof quotes]\n\n/** `source` with the text between `start` and `end` replaced by `text`. */\nexport function replaceText(source: string, start: number, end: number, text = ''): string {\n return `${source.slice(0, start)}${text}${source.slice(end)}`\n}\n\n/** The 1-based line and 0-based column of `offset` in `source`. */\nexport function getPosition(source: string, offset: number): { line: number; column: number } {\n return { line: source.slice(0, offset).split('\\n').length, column: offset - source.lastIndexOf('\\n', offset - 1) - 1 }\n}\n\n/** Writes `value` as a single-line literal with the file's quote style. */\nexport function printValue(value: OptionValue, quote: Quote): string {\n if (typeof value === 'string') {\n // JSON's escaping covers every character that could end the literal or the line.\n const escaped = JSON.stringify(value).slice(1, -1)\n return quote === quotes.double ? `\"${escaped}\"` : `'${escaped.replaceAll(`\\\\\"`, `\"`).replaceAll(`'`, `\\\\'`)}'`\n }\n if (value === null || typeof value !== 'object') return String(value)\n if (Array.isArray(value)) return `[${value.map((item) => printValue(item, quote)).join(', ')}]`\n\n const entries = Object.entries(value)\n return entries.length ? `{ ${entries.map(([key, item]) => `${printKey(key, quote)}: ${printValue(item, quote)}`).join(', ')} }` : '{}'\n}\n\n/** An object key as source text: bare when it is an identifier, quoted otherwise. */\nexport function printKey(key: string, quote: Quote): string {\n return IDENTIFIER_PATTERN.test(key) ? key : printValue(key, quote)\n}\n\n/** `value` wrapped in one object per key of `path`: `wrapPath(['enum', 'type'], 'enum')` is `{ enum: { type: 'enum' } }`. */\nexport function wrapPath(path: Array<string>, value: OptionValue): OptionValue {\n return path.reduceRight<OptionValue>((inner, key) => ({ [key]: inner }), value)\n}\n\n/**\n * Adds `text` as the last item of an object or array literal, following its layout: on a line of\n * its own with the last item's indentation when the literal spans lines, inline otherwise.\n */\nexport function appendItem(source: string, container: ObjectExpression | ArrayExpression, text: string): string {\n const { start, end } = container\n const items: Array<{ start: number; end: number } | null> = container.type === nodeTypes.objectExpression ? container.properties : container.elements\n const last = items.filter((item) => item !== null).at(-1)\n\n if (!last) {\n const inner = source.slice(start + 1, end - 1)\n // A comment inside the empty literal stays, after the new item.\n if (inner.trim()) return replaceText(source, start + 1, start + 1, /^\\s/.test(inner) ? `${text},` : `${text}, `)\n return replaceText(source, start, end, container.type === nodeTypes.objectExpression ? `{ ${text} }` : `[${text}]`)\n }\n\n const between = source.slice(last.end, end - 1)\n // The closing bracket shares the last item's line: add the item inline.\n if (!between.includes('\\n')) return replaceText(source, last.end, last.end, `, ${text}`)\n\n const lineStart = source.lastIndexOf('\\n', last.start - 1) + 1\n const indent = source.slice(lineStart).match(/^[ \\t]*/)?.[0] ?? ''\n // After the last item's comma and any comment on its line, so neither moves. `between` holds a\n // newline, so one always follows.\n const lineEnd = source.indexOf('\\n', last.end)\n const comma = /^\\s*,/.test(between)\n\n return `${source.slice(0, last.end)}${comma ? '' : ','}${source.slice(last.end, lineEnd)}\\n${indent}${text}${comma ? ',' : ''}${source.slice(lineEnd)}`\n}\n\n/** Drops the item at `index` from an object or array literal, with its own lines when it sits on them alone. */\nexport function removeItem(source: string, node: ObjectExpression | ArrayExpression, index: number): string {\n const items: Array<{ start: number; end: number }> =\n node.type === nodeTypes.objectExpression ? node.properties : node.elements.filter((element) => element !== null)\n if (items.length === 1) return replaceText(source, node.start, node.end, node.type === nodeTypes.objectExpression ? '{}' : '[]')\n\n const { start, end } = items[index]!\n const lineStart = source.lastIndexOf('\\n', start - 1) + 1\n const nextNewline = source.indexOf('\\n', end)\n const lineEnd = nextNewline === -1 ? source.length : nextNewline\n if (!source.slice(lineStart, start).trim() && /^\\s*,?\\s*(\\/\\/.*)?$/.test(source.slice(end, lineEnd))) {\n return replaceText(source, lineStart, Math.min(lineEnd + 1, source.length))\n }\n\n const next = items[index + 1]\n return next ? replaceText(source, start, next.start) : replaceText(source, items[index - 1]!.end, end)\n}\n","import type { ExtensionKind } from '@kubb/core'\nimport { getErrorMessage, read, writeRaw } from '@internals/utils'\nimport {\n type AssignmentExpression,\n type BindingProperty,\n type CallExpression,\n type Comment,\n type Expression,\n type ImportDeclaration,\n type ObjectExpression,\n type ObjectPropertyKind,\n type Program,\n type RestElement,\n type SpreadElement,\n type VariableDeclaration,\n commentTypes,\n nodeTypes,\n parseExpression,\n parseSource,\n propertyKinds,\n unaryOperators,\n} from './ast.ts'\nimport { isAllowedPlugin, isOptionValue, isOutputKey, isOutputValue, isSafeKey, pickOutput, toExportName } from './rules.ts'\nimport { appendItem, getPosition, IDENTIFIER_PATTERN, printKey, printValue, quotes, type Quote, removeItem, replaceText, wrapPath } from './text.ts'\nimport {\n type ConfigEdit,\n ConfigEditOperation,\n type ConfigEditOutcome,\n type ConfigFileView,\n type ConfigRef,\n type ConfigView,\n extensionKinds,\n type InstalledExtensions,\n type OptionsView,\n type OptionValue,\n type PluginView,\n} from './types.ts'\n\n/** The marker `disable-plugin` writes, with the block's line count so `enable-plugin` restores exactly those lines. */\nconst DISABLED_MARKER_PATTERN = /^kubb:disabled (.+)\\s+(\\d+)$/\n\nconst OPERATIONS = new Set<string>(Object.values(ConfigEditOperation))\nconst OPTION_OPERATIONS = new Set<string>([ConfigEditOperation.SET_OPTION, ConfigEditOperation.REMOVE_OPTION])\nconst OUTPUT_OPERATIONS = new Set<string>([ConfigEditOperation.SET_OUTPUT, ConfigEditOperation.REMOVE_OUTPUT])\nconst KINDS = new Set<string>(Object.values(extensionKinds))\n\n/** Identifiers the editor matches by name. */\nconst identifiers = { defineConfig: 'defineConfig', require: 'require', module: 'module', exports: 'exports' } as const\n\nconst moduleKinds = { esm: 'esm', cjs: 'cjs' } as const\ntype ModuleKind = (typeof moduleKinds)[keyof typeof moduleKinds]\n\ntype EditResult = { source: string } | { reason: string }\ntype ParsedConfig = { program: Program; comments: Array<Comment>; configs: Array<ObjectExpression>; kind: ModuleKind }\ntype ValueNode = Expression | SpreadElement | null | undefined\ntype Import = { from: string; exported: string }\ntype FactoryCall = { importName: string; exportName: string; packageName: string; call: CallExpression }\ntype DisabledBlock = { packageName: string; line: number; end: number; code: Array<string> }\ntype OutputEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.SET_OUTPUT | typeof ConfigEditOperation.REMOVE_OUTPUT }>\ntype OptionEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.SET_OPTION | typeof ConfigEditOperation.REMOVE_OPTION }>\ntype AddPluginEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.ADD_PLUGIN }>\ntype DisablePluginEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.DISABLE_PLUGIN }>\ntype RemoveExtensionEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.REMOVE_EXTENSION }>\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value !== ''\n}\n\n/** Edits cross the wire, so their shape is checked before anything reads them. */\nfunction validateEdit(edit: ConfigEdit): string | undefined {\n const { operation, plugin, config, path, kind, input } = (typeof edit === 'object' && edit !== null ? edit : {}) as Record<string, unknown>\n\n if (typeof operation !== 'string' || !OPERATIONS.has(operation)) return `unknown operation ${JSON.stringify(operation)}`\n if (config !== undefined && typeof config !== 'string' && !Number.isSafeInteger(config)) return 'config must name an entry or give its index'\n\n if (operation === ConfigEditOperation.SET_INPUT) {\n return typeof input === 'string' && input.trim() !== '' ? undefined : 'the edit names no input'\n }\n\n const isOption = OPTION_OPERATIONS.has(operation)\n const isOutput = OUTPUT_OPERATIONS.has(operation)\n\n if (!isOutput && !isNonEmptyString(plugin)) return 'the edit names no plugin'\n\n if (kind !== undefined) {\n if (typeof kind !== 'string' || !KINDS.has(kind)) return `unknown kind ${JSON.stringify(kind)}`\n const takesKind = operation === ConfigEditOperation.ADD_PLUGIN || operation === ConfigEditOperation.REMOVE_EXTENSION\n if (takesKind && kind === extensionKinds.adapter) return `${operation} takes a plugin or a parser, since a config has one adapter`\n if (!isOption && !takesKind) return `${operation} edits the plugins array, so it takes no kind`\n }\n\n if (!isOption && !isOutput) return undefined\n\n if (!Array.isArray(path) || !path.every(isNonEmptyString)) return 'path must be a list of option names'\n if (path.length === 0) return 'no option path given'\n\n const unsafe = path.find((key) => !isSafeKey(key))\n if (unsafe !== undefined) return `${unsafe} cannot be used as an option name`\n\n if (isOutput && !isOutputKey(path[0]!)) return `output.${path[0]} can only be changed in the config file`\n\n return undefined\n}\n\n// Finding the config\n\n/** Steps through `as`/`satisfies` and `() => ...` wrappers to the config object. */\nfunction unwrapValue(node: ValueNode): ValueNode {\n if (!node) return undefined\n if (node.type === nodeTypes.tSAsExpression || node.type === nodeTypes.tSSatisfiesExpression) return unwrapValue(node.expression)\n if (node.type !== nodeTypes.arrowFunctionExpression && node.type !== nodeTypes.functionExpression) return node\n if (node.body?.type !== nodeTypes.blockStatement) return unwrapValue(node.body as Expression | null)\n\n const returned = node.body.body.find((statement) => statement.type === nodeTypes.returnStatement)\n return unwrapValue(returned?.type === nodeTypes.returnStatement ? returned.argument : undefined)\n}\n\nfunction isModuleExports(node: AssignmentExpression['left']): boolean {\n return (\n node.type === nodeTypes.memberExpression &&\n !node.computed &&\n node.object.type === nodeTypes.identifier &&\n node.object.name === identifiers.module &&\n node.property.type === nodeTypes.identifier &&\n node.property.name === identifiers.exports\n )\n}\n\n/** The exported config value and how the file exports it. */\nfunction findExport(program: Program): { exported: ValueNode; kind: ModuleKind } {\n for (const node of program.body) {\n if (node.type === nodeTypes.exportDefaultDeclaration) {\n // A `function` or `class` declaration is never a `defineConfig(...)` call, so `findConfigs` refuses it.\n return { exported: node.declaration as Expression, kind: moduleKinds.esm }\n }\n if (node.type === nodeTypes.expressionStatement && node.expression.type === nodeTypes.assignmentExpression && isModuleExports(node.expression.left)) {\n return { exported: node.expression.right, kind: moduleKinds.cjs }\n }\n }\n return { exported: undefined, kind: moduleKinds.esm }\n}\n\n/** Every config object in `export default` or `module.exports = defineConfig(...)`, or why the file is unmanaged. */\nfunction findConfigs(source: string): ParsedConfig | { reason: string } {\n const parsed = parseSource(source)\n if ('reason' in parsed) return parsed\n\n const { exported, kind } = findExport(parsed.program)\n const value = unwrapValue(exported)\n if (!value) return { reason: 'no `export default` or `module.exports` found' }\n if (value.type !== nodeTypes.callExpression || value.callee.type !== nodeTypes.identifier || value.callee.name !== identifiers.defineConfig) {\n return { reason: 'the exported config is not a defineConfig(...) call' }\n }\n\n const argument = unwrapValue(value.arguments[0])\n if (!argument) return { reason: 'defineConfig(...) was called without a config' }\n\n const entries = argument.type === nodeTypes.arrayExpression ? argument.elements.map((element) => unwrapValue(element)) : [argument]\n const configs = entries.filter((entry): entry is ObjectExpression => entry?.type === nodeTypes.objectExpression)\n if (configs.length !== entries.length) return { reason: 'config is not an object literal' }\n\n return { ...parsed, configs, kind }\n}\n\nfunction findConfigEntry(configs: Array<ObjectExpression>, ref: ConfigRef | undefined): ObjectExpression | undefined {\n return typeof ref === 'string' ? configs.find((entry) => getConfigName(entry) === ref) : configs[ref ?? 0]\n}\n\n// Reading object literals\n\nfunction getKey(entry: ObjectPropertyKind | BindingProperty | RestElement): string | undefined {\n if (entry.type !== nodeTypes.property || entry.computed) return undefined\n if (entry.key.type === nodeTypes.identifier) return entry.key.name\n return entry.key.type === nodeTypes.literal && typeof entry.key.value === 'string' ? entry.key.value : undefined\n}\n\n/** The last one wins when the key repeats, as at runtime. */\nfunction findProperty(node: ObjectExpression, key: string): { member: ObjectPropertyKind; index: number } | undefined {\n const index = node.properties.findLastIndex((entry) => getKey(entry) === key)\n return index === -1 ? undefined : { member: node.properties[index]!, index }\n}\n\nfunction getValue(node: ObjectExpression, key: string): ValueNode {\n const member = findProperty(node, key)?.member\n return member?.type === nodeTypes.property ? member.value : member\n}\n\nfunction getConfigName(config: ObjectExpression): string | undefined {\n const name = getValue(config, 'name')\n return name?.type === nodeTypes.literal && typeof name.value === 'string' ? name.value : undefined\n}\n\nfunction isOverridden(node: ObjectExpression, index: number): boolean {\n return node.properties.slice(index + 1).some((entry) => entry.type === nodeTypes.spreadElement)\n}\n\n/** `key: value`, not a method, getter, setter, or `{ key }` shorthand. */\nfunction isPlainProperty(member: Extract<ObjectPropertyKind, { type: typeof nodeTypes.property }>): boolean {\n return !member.method && !member.shorthand && member.kind === propertyKinds.init\n}\n\n/** A literal's value, `undefined` for code. */\nfunction readLiteral(node: ValueNode): OptionValue | undefined {\n switch (node?.type) {\n case nodeTypes.literal:\n // A bigint or a regex is code, not a value JSON can carry. A regex Node cannot compile also has a `null` value.\n return 'regex' in node || 'bigint' in node ? undefined : (node.value as OptionValue)\n case nodeTypes.templateLiteral:\n return node.expressions.length ? undefined : (node.quasis[0]?.value.cooked ?? '')\n case nodeTypes.unaryExpression: {\n const value = readLiteral(node.argument)\n if (typeof value !== 'number') return undefined\n if (node.operator === unaryOperators.minus) return -value\n if (node.operator === unaryOperators.plus) return value\n return undefined\n }\n case nodeTypes.arrayExpression: {\n const values = node.elements.map((element) => readLiteral(element))\n return values.every((value) => value !== undefined) ? values : undefined\n }\n case nodeTypes.objectExpression: {\n const entries: Record<string, OptionValue> = {}\n for (const entry of node.properties) {\n if (entry.type !== nodeTypes.property) return undefined\n const key = getKey(entry)\n const value = readLiteral(entry.value)\n // A `__proto__` key would replace the object's prototype instead of adding an entry.\n if (key === undefined || !isSafeKey(key) || value === undefined) return undefined\n entries[key] = value\n }\n return entries\n }\n }\n return undefined\n}\n\n// Imports and factory calls\n\nfunction getRequirePath(node: ValueNode): string | undefined {\n if (node?.type !== nodeTypes.callExpression || node.callee.type !== nodeTypes.identifier || node.callee.name !== identifiers.require) return undefined\n const [argument] = node.arguments\n return argument?.type === nodeTypes.literal && typeof argument.value === 'string' ? argument.value : undefined\n}\n\n/** `import { exported as local } from '...'`. A default or namespace import has no exported name, so its local name stands in. */\nfunction importBindings(statement: ImportDeclaration): Array<[string, Import]> {\n return statement.specifiers.map((specifier) => {\n const imported = specifier.type === nodeTypes.importSpecifier ? specifier.imported : specifier.local\n const exported = imported.type === nodeTypes.identifier ? imported.name : imported.value\n return [specifier.local.name, { from: statement.source.value, exported }]\n })\n}\n\n/** `const { exported: local } = require('...')`. */\nfunction requireBindings(statement: VariableDeclaration): Array<[string, Import]> {\n return statement.declarations.flatMap((declarator): Array<[string, Import]> => {\n const from = getRequirePath(declarator.init)\n if (from === undefined || declarator.id.type !== nodeTypes.objectPattern) return []\n\n return declarator.id.properties.flatMap((entry): Array<[string, Import]> => {\n if (entry.type !== nodeTypes.property || entry.value.type !== nodeTypes.identifier) return []\n return [[entry.value.name, { from, exported: getKey(entry) ?? entry.value.name }]]\n })\n })\n}\n\nfunction getImports(program: Program): Map<string, Import> {\n return new Map(\n program.body.flatMap((statement) => {\n if (statement.type === nodeTypes.importDeclaration) return importBindings(statement)\n if (statement.type === nodeTypes.variableDeclaration) return requireBindings(statement)\n return []\n }),\n )\n}\n\nfunction isImportStatement(node: Program['body'][number], kind: ModuleKind): boolean {\n if (kind === moduleKinds.esm) return node.type === nodeTypes.importDeclaration\n return node.type === nodeTypes.variableDeclaration && node.declarations.some((declarator) => getRequirePath(declarator.init) !== undefined)\n}\n\n/** The quote of the first string literal in the file, so new code matches it. */\nfunction detectQuote(node: unknown): Quote | undefined {\n if (!node || typeof node !== 'object') return undefined\n const { type, raw } = node as { type?: string; raw?: unknown }\n if (type === nodeTypes.literal && typeof raw === 'string' && (raw[0] === quotes.single || raw[0] === quotes.double)) return raw[0]\n for (const child of Object.values(node)) {\n const quote = detectQuote(child)\n if (quote) return quote\n }\n return undefined\n}\n\n/** The `adapter` value, or the elements of the `plugins` or `parsers` array. */\nfunction factoryNodes(config: ObjectExpression, kind: ExtensionKind): Array<ValueNode> {\n if (kind === extensionKinds.adapter) return [getValue(config, 'adapter')]\n const array = getValue(config, `${kind}s`)\n return array?.type === nodeTypes.arrayExpression ? array.elements : []\n}\n\n/** The factory calls of one kind whose callee the file imports. */\nfunction findCalls(program: Program, config: ObjectExpression, kind: ExtensionKind = extensionKinds.plugin): Array<FactoryCall> {\n const imports = getImports(program)\n return factoryNodes(config, kind).flatMap((node) => {\n if (node?.type !== nodeTypes.callExpression || node.callee.type !== nodeTypes.identifier) return []\n const imported = imports.get(node.callee.name)\n return imported ? [{ importName: node.callee.name, exportName: imported.exported, packageName: imported.from, call: node }] : []\n })\n}\n\n// Disabled plugins\n\n/** Whether nothing but whitespace precedes `offset` on its line. */\nfunction startsLine(source: string, offset: number): boolean {\n return source.slice(source.lastIndexOf('\\n', offset - 1) + 1, offset).trim() === ''\n}\n\n/** The `disable-plugin` blocks in this config, read from marker comments since the call is no longer a node. */\nfunction findDisabled(source: string, comments: Array<Comment>, config: ObjectExpression): Array<DisabledBlock> {\n const lines = source.split('\\n')\n\n return comments.flatMap((comment) => {\n const match = comment.type === commentTypes.line ? comment.value.trim().match(DISABLED_MARKER_PATTERN) : null\n // Only markers inside this entry, on a line of their own, so another entry or a trailing comment never matches.\n if (!match || comment.start < config.start || comment.end > config.end || !startsLine(source, comment.start)) return []\n\n const line = getPosition(source, comment.start).line\n const end = line + Number(match[2])\n const code = lines.slice(line, end).map((text) => text.replace(/^(\\s*)\\/\\/ ?/, '$1').replace(/^\\s+$/, ''))\n return [{ packageName: match[1]!, line, end, code }]\n })\n}\n\n// Reading options\n\n/** Literal members as `value` and code paths as `locked`, `undefined` for a computed key. */\nfunction readEditable(node: ObjectExpression, prefix: Array<string> = []): { value: Record<string, OptionValue>; locked: Array<Array<string>> } | undefined {\n const value: Record<string, OptionValue> = {}\n const locked: Array<Array<string>> = []\n\n for (const [index, entry] of node.properties.entries()) {\n if (entry.type === nodeTypes.spreadElement) continue\n const key = getKey(entry)\n if (key === undefined) return undefined\n if (findProperty(node, key)?.index !== index) continue\n\n const path = [...prefix, key]\n // A `__proto__` key replaces the prototype, so it reads as code.\n if (!isSafeKey(key)) {\n locked.push(path)\n continue\n }\n\n const member = isOverridden(node, index) ? undefined : entry.value\n const literal = readLiteral(member)\n if (literal !== undefined) {\n value[key] = literal\n continue\n }\n if (member?.type !== nodeTypes.objectExpression) {\n locked.push(path)\n continue\n }\n\n const nested = readEditable(member, path)\n if (!nested) return undefined\n value[key] = nested.value\n locked.push(...nested.locked)\n }\n return { value, locked }\n}\n\nfunction readObjectOptions(options: ObjectExpression): OptionsView {\n const entries: OptionsView = {}\n for (const [index, entry] of options.properties.entries()) {\n const key = getKey(entry)\n if (key === undefined || !isSafeKey(key)) continue\n\n const member = entry.type === nodeTypes.property && !isOverridden(options, index) ? entry.value : undefined\n const value = readLiteral(member)\n if (value !== undefined) {\n entries[key] = { literal: true, value }\n continue\n }\n entries[key] = { literal: false, ...(member?.type === nodeTypes.objectExpression ? readEditable(member) : undefined) }\n }\n return entries\n}\n\nfunction readCallOptions(call: CallExpression): OptionsView {\n const options = call.arguments[0]\n return options?.type === nodeTypes.objectExpression ? readObjectOptions(options) : {}\n}\n\nfunction readDisabledOptions(code: Array<string>): OptionsView {\n const call = parseExpression(code.join('\\n').trim().replace(/,$/, ''))\n return call?.type === nodeTypes.callExpression ? readCallOptions(call) : {}\n}\n\nfunction toPluginView({ importName, packageName, call }: FactoryCall): PluginView {\n return { importName, packageName, options: readCallOptions(call) }\n}\n\n/** Active and disabled plugins, in source order so a disabled plugin keeps its place. */\nfunction readPlugins({ source, parsed, config }: { source: string; parsed: ParsedConfig; config: ObjectExpression }): Array<PluginView> {\n const importNames = new Map([...getImports(parsed.program)].map(([local, { from }]) => [from, local]))\n\n const active = findCalls(parsed.program, config).map((call) => ({ line: getPosition(source, call.call.start).line, plugin: toPluginView(call) }))\n const disabled = findDisabled(source, parsed.comments, config).map(({ packageName, line, code }) => ({\n line,\n plugin: {\n importName: importNames.get(packageName) ?? toExportName(packageName),\n packageName,\n options: readDisabledOptions(code),\n disabled: true as const,\n },\n }))\n\n return [...active, ...disabled].sort((a, b) => a.line - b.line).map(({ plugin }) => plugin)\n}\n\nfunction readConfigView({ source, parsed, config }: { source: string; parsed: ParsedConfig; config: ObjectExpression }): ConfigView {\n const [adapter] = findCalls(parsed.program, config, extensionKinds.adapter).map(toPluginView)\n const parsers = findCalls(parsed.program, config, extensionKinds.parser).map(toPluginView)\n const output = getOutput(config)\n\n return {\n name: getConfigName(config),\n plugins: readPlugins({ source, parsed, config }),\n ...(adapter && { adapter }),\n ...(parsers.length ? { parsers } : {}),\n ...(!('reason' in output) && { output: pickOutput(readObjectOptions(output.object)) }),\n }\n}\n\n/** Which plugins the file declares and which options Studio may write. */\nexport function readConfig(source: string): ConfigFileView {\n const parsed = findConfigs(source)\n if ('reason' in parsed) return { managed: false, reason: parsed.reason }\n\n return { managed: true, configs: parsed.configs.map((config) => readConfigView({ source, parsed, config })) }\n}\n\n/** The modules the file imports, empty when it cannot be parsed. */\nexport function readImports(source: string): Array<string> {\n const parsed = parseSource(source)\n if ('reason' in parsed) return []\n return [...new Set([...getImports(parsed.program).values()].map(({ from }) => from))]\n}\n\n// Editing options\n\ntype FoundPath = { object: ObjectExpression; index: number; value: Expression } | { object: ObjectExpression; missing: number } | { reason: string }\n\n/** Follows `path` to its literal, or to the first missing key. Refuses a value set in code. */\nfunction findPath(options: ObjectExpression, path: Array<string>): FoundPath {\n let object = options\n\n for (const [depth, key] of path.entries()) {\n const found = findProperty(object, key)\n if (!found) return { object, missing: depth }\n if (isOverridden(object, found.index)) {\n return { reason: `${path.slice(0, depth + 1).join('.')} can be overridden by a spread after it, so it is customized in code` }\n }\n\n const { member, index } = found\n const isLast = depth === path.length - 1\n if (isLast) {\n return member.type === nodeTypes.property && readLiteral(member.value) !== undefined\n ? { object, index, value: member.value }\n : { reason: `${path.join('.')} is customized in code` }\n }\n if (member.type !== nodeTypes.property || member.value.type !== nodeTypes.objectExpression) {\n return { reason: `${key} is not an object, so ${path.join('.')} cannot be reached` }\n }\n object = member.value\n }\n return { reason: 'no option path given' }\n}\n\nfunction setAtPath({\n source,\n options,\n path,\n value,\n quote,\n}: {\n source: string\n options: ObjectExpression\n path: Array<string>\n value: OptionValue\n quote: Quote\n}): EditResult {\n const target = findPath(options, path)\n if ('reason' in target) return target\n if ('missing' in target) {\n const [key, ...rest] = path.slice(target.missing)\n return { source: appendItem(source, target.object, `${printKey(key!, quote)}: ${printValue(wrapPath(rest, value), quote)}`) }\n }\n return { source: replaceText(source, target.value.start, target.value.end, printValue(value, quote)) }\n}\n\nfunction removeAtPath({ source, options, path }: { source: string; options: ObjectExpression; path: Array<string> }): EditResult {\n const target = findPath(options, path)\n if ('reason' in target) return target\n if ('missing' in target) return { source }\n return { source: removeItem(source, target.object, target.index) }\n}\n\nfunction setOption(source: string, call: CallExpression, path: Array<string>, value: unknown, quote: Quote): EditResult {\n if (!isOptionValue(value)) return { reason: 'the value is not a literal that can be written to a config file' }\n\n const options = call.arguments[0]\n if (!options) {\n const closing = call.end - 1\n if (source[closing] !== ')') return { reason: 'the factory call could not be located in the file' }\n return { source: replaceText(source, closing, closing, printValue(wrapPath(path, value), quote)) }\n }\n if (options.type !== nodeTypes.objectExpression) return { reason: 'the factory was not called with an object literal' }\n return setAtPath({ source, options, path, value, quote })\n}\n\nfunction removeOption(source: string, call: CallExpression, path: Array<string>): EditResult {\n const options = call.arguments[0]\n if (!options) return { source }\n if (options.type !== nodeTypes.objectExpression) return { reason: 'the factory was not called with an object literal' }\n return removeAtPath({ source, options, path })\n}\n\nfunction editOption({\n source,\n parsed,\n config,\n edit,\n quote,\n extensions,\n}: {\n source: string\n parsed: ParsedConfig\n config: ObjectExpression\n edit: OptionEdit\n quote: Quote\n extensions: InstalledExtensions\n}): EditResult {\n const kind = edit.kind ?? extensionKinds.plugin\n // A package can ship several factories (`parserTs`, `parserTsx`), so prefer the export its manifest names.\n const calls = findCalls(parsed.program, config, kind).filter((entry) => entry.packageName === edit.plugin)\n const exportName = extensions.get(edit.plugin)?.manifest.export ?? toExportName(edit.plugin)\n const call = (calls.find((entry) => entry.exportName === exportName) ?? calls[0])?.call\n\n if (!call) {\n if (kind === extensionKinds.adapter) return { reason: `${edit.plugin} is not the config's adapter` }\n const disabled = kind === extensionKinds.plugin && findDisabled(source, parsed.comments, config).some((block) => block.packageName === edit.plugin)\n return { reason: disabled ? `${edit.plugin} is disabled, enable it first` : `${edit.plugin} is not in the ${kind}s array` }\n }\n\n if (edit.operation === ConfigEditOperation.SET_OPTION) return setOption(source, call, edit.path, edit.value, quote)\n return removeOption(source, call, edit.path)\n}\n\n// Editing the config's own fields\n\nfunction setInput(source: string, config: ObjectExpression, input: string, quote: Quote): EditResult {\n const value = printValue(input, quote)\n const found = findProperty(config, 'input')\n if (!found) return { source: appendItem(source, config, `input: ${value}`) }\n if (found.member.type !== nodeTypes.property || !isPlainProperty(found.member)) return { reason: 'input is not a plain property' }\n if (isOverridden(config, found.index)) return { reason: 'a spread after input could override it' }\n return { source: replaceText(source, found.member.value.start, found.member.value.end, value) }\n}\n\nfunction getOutput(config: ObjectExpression): { object: ObjectExpression } | { reason: string } {\n const found = findProperty(config, 'output')\n if (found?.member.type !== nodeTypes.property || found.member.value.type !== nodeTypes.objectExpression) return { reason: 'output is not an object literal' }\n if (isOverridden(config, found.index)) return { reason: 'a spread after output could override it' }\n return { object: found.member.value }\n}\n\nfunction editOutput({ source, config, edit, quote }: { source: string; config: ObjectExpression; edit: OutputEdit; quote: Quote }): EditResult {\n const output = getOutput(config)\n if ('reason' in output) return output\n if (edit.operation === ConfigEditOperation.REMOVE_OUTPUT) return removeAtPath({ source, options: output.object, path: edit.path })\n\n const [key, ...rest] = edit.path\n if (!isOptionValue(edit.value) || !isOutputValue({ key: key!, value: wrapPath(rest, edit.value) }))\n return { reason: `the value is not one output.${key} takes` }\n return setAtPath({ source, options: output.object, path: edit.path, value: edit.value, quote })\n}\n\n// Adding, disabling, and enabling plugins\n\n/** Adds the import after the last one, matching its semicolon style. */\nfunction addImport({\n source,\n parsed,\n importNames,\n moduleSpecifier,\n quote,\n}: {\n source: string\n parsed: ParsedConfig\n importNames: Array<string>\n moduleSpecifier: string\n quote: Quote\n}): string {\n const lastImport = parsed.program.body.findLast((node) => isImportStatement(node, parsed.kind))\n const afterLine = lastImport ? getPosition(source, lastImport.end).line : 0\n const lines = source.split('\\n')\n\n const semicolon = afterLine > 0 && lines[afterLine - 1]?.trimEnd().endsWith(';') ? ';' : ''\n const specifier = `${quote}${moduleSpecifier}${quote}`\n const statement =\n parsed.kind === moduleKinds.esm ? `import { ${importNames.join(', ')} } from ${specifier}` : `const { ${importNames.join(', ')} } = require(${specifier})`\n\n lines.splice(afterLine, 0, `${statement}${semicolon}`)\n if (afterLine === 0) lines.splice(1, 0, '')\n\n return lines.join('\\n')\n}\n\n/**\n * The parsers `defineConfig` applies when a config sets no `parsers`, by import name. Adding a parser\n * to such a config writes these too, or the new array would replace them.\n */\nconst DEFAULT_PARSERS = [\n { importName: 'parserTs', packageName: '@kubb/parser-ts' },\n { importName: 'parserTsx', packageName: '@kubb/parser-ts' },\n { importName: 'parserMd', packageName: '@kubb/parser-md' },\n] as const\n\n/**\n * Adds a plugin to `plugins`, or with `kind: 'parser'` a parser to `parsers`. Replaying the same add\n * is a no-op, while an import name taken by another package is an error.\n */\nfunction addPlugin({\n source,\n parsed,\n config,\n edit,\n quote,\n extensions,\n}: {\n source: string\n parsed: ParsedConfig\n config: ObjectExpression\n edit: AddPluginEdit\n quote: Quote\n extensions: InstalledExtensions\n}): EditResult {\n const kind = edit.kind ?? extensionKinds.plugin\n const isParser = kind === extensionKinds.parser\n if (!isAllowedPlugin({ packageName: edit.plugin, extensions, kind })) {\n return {\n reason: isParser ? `\"${edit.plugin}\" is not an installed Kubb parser` : `\"${edit.plugin}\" is not a @kubb/plugin-* package or an installed Kubb plugin`,\n }\n }\n\n const importName = extensions.get(edit.plugin)?.manifest.export ?? toExportName(edit.plugin)\n if (!IDENTIFIER_PATTERN.test(importName)) return { reason: `\"${importName}\" is not a valid import name` }\n // A package can ship several parsers (`parserTs` and `parserTsx`), so a parser is matched by its export too.\n if (findCalls(parsed.program, config, kind).some((entry) => entry.packageName === edit.plugin && (!isParser || entry.exportName === importName))) {\n return { source }\n }\n\n const options = edit.options ?? {}\n if (!isOptionValue(options)) return { reason: 'the options are not literals that can be written to a config file' }\n\n const key = `${kind}s`\n const array = getValue(config, key)\n if (array ? array.type !== nodeTypes.arrayExpression : !isParser) return { reason: `${key} is not an array literal` }\n // A config without `parsers` runs the defaults, so the new array lists them before the added parser.\n const defaults = isParser && !array ? DEFAULT_PARSERS.filter((parser) => parser.importName !== importName) : []\n\n // The missing imports by package, so `parserTs` and `parserTsx` share one line.\n const imports = getImports(parsed.program)\n const missing = new Map<string, Array<string>>()\n for (const item of [...defaults, { importName, packageName: edit.plugin }]) {\n const from = imports.get(item.importName)?.from\n if (from && from !== item.packageName) return { reason: `${item.importName} is already imported from ${from}` }\n if (!from) missing.set(item.packageName, [...(missing.get(item.packageName) ?? []), item.importName])\n }\n\n // The array sits below the imports, so adding to it first leaves the import lines where they are.\n const call = `${importName}(${Object.keys(options).length ? printValue(options, quote) : ''})`\n const next =\n array?.type === nodeTypes.arrayExpression\n ? appendItem(source, array, call)\n : appendItem(source, config, `parsers: [${[...defaults.map((parser) => `${parser.importName}()`), call].join(', ')}]`)\n\n return {\n source: [...missing].reduceRight(\n (current, [moduleSpecifier, importNames]) => addImport({ source: current, parsed, importNames, moduleSpecifier, quote }),\n next,\n ),\n }\n}\n\n/** One item per line, so a call can be commented out alone. Skipped when comments sit between items. */\nfunction splitPlugins(source: string, config: ObjectExpression): string | undefined {\n const array = getValue(config, 'plugins')\n if (array?.type !== nodeTypes.arrayExpression) return undefined\n\n const items = array.elements.flatMap((element) => (element ? [element] : []))\n const { start, end } = array\n const gaps = [source.slice(start + 1, items[0]?.start ?? end - 1), ...items.map((item, index) => source.slice(item.end, items[index + 1]?.start ?? end - 1))]\n if (!items.length || gaps.some((gap) => !/^[\\s,]*$/.test(gap))) return undefined\n\n const lineStart = source.lastIndexOf('\\n', start - 1) + 1\n const indent = source.slice(lineStart).match(/^[ \\t]*/)?.[0] ?? ''\n const lines = items.map((item) => `${indent} ${source.slice(item.start, item.end)},`)\n\n return replaceText(source, start, end, `[\\n${lines.join('\\n')}\\n${indent}]`)\n}\n\nfunction disablePlugin(source: string, program: Program, config: ObjectExpression, plugin: string): EditResult {\n const call = findCalls(program, config).find((entry) => entry.packageName === plugin)?.call\n if (!call) return { reason: `${plugin} is not in the plugins array` }\n\n const start = getPosition(source, call.start)\n const end = getPosition(source, call.end)\n const lines = source.split('\\n')\n const from = start.line - 1\n const to = end.line - 1\n const firstLine = lines[from] ?? ''\n\n // Only safe when the call sits alone on its lines: anything else on its first line, or on its last\n // line besides a trailing comma, would be swallowed into the comment and corrupt the file.\n if (firstLine.slice(0, start.column).trim() || !/^,?\\s*$/.test((lines[to] ?? '').slice(end.column))) {\n return { reason: `${plugin} shares a line with other code, so it cannot be commented out safely` }\n }\n\n const indent = firstLine.match(/^\\s*/)?.[0] ?? ''\n const commented = lines.slice(from, to + 1).map((line) => (line.trim() ? `${indent}// ${line.slice(indent.length)}` : `${indent}//`))\n lines.splice(from, commented.length, `${indent}// kubb:disabled ${plugin} ${commented.length}`, ...commented)\n\n return { source: lines.join('\\n') }\n}\n\n/** Disables the plugin, first putting a one-line `plugins: [a(), b()]` (what `add-plugin` writes) on separate lines. */\nfunction disablePluginInConfig({\n source,\n parsed,\n config,\n edit,\n}: {\n source: string\n parsed: ParsedConfig\n config: ObjectExpression\n edit: DisablePluginEdit\n}): EditResult {\n const result = disablePlugin(source, parsed.program, config, edit.plugin)\n if (!('reason' in result) || !result.reason.includes('shares a line')) return result\n\n const split = splitPlugins(source, config)\n if (split === undefined) return result\n\n const reparsed = findConfigs(split)\n const reparsedConfig = 'reason' in reparsed ? undefined : findConfigEntry(reparsed.configs, edit.config)\n if ('reason' in reparsed || !reparsedConfig) return result\n\n return disablePlugin(split, reparsed.program, reparsedConfig, edit.plugin)\n}\n\nfunction enablePlugin(source: string, comments: Array<Comment>, config: ObjectExpression, plugin: string): EditResult {\n const block = findDisabled(source, comments, config).find((entry) => entry.packageName === plugin)\n if (!block) return { reason: `${plugin} is not disabled` }\n\n const lines = source.split('\\n')\n lines.splice(block.line - 1, block.end - block.line + 1, ...block.code)\n return { source: lines.join('\\n') }\n}\n\n// Removing extensions\n\n/** Drops the import statements of `packageName` once nothing else in the file uses their names. */\nfunction removeUnusedImports(source: string, packageName: string): string {\n const parsed = parseSource(source)\n if ('reason' in parsed) return source\n\n // From the last statement up, so the offsets of the earlier ones stay valid.\n return parsed.program.body.reduceRight((current, statement) => {\n const bindings =\n statement.type === nodeTypes.importDeclaration\n ? importBindings(statement)\n : statement.type === nodeTypes.variableDeclaration\n ? requireBindings(statement)\n : []\n if (!bindings.length || bindings.some(([, { from }]) => from !== packageName)) return current\n\n const rest = replaceText(current, statement.start, statement.end)\n if (bindings.some(([local]) => new RegExp(`(?<![\\\\w$])${local.replaceAll('$', '\\\\$')}(?![\\\\w$])`).test(rest))) return current\n\n const lineStart = current.lastIndexOf('\\n', statement.start - 1) + 1\n const lineEnd = current.indexOf('\\n', statement.end)\n const after = lineEnd === -1 ? current.length : lineEnd + 1\n // At the top of the file, the blank line after the import goes too, so the file does not start with one.\n return replaceText(current, lineStart, lineStart === 0 && current[after] === '\\n' ? after + 1 : after)\n }, source)\n}\n\n/**\n * Removes every call of a plugin or parser package, and the block `disable-plugin` commented out,\n * then its unused imports. Removing what the config does not hold is a no-op. Refuses to empty\n * `parsers`, since a config with no parser cannot print files.\n */\nfunction removeExtension(source: string, edit: RemoveExtensionEdit): EditResult {\n const kind = edit.kind ?? extensionKinds.plugin\n let current = source\n\n // One call at a time, re-parsing in between, since each removal moves the ones after it.\n for (;;) {\n const parsed = findConfigs(current)\n if ('reason' in parsed) return parsed\n const config = findConfigEntry(parsed.configs, edit.config)\n if (!config) return { reason: `no config entry found for ${JSON.stringify(edit.config)}` }\n\n const array = getValue(config, `${kind}s`)\n const calls = findCalls(parsed.program, config, kind).filter((entry) => entry.packageName === edit.plugin)\n const block = findDisabled(current, parsed.comments, config).find((entry) => entry.packageName === edit.plugin)\n\n if (calls[0] && array?.type === nodeTypes.arrayExpression) {\n const elements = array.elements.filter((element) => element !== null)\n if (kind === extensionKinds.parser && elements.length === calls.length) return { reason: `${edit.plugin} is the last parser in the parsers array` }\n current = removeItem(current, array, elements.indexOf(calls[0].call))\n continue\n }\n if (block && kind === extensionKinds.plugin) {\n const lines = current.split('\\n')\n lines.splice(block.line - 1, block.end - block.line + 1)\n current = lines.join('\\n')\n continue\n }\n return { source: current === source ? source : removeUnusedImports(current, edit.plugin) }\n }\n}\n\n// Applying edits\n\n/** Every edit re-parses the file, since the previous one rewrote it. */\nfunction applyEdit({ source, edit, extensions }: { source: string; edit: ConfigEdit; extensions: InstalledExtensions }): EditResult {\n const parsed = findConfigs(source)\n if ('reason' in parsed) return parsed\n\n const config = findConfigEntry(parsed.configs, edit.config)\n if (!config) return { reason: `no config entry found for ${JSON.stringify(edit.config)}` }\n const quote = detectQuote(parsed.program) ?? quotes.single\n\n switch (edit.operation) {\n case ConfigEditOperation.SET_INPUT:\n return setInput(source, config, edit.input, quote)\n case ConfigEditOperation.SET_OUTPUT:\n case ConfigEditOperation.REMOVE_OUTPUT:\n return editOutput({ source, config, edit, quote })\n case ConfigEditOperation.DISABLE_PLUGIN:\n return disablePluginInConfig({ source, parsed, config, edit })\n case ConfigEditOperation.ENABLE_PLUGIN:\n return enablePlugin(source, parsed.comments, config, edit.plugin)\n case ConfigEditOperation.ADD_PLUGIN:\n return addPlugin({ source, parsed, config, edit, quote, extensions })\n case ConfigEditOperation.REMOVE_EXTENSION:\n return removeExtension(source, edit)\n case ConfigEditOperation.SET_OPTION:\n case ConfigEditOperation.REMOVE_OPTION:\n return editOption({ source, parsed, config, edit, quote, extensions })\n }\n}\n\n/** Applies edits in place, touching only the text each targets. A refused edit is reported and the rest still run. */\nexport function editConfig({ source, edits, extensions = new Map() }: { source: string; edits: Array<ConfigEdit>; extensions?: InstalledExtensions }): {\n source: string\n outcomes: Array<ConfigEditOutcome>\n changed: boolean\n} {\n let current = source\n\n const outcomes = edits.map((edit): ConfigEditOutcome => {\n const invalid = validateEdit(edit)\n if (invalid) return { edit, applied: false, reason: invalid }\n\n try {\n const result = applyEdit({ source: current, edit, extensions })\n if ('reason' in result) return { edit, applied: false, reason: result.reason }\n current = result.source\n return { edit, applied: true }\n } catch (error) {\n return { edit, applied: false, reason: getErrorMessage(error) }\n }\n })\n\n return { source: current, outcomes, changed: current !== source }\n}\n\n/** Applies `edits` to `filePath`, writing only when something changed. */\nexport async function editConfigFile({ filePath, edits, extensions }: { filePath: string; edits: Array<ConfigEdit>; extensions?: InstalledExtensions }) {\n const current = await read(filePath)\n const result = editConfig({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AQ;EAAQ;EAE5D,IAAI;GACF,MAAM,SAAS,UAAU;IAAE,QAAQ;IAAS;IAAM;GAAW,CAAC;GAC9D,IAAI,YAAY,QAAQ,OAAO;IAAE;IAAM,SAAS;IAAO,QAAQ,OAAO;GAAO;GAC7E,UAAU,OAAO;GACjB,OAAO;IAAE;IAAM,SAAS;GAAK;EAC/B,SAAS,OAAO;GACd,OAAO;IAAE;IAAM,SAAS;IAAO,QAAQ,gBAAgB,KAAK;GAAE;EAChE;CACF,CAAC;CAED,OAAO;EAAE,QAAQ;EAAS;EAAU,SAAS,YAAY;CAAO;AAClE;;AAGA,eAAsB,eAAe,EAAE,UAAU,OAAO,cAAgG;CAEtJ,MAAM,SAAS,WAAW;EAAE,QAAQ,MADd,KAAK,QAAQ;EACU;EAAO;CAAW,CAAC;CAChE,IAAI,OAAO,SAAS,MAAM,SAAS,UAAU,OAAO,MAAM;CAC1D,OAAO;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configFile-CoEpHdXG.cjs","names":["parse","getErrorMessage","isPackageName","getErrorMessage","read","writeRaw"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/shared/src/configFile/ast.ts","../../../internals/shared/src/configFile/types.ts","../../../internals/shared/src/configFile/rules.ts","../../../internals/shared/src/configFile/text.ts","../../../internals/shared/src/configFile/configFile.ts"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = new Map<string, string>()\nconst cacheLimit = 100_000\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n const cached = cache.get(key)\n if (cached !== undefined) return cached\n\n const result = convert(text, pascal)\n if (cache.size >= cacheLimit) cache.clear()\n cache.set(key, result)\n return result\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n","import { getErrorMessage } from '@internals/utils'\nimport { type Comment, type Expression, type Program, parse } from 'yuku-parser'\n\nexport type {\n ArrayExpression,\n AssignmentExpression,\n BindingProperty,\n CallExpression,\n Comment,\n Expression,\n ImportDeclaration,\n ObjectExpression,\n ObjectPropertyKind,\n Program,\n RestElement,\n SpreadElement,\n VariableDeclaration,\n} from 'yuku-parser'\n\n/** Node types the config editor reads from the yuku AST. */\nexport const nodeTypes = {\n arrayExpression: 'ArrayExpression',\n arrowFunctionExpression: 'ArrowFunctionExpression',\n assignmentExpression: 'AssignmentExpression',\n blockStatement: 'BlockStatement',\n callExpression: 'CallExpression',\n exportDefaultDeclaration: 'ExportDefaultDeclaration',\n expressionStatement: 'ExpressionStatement',\n functionExpression: 'FunctionExpression',\n identifier: 'Identifier',\n importDeclaration: 'ImportDeclaration',\n importSpecifier: 'ImportSpecifier',\n literal: 'Literal',\n memberExpression: 'MemberExpression',\n objectExpression: 'ObjectExpression',\n objectPattern: 'ObjectPattern',\n property: 'Property',\n returnStatement: 'ReturnStatement',\n spreadElement: 'SpreadElement',\n tSAsExpression: 'TSAsExpression',\n tSSatisfiesExpression: 'TSSatisfiesExpression',\n templateLiteral: 'TemplateLiteral',\n unaryExpression: 'UnaryExpression',\n variableDeclaration: 'VariableDeclaration',\n} as const\n\nexport const commentTypes = { line: 'Line' } as const\nexport const propertyKinds = { init: 'init' } as const\nexport const unaryOperators = { minus: '-', plus: '+' } as const\nconst diagnosticSeverities = { error: 'error' } as const\n\n/** A parsed file: its statements and every comment in it, or why it could not be parsed. */\ntype ParsedSource = { program: Program; comments: Array<Comment> } | { reason: string }\n\n/**\n * Parses `source` as a TypeScript module. Never throws: a syntax error, or a native parser that\n * cannot load on this platform, comes back as a `reason`.\n */\nexport function parseSource(source: string): ParsedSource {\n try {\n // Parentheses are dropped, so `export default (defineConfig({}))` reads as the call itself.\n const { program, comments, diagnostics } = parse(source, { lang: 'ts', sourceType: 'module', preserveParens: false })\n if (diagnostics.some((diagnostic) => diagnostic.severity === diagnosticSeverities.error)) return { reason: 'the config file could not be parsed' }\n return { program, comments }\n } catch (error) {\n return { reason: `the config parser could not load on this platform: ${getErrorMessage(error)}` }\n }\n}\n\n/** Parses `source` as one expression, such as a commented-out `pluginTs({ ... })` call. */\nexport function parseExpression(source: string): Expression | undefined {\n const parsed = parseSource(source)\n if ('reason' in parsed) return undefined\n const [statement] = parsed.program.body\n return parsed.program.body.length === 1 && statement?.type === nodeTypes.expressionStatement ? statement.expression : undefined\n}\n","import type { ExtensionKind, ExtensionManifest } from '@kubb/core'\n\n/** Which `defineConfig(...)` entry an edit targets: its index or `name`, the first entry when omitted. */\nexport type ConfigRef = string | number\n\n/** A literal option value that survives a JSON round trip. */\nexport type OptionValue = string | number | boolean | null | Array<OptionValue> | { [key: string]: OptionValue }\n\nexport const extensionKinds = { plugin: 'plugin', adapter: 'adapter', parser: 'parser' } as const satisfies Record<string, ExtensionKind>\n\nexport const ConfigEditOperation = {\n SET_OPTION: 'set-option',\n REMOVE_OPTION: 'remove-option',\n ADD_PLUGIN: 'add-plugin',\n REMOVE_EXTENSION: 'remove-extension',\n DISABLE_PLUGIN: 'disable-plugin',\n ENABLE_PLUGIN: 'enable-plugin',\n SET_INPUT: 'set-input',\n SET_OUTPUT: 'set-output',\n REMOVE_OUTPUT: 'remove-output',\n} as const\nexport type ConfigEditOperation = (typeof ConfigEditOperation)[keyof typeof ConfigEditOperation]\n\n/**\n * One change to `kubb.config.ts`. `plugin` is the package name, and `kind` picks the `plugins` entry\n * (default), the `adapter`, or a `parsers` entry. `path` walks nested option objects.\n */\nexport type ConfigEdit =\n | { operation: typeof ConfigEditOperation.SET_OPTION; config?: ConfigRef; kind?: ExtensionKind; plugin: string; path: Array<string>; value: unknown }\n | { operation: typeof ConfigEditOperation.REMOVE_OPTION; config?: ConfigRef; kind?: ExtensionKind; plugin: string; path: Array<string> }\n /** With `kind: 'parser'`, adds to `parsers`. A config without `parsers` gets the defaults written next to it, so they keep running. */\n | {\n operation: typeof ConfigEditOperation.ADD_PLUGIN\n config?: ConfigRef\n kind?: typeof extensionKinds.plugin | typeof extensionKinds.parser\n plugin: string\n options?: Record<string, unknown>\n }\n /** Deletes every call of a plugin, or a parser with `kind: 'parser'`, a disabled block included, and the imports nothing else uses. */\n | {\n operation: typeof ConfigEditOperation.REMOVE_EXTENSION\n config?: ConfigRef\n kind?: typeof extensionKinds.plugin | typeof extensionKinds.parser\n plugin: string\n }\n | { operation: typeof ConfigEditOperation.DISABLE_PLUGIN; config?: ConfigRef; plugin: string }\n | { operation: typeof ConfigEditOperation.ENABLE_PLUGIN; config?: ConfigRef; plugin: string }\n | { operation: typeof ConfigEditOperation.SET_INPUT; config?: ConfigRef; input: string }\n | { operation: typeof ConfigEditOperation.SET_OUTPUT; config?: ConfigRef; path: Array<string>; value: unknown }\n | { operation: typeof ConfigEditOperation.REMOVE_OUTPUT; config?: ConfigRef; path: Array<string> }\n\n/** Option keys, each with whether Studio may write it. `locked` lists the code paths inside a partly literal object. */\nexport type OptionsView = Record<string, { literal: boolean; value?: OptionValue; locked?: Array<Array<string>> }>\n\n/** A factory call in `plugins`, `adapter`, or `parsers`. `importName` is the local name, alias included. */\nexport type PluginView = {\n importName: string\n packageName: string\n options: OptionsView\n /** The call is commented out by `disable-plugin`. */\n disabled?: true\n}\n\nexport type ConfigView = {\n name?: string\n plugins: Array<PluginView>\n adapter?: PluginView\n parsers?: Array<PluginView>\n /** The root `output` members Studio may set, absent when `output` is not an object literal. */\n output?: OptionsView\n}\n\n/** The config file as Studio may edit it, or why it cannot. */\nexport type ConfigFileView = { managed: true; configs: Array<ConfigView> } | { managed: false; reason: string }\n\nexport type ConfigEditOutcome = {\n edit: ConfigEdit\n applied: boolean\n reason?: string\n}\n\nexport type ExtensionEntry = {\n package: string\n version: string\n manifest: ExtensionManifest\n /** Ships with `kubb` at its version, so updating `kubb` updates it and `kubb update` cannot. */\n bundled?: true\n}\n\n/** Installed extensions by package name, the only ones Studio may import besides `@kubb/plugin-*`. */\nexport type InstalledExtensions = ReadonlyMap<string, ExtensionEntry>\n","import { type ExtensionKind, isPackageName } from '@kubb/core'\nimport { camelCase } from '@internals/utils'\nimport { extensionKinds, type InstalledExtensions, type OptionValue } from './types.ts'\n\n/** `@kubb/plugin-ts` becomes `plugin-ts`, the `name` Kubb plugin factories use. */\nexport function toPluginName(packageName: string): string {\n return packageName.split('/').pop() ?? packageName\n}\n\n/** `@kubb/plugin-react-query` becomes `pluginReactQuery`, the export a plugin package uses by convention. */\nexport function toExportName(packageName: string): string {\n return camelCase(toPluginName(packageName))\n}\n\nconst KUBB_PLUGIN_SPECIFIER = /^@kubb\\/plugin-[\\w.-]+$/\n\n/** Only a `@kubb/plugin-*` package or an installed extension of `kind` may be imported, never a path or URL. */\nexport function isAllowedPlugin({\n packageName,\n extensions,\n kind = extensionKinds.plugin,\n}: {\n packageName: string\n extensions: InstalledExtensions\n kind?: ExtensionKind\n}): boolean {\n if (!isPackageName(packageName)) return false\n return (kind === extensionKinds.plugin && KUBB_PLUGIN_SPECIFIER.test(packageName)) || extensions.get(packageName)?.manifest.kind === kind\n}\n\nconst UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\n/** Whether `key` can be an option key without reaching the object's prototype. */\nexport function isSafeKey(key: string): boolean {\n return !UNSAFE_KEYS.has(key)\n}\n\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null) return false\n const prototype = Object.getPrototypeOf(value)\n return prototype === null || prototype === Object.prototype\n}\n\n/** Whether `value` survives a JSON round trip, so an edit never writes a lossy copy into the file. */\nexport function isOptionValue(value: unknown): value is OptionValue {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return true\n if (typeof value === 'number') return Number.isFinite(value)\n if (Array.isArray(value)) return value.every(isOptionValue)\n if (isPlainObject(value)) return Object.entries(value).every(([key, entry]) => isSafeKey(key) && isOptionValue(entry))\n\n return false\n}\n\n/** The root `output` members Studio may set, with the values each takes. */\nconst OUTPUT_VALUES: Record<string, (value: unknown) => boolean> = {\n barrel: (value) => value === false || (isPlainObject(value) && Object.keys(value).length === 1 && (value.type === 'named' || value.type === 'all')),\n format: (value) => value === false || ['auto', 'prettier', 'biome', 'oxfmt'].includes(value as string),\n lint: (value) => value === false || ['auto', 'eslint', 'biome', 'oxlint'].includes(value as string),\n clean: (value) => typeof value === 'boolean',\n defaultBanner: (value) => value === false || value === 'simple' || value === 'full',\n}\n\nexport function isOutputKey(key: string): boolean {\n return Object.hasOwn(OUTPUT_VALUES, key)\n}\n\nexport function isOutputValue({ key, value }: { key: string; value: unknown }): boolean {\n return isOutputKey(key) && OUTPUT_VALUES[key]!(value)\n}\n\nexport function pickOutput<T>(output: Record<string, T>): Record<string, T> {\n return Object.fromEntries(Object.entries(output).filter(([key]) => isOutputKey(key)))\n}\n","import { type ArrayExpression, nodeTypes, type ObjectExpression } from './ast.ts'\nimport type { OptionValue } from './types.ts'\n\n/**\n * A valid JavaScript identifier, so an import name can only ever print as `import { name } from`,\n * never as source that breaks out of the import statement.\n */\nexport const IDENTIFIER_PATTERN = /^[A-Za-z_$][\\w$]*$/\n\nexport const quotes = { single: `'`, double: `\"` } as const\nexport type Quote = (typeof quotes)[keyof typeof quotes]\n\n/** `source` with the text between `start` and `end` replaced by `text`. */\nexport function replaceText(source: string, start: number, end: number, text = ''): string {\n return `${source.slice(0, start)}${text}${source.slice(end)}`\n}\n\n/** The 1-based line and 0-based column of `offset` in `source`. */\nexport function getPosition(source: string, offset: number): { line: number; column: number } {\n return { line: source.slice(0, offset).split('\\n').length, column: offset - source.lastIndexOf('\\n', offset - 1) - 1 }\n}\n\n/** Writes `value` as a single-line literal with the file's quote style. */\nexport function printValue(value: OptionValue, quote: Quote): string {\n if (typeof value === 'string') {\n // JSON's escaping covers every character that could end the literal or the line.\n const escaped = JSON.stringify(value).slice(1, -1)\n return quote === quotes.double ? `\"${escaped}\"` : `'${escaped.replaceAll(`\\\\\"`, `\"`).replaceAll(`'`, `\\\\'`)}'`\n }\n if (value === null || typeof value !== 'object') return String(value)\n if (Array.isArray(value)) return `[${value.map((item) => printValue(item, quote)).join(', ')}]`\n\n const entries = Object.entries(value)\n return entries.length ? `{ ${entries.map(([key, item]) => `${printKey(key, quote)}: ${printValue(item, quote)}`).join(', ')} }` : '{}'\n}\n\n/** An object key as source text: bare when it is an identifier, quoted otherwise. */\nexport function printKey(key: string, quote: Quote): string {\n return IDENTIFIER_PATTERN.test(key) ? key : printValue(key, quote)\n}\n\n/** `value` wrapped in one object per key of `path`: `wrapPath(['enum', 'type'], 'enum')` is `{ enum: { type: 'enum' } }`. */\nexport function wrapPath(path: Array<string>, value: OptionValue): OptionValue {\n return path.reduceRight<OptionValue>((inner, key) => ({ [key]: inner }), value)\n}\n\n/**\n * Adds `text` as the last item of an object or array literal, following its layout: on a line of\n * its own with the last item's indentation when the literal spans lines, inline otherwise.\n */\nexport function appendItem(source: string, container: ObjectExpression | ArrayExpression, text: string): string {\n const { start, end } = container\n const items: Array<{ start: number; end: number } | null> = container.type === nodeTypes.objectExpression ? container.properties : container.elements\n const last = items.filter((item) => item !== null).at(-1)\n\n if (!last) {\n const inner = source.slice(start + 1, end - 1)\n // A comment inside the empty literal stays, after the new item.\n if (inner.trim()) return replaceText(source, start + 1, start + 1, /^\\s/.test(inner) ? `${text},` : `${text}, `)\n return replaceText(source, start, end, container.type === nodeTypes.objectExpression ? `{ ${text} }` : `[${text}]`)\n }\n\n const between = source.slice(last.end, end - 1)\n // The closing bracket shares the last item's line: add the item inline.\n if (!between.includes('\\n')) return replaceText(source, last.end, last.end, `, ${text}`)\n\n const lineStart = source.lastIndexOf('\\n', last.start - 1) + 1\n const indent = source.slice(lineStart).match(/^[ \\t]*/)?.[0] ?? ''\n // After the last item's comma and any comment on its line, so neither moves. `between` holds a\n // newline, so one always follows.\n const lineEnd = source.indexOf('\\n', last.end)\n const comma = /^\\s*,/.test(between)\n\n return `${source.slice(0, last.end)}${comma ? '' : ','}${source.slice(last.end, lineEnd)}\\n${indent}${text}${comma ? ',' : ''}${source.slice(lineEnd)}`\n}\n\n/** Drops the item at `index` from an object or array literal, with its own lines when it sits on them alone. */\nexport function removeItem(source: string, node: ObjectExpression | ArrayExpression, index: number): string {\n const items: Array<{ start: number; end: number }> =\n node.type === nodeTypes.objectExpression ? node.properties : node.elements.filter((element) => element !== null)\n if (items.length === 1) return replaceText(source, node.start, node.end, node.type === nodeTypes.objectExpression ? '{}' : '[]')\n\n const { start, end } = items[index]!\n const lineStart = source.lastIndexOf('\\n', start - 1) + 1\n const nextNewline = source.indexOf('\\n', end)\n const lineEnd = nextNewline === -1 ? source.length : nextNewline\n if (!source.slice(lineStart, start).trim() && /^\\s*,?\\s*(\\/\\/.*)?$/.test(source.slice(end, lineEnd))) {\n return replaceText(source, lineStart, Math.min(lineEnd + 1, source.length))\n }\n\n const next = items[index + 1]\n return next ? replaceText(source, start, next.start) : replaceText(source, items[index - 1]!.end, end)\n}\n","import type { ExtensionKind } from '@kubb/core'\nimport { getErrorMessage, read, writeRaw } from '@internals/utils'\nimport {\n type AssignmentExpression,\n type BindingProperty,\n type CallExpression,\n type Comment,\n type Expression,\n type ImportDeclaration,\n type ObjectExpression,\n type ObjectPropertyKind,\n type Program,\n type RestElement,\n type SpreadElement,\n type VariableDeclaration,\n commentTypes,\n nodeTypes,\n parseExpression,\n parseSource,\n propertyKinds,\n unaryOperators,\n} from './ast.ts'\nimport { isAllowedPlugin, isOptionValue, isOutputKey, isOutputValue, isSafeKey, pickOutput, toExportName } from './rules.ts'\nimport { appendItem, getPosition, IDENTIFIER_PATTERN, printKey, printValue, quotes, type Quote, removeItem, replaceText, wrapPath } from './text.ts'\nimport {\n type ConfigEdit,\n ConfigEditOperation,\n type ConfigEditOutcome,\n type ConfigFileView,\n type ConfigRef,\n type ConfigView,\n extensionKinds,\n type InstalledExtensions,\n type OptionsView,\n type OptionValue,\n type PluginView,\n} from './types.ts'\n\n/** The marker `disable-plugin` writes, with the block's line count so `enable-plugin` restores exactly those lines. */\nconst DISABLED_MARKER_PATTERN = /^kubb:disabled (.+)\\s+(\\d+)$/\n\nconst OPERATIONS = new Set<string>(Object.values(ConfigEditOperation))\nconst OPTION_OPERATIONS = new Set<string>([ConfigEditOperation.SET_OPTION, ConfigEditOperation.REMOVE_OPTION])\nconst OUTPUT_OPERATIONS = new Set<string>([ConfigEditOperation.SET_OUTPUT, ConfigEditOperation.REMOVE_OUTPUT])\nconst KINDS = new Set<string>(Object.values(extensionKinds))\n\n/** Identifiers the editor matches by name. */\nconst identifiers = { defineConfig: 'defineConfig', require: 'require', module: 'module', exports: 'exports' } as const\n\nconst moduleKinds = { esm: 'esm', cjs: 'cjs' } as const\ntype ModuleKind = (typeof moduleKinds)[keyof typeof moduleKinds]\n\ntype EditResult = { source: string } | { reason: string }\ntype ParsedConfig = { program: Program; comments: Array<Comment>; configs: Array<ObjectExpression>; kind: ModuleKind }\ntype ValueNode = Expression | SpreadElement | null | undefined\ntype Import = { from: string; exported: string }\ntype FactoryCall = { importName: string; exportName: string; packageName: string; call: CallExpression }\ntype DisabledBlock = { packageName: string; line: number; end: number; code: Array<string> }\ntype OutputEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.SET_OUTPUT | typeof ConfigEditOperation.REMOVE_OUTPUT }>\ntype OptionEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.SET_OPTION | typeof ConfigEditOperation.REMOVE_OPTION }>\ntype AddPluginEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.ADD_PLUGIN }>\ntype DisablePluginEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.DISABLE_PLUGIN }>\ntype RemoveExtensionEdit = Extract<ConfigEdit, { operation: typeof ConfigEditOperation.REMOVE_EXTENSION }>\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value !== ''\n}\n\n/** Edits cross the wire, so their shape is checked before anything reads them. */\nfunction validateEdit(edit: ConfigEdit): string | undefined {\n const { operation, plugin, config, path, kind, input } = (typeof edit === 'object' && edit !== null ? edit : {}) as Record<string, unknown>\n\n if (typeof operation !== 'string' || !OPERATIONS.has(operation)) return `unknown operation ${JSON.stringify(operation)}`\n if (config !== undefined && typeof config !== 'string' && !Number.isSafeInteger(config)) return 'config must name an entry or give its index'\n\n if (operation === ConfigEditOperation.SET_INPUT) {\n return typeof input === 'string' && input.trim() !== '' ? undefined : 'the edit names no input'\n }\n\n const isOption = OPTION_OPERATIONS.has(operation)\n const isOutput = OUTPUT_OPERATIONS.has(operation)\n\n if (!isOutput && !isNonEmptyString(plugin)) return 'the edit names no plugin'\n\n if (kind !== undefined) {\n if (typeof kind !== 'string' || !KINDS.has(kind)) return `unknown kind ${JSON.stringify(kind)}`\n const takesKind = operation === ConfigEditOperation.ADD_PLUGIN || operation === ConfigEditOperation.REMOVE_EXTENSION\n if (takesKind && kind === extensionKinds.adapter) return `${operation} takes a plugin or a parser, since a config has one adapter`\n if (!isOption && !takesKind) return `${operation} edits the plugins array, so it takes no kind`\n }\n\n if (!isOption && !isOutput) return undefined\n\n if (!Array.isArray(path) || !path.every(isNonEmptyString)) return 'path must be a list of option names'\n if (path.length === 0) return 'no option path given'\n\n const unsafe = path.find((key) => !isSafeKey(key))\n if (unsafe !== undefined) return `${unsafe} cannot be used as an option name`\n\n if (isOutput && !isOutputKey(path[0]!)) return `output.${path[0]} can only be changed in the config file`\n\n return undefined\n}\n\n// Finding the config\n\n/** Steps through `as`/`satisfies` and `() => ...` wrappers to the config object. */\nfunction unwrapValue(node: ValueNode): ValueNode {\n if (!node) return undefined\n if (node.type === nodeTypes.tSAsExpression || node.type === nodeTypes.tSSatisfiesExpression) return unwrapValue(node.expression)\n if (node.type !== nodeTypes.arrowFunctionExpression && node.type !== nodeTypes.functionExpression) return node\n if (node.body?.type !== nodeTypes.blockStatement) return unwrapValue(node.body as Expression | null)\n\n const returned = node.body.body.find((statement) => statement.type === nodeTypes.returnStatement)\n return unwrapValue(returned?.type === nodeTypes.returnStatement ? returned.argument : undefined)\n}\n\nfunction isModuleExports(node: AssignmentExpression['left']): boolean {\n return (\n node.type === nodeTypes.memberExpression &&\n !node.computed &&\n node.object.type === nodeTypes.identifier &&\n node.object.name === identifiers.module &&\n node.property.type === nodeTypes.identifier &&\n node.property.name === identifiers.exports\n )\n}\n\n/** The exported config value and how the file exports it. */\nfunction findExport(program: Program): { exported: ValueNode; kind: ModuleKind } {\n for (const node of program.body) {\n if (node.type === nodeTypes.exportDefaultDeclaration) {\n // A `function` or `class` declaration is never a `defineConfig(...)` call, so `findConfigs` refuses it.\n return { exported: node.declaration as Expression, kind: moduleKinds.esm }\n }\n if (node.type === nodeTypes.expressionStatement && node.expression.type === nodeTypes.assignmentExpression && isModuleExports(node.expression.left)) {\n return { exported: node.expression.right, kind: moduleKinds.cjs }\n }\n }\n return { exported: undefined, kind: moduleKinds.esm }\n}\n\n/** Every config object in `export default` or `module.exports = defineConfig(...)`, or why the file is unmanaged. */\nfunction findConfigs(source: string): ParsedConfig | { reason: string } {\n const parsed = parseSource(source)\n if ('reason' in parsed) return parsed\n\n const { exported, kind } = findExport(parsed.program)\n const value = unwrapValue(exported)\n if (!value) return { reason: 'no `export default` or `module.exports` found' }\n if (value.type !== nodeTypes.callExpression || value.callee.type !== nodeTypes.identifier || value.callee.name !== identifiers.defineConfig) {\n return { reason: 'the exported config is not a defineConfig(...) call' }\n }\n\n const argument = unwrapValue(value.arguments[0])\n if (!argument) return { reason: 'defineConfig(...) was called without a config' }\n\n const entries = argument.type === nodeTypes.arrayExpression ? argument.elements.map((element) => unwrapValue(element)) : [argument]\n const configs = entries.filter((entry): entry is ObjectExpression => entry?.type === nodeTypes.objectExpression)\n if (configs.length !== entries.length) return { reason: 'config is not an object literal' }\n\n return { ...parsed, configs, kind }\n}\n\nfunction findConfigEntry(configs: Array<ObjectExpression>, ref: ConfigRef | undefined): ObjectExpression | undefined {\n return typeof ref === 'string' ? configs.find((entry) => getConfigName(entry) === ref) : configs[ref ?? 0]\n}\n\n// Reading object literals\n\nfunction getKey(entry: ObjectPropertyKind | BindingProperty | RestElement): string | undefined {\n if (entry.type !== nodeTypes.property || entry.computed) return undefined\n if (entry.key.type === nodeTypes.identifier) return entry.key.name\n return entry.key.type === nodeTypes.literal && typeof entry.key.value === 'string' ? entry.key.value : undefined\n}\n\n/** The last one wins when the key repeats, as at runtime. */\nfunction findProperty(node: ObjectExpression, key: string): { member: ObjectPropertyKind; index: number } | undefined {\n const index = node.properties.findLastIndex((entry) => getKey(entry) === key)\n return index === -1 ? undefined : { member: node.properties[index]!, index }\n}\n\nfunction getValue(node: ObjectExpression, key: string): ValueNode {\n const member = findProperty(node, key)?.member\n return member?.type === nodeTypes.property ? member.value : member\n}\n\nfunction getConfigName(config: ObjectExpression): string | undefined {\n const name = getValue(config, 'name')\n return name?.type === nodeTypes.literal && typeof name.value === 'string' ? name.value : undefined\n}\n\nfunction isOverridden(node: ObjectExpression, index: number): boolean {\n return node.properties.slice(index + 1).some((entry) => entry.type === nodeTypes.spreadElement)\n}\n\n/** `key: value`, not a method, getter, setter, or `{ key }` shorthand. */\nfunction isPlainProperty(member: Extract<ObjectPropertyKind, { type: typeof nodeTypes.property }>): boolean {\n return !member.method && !member.shorthand && member.kind === propertyKinds.init\n}\n\n/** A literal's value, `undefined` for code. */\nfunction readLiteral(node: ValueNode): OptionValue | undefined {\n switch (node?.type) {\n case nodeTypes.literal:\n // A bigint or a regex is code, not a value JSON can carry. A regex Node cannot compile also has a `null` value.\n return 'regex' in node || 'bigint' in node ? undefined : (node.value as OptionValue)\n case nodeTypes.templateLiteral:\n return node.expressions.length ? undefined : (node.quasis[0]?.value.cooked ?? '')\n case nodeTypes.unaryExpression: {\n const value = readLiteral(node.argument)\n if (typeof value !== 'number') return undefined\n if (node.operator === unaryOperators.minus) return -value\n if (node.operator === unaryOperators.plus) return value\n return undefined\n }\n case nodeTypes.arrayExpression: {\n const values = node.elements.map((element) => readLiteral(element))\n return values.every((value) => value !== undefined) ? values : undefined\n }\n case nodeTypes.objectExpression: {\n const entries: Record<string, OptionValue> = {}\n for (const entry of node.properties) {\n if (entry.type !== nodeTypes.property) return undefined\n const key = getKey(entry)\n const value = readLiteral(entry.value)\n // A `__proto__` key would replace the object's prototype instead of adding an entry.\n if (key === undefined || !isSafeKey(key) || value === undefined) return undefined\n entries[key] = value\n }\n return entries\n }\n }\n return undefined\n}\n\n// Imports and factory calls\n\nfunction getRequirePath(node: ValueNode): string | undefined {\n if (node?.type !== nodeTypes.callExpression || node.callee.type !== nodeTypes.identifier || node.callee.name !== identifiers.require) return undefined\n const [argument] = node.arguments\n return argument?.type === nodeTypes.literal && typeof argument.value === 'string' ? argument.value : undefined\n}\n\n/** `import { exported as local } from '...'`. A default or namespace import has no exported name, so its local name stands in. */\nfunction importBindings(statement: ImportDeclaration): Array<[string, Import]> {\n return statement.specifiers.map((specifier) => {\n const imported = specifier.type === nodeTypes.importSpecifier ? specifier.imported : specifier.local\n const exported = imported.type === nodeTypes.identifier ? imported.name : imported.value\n return [specifier.local.name, { from: statement.source.value, exported }]\n })\n}\n\n/** `const { exported: local } = require('...')`. */\nfunction requireBindings(statement: VariableDeclaration): Array<[string, Import]> {\n return statement.declarations.flatMap((declarator): Array<[string, Import]> => {\n const from = getRequirePath(declarator.init)\n if (from === undefined || declarator.id.type !== nodeTypes.objectPattern) return []\n\n return declarator.id.properties.flatMap((entry): Array<[string, Import]> => {\n if (entry.type !== nodeTypes.property || entry.value.type !== nodeTypes.identifier) return []\n return [[entry.value.name, { from, exported: getKey(entry) ?? entry.value.name }]]\n })\n })\n}\n\nfunction getImports(program: Program): Map<string, Import> {\n return new Map(\n program.body.flatMap((statement) => {\n if (statement.type === nodeTypes.importDeclaration) return importBindings(statement)\n if (statement.type === nodeTypes.variableDeclaration) return requireBindings(statement)\n return []\n }),\n )\n}\n\nfunction isImportStatement(node: Program['body'][number], kind: ModuleKind): boolean {\n if (kind === moduleKinds.esm) return node.type === nodeTypes.importDeclaration\n return node.type === nodeTypes.variableDeclaration && node.declarations.some((declarator) => getRequirePath(declarator.init) !== undefined)\n}\n\n/** The quote of the first string literal in the file, so new code matches it. */\nfunction detectQuote(node: unknown): Quote | undefined {\n if (!node || typeof node !== 'object') return undefined\n const { type, raw } = node as { type?: string; raw?: unknown }\n if (type === nodeTypes.literal && typeof raw === 'string' && (raw[0] === quotes.single || raw[0] === quotes.double)) return raw[0]\n for (const child of Object.values(node)) {\n const quote = detectQuote(child)\n if (quote) return quote\n }\n return undefined\n}\n\n/** The `adapter` value, or the elements of the `plugins` or `parsers` array. */\nfunction factoryNodes(config: ObjectExpression, kind: ExtensionKind): Array<ValueNode> {\n if (kind === extensionKinds.adapter) return [getValue(config, 'adapter')]\n const array = getValue(config, `${kind}s`)\n return array?.type === nodeTypes.arrayExpression ? array.elements : []\n}\n\n/** The factory calls of one kind whose callee the file imports. */\nfunction findCalls(program: Program, config: ObjectExpression, kind: ExtensionKind = extensionKinds.plugin): Array<FactoryCall> {\n const imports = getImports(program)\n return factoryNodes(config, kind).flatMap((node) => {\n if (node?.type !== nodeTypes.callExpression || node.callee.type !== nodeTypes.identifier) return []\n const imported = imports.get(node.callee.name)\n return imported ? [{ importName: node.callee.name, exportName: imported.exported, packageName: imported.from, call: node }] : []\n })\n}\n\n// Disabled plugins\n\n/** Whether nothing but whitespace precedes `offset` on its line. */\nfunction startsLine(source: string, offset: number): boolean {\n return source.slice(source.lastIndexOf('\\n', offset - 1) + 1, offset).trim() === ''\n}\n\n/** The `disable-plugin` blocks in this config, read from marker comments since the call is no longer a node. */\nfunction findDisabled(source: string, comments: Array<Comment>, config: ObjectExpression): Array<DisabledBlock> {\n const lines = source.split('\\n')\n\n return comments.flatMap((comment) => {\n const match = comment.type === commentTypes.line ? comment.value.trim().match(DISABLED_MARKER_PATTERN) : null\n // Only markers inside this entry, on a line of their own, so another entry or a trailing comment never matches.\n if (!match || comment.start < config.start || comment.end > config.end || !startsLine(source, comment.start)) return []\n\n const line = getPosition(source, comment.start).line\n const end = line + Number(match[2])\n const code = lines.slice(line, end).map((text) => text.replace(/^(\\s*)\\/\\/ ?/, '$1').replace(/^\\s+$/, ''))\n return [{ packageName: match[1]!, line, end, code }]\n })\n}\n\n// Reading options\n\n/** Literal members as `value` and code paths as `locked`, `undefined` for a computed key. */\nfunction readEditable(node: ObjectExpression, prefix: Array<string> = []): { value: Record<string, OptionValue>; locked: Array<Array<string>> } | undefined {\n const value: Record<string, OptionValue> = {}\n const locked: Array<Array<string>> = []\n\n for (const [index, entry] of node.properties.entries()) {\n if (entry.type === nodeTypes.spreadElement) continue\n const key = getKey(entry)\n if (key === undefined) return undefined\n if (findProperty(node, key)?.index !== index) continue\n\n const path = [...prefix, key]\n // A `__proto__` key replaces the prototype, so it reads as code.\n if (!isSafeKey(key)) {\n locked.push(path)\n continue\n }\n\n const member = isOverridden(node, index) ? undefined : entry.value\n const literal = readLiteral(member)\n if (literal !== undefined) {\n value[key] = literal\n continue\n }\n if (member?.type !== nodeTypes.objectExpression) {\n locked.push(path)\n continue\n }\n\n const nested = readEditable(member, path)\n if (!nested) return undefined\n value[key] = nested.value\n locked.push(...nested.locked)\n }\n return { value, locked }\n}\n\nfunction readObjectOptions(options: ObjectExpression): OptionsView {\n const entries: OptionsView = {}\n for (const [index, entry] of options.properties.entries()) {\n const key = getKey(entry)\n if (key === undefined || !isSafeKey(key)) continue\n\n const member = entry.type === nodeTypes.property && !isOverridden(options, index) ? entry.value : undefined\n const value = readLiteral(member)\n if (value !== undefined) {\n entries[key] = { literal: true, value }\n continue\n }\n entries[key] = { literal: false, ...(member?.type === nodeTypes.objectExpression ? readEditable(member) : undefined) }\n }\n return entries\n}\n\nfunction readCallOptions(call: CallExpression): OptionsView {\n const options = call.arguments[0]\n return options?.type === nodeTypes.objectExpression ? readObjectOptions(options) : {}\n}\n\nfunction readDisabledOptions(code: Array<string>): OptionsView {\n const call = parseExpression(code.join('\\n').trim().replace(/,$/, ''))\n return call?.type === nodeTypes.callExpression ? readCallOptions(call) : {}\n}\n\nfunction toPluginView({ importName, packageName, call }: FactoryCall): PluginView {\n return { importName, packageName, options: readCallOptions(call) }\n}\n\n/** Active and disabled plugins, in source order so a disabled plugin keeps its place. */\nfunction readPlugins({ source, parsed, config }: { source: string; parsed: ParsedConfig; config: ObjectExpression }): Array<PluginView> {\n const importNames = new Map([...getImports(parsed.program)].map(([local, { from }]) => [from, local]))\n\n const active = findCalls(parsed.program, config).map((call) => ({ line: getPosition(source, call.call.start).line, plugin: toPluginView(call) }))\n const disabled = findDisabled(source, parsed.comments, config).map(({ packageName, line, code }) => ({\n line,\n plugin: {\n importName: importNames.get(packageName) ?? toExportName(packageName),\n packageName,\n options: readDisabledOptions(code),\n disabled: true as const,\n },\n }))\n\n return [...active, ...disabled].sort((a, b) => a.line - b.line).map(({ plugin }) => plugin)\n}\n\nfunction readConfigView({ source, parsed, config }: { source: string; parsed: ParsedConfig; config: ObjectExpression }): ConfigView {\n const [adapter] = findCalls(parsed.program, config, extensionKinds.adapter).map(toPluginView)\n const parsers = findCalls(parsed.program, config, extensionKinds.parser).map(toPluginView)\n const output = getOutput(config)\n\n return {\n name: getConfigName(config),\n plugins: readPlugins({ source, parsed, config }),\n ...(adapter && { adapter }),\n ...(parsers.length ? { parsers } : {}),\n ...(!('reason' in output) && { output: pickOutput(readObjectOptions(output.object)) }),\n }\n}\n\n/** Which plugins the file declares and which options Studio may write. */\nexport function readConfig(source: string): ConfigFileView {\n const parsed = findConfigs(source)\n if ('reason' in parsed) return { managed: false, reason: parsed.reason }\n\n return { managed: true, configs: parsed.configs.map((config) => readConfigView({ source, parsed, config })) }\n}\n\n/** The modules the file imports, empty when it cannot be parsed. */\nexport function readImports(source: string): Array<string> {\n const parsed = parseSource(source)\n if ('reason' in parsed) return []\n return [...new Set([...getImports(parsed.program).values()].map(({ from }) => from))]\n}\n\n// Editing options\n\ntype FoundPath = { object: ObjectExpression; index: number; value: Expression } | { object: ObjectExpression; missing: number } | { reason: string }\n\n/** Follows `path` to its literal, or to the first missing key. Refuses a value set in code. */\nfunction findPath(options: ObjectExpression, path: Array<string>): FoundPath {\n let object = options\n\n for (const [depth, key] of path.entries()) {\n const found = findProperty(object, key)\n if (!found) return { object, missing: depth }\n if (isOverridden(object, found.index)) {\n return { reason: `${path.slice(0, depth + 1).join('.')} can be overridden by a spread after it, so it is customized in code` }\n }\n\n const { member, index } = found\n const isLast = depth === path.length - 1\n if (isLast) {\n return member.type === nodeTypes.property && readLiteral(member.value) !== undefined\n ? { object, index, value: member.value }\n : { reason: `${path.join('.')} is customized in code` }\n }\n if (member.type !== nodeTypes.property || member.value.type !== nodeTypes.objectExpression) {\n return { reason: `${key} is not an object, so ${path.join('.')} cannot be reached` }\n }\n object = member.value\n }\n return { reason: 'no option path given' }\n}\n\nfunction setAtPath({\n source,\n options,\n path,\n value,\n quote,\n}: {\n source: string\n options: ObjectExpression\n path: Array<string>\n value: OptionValue\n quote: Quote\n}): EditResult {\n const target = findPath(options, path)\n if ('reason' in target) return target\n if ('missing' in target) {\n const [key, ...rest] = path.slice(target.missing)\n return { source: appendItem(source, target.object, `${printKey(key!, quote)}: ${printValue(wrapPath(rest, value), quote)}`) }\n }\n return { source: replaceText(source, target.value.start, target.value.end, printValue(value, quote)) }\n}\n\nfunction removeAtPath({ source, options, path }: { source: string; options: ObjectExpression; path: Array<string> }): EditResult {\n const target = findPath(options, path)\n if ('reason' in target) return target\n if ('missing' in target) return { source }\n return { source: removeItem(source, target.object, target.index) }\n}\n\nfunction setOption(source: string, call: CallExpression, path: Array<string>, value: unknown, quote: Quote): EditResult {\n if (!isOptionValue(value)) return { reason: 'the value is not a literal that can be written to a config file' }\n\n const options = call.arguments[0]\n if (!options) {\n const closing = call.end - 1\n if (source[closing] !== ')') return { reason: 'the factory call could not be located in the file' }\n return { source: replaceText(source, closing, closing, printValue(wrapPath(path, value), quote)) }\n }\n if (options.type !== nodeTypes.objectExpression) return { reason: 'the factory was not called with an object literal' }\n return setAtPath({ source, options, path, value, quote })\n}\n\nfunction removeOption(source: string, call: CallExpression, path: Array<string>): EditResult {\n const options = call.arguments[0]\n if (!options) return { source }\n if (options.type !== nodeTypes.objectExpression) return { reason: 'the factory was not called with an object literal' }\n return removeAtPath({ source, options, path })\n}\n\nfunction editOption({\n source,\n parsed,\n config,\n edit,\n quote,\n extensions,\n}: {\n source: string\n parsed: ParsedConfig\n config: ObjectExpression\n edit: OptionEdit\n quote: Quote\n extensions: InstalledExtensions\n}): EditResult {\n const kind = edit.kind ?? extensionKinds.plugin\n // A package can ship several factories (`parserTs`, `parserTsx`), so prefer the export its manifest names.\n const calls = findCalls(parsed.program, config, kind).filter((entry) => entry.packageName === edit.plugin)\n const exportName = extensions.get(edit.plugin)?.manifest.export ?? toExportName(edit.plugin)\n const call = (calls.find((entry) => entry.exportName === exportName) ?? calls[0])?.call\n\n if (!call) {\n if (kind === extensionKinds.adapter) return { reason: `${edit.plugin} is not the config's adapter` }\n const disabled = kind === extensionKinds.plugin && findDisabled(source, parsed.comments, config).some((block) => block.packageName === edit.plugin)\n return { reason: disabled ? `${edit.plugin} is disabled, enable it first` : `${edit.plugin} is not in the ${kind}s array` }\n }\n\n if (edit.operation === ConfigEditOperation.SET_OPTION) return setOption(source, call, edit.path, edit.value, quote)\n return removeOption(source, call, edit.path)\n}\n\n// Editing the config's own fields\n\nfunction setInput(source: string, config: ObjectExpression, input: string, quote: Quote): EditResult {\n const value = printValue(input, quote)\n const found = findProperty(config, 'input')\n if (!found) return { source: appendItem(source, config, `input: ${value}`) }\n if (found.member.type !== nodeTypes.property || !isPlainProperty(found.member)) return { reason: 'input is not a plain property' }\n if (isOverridden(config, found.index)) return { reason: 'a spread after input could override it' }\n return { source: replaceText(source, found.member.value.start, found.member.value.end, value) }\n}\n\nfunction getOutput(config: ObjectExpression): { object: ObjectExpression } | { reason: string } {\n const found = findProperty(config, 'output')\n if (found?.member.type !== nodeTypes.property || found.member.value.type !== nodeTypes.objectExpression) return { reason: 'output is not an object literal' }\n if (isOverridden(config, found.index)) return { reason: 'a spread after output could override it' }\n return { object: found.member.value }\n}\n\nfunction editOutput({ source, config, edit, quote }: { source: string; config: ObjectExpression; edit: OutputEdit; quote: Quote }): EditResult {\n const output = getOutput(config)\n if ('reason' in output) return output\n if (edit.operation === ConfigEditOperation.REMOVE_OUTPUT) return removeAtPath({ source, options: output.object, path: edit.path })\n\n const [key, ...rest] = edit.path\n if (!isOptionValue(edit.value) || !isOutputValue({ key: key!, value: wrapPath(rest, edit.value) }))\n return { reason: `the value is not one output.${key} takes` }\n return setAtPath({ source, options: output.object, path: edit.path, value: edit.value, quote })\n}\n\n// Adding, disabling, and enabling plugins\n\n/** Adds the import after the last one, matching its semicolon style. */\nfunction addImport({\n source,\n parsed,\n importNames,\n moduleSpecifier,\n quote,\n}: {\n source: string\n parsed: ParsedConfig\n importNames: Array<string>\n moduleSpecifier: string\n quote: Quote\n}): string {\n const lastImport = parsed.program.body.findLast((node) => isImportStatement(node, parsed.kind))\n const afterLine = lastImport ? getPosition(source, lastImport.end).line : 0\n const lines = source.split('\\n')\n\n const semicolon = afterLine > 0 && lines[afterLine - 1]?.trimEnd().endsWith(';') ? ';' : ''\n const specifier = `${quote}${moduleSpecifier}${quote}`\n const statement =\n parsed.kind === moduleKinds.esm ? `import { ${importNames.join(', ')} } from ${specifier}` : `const { ${importNames.join(', ')} } = require(${specifier})`\n\n lines.splice(afterLine, 0, `${statement}${semicolon}`)\n if (afterLine === 0) lines.splice(1, 0, '')\n\n return lines.join('\\n')\n}\n\n/**\n * The parsers `defineConfig` applies when a config sets no `parsers`, by import name. Adding a parser\n * to such a config writes these too, or the new array would replace them.\n */\nconst DEFAULT_PARSERS = [\n { importName: 'parserTs', packageName: '@kubb/parser-ts' },\n { importName: 'parserTsx', packageName: '@kubb/parser-ts' },\n { importName: 'parserMd', packageName: '@kubb/parser-md' },\n] as const\n\n/**\n * Adds a plugin to `plugins`, or with `kind: 'parser'` a parser to `parsers`. Replaying the same add\n * is a no-op, while an import name taken by another package is an error.\n */\nfunction addPlugin({\n source,\n parsed,\n config,\n edit,\n quote,\n extensions,\n}: {\n source: string\n parsed: ParsedConfig\n config: ObjectExpression\n edit: AddPluginEdit\n quote: Quote\n extensions: InstalledExtensions\n}): EditResult {\n const kind = edit.kind ?? extensionKinds.plugin\n const isParser = kind === extensionKinds.parser\n if (!isAllowedPlugin({ packageName: edit.plugin, extensions, kind })) {\n return {\n reason: isParser ? `\"${edit.plugin}\" is not an installed Kubb parser` : `\"${edit.plugin}\" is not a @kubb/plugin-* package or an installed Kubb plugin`,\n }\n }\n\n const importName = extensions.get(edit.plugin)?.manifest.export ?? toExportName(edit.plugin)\n if (!IDENTIFIER_PATTERN.test(importName)) return { reason: `\"${importName}\" is not a valid import name` }\n // A package can ship several parsers (`parserTs` and `parserTsx`), so a parser is matched by its export too.\n if (findCalls(parsed.program, config, kind).some((entry) => entry.packageName === edit.plugin && (!isParser || entry.exportName === importName))) {\n return { source }\n }\n\n const options = edit.options ?? {}\n if (!isOptionValue(options)) return { reason: 'the options are not literals that can be written to a config file' }\n\n const key = `${kind}s`\n const array = getValue(config, key)\n if (array ? array.type !== nodeTypes.arrayExpression : !isParser) return { reason: `${key} is not an array literal` }\n // A config without `parsers` runs the defaults, so the new array lists them before the added parser.\n const defaults = isParser && !array ? DEFAULT_PARSERS.filter((parser) => parser.importName !== importName) : []\n\n // The missing imports by package, so `parserTs` and `parserTsx` share one line.\n const imports = getImports(parsed.program)\n const missing = new Map<string, Array<string>>()\n for (const item of [...defaults, { importName, packageName: edit.plugin }]) {\n const from = imports.get(item.importName)?.from\n if (from && from !== item.packageName) return { reason: `${item.importName} is already imported from ${from}` }\n if (!from) missing.set(item.packageName, [...(missing.get(item.packageName) ?? []), item.importName])\n }\n\n // The array sits below the imports, so adding to it first leaves the import lines where they are.\n const call = `${importName}(${Object.keys(options).length ? printValue(options, quote) : ''})`\n const next =\n array?.type === nodeTypes.arrayExpression\n ? appendItem(source, array, call)\n : appendItem(source, config, `parsers: [${[...defaults.map((parser) => `${parser.importName}()`), call].join(', ')}]`)\n\n return {\n source: [...missing].reduceRight(\n (current, [moduleSpecifier, importNames]) => addImport({ source: current, parsed, importNames, moduleSpecifier, quote }),\n next,\n ),\n }\n}\n\n/** One item per line, so a call can be commented out alone. Skipped when comments sit between items. */\nfunction splitPlugins(source: string, config: ObjectExpression): string | undefined {\n const array = getValue(config, 'plugins')\n if (array?.type !== nodeTypes.arrayExpression) return undefined\n\n const items = array.elements.flatMap((element) => (element ? [element] : []))\n const { start, end } = array\n const gaps = [source.slice(start + 1, items[0]?.start ?? end - 1), ...items.map((item, index) => source.slice(item.end, items[index + 1]?.start ?? end - 1))]\n if (!items.length || gaps.some((gap) => !/^[\\s,]*$/.test(gap))) return undefined\n\n const lineStart = source.lastIndexOf('\\n', start - 1) + 1\n const indent = source.slice(lineStart).match(/^[ \\t]*/)?.[0] ?? ''\n const lines = items.map((item) => `${indent} ${source.slice(item.start, item.end)},`)\n\n return replaceText(source, start, end, `[\\n${lines.join('\\n')}\\n${indent}]`)\n}\n\nfunction disablePlugin(source: string, program: Program, config: ObjectExpression, plugin: string): EditResult {\n const call = findCalls(program, config).find((entry) => entry.packageName === plugin)?.call\n if (!call) return { reason: `${plugin} is not in the plugins array` }\n\n const start = getPosition(source, call.start)\n const end = getPosition(source, call.end)\n const lines = source.split('\\n')\n const from = start.line - 1\n const to = end.line - 1\n const firstLine = lines[from] ?? ''\n\n // Only safe when the call sits alone on its lines: anything else on its first line, or on its last\n // line besides a trailing comma, would be swallowed into the comment and corrupt the file.\n if (firstLine.slice(0, start.column).trim() || !/^,?\\s*$/.test((lines[to] ?? '').slice(end.column))) {\n return { reason: `${plugin} shares a line with other code, so it cannot be commented out safely` }\n }\n\n const indent = firstLine.match(/^\\s*/)?.[0] ?? ''\n const commented = lines.slice(from, to + 1).map((line) => (line.trim() ? `${indent}// ${line.slice(indent.length)}` : `${indent}//`))\n lines.splice(from, commented.length, `${indent}// kubb:disabled ${plugin} ${commented.length}`, ...commented)\n\n return { source: lines.join('\\n') }\n}\n\n/** Disables the plugin, first putting a one-line `plugins: [a(), b()]` (what `add-plugin` writes) on separate lines. */\nfunction disablePluginInConfig({\n source,\n parsed,\n config,\n edit,\n}: {\n source: string\n parsed: ParsedConfig\n config: ObjectExpression\n edit: DisablePluginEdit\n}): EditResult {\n const result = disablePlugin(source, parsed.program, config, edit.plugin)\n if (!('reason' in result) || !result.reason.includes('shares a line')) return result\n\n const split = splitPlugins(source, config)\n if (split === undefined) return result\n\n const reparsed = findConfigs(split)\n const reparsedConfig = 'reason' in reparsed ? undefined : findConfigEntry(reparsed.configs, edit.config)\n if ('reason' in reparsed || !reparsedConfig) return result\n\n return disablePlugin(split, reparsed.program, reparsedConfig, edit.plugin)\n}\n\nfunction enablePlugin(source: string, comments: Array<Comment>, config: ObjectExpression, plugin: string): EditResult {\n const block = findDisabled(source, comments, config).find((entry) => entry.packageName === plugin)\n if (!block) return { reason: `${plugin} is not disabled` }\n\n const lines = source.split('\\n')\n lines.splice(block.line - 1, block.end - block.line + 1, ...block.code)\n return { source: lines.join('\\n') }\n}\n\n// Removing extensions\n\n/** Drops the import statements of `packageName` once nothing else in the file uses their names. */\nfunction removeUnusedImports(source: string, packageName: string): string {\n const parsed = parseSource(source)\n if ('reason' in parsed) return source\n\n // From the last statement up, so the offsets of the earlier ones stay valid.\n return parsed.program.body.reduceRight((current, statement) => {\n const bindings =\n statement.type === nodeTypes.importDeclaration\n ? importBindings(statement)\n : statement.type === nodeTypes.variableDeclaration\n ? requireBindings(statement)\n : []\n if (!bindings.length || bindings.some(([, { from }]) => from !== packageName)) return current\n\n const rest = replaceText(current, statement.start, statement.end)\n if (bindings.some(([local]) => new RegExp(`(?<![\\\\w$])${local.replaceAll('$', '\\\\$')}(?![\\\\w$])`).test(rest))) return current\n\n const lineStart = current.lastIndexOf('\\n', statement.start - 1) + 1\n const lineEnd = current.indexOf('\\n', statement.end)\n const after = lineEnd === -1 ? current.length : lineEnd + 1\n // At the top of the file, the blank line after the import goes too, so the file does not start with one.\n return replaceText(current, lineStart, lineStart === 0 && current[after] === '\\n' ? after + 1 : after)\n }, source)\n}\n\n/**\n * Removes every call of a plugin or parser package, and the block `disable-plugin` commented out,\n * then its unused imports. Removing what the config does not hold is a no-op. Refuses to empty\n * `parsers`, since a config with no parser cannot print files.\n */\nfunction removeExtension(source: string, edit: RemoveExtensionEdit): EditResult {\n const kind = edit.kind ?? extensionKinds.plugin\n let current = source\n\n // One call at a time, re-parsing in between, since each removal moves the ones after it.\n for (;;) {\n const parsed = findConfigs(current)\n if ('reason' in parsed) return parsed\n const config = findConfigEntry(parsed.configs, edit.config)\n if (!config) return { reason: `no config entry found for ${JSON.stringify(edit.config)}` }\n\n const array = getValue(config, `${kind}s`)\n const calls = findCalls(parsed.program, config, kind).filter((entry) => entry.packageName === edit.plugin)\n const block = findDisabled(current, parsed.comments, config).find((entry) => entry.packageName === edit.plugin)\n\n if (calls[0] && array?.type === nodeTypes.arrayExpression) {\n const elements = array.elements.filter((element) => element !== null)\n if (kind === extensionKinds.parser && elements.length === calls.length) return { reason: `${edit.plugin} is the last parser in the parsers array` }\n current = removeItem(current, array, elements.indexOf(calls[0].call))\n continue\n }\n if (block && kind === extensionKinds.plugin) {\n const lines = current.split('\\n')\n lines.splice(block.line - 1, block.end - block.line + 1)\n current = lines.join('\\n')\n continue\n }\n return { source: current === source ? source : removeUnusedImports(current, edit.plugin) }\n }\n}\n\n// Applying edits\n\n/** Every edit re-parses the file, since the previous one rewrote it. */\nfunction applyEdit({ source, edit, extensions }: { source: string; edit: ConfigEdit; extensions: InstalledExtensions }): EditResult {\n const parsed = findConfigs(source)\n if ('reason' in parsed) return parsed\n\n const config = findConfigEntry(parsed.configs, edit.config)\n if (!config) return { reason: `no config entry found for ${JSON.stringify(edit.config)}` }\n const quote = detectQuote(parsed.program) ?? quotes.single\n\n switch (edit.operation) {\n case ConfigEditOperation.SET_INPUT:\n return setInput(source, config, edit.input, quote)\n case ConfigEditOperation.SET_OUTPUT:\n case ConfigEditOperation.REMOVE_OUTPUT:\n return editOutput({ source, config, edit, quote })\n case ConfigEditOperation.DISABLE_PLUGIN:\n return disablePluginInConfig({ source, parsed, config, edit })\n case ConfigEditOperation.ENABLE_PLUGIN:\n return enablePlugin(source, parsed.comments, config, edit.plugin)\n case ConfigEditOperation.ADD_PLUGIN:\n return addPlugin({ source, parsed, config, edit, quote, extensions })\n case ConfigEditOperation.REMOVE_EXTENSION:\n return removeExtension(source, edit)\n case ConfigEditOperation.SET_OPTION:\n case ConfigEditOperation.REMOVE_OPTION:\n return editOption({ source, parsed, config, edit, quote, extensions })\n }\n}\n\n/** Applies edits in place, touching only the text each targets. A refused edit is reported and the rest still run. */\nexport function editConfig({ source, edits, extensions = new Map() }: { source: string; edits: Array<ConfigEdit>; extensions?: InstalledExtensions }): {\n source: string\n outcomes: Array<ConfigEditOutcome>\n changed: boolean\n} {\n let current = source\n\n const outcomes = edits.map((edit): ConfigEditOutcome => {\n const invalid = validateEdit(edit)\n if (invalid) return { edit, applied: false, reason: invalid }\n\n try {\n const result = applyEdit({ source: current, edit, extensions })\n if ('reason' in result) return { edit, applied: false, reason: result.reason }\n current = result.source\n return { edit, applied: true }\n } catch (error) {\n return { edit, applied: false, reason: getErrorMessage(error) }\n }\n })\n\n return { source: current, outcomes, changed: current !== source }\n}\n\n/** Applies `edits` to `filePath`, writing only when something changed. */\nexport async function editConfigFile({ filePath, edits, extensions }: { filePath: string; edits: Array<ConfigEdit>; extensions?: InstalledExtensions }) {\n const current = await read(filePath)\n const result = editConfig({ source: current, edits, extensions })\n if (result.changed) await writeRaw(filePath, result.source)\n return result\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,QAAQ,MAAc,QAAyB;CACtD,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,KAC9E,KAAK,MAAM,CAAC;CAC5B,CAAC,CAAC,CACD,KAAK,EAAE,CAAC,CACR,QAAQ,iBAAiB,EAAE;AAChC;AAGA,MAAM,wBAAQ,IAAI,IAAoB;AACtC,MAAM,aAAa;AAE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AO;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"intro-9PB8sE8z.js","names":[],"sources":["../src/loggers/clackWriter.ts","../src/loggers/plainWriter.ts","../src/ui/log.ts","../src/ui/intro.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport type { LoggerWriter } from './types.ts'\n\n/**\n * Draws with clack for local development: a gutter bar per group, animated steps, and a progress\n * bar for the writes.\n */\nexport const clackWriter: LoggerWriter = {\n audience: 'human',\n group: (title) => clack.intro(title),\n groupEnd: (text) => clack.outro(text),\n step: (text) => clack.log.step(text, { spacing: 0 }),\n info: (text) => clack.log.info(text),\n success: (text) => clack.log.success(text),\n warn: (text) => clack.log.warn(text),\n error: (text) => clack.log.error(text),\n block: (lines) => clack.log.message(lines, { spacing: 0 }),\n // A subprocess's output is not Kubb's tree, so it goes out past clack and its gutter bar. The\n // step above it is already stopped by the time this runs.\n raw: (lines) => console.log(styleText('dim', lines.join('\\n'))),\n // The diagnostic carries its own code and indented rows, so clear clack's gutter and bar and let\n // the block stand on its own.\n diagnostic: (lines) => clack.log.message(lines, { symbol: '', secondarySymbol: '' }),\n update: (lines, title) =>\n clack.box(lines.join('\\n'), title, {\n width: 'auto',\n formatBorder: (border: string) => styleText('yellow', border),\n rounded: true,\n withGuide: false,\n contentAlign: 'center',\n titleAlign: 'center',\n }),\n spinner: () => clack.spinner(),\n progress(max) {\n const bar = clack.progress({ style: 'block', max, size: 30 })\n\n return {\n start: (text) => bar.start(text),\n advance: (text) => bar.advance(1, text),\n stop: (text) => bar.stop(text),\n }\n },\n}\n","import type { LoggerWriter } from './types.ts'\n\n/**\n * Prefixes that stand in for the symbols clack draws, so plain output reads the same way.\n */\nexport const SYMBOLS = { info: 'ℹ', warn: '⚠', error: '✗', step: '◇' } as const\n\n/**\n * Draws with one `write` call per line, e.g. `console.error` so stdout carries only JSON. Nothing\n * animates, so a step prints at start and end.\n */\nexport function createPlainWriter(write: (line: string) => void): LoggerWriter {\n return {\n audience: 'agent',\n group: write,\n groupEnd: write,\n step: (text) => write(`${SYMBOLS.step} ${text}`),\n info: write,\n success: write,\n warn: write,\n error: (text) => write(`${SYMBOLS.error} ${text}`),\n block: (lines) => write(lines.join('\\n')),\n raw: (lines) => write(lines.join('\\n')),\n diagnostic: (lines) => write(lines.join('\\n')),\n update: (lines, title) => write([title, ...lines].join('\\n')),\n spinner: () => ({\n start: write,\n message: write,\n clear: () => {},\n stop: (text) => text && write(text),\n error: (text) => write(`${SYMBOLS.error} ${text}`),\n }),\n progress: () => ({\n start: write,\n advance: write,\n stop: (text) => text && write(text),\n }),\n }\n}\n\n/**\n * Draws on the console, for non-TTY environments and for an AI coding agent reading the output.\n * Reports the same run in the same order as `clackWriter`, without the animation.\n */\nexport const plainWriter = createPlainWriter((line) => console.log(line))\n","import * as prompts from '@clack/prompts'\nimport { isRichOutput } from '../utils/env.ts'\nimport { clackWriter } from '../loggers/clackWriter.ts'\nimport { plainWriter, SYMBOLS } from '../loggers/plainWriter.ts'\nimport type { LoggerWriter } from '../loggers/types.ts'\n\n/** The writer the loggers draw with on this terminal, so a command's own lines look like its run. */\nexport function writer(): LoggerWriter {\n return isRichOutput() ? clackWriter : plainWriter\n}\n\ntype Level = keyof typeof SYMBOLS\n\n// Not through the writers: in plain output a command's own info and warning carry their symbol, and clack's step keeps its spacing.\nfunction write(level: Level, message: string): void {\n if (isRichOutput()) {\n prompts.log[level](message)\n\n return\n }\n\n console.log(`${SYMBOLS[level]} ${message}`)\n}\n\n/** Prints lines as one block, without a symbol in front of them. Not the writer's block, which drops clack's spacing around it. */\nexport function logBlock(lines: string | Array<string>): void {\n if (isRichOutput()) {\n prompts.log.message(lines)\n\n return\n }\n\n console.log([lines].flat().join('\\n'))\n}\n\nexport function logInfo(message: string): void {\n write('info', message)\n}\n\nexport function logWarn(message: string): void {\n write('warn', message)\n}\n\nexport function logError(message: string): void {\n write('error', message)\n}\n\n/**\n * Reports a step the command is taking, rather than something it found.\n */\nexport function logStep(message: string): void {\n write('step', message)\n}\n","import { styleText } from 'node:util'\nimport * as prompts from '@clack/prompts'\nimport { isRichOutput } from '../utils/env.ts'\nimport { writer } from './log.ts'\n\nconst SPONSOR_TIPS = [\n 'Your sponsorship keeps Kubb codegen, plugins, and docs maintained',\n 'Sponsor faster generators and better Kubb Studio workflows',\n 'Help keep Kubb free for TypeScript teams building APIs',\n 'Support React Query, Zod, Faker, and MSW integrations',\n 'Back open-source tools that turn OpenAPI into TypeScript',\n 'Sponsor fixes, releases, and new plugins for your API workflow',\n 'Help Kubb stay independent and focused on developer tools',\n] as const\n\nconst SPONSOR_LINKS = ['https://github.com/sponsors/stijnvanhulle', 'https://opencollective.com/kubb', 'https://kubb.dev/sponsors'] as const\n\nfunction nextTip(): string {\n const tip = SPONSOR_TIPS[Math.floor(Math.random() * SPONSOR_TIPS.length)]!\n const link = SPONSOR_LINKS[Math.floor(Math.random() * SPONSOR_LINKS.length)]!\n return `${tip}: ${link}`\n}\n\nfunction formatTip(tip: string): string {\n return styleText('magenta', ' Tip ') + styleText('yellow', tip)\n}\n\n/**\n * Prints one random tip outside every group. Rich terminals get the styled variant;\n * plain/CI output gets a stable text-only line so the tip is still visible as final output.\n */\nexport function logTip(): void {\n const tip = nextTip()\n if (!isRichOutput()) {\n console.log(`Tip: ${tip}`)\n return\n }\n\n console.log(`${styleText('magenta', '✦')}${formatTip(tip)}`)\n}\n\ntype IntroOptions = {\n title?: string\n /**\n * Printed under the title, for a command that has a caveat to lead with.\n */\n warning?: string\n /**\n * Whether to open a block a later {@link logOutro} closes. Pass `false` for a command that\n * prints and exits, since nothing would ever close the block.\n *\n * @default true\n */\n block?: boolean\n}\n\n/**\n * Opens a command's output. A command the banner already names passes no title.\n */\nexport function logIntro({ title, warning, block = true }: IntroOptions): void {\n if (block && isRichOutput()) {\n if (title) prompts.intro(title)\n\n if (warning) {\n prompts.log.warn(warning)\n }\n\n return\n }\n\n if (title) {\n console.log(title)\n }\n\n if (warning) {\n console.warn(warning)\n }\n\n if (title || warning) {\n console.log()\n }\n}\n\n/**\n * Closes the block {@link logIntro} opened. The closing gutter is not a written line, so plain\n * output prints the text on its own.\n */\nexport function logOutro(text: string): void {\n writer().groupEnd(text)\n}\n\n/**\n * Prints one empty line between two groups, without clack's gutter bar, since the bar belongs to a\n * group and a spacer sits outside every one.\n */\nexport function logSpacer(): void {\n console.log('')\n}\n\n/** Whether a run stops to ask something: no `--yes`, no `--dry-run`, and a person at a terminal. */\nexport function isInteractiveRun({ yes, dryRun }: { yes?: unknown; dryRun?: unknown }): boolean {\n return !yes && !dryRun && process.stdin.isTTY === true\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,cAA4B;CACvC,UAAU;CACV,QAAQ,UAAU,MAAM,MAAM,KAAK;CACnC,WAAW,SAAS,MAAM,MAAM,IAAI;CACpC,OAAO,SAAS,MAAM,IAAI,KAAK,MAAM,EAAE,SAAS,EAAE,CAAC;CACnD,OAAO,SAAS,MAAM,IAAI,KAAK,IAAI;CACnC,UAAU,SAAS,MAAM,IAAI,QAAQ,IAAI;CACzC,OAAO,SAAS,MAAM,IAAI,KAAK,IAAI;CACnC,QAAQ,SAAS,MAAM,IAAI,MAAM,IAAI;CACrC,QAAQ,UAAU,MAAM,IAAI,QAAQ,OAAO,EAAE,SAAS,EAAE,CAAC;CAGzD,MAAM,UAAU,QAAQ,IAAI,UAAU,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC;CAG9D,aAAa,UAAU,MAAM,IAAI,QAAQ,OAAO;EAAE,QAAQ;EAAI,iBAAiB;CAAG,CAAC;CACnF,SAAS,OAAO,UACd,MAAM,IAAI,MAAM,KAAK,IAAI,GAAG,OAAO;EACjC,OAAO;EACP,eAAe,WAAmB,UAAU,UAAU,MAAM;EAC5D,SAAS;EACT,WAAW;EACX,cAAc;EACd,YAAY;CACd,CAAC;CACH,eAAe,MAAM,QAAQ;CAC7B,SAAS,KAAK;EACZ,MAAM,MAAM,MAAM,SAAS;GAAE,OAAO;GAAS;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,IAAI,SAAS,SACX,QAAQ,IAAI;AAEhB;;;;;AAMA,SAAgB,SAAS,MAAoB;CAC3C,OAAO,CAAC,CAAC,SAAS,IAAI;AACxB;;;;;AAMA,SAAgB,YAAkB;CAChC,QAAQ,IAAI,EAAE;AAChB;;AAGA,SAAgB,iBAAiB,EAAE,KAAK,UAAwD;CAC9F,OAAO,CAAC,OAAO,CAAC,UAAU,QAAQ,MAAM,UAAU;AACpD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"intro-YPaf1Imr.cjs","names":["clack","styleText","isRichOutput","styleText","isRichOutput"],"sources":["../src/loggers/clackWriter.ts","../src/loggers/plainWriter.ts","../src/ui/log.ts","../src/ui/intro.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport type { LoggerWriter } from './types.ts'\n\n/**\n * Draws with clack for local development: a gutter bar per group, animated steps, and a progress\n * bar for the writes.\n */\nexport const clackWriter: LoggerWriter = {\n audience: 'human',\n group: (title) => clack.intro(title),\n groupEnd: (text) => clack.outro(text),\n step: (text) => clack.log.step(text, { spacing: 0 }),\n info: (text) => clack.log.info(text),\n success: (text) => clack.log.success(text),\n warn: (text) => clack.log.warn(text),\n error: (text) => clack.log.error(text),\n block: (lines) => clack.log.message(lines, { spacing: 0 }),\n // A subprocess's output is not Kubb's tree, so it goes out past clack and its gutter bar. The\n // step above it is already stopped by the time this runs.\n raw: (lines) => console.log(styleText('dim', lines.join('\\n'))),\n // The diagnostic carries its own code and indented rows, so clear clack's gutter and bar and let\n // the block stand on its own.\n diagnostic: (lines) => clack.log.message(lines, { symbol: '', secondarySymbol: '' }),\n update: (lines, title) =>\n clack.box(lines.join('\\n'), title, {\n width: 'auto',\n formatBorder: (border: string) => styleText('yellow', border),\n rounded: true,\n withGuide: false,\n contentAlign: 'center',\n titleAlign: 'center',\n }),\n spinner: () => clack.spinner(),\n progress(max) {\n const bar = clack.progress({ style: 'block', max, size: 30 })\n\n return {\n start: (text) => bar.start(text),\n advance: (text) => bar.advance(1, text),\n stop: (text) => bar.stop(text),\n }\n },\n}\n","import type { LoggerWriter } from './types.ts'\n\n/**\n * Prefixes that stand in for the symbols clack draws, so plain output reads the same way.\n */\nexport const SYMBOLS = { info: 'ℹ', warn: '⚠', error: '✗', step: '◇' } as const\n\n/**\n * Draws with one `write` call per line, e.g. `console.error` so stdout carries only JSON. Nothing\n * animates, so a step prints at start and end.\n */\nexport function createPlainWriter(write: (line: string) => void): LoggerWriter {\n return {\n audience: 'agent',\n group: write,\n groupEnd: write,\n step: (text) => write(`${SYMBOLS.step} ${text}`),\n info: write,\n success: write,\n warn: write,\n error: (text) => write(`${SYMBOLS.error} ${text}`),\n block: (lines) => write(lines.join('\\n')),\n raw: (lines) => write(lines.join('\\n')),\n diagnostic: (lines) => write(lines.join('\\n')),\n update: (lines, title) => write([title, ...lines].join('\\n')),\n spinner: () => ({\n start: write,\n message: write,\n clear: () => {},\n stop: (text) => text && write(text),\n error: (text) => write(`${SYMBOLS.error} ${text}`),\n }),\n progress: () => ({\n start: write,\n advance: write,\n stop: (text) => text && write(text),\n }),\n }\n}\n\n/**\n * Draws on the console, for non-TTY environments and for an AI coding agent reading the output.\n * Reports the same run in the same order as `clackWriter`, without the animation.\n */\nexport const plainWriter = createPlainWriter((line) => console.log(line))\n","import * as prompts from '@clack/prompts'\nimport { isRichOutput } from '../utils/env.ts'\nimport { clackWriter } from '../loggers/clackWriter.ts'\nimport { plainWriter, SYMBOLS } from '../loggers/plainWriter.ts'\nimport type { LoggerWriter } from '../loggers/types.ts'\n\n/** The writer the loggers draw with on this terminal, so a command's own lines look like its run. */\nexport function writer(): LoggerWriter {\n return isRichOutput() ? clackWriter : plainWriter\n}\n\ntype Level = keyof typeof SYMBOLS\n\n// Not through the writers: in plain output a command's own info and warning carry their symbol, and clack's step keeps its spacing.\nfunction write(level: Level, message: string): void {\n if (isRichOutput()) {\n prompts.log[level](message)\n\n return\n }\n\n console.log(`${SYMBOLS[level]} ${message}`)\n}\n\n/** Prints lines as one block, without a symbol in front of them. Not the writer's block, which drops clack's spacing around it. */\nexport function logBlock(lines: string | Array<string>): void {\n if (isRichOutput()) {\n prompts.log.message(lines)\n\n return\n }\n\n console.log([lines].flat().join('\\n'))\n}\n\nexport function logInfo(message: string): void {\n write('info', message)\n}\n\nexport function logWarn(message: string): void {\n write('warn', message)\n}\n\nexport function logError(message: string): void {\n write('error', message)\n}\n\n/**\n * Reports a step the command is taking, rather than something it found.\n */\nexport function logStep(message: string): void {\n write('step', message)\n}\n","import { styleText } from 'node:util'\nimport * as prompts from '@clack/prompts'\nimport { isRichOutput } from '../utils/env.ts'\nimport { writer } from './log.ts'\n\nconst SPONSOR_TIPS = [\n 'Your sponsorship keeps Kubb codegen, plugins, and docs maintained',\n 'Sponsor faster generators and better Kubb Studio workflows',\n 'Help keep Kubb free for TypeScript teams building APIs',\n 'Support React Query, Zod, Faker, and MSW integrations',\n 'Back open-source tools that turn OpenAPI into TypeScript',\n 'Sponsor fixes, releases, and new plugins for your API workflow',\n 'Help Kubb stay independent and focused on developer tools',\n] as const\n\nconst SPONSOR_LINKS = ['https://github.com/sponsors/stijnvanhulle', 'https://opencollective.com/kubb', 'https://kubb.dev/sponsors'] as const\n\nfunction nextTip(): string {\n const tip = SPONSOR_TIPS[Math.floor(Math.random() * SPONSOR_TIPS.length)]!\n const link = SPONSOR_LINKS[Math.floor(Math.random() * SPONSOR_LINKS.length)]!\n return `${tip}: ${link}`\n}\n\nfunction formatTip(tip: string): string {\n return styleText('magenta', ' Tip ') + styleText('yellow', tip)\n}\n\n/**\n * Prints one random tip outside every group. Rich terminals get the styled variant;\n * plain/CI output gets a stable text-only line so the tip is still visible as final output.\n */\nexport function logTip(): void {\n const tip = nextTip()\n if (!isRichOutput()) {\n console.log(`Tip: ${tip}`)\n return\n }\n\n console.log(`${styleText('magenta', '✦')}${formatTip(tip)}`)\n}\n\ntype IntroOptions = {\n title?: string\n /**\n * Printed under the title, for a command that has a caveat to lead with.\n */\n warning?: string\n /**\n * Whether to open a block a later {@link logOutro} closes. Pass `false` for a command that\n * prints and exits, since nothing would ever close the block.\n *\n * @default true\n */\n block?: boolean\n}\n\n/**\n * Opens a command's output. A command the banner already names passes no title.\n */\nexport function logIntro({ title, warning, block = true }: IntroOptions): void {\n if (block && isRichOutput()) {\n if (title) prompts.intro(title)\n\n if (warning) {\n prompts.log.warn(warning)\n }\n\n return\n }\n\n if (title) {\n console.log(title)\n }\n\n if (warning) {\n console.warn(warning)\n }\n\n if (title || warning) {\n console.log()\n }\n}\n\n/**\n * Closes the block {@link logIntro} opened. The closing gutter is not a written line, so plain\n * output prints the text on its own.\n */\nexport function logOutro(text: string): void {\n writer().groupEnd(text)\n}\n\n/**\n * Prints one empty line between two groups, without clack's gutter bar, since the bar belongs to a\n * group and a spacer sits outside every one.\n */\nexport function logSpacer(): void {\n console.log('')\n}\n\n/** Whether a run stops to ask something: no `--yes`, no `--dry-run`, and a person at a terminal. */\nexport function isInteractiveRun({ yes, dryRun }: { yes?: unknown; dryRun?: unknown }): boolean {\n return !yes && !dryRun && process.stdin.isTTY === true\n}\n"],"mappings":";;;;;;;;;;AAQA,MAAa,cAA4B;CACvC,UAAU;CACV,QAAQ,UAAUA,eAAM,MAAM,KAAK;CACnC,WAAW,SAASA,eAAM,MAAM,IAAI;CACpC,OAAO,SAASA,eAAM,IAAI,KAAK,MAAM,EAAE,SAAS,EAAE,CAAC;CACnD,OAAO,SAASA,eAAM,IAAI,KAAK,IAAI;CACnC,UAAU,SAASA,eAAM,IAAI,QAAQ,IAAI;CACzC,OAAO,SAASA,eAAM,IAAI,KAAK,IAAI;CACnC,QAAQ,SAASA,eAAM,IAAI,MAAM,IAAI;CACrC,QAAQ,UAAUA,eAAM,IAAI,QAAQ,OAAO,EAAE,SAAS,EAAE,CAAC;CAGzD,MAAM,UAAU,QAAQ,KAAA,GAAIC,UAAAA,UAAAA,CAAU,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC;CAG9D,aAAa,UAAUD,e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M,QAAQ;CACpB,IAAI,CAACC,YAAAA,aAAa,GAAG;EACnB,QAAQ,IAAI,QAAQ,KAAK;EACzB;CACF;CAEA,QAAQ,IAAI,IAAA,GAAGD,UAAAA,UAAAA,CAAU,WAAW,GAAG,IAAI,UAAU,GAAG,GAAG;AAC7D;;;;AAoBA,SAAgB,SAAS,EAAE,OAAO,SAAS,QAAQ,QAA4B;CAC7E,IAAI,SAASC,YAAAA,aAAa,GAAG;EAC3B,IAAI,OAAO,eAAQ,MAAM,KAAK;EAE9B,IAAI,SACF,eAAQ,IAAI,KAAK,OAAO;EAG1B;CACF;CAEA,IAAI,OACF,QAAQ,IAAI,KAAK;CAGnB,IAAI,SACF,QAAQ,KAAK,OAAO;CAGtB,IAAI,SAAS,SACX,QAAQ,IAAI;AAEhB;;;;;AAMA,SAAgB,SAAS,MAAoB;CAC3C,OAAO,CAAC,CAAC,SAAS,IAAI;AACxB;;;;;AAMA,SAAgB,YAAkB;CAChC,QAAQ,IAAI,EAAE;AAChB;;AAGA,SAAgB,iBAAiB,EAAE,KAAK,UAAwD;CAC9F,OAAO,CAAC,OAAO,CAAC,UAAU,QAAQ,MAAM,UAAU;AACpD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-B1hUUjio.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,5 +0,0 @@
1
- // package.json
2
- var version = "5.15.1";
3
- export { version as t };
4
-
5
- //# sourceMappingURL=package-MYPMnnTX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-MYPMnnTX.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry-B3eYk4LN.js","names":[],"sources":["../src/utils/registry.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage, toError } from '@internals/utils'\nimport { checkCompatibility, Diagnostics, type ExtensionManifest, isRegistryEntry, type RegistryArtifact, type RegistryEntry } from '@kubb/core'\nimport { difference, isLessThan, isValid } from 'verkit'\n\nconst DEFAULT_REGISTRY = 'https://kubb.dev/registry'\n\nconst SLUG = '[a-z0-9]+(?:-[a-z0-9]+)*'\nconst ID = new RegExp(`^${SLUG}(\\\\/${SLUG})?$`)\n\n/** The registry base URL: `KUBB_REGISTRY`, or kubb.dev. */\nexport function registryUrl(): string {\n const url = process.env.KUBB_REGISTRY || DEFAULT_REGISTRY\n if (!/^https?:\\/\\//.test(url))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `KUBB_REGISTRY must be an http(s) URL, got \"${url}\".`,\n help: 'Set `KUBB_REGISTRY` to an http(s) URL, or unset it to use https://kubb.dev/registry.',\n })\n return url.replace(/\\/+$/, '')\n}\n\n/**\n * Turns `owner/slug`, or a bare `slug` meaning `kubb-labs/<slug>`, into a registry id.\n *\n * @throws when the id has another shape, so it never reaches a URL unchecked.\n */\nexport function toRegistryId(input: string): string {\n if (!ID.test(input))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `\"${input}\" is not a registry id. Use owner/slug, such as kubb-labs/plugin-zod, or a slug, such as plugin-zod.`,\n })\n return input.includes('/') ? input : `kubb-labs/${input}`\n}\n\n/** The shortest id `kubb add` and `kubb update` accept: the slug for an official extension, else `owner/slug`. */\nexport function toShortId(id: string): string {\n return id.startsWith('kubb-labs/') ? id.slice('kubb-labs/'.length) : id\n}\n\n/**\n * GETs `url` as JSON. A non-2xx answer or a body that is not JSON returns no `body`.\n * A network error throws with the URL.\n */\nasync function fetchJSON(url: string): Promise<{ status: number; body?: unknown }> {\n let response: Response\n try {\n response = await globalThis.fetch(url, { headers: { accept: 'application/json' } })\n } catch (cause) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputUnreachable,\n severity: 'error',\n message: `Could not read ${url}: ${getErrorMessage(cause)}`,\n help: 'Check your network connection and that the registry is reachable.',\n cause: toError(cause),\n })\n }\n if (!response.ok) return { status: response.status }\n return { status: response.status, body: await response.json().catch(() => undefined) }\n}\n\n/** Fetches the registry index, leaving out entries that fail validation. */\nexport async function fetchRegistryIndex({ registry }: { registry: string }): Promise<Array<RegistryEntry>> {\n const { status, body } = await fetchJSON(`${registry}/index.json`)\n const index = body as { version?: unknown; extensions?: unknown } | null | undefined\n if (status !== 200 || index?.version !== 1 || !Array.isArray(index.extensions)) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputRequestFailed,\n severity: 'error',\n message: `The registry at ${registry} sent an invalid index (HTTP ${status}).`,\n help: 'Try again later, or check that `KUBB_REGISTRY` points at a Kubb registry.',\n })\n }\n return index.extensions.filter(isRegistryEntry)\n}\n\n/** What the package manager installs: `<package>@<version>`, or a GitHub release's commit, so the install cannot move with the tag. */\nexport function installSpec(artifact: RegistryArtifact): string {\n return artifact.kind === 'github' ? `github:${artifact.owner}/${artifact.repo}#${artifact.commit}` : `${artifact.package}@${artifact.version}`\n}\n\n/** Why the running Kubb or Node.js version cannot use this extension, or `undefined` when it can. */\nexport function incompatibility(manifest: ExtensionManifest): string | undefined {\n try {\n checkCompatibility({ name: manifest.name, compatibility: manifest.compatibility })\n return undefined\n } catch (error) {\n return getErrorMessage(error)\n }\n}\n\n/**\n * Whether `latest` is newer than `installed`. An unknown installed version counts as outdated, and an\n * invalid `latest` never does.\n */\nexport function isOutdated({ installed, latest }: { installed: string | undefined; latest: string }): boolean {\n if (!isValid(latest)) return false\n return !installed || !isValid(installed) || isLessThan(installed, latest)\n}\n\n/** `major`, `minor`, or `patch` from `installed` to `latest`, or `undefined` when either is unknown or invalid. */\nexport function bumpOf({ installed, latest }: { installed: string | undefined; latest: string }): 'major' | 'minor' | 'patch' | undefined {\n if (!installed || !isValid(installed) || !isValid(latest)) return undefined\n const kind = difference(installed, latest)\n if (!kind) return undefined\n if (kind.endsWith('major')) return 'major'\n return kind.endsWith('minor') ? 'minor' : 'patch'\n}\n\nfunction editDistance(a: string, b: string): number {\n const row = Array.from({ length: b.length + 1 }, (_, index) => index)\n for (let i = 1; i <= a.length; i++) {\n let previous = row[0]!\n row[0] = i\n for (let j = 1; j <= b.length; j++) {\n const current = row[j]!\n row[j] = Math.min(row[j]! + 1, row[j - 1]! + 1, previous + (a[i - 1] === b[j - 1] ? 0 : 1))\n previous = current\n }\n }\n return row[b.length]!\n}\n\n/** Words every extension shares, so they never make two ids look alike. */\nconst COMMON_TOKENS = new Set(['kubb', 'plugin', 'adapter', 'parser'])\n\n/**\n * The ids closest to a mistyped `input`, best first, at most three: those within a few edits of it,\n * or sharing a word such as `zod` in any order. Compares slugs, so the owner may be left out.\n */\nexport function closestIds({ input, ids }: { input: string; ids: Array<string> }): Array<string> {\n const slug = (id: string) => id.slice(id.indexOf('/') + 1)\n const tokens = new Set(\n slug(input)\n .split('-')\n .filter((token) => !COMMON_TOKENS.has(token)),\n )\n return ids\n .map((id) => ({\n id,\n distance: editDistance(slug(input), slug(id)),\n shared: slug(id)\n .split('-')\n .some((token) => tokens.has(token)),\n }))\n .filter(({ distance, shared }) => shared || distance <= Math.max(2, Math.floor(slug(input).length / 4)))\n .sort((a, b) => Number(b.shared) - Number(a.shared) || a.distance - b.distance)\n .slice(0, 3)\n .map(({ id }) => id)\n}\n"],"mappings":";;;;;;AAKA,MAAM,mBAAmB;AAEzB,MAAM,OAAO;AACb,MAAM,KAAK,IAAI,OAAO,IAAI,KAAK,MAAM,KAAK,IAAI;;AAG9C,SAAgB,cAAsB;CACpC,MAAM,MAAM,QAAQ,IAAI,iBAAiB;CACzC,IAAI,CAAC,eAAe,KAAK,GAAG,GAC1B,MAAM,IAAI,YAAY,MAAM;EAC1B,MAAM,YAAY,KAAK;EACvB,UAAU;EACV,SAAS,8CAA8C,IAAI;EAC3D,MAAM;CACR,CAAC;CACH,OAAO,IAAI,QAAQ,QAAQ,EAAE;AAC/B;;;;;;AAOA,SAAgB,aAAa,OAAuB;CAClD,IAAI,CAAC,GAAG,KAAK,KAAK,GAChB,MAAM,IAAI,YAAY,MAAM;EAC1B,MAAM,YAAY,KAAK;E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AC;CACzD,MAAM,SAAS,IAAI,IACjB,KAAK,KAAK,CAAC,CACR,MAAM,GAAG,CAAC,CACV,QAAQ,UAAU,CAAC,cAAc,IAAI,KAAK,CAAC,CAChD;CACA,OAAO,IACJ,KAAK,QAAQ;EACZ;EACA,UAAU,aAAa,KAAK,KAAK,GAAG,KAAK,EAAE,CAAC;EAC5C,QAAQ,KAAK,EAAE,CAAC,CACb,MAAM,GAAG,CAAC,CACV,MAAM,UAAU,OAAO,IAAI,KAAK,CAAC;CACtC,EAAE,CAAC,CACF,QAAQ,EAAE,UAAU,aAAa,UAAU,YAAY,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CACvG,MAAM,GAAG,MAAM,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,CAC9E,MAAM,GAAG,CAAC,CAAC,CACX,KAAK,EAAE,SAAS,EAAE;AACvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry-YE1pFWL-.cjs","names":["process","Diagnostics","getErrorMessage","toError","isRegistryEntry","isValid","isLessThan","difference"],"sources":["../src/utils/registry.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage, toError } from '@internals/utils'\nimport { checkCompatibility, Diagnostics, type ExtensionManifest, isRegistryEntry, type RegistryArtifact, type RegistryEntry } from '@kubb/core'\nimport { difference, isLessThan, isValid } from 'verkit'\n\nconst DEFAULT_REGISTRY = 'https://kubb.dev/registry'\n\nconst SLUG = '[a-z0-9]+(?:-[a-z0-9]+)*'\nconst ID = new RegExp(`^${SLUG}(\\\\/${SLUG})?$`)\n\n/** The registry base URL: `KUBB_REGISTRY`, or kubb.dev. */\nexport function registryUrl(): string {\n const url = process.env.KUBB_REGISTRY || DEFAULT_REGISTRY\n if (!/^https?:\\/\\//.test(url))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `KUBB_REGISTRY must be an http(s) URL, got \"${url}\".`,\n help: 'Set `KUBB_REGISTRY` to an http(s) URL, or unset it to use https://kubb.dev/registry.',\n })\n return url.replace(/\\/+$/, '')\n}\n\n/**\n * Turns `owner/slug`, or a bare `slug` meaning `kubb-labs/<slug>`, into a registry id.\n *\n * @throws when the id has another shape, so it never reaches a URL unchecked.\n */\nexport function toRegistryId(input: string): string {\n if (!ID.test(input))\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `\"${input}\" is not a registry id. Use owner/slug, such as kubb-labs/plugin-zod, or a slug, such as plugin-zod.`,\n })\n return input.includes('/') ? input : `kubb-labs/${input}`\n}\n\n/** The shortest id `kubb add` and `kubb update` accept: the slug for an official extension, else `owner/slug`. */\nexport function toShortId(id: string): string {\n return id.startsWith('kubb-labs/') ? id.slice('kubb-labs/'.length) : id\n}\n\n/**\n * GETs `url` as JSON. A non-2xx answer or a body that is not JSON returns no `body`.\n * A network error throws with the URL.\n */\nasync function fetchJSON(url: string): Promise<{ status: number; body?: unknown }> {\n let response: Response\n try {\n response = await globalThis.fetch(url, { headers: { accept: 'application/json' } })\n } catch (cause) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputUnreachable,\n severity: 'error',\n message: `Could not read ${url}: ${getErrorMessage(cause)}`,\n help: 'Check your network connection and that the registry is reachable.',\n cause: toError(cause),\n })\n }\n if (!response.ok) return { status: response.status }\n return { status: response.status, body: await response.json().catch(() => undefined) }\n}\n\n/** Fetches the registry index, leaving out entries that fail validation. */\nexport async function fetchRegistryIndex({ registry }: { registry: string }): Promise<Array<RegistryEntry>> {\n const { status, body } = await fetchJSON(`${registry}/index.json`)\n const index = body as { version?: unknown; extensions?: unknown } | null | undefined\n if (status !== 200 || index?.version !== 1 || !Array.isArray(index.extensions)) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.inputRequestFailed,\n severity: 'error',\n message: `The registry at ${registry} sent an invalid index (HTTP ${status}).`,\n help: 'Try again later, or check that `KUBB_REGISTRY` points at a Kubb registry.',\n })\n }\n return index.extensions.filter(isRegistryEntry)\n}\n\n/** What the package manager installs: `<package>@<version>`, or a GitHub release's commit, so the install cannot move with the tag. */\nexport function installSpec(artifact: RegistryArtifact): string {\n return artifact.kind === 'github' ? `github:${artifact.owner}/${artifact.repo}#${artifact.commit}` : `${artifact.package}@${artifact.version}`\n}\n\n/** Why the running Kubb or Node.js version cannot use this extension, or `undefined` when it can. */\nexport function incompatibility(manifest: ExtensionManifest): string | undefined {\n try {\n checkCompatibility({ name: manifest.name, compatibility: manifest.compatibility })\n return undefined\n } catch (error) {\n return getErrorMessage(error)\n }\n}\n\n/**\n * Whether `latest` is newer than `installed`. An unknown installed version counts as outdated, and an\n * invalid `latest` never does.\n */\nexport function isOutdated({ installed, latest }: { installed: string | undefined; latest: string }): boolean {\n if (!isValid(latest)) return false\n return !installed || !isValid(installed) || isLessThan(installed, latest)\n}\n\n/** `major`, `minor`, or `patch` from `installed` to `latest`, or `undefined` when either is unknown or invalid. */\nexport function bumpOf({ installed, latest }: { installed: string | undefined; latest: string }): 'major' | 'minor' | 'patch' | undefined {\n if (!installed || !isValid(installed) || !isValid(latest)) return undefined\n const kind = difference(installed, latest)\n if (!kind) return undefined\n if (kind.endsWith('major')) return 'major'\n return kind.endsWith('minor') ? 'minor' : 'patch'\n}\n\nfunction editDistance(a: string, b: string): number {\n const row = Array.from({ length: b.length + 1 }, (_, index) => index)\n for (let i = 1; i <= a.length; i++) {\n let previous = row[0]!\n row[0] = i\n for (let j = 1; j <= b.length; j++) {\n const current = row[j]!\n row[j] = Math.min(row[j]! + 1, row[j - 1]! + 1, previous + (a[i - 1] === b[j - 1] ? 0 : 1))\n previous = current\n }\n }\n return row[b.length]!\n}\n\n/** Words every extension shares, so they never make two ids look alike. */\nconst COMMON_TOKENS = new Set(['kubb', 'plugin', 'adapter', 'parser'])\n\n/**\n * The ids closest to a mistyped `input`, best first, at most three: those within a few edits of it,\n * or sharing a word such as `zod` in any order. Compares slugs, so the owner may be left out.\n */\nexport function closestIds({ input, ids }: { input: string; ids: Array<string> }): Array<string> {\n const slug = (id: string) => id.slice(id.indexOf('/') + 1)\n const tokens = new Set(\n slug(input)\n .split('-')\n .filter((token) => !COMMON_TOKENS.has(token)),\n )\n return ids\n .map((id) => ({\n id,\n distance: editDistance(slug(input), slug(id)),\n shared: slug(id)\n .split('-')\n .some((token) => tokens.has(token)),\n }))\n .filter(({ distance, shared }) => shared || distance <= Math.max(2, Math.floor(slug(input).length / 4)))\n .sort((a, b) => Number(b.shared) - Number(a.shared) || a.distance - b.distance)\n .slice(0, 3)\n .map(({ id }) => id)\n}\n"],"mappings":";;;;;;;AAKA,MAAM,mBAAmB;AAEzB,MAAM,OAAO;AACb,MAAM,KAAK,IAAI,OAAO,IAAI,KAAK,MAAM,KAAK,IAAI;;AAG9C,SAAgB,cAAsB;CACpC,MAAM,MAAMA,aAAAA,QAAQ,IAAI,iBAAiB;CACzC,IAAI,CAAC,eAAe,KAAK,GAAG,GAC1B,MAAM,IAAIC,WAAAA,YAAY,MAAM;EAC1B,MAAMA,WAAAA,YAAY,KAAK;EACvB,UAAU;EACV,SAAS,8CAA8C,IAAI;EAC3D,MAAM;CACR,CAAC;CACH,OAAO,IAAI,QAAQ,QAAQ,EAAE;AAC/B;;;;;;AAOA,SAAgB,aAAa,OAAuB;CAClD,IAAI,CAAC,GAAG,KAAK,KAAK,GAChB,MAAM,IAAIA,WAAAA,YAAY,MAAM;EAC1B,MAAMA,WAAAA,YAAY,KAAK;EACvB,UAAU;EACV,SAAS,IAAI,MAAM;CACrB,CAAC;CACH,OAAO,MAAM,SAAS,GAAG,IAAI,QAAQ,aAAa;AACpD;;AAGA,SAAgB,UAAU,IAAoB;CAC5C,OAAO,GAAG,WAAW,YAAY,IAAI,GAAG,MAAM,EAAmB,IAAI;AACvE;;;;;AAMA,eAAe,UAAU,KAA0D;CACjF,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,WAAW,MAAM,KA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