@kubb/ast 5.26.0 → 5.27.1

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 (91) hide show
  1. package/dist/{combineFileMembers-DJHNAZBN.js → combineFileMembers-B-mdjXrG.js} +2 -2
  2. package/dist/{combineFileMembers-DJHNAZBN.js.map → combineFileMembers-B-mdjXrG.js.map} +1 -1
  3. package/dist/{combineFileMembers-DmmuOmY8.cjs → combineFileMembers-DZCKxAN0.cjs} +2 -2
  4. package/dist/{combineFileMembers-DmmuOmY8.cjs.map → combineFileMembers-DZCKxAN0.cjs.map} +1 -1
  5. package/dist/factory.cjs +2 -2
  6. package/dist/factory.d.cts +2 -2
  7. package/dist/factory.d.ts +2 -2
  8. package/dist/factory.js +2 -2
  9. package/dist/{file-z3xToonr.cjs → file-D9kqBrBl.cjs} +55 -7
  10. package/dist/file-D9kqBrBl.cjs.map +1 -0
  11. package/dist/{file-HwCmj--S.js → file-F3pgfoe4.js} +55 -7
  12. package/dist/file-F3pgfoe4.js.map +1 -0
  13. package/dist/file.cjs +2 -2
  14. package/dist/file.js +2 -2
  15. package/dist/{graph-D-0CbFIv.cjs → graph-D6Ffy9YD.cjs} +3 -3
  16. package/dist/{graph-D-0CbFIv.cjs.map → graph-D6Ffy9YD.cjs.map} +1 -1
  17. package/dist/{graph-CePbhGIt.js → graph-DWlCmvm6.js} +3 -3
  18. package/dist/{graph-CePbhGIt.js.map → graph-DWlCmvm6.js.map} +1 -1
  19. package/dist/graph.cjs +1 -1
  20. package/dist/graph.d.cts +1 -1
  21. package/dist/graph.d.ts +1 -1
  22. package/dist/graph.js +1 -1
  23. package/dist/{guards-l2AsKeHR.d.ts → guards-CTqHwyNs.d.ts} +1 -1
  24. package/dist/{guards-B6LgmDhJ.d.cts → guards-EpQMJGyF.d.cts} +1 -1
  25. package/dist/http.d.cts +2 -2
  26. package/dist/http.d.ts +2 -2
  27. package/dist/{index-f90iIhHX.d.ts → index-B8ZxUpy4.d.ts} +1 -1
  28. package/dist/{index-BfNUrkK6.d.ts → index-BGhhO3z8.d.ts} +1 -1
  29. package/dist/{index-D2tWPgnK.d.cts → index-BXv0B9Pd.d.cts} +1 -1
  30. package/dist/{index-Br4bwEnS.d.ts → index-C0_Y9yA1.d.ts} +1 -1
  31. package/dist/{index-BNf4pYPx.d.cts → index-C4ZZnf_X.d.cts} +1 -1
  32. package/dist/{index-DNDNDzyJ.d.cts → index-CKd3ogUZ.d.cts} +2 -2
  33. package/dist/{index-CCUB1hoV.d.cts → index-CiVsdeOh.d.cts} +3 -3
  34. package/dist/{index-C5SXJAtZ.d.cts → index-Ck6nqnxZ.d.cts} +1 -1
  35. package/dist/{index-YTyLBHFN.d.ts → index-CuQPyRve.d.ts} +1 -1
  36. package/dist/{index-2hzFweaD.d.cts → index-DSW89P6k.d.cts} +1 -1
  37. package/dist/index-DT-_5NUx.d.cts +5 -0
  38. package/dist/{index-DXdwkq7X.d.ts → index-DVX6E3vZ.d.ts} +2 -2
  39. package/dist/{index-BjmAaymt.d.cts → index-DdD4PIY8.d.cts} +1 -1
  40. package/dist/{index-Bz33tfQo.d.ts → index-DjwCRndP.d.ts} +1 -1
  41. package/dist/{index-MzcNxet1.d.ts → index-DphKh9u9.d.ts} +3 -3
  42. package/dist/index-kxuajWM1.d.ts +5 -0
  43. package/dist/index.cjs +6 -6
  44. package/dist/index.d.cts +13 -13
  45. package/dist/index.d.ts +13 -13
  46. package/dist/index.js +6 -6
  47. package/dist/json.d.cts +1 -1
  48. package/dist/json.d.ts +1 -1
  49. package/dist/macro.d.cts +1 -1
  50. package/dist/macro.d.ts +1 -1
  51. package/dist/node.d.cts +2 -2
  52. package/dist/node.d.ts +2 -2
  53. package/dist/{nodes-TtDfZ9qf.cjs → nodes-BGxHocS_.cjs} +2 -2
  54. package/dist/{nodes-TtDfZ9qf.cjs.map → nodes-BGxHocS_.cjs.map} +1 -1
  55. package/dist/{nodes-u9i-tqFp.js → nodes-KgbYiyJQ.js} +2 -2
  56. package/dist/{nodes-u9i-tqFp.js.map → nodes-KgbYiyJQ.js.map} +1 -1
  57. package/dist/{operation-De4lbIZS.d.cts → operation-B86IER5K.d.cts} +1 -1
  58. package/dist/{operation-Dd0-l2VB.d.ts → operation-DJ7F0cFp.d.ts} +1 -1
  59. package/dist/{promise-DScaykew.cjs → promise-DMQPWp6M.cjs} +37 -22
  60. package/dist/promise-DMQPWp6M.cjs.map +1 -0
  61. package/dist/{promise-B3YkZ4C8.js → promise-bi4pc8Xr.js} +37 -22
  62. package/dist/promise-bi4pc8Xr.js.map +1 -0
  63. package/dist/{ref-Dlxn7eu7.js → ref-BU7sfEFr.js} +2 -2
  64. package/dist/{ref-Dlxn7eu7.js.map → ref-BU7sfEFr.js.map} +1 -1
  65. package/dist/{ref-Ck-0j8NV.cjs → ref-CGeCLkAk.cjs} +2 -2
  66. package/dist/{ref-Ck-0j8NV.cjs.map → ref-CGeCLkAk.cjs.map} +1 -1
  67. package/dist/ref.cjs +2 -2
  68. package/dist/ref.d.cts +1 -1
  69. package/dist/ref.d.ts +1 -1
  70. package/dist/ref.js +2 -2
  71. package/dist/{refs-Bgf8_9Ui.js → refs-C0hb_qu-.js} +2 -2
  72. package/dist/{refs-Bgf8_9Ui.js.map → refs-C0hb_qu-.js.map} +1 -1
  73. package/dist/{refs-rmr2LFV1.cjs → refs-CJZBa9hL.cjs} +2 -2
  74. package/dist/{refs-rmr2LFV1.cjs.map → refs-CJZBa9hL.cjs.map} +1 -1
  75. package/dist/{schema-BvUrXIoX.js → schema-B05JSQRq.js} +3 -3
  76. package/dist/{schema-BvUrXIoX.js.map → schema-B05JSQRq.js.map} +1 -1
  77. package/dist/{schema-DfLGJ-oh.cjs → schema-XGRiAvok.cjs} +3 -3
  78. package/dist/{schema-DfLGJ-oh.cjs.map → schema-XGRiAvok.cjs.map} +1 -1
  79. package/dist/schema.cjs +1 -1
  80. package/dist/schema.d.cts +3 -3
  81. package/dist/schema.d.ts +3 -3
  82. package/dist/schema.js +1 -1
  83. package/dist/{visitor-BN5QJX7-.d.cts → visitor-BIldddZd.d.cts} +2 -2
  84. package/dist/{visitor-BNGMMmpe.d.ts → visitor-xxcbpM5-.d.ts} +2 -2
  85. package/package.json +1 -1
  86. package/dist/file-HwCmj--S.js.map +0 -1
  87. package/dist/file-z3xToonr.cjs.map +0 -1
  88. package/dist/index-BiXrjYNm.d.cts +0 -5
  89. package/dist/index-CC5Rmgcm.d.ts +0 -5
  90. package/dist/promise-B3YkZ4C8.js.map +0 -1
  91. package/dist/promise-DScaykew.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-D9kqBrBl.cjs","names":["getNames","createFile","createImport","nodeKinds","getNodeText","CODE_NODE_TEXT_FIELDS"],"sources":["../../../internals/utils/src/text.ts","../src/utils/inline.ts","../src/file/index.ts"],"sourcesContent":["/**\n * Indents every non-empty line of `text` by `unit`, leaving blank lines empty.\n * @example\n * `indent({ text: 'a\\n\\nb' }) // ' a\\n\\n b'`\n */\nexport function indent({ text, unit = ' ' }: { text: string; unit?: string }): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${unit}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Strips the common leading whitespace and the surrounding blank lines, counting tabs and spaces alike, so indented template literals start at column zero.\n */\nexport function dedent(text: string): string {\n if (!text) return ''\n // Most text nodes are one line, so the common indent is its leading whitespace.\n if (!text.includes('\\n')) return text.trim() ? text.trimStart() : ''\n\n const lines = text.split('\\n')\n const indents = lines.map((line) => {\n const indent = line.length - line.trimStart().length\n return indent === line.length ? -1 : indent\n })\n const start = indents.findIndex((indent) => indent !== -1)\n if (start === -1) return ''\n const end = indents.findLastIndex((indent) => indent !== -1)\n // `-1` marks a blank line. `reduce`, not `Math.min(...indents)`, which overflows the stack on very long text.\n const min = indents.reduce((lowest, indent) => (indent !== -1 && indent < lowest ? indent : lowest), Infinity)\n\n return lines\n .slice(start, end + 1)\n .map((line, i) => (indents[start + i] === -1 ? '' : line.slice(min)))\n .join('\\n')\n}\n\n/**\n * Strips one matching pair of `\"`, `'` or `` ` `` from both ends of `text`. Returns `text` unchanged without a matching pair.\n * @example\n * `unquote('\"hello\"') // 'hello'`\n */\nexport function unquote(text: string): string {\n if (text.length < 2) return text\n const first = text[0]\n return (first === '\"' || first === \"'\" || first === '`') && text.at(-1) === first ? text.slice(1, -1) : text\n}\n\n/**\n * Returns `name` when it is free, otherwise the first free `name2`, `name3`, and so on.\n * @example\n * `uniqueName('Options', (name) => name === 'Options') // 'Options2'`\n */\nexport function uniqueName(name: string, isTaken: (candidate: string) => boolean): string {\n let candidate = name\n for (let suffix = 2; isTaken(candidate); suffix++) candidate = `${name}${suffix}`\n return candidate\n}\n","import { nodeKinds } from '../constants.ts'\nimport type { CodeNode } from '../nodes/code.ts'\nimport { createFile, createImport } from '../nodes/file.ts'\nimport type { FileNode, ImportNode, SourceNode } from '../nodes/file.ts'\nimport { uniqueName } from '@internals/utils'\nimport { getNames } from './moduleNames.ts'\nimport { CODE_NODE_TEXT_FIELDS, getNodeText } from './nodeText.ts'\n\nexport type InlineFilesResult = {\n /**\n * Files that imported an inline name, rewritten to hold its definition.\n */\n files: Array<FileNode>\n /**\n * Paths of the virtual files, which are not written.\n */\n virtualPaths: Array<string>\n /**\n * One message per name that could not be inlined.\n */\n problems: Array<{ path: string; message: string }>\n}\n\ntype Definition = { expression: string; imports: Array<ImportNode> }\n\n/**\n * The language-specific half of {@link inlineFiles}, supplied by the parser that prints the file.\n */\nexport type InlineLanguage = {\n /**\n * Swaps in what `replace` returns for every identifier in `text` that references a name, skipping strings and comments.\n */\n replaceIdentifiers(text: string, replace: (name: string) => string | undefined): string\n /**\n * Makes `expression` safe to put where a name was, such as `(A | B)` in TypeScript.\n */\n wrap(expression: string): string\n}\n\nexport type InlineFilesOptions = {\n /**\n * The inline support for a file's language, or `undefined` when it has none.\n */\n language: (file: FileNode) => InlineLanguage | undefined\n}\n\n/**\n * Replaces every name a file imports from a virtual file (one marked `inline`, so it is never written) with the body of that name's\n * declaration, until no inline names are left. The definitions' own imports move to the importing file.\n */\nexport function inlineFiles(files: ReadonlyArray<FileNode>, { language }: InlineFilesOptions): InlineFilesResult {\n const virtualFiles = new Map(files.filter(isInlineFile).map((file) => [file.path, file]))\n const result: InlineFilesResult = { files: [], virtualPaths: [...virtualFiles.keys()], problems: [] }\n if (virtualFiles.size === 0) return result\n\n // `null` marks a definition that is being resolved, so a name that reaches itself is a cycle.\n const definitions = new Map<string, Definition | null>()\n\n function define(path: string, name: string, from: string, lang: InlineLanguage): Definition | undefined {\n const key = `${path}\\0${name}`\n if (definitions.has(key)) {\n const definition = definitions.get(key)\n if (definition === null) result.problems.push({ path: from, message: `\"${name}\" from \"${path}\" is defined in terms of itself.` })\n return definition ?? undefined\n }\n\n const file = virtualFiles.get(path)!\n const expression = bodyOf(file.sources.find((source) => source.name === name))\n if (expression === undefined) {\n result.problems.push({ path: from, message: `\"${name}\" is imported from \"${path}\", which never writes it and has no inline definition for it.` })\n return undefined\n }\n\n definitions.set(key, null)\n const imports: Array<ImportNode> = []\n const { text, used } = replaceNames(expression, file, lang, (inner) => {\n imports.push(...inner.imports)\n return inner.expression\n })\n imports.push(...file.imports.flatMap((imp) => (virtualFiles.has(imp.path) ? [] : pickNames(imp, used))))\n\n const definition = { expression: text, imports }\n definitions.set(key, definition)\n return definition\n }\n\n // `use` takes each replaced definition's imports and returns its text; `used` holds the names left as they are.\n function replaceNames(input: string, file: FileNode, lang: InlineLanguage, use: (definition: Definition) => string) {\n const used = new Set<string>()\n const text = lang.replaceIdentifiers(input, (local) => {\n const target = findTarget(file, local)\n const definition = target && define(target.path, target.name, file.path, lang)\n if (!definition) {\n used.add(local)\n return undefined\n }\n\n return lang.wrap(use(definition))\n })\n\n return { text, used }\n }\n\n function findTarget(file: FileNode, local: string): { path: string; name: string } | undefined {\n if (virtualFiles.has(file.path) && file.sources.some((source) => source.name === local)) return { path: file.path, name: local }\n\n for (const imp of file.imports) {\n const item = virtualFiles.has(imp.path) && getNames(imp).find((item) => (item.alias ?? item.name) === local)\n if (item) return { path: imp.path, name: item.name }\n }\n\n return undefined\n }\n\n for (const file of files) {\n if (virtualFiles.has(file.path) || !file.imports.some((imp) => virtualFiles.has(imp.path))) continue\n\n const lang = language(file)\n if (!lang) {\n result.problems.push({ path: file.path, message: `No parser for \"${file.extname}\" files supports inline sources.` })\n continue\n }\n\n const carried: Array<ImportNode> = []\n const carry = carryImports(file, lang, carried)\n const sources = file.sources.map((source) => ({ ...source, nodes: rewriteNodes(source.nodes, (text) => replaceNames(text, file, lang, carry).text) }))\n\n // A carried import keeps its target; `root` moves to the importing file so the relative path is computed from there.\n const imports = [...file.imports.filter((imp) => !virtualFiles.has(imp.path)), ...carried.map((imp) => (imp.root ? { ...imp, root: file.path } : imp))]\n\n result.files.push(createFile({ ...file, sources, imports }))\n }\n\n return result\n}\n\n// Moves each definition's imports into `carried` and returns the definition's text. A carried name the file already binds to\n// something else, such as a schema `Options` next to the client's own `Options`, gets an alias like `Options2`.\nfunction carryImports(file: FileNode, lang: InlineLanguage, carried: Array<ImportNode>) {\n // Each name the file uses, to the import (module and exported name) or declaration behind it. `''` marks a global, such as\n // the fetch `Response` next to a schema `Response`.\n const bindings = new Map<string, string>()\n for (const imp of file.imports) for (const item of getNames(imp)) bindings.set(item.alias ?? item.name, `${imp.path}\\0${item.name}`)\n for (const source of file.sources) {\n if (source.name) bindings.set(source.name, file.path)\n rewriteNodes(source.nodes, (text) =>\n lang.replaceIdentifiers(text, (name) => {\n if (!bindings.has(name)) bindings.set(name, '')\n return undefined\n }),\n )\n }\n\n return (definition: Definition): string => {\n const aliases = new Map<string, string>()\n for (const imp of definition.imports) {\n const before = aliases.size\n const names = getNames(imp).map((item) => {\n const local = item.alias ?? item.name\n const binding = `${imp.path}\\0${item.name}`\n const name = uniqueName(local, (candidate) => bindings.has(candidate) && bindings.get(candidate) !== binding)\n bindings.set(name, binding)\n if (name === local) return item\n aliases.set(local, name)\n return { ...item, alias: name }\n })\n carried.push(aliases.size > before ? createImport({ path: imp.path, ...(imp.root != null ? { root: imp.root } : {}), names }) : imp)\n }\n\n return aliases.size ? lang.replaceIdentifiers(definition.expression, (name) => aliases.get(name)) : definition.expression\n }\n}\n\n// A file of only deprecated per-source `inline` counts as inline too.\nfunction isInlineFile(file: FileNode): boolean {\n return !!file.inline || (file.sources.length > 0 && file.sources.every((source) => source.inline))\n}\n\n// The right-hand side of a `Const` or `Type`. A function body is not an expression, and printed text such as `Code` has none.\nfunction bodyOf(source: SourceNode | undefined): string | undefined {\n if (source?.inline) return source.inline.expression\n const node = source?.nodes?.length === 1 ? source.nodes[0] : undefined\n if (node?.kind !== nodeKinds.const && node?.kind !== nodeKinds.type) return undefined\n return getNodeText(node.nodes) || undefined\n}\n\nfunction pickNames(imp: ImportNode, used: ReadonlySet<string>): Array<ImportNode> {\n const names = getNames(imp).filter((item) => used.has(item.alias ?? item.name))\n return names.length > 0 ? [createImport({ path: imp.path, ...(imp.root != null ? { root: imp.root } : {}), names })] : []\n}\n\n// Rewrites the string fields `getNodeText` reads; JSDoc stays as written.\nfunction rewriteNodes(nodes: Array<CodeNode> | undefined, rewrite: (text: string) => string): Array<CodeNode> | undefined {\n return nodes?.map((node): CodeNode => {\n // Backward-compat: compiled plugins may still pass bare strings at runtime\n if (typeof node === 'string') return rewrite(node) as unknown as CodeNode\n if (node.kind === nodeKinds.break) return node\n\n const next = { ...node } as unknown as Record<string, unknown>\n for (const field of CODE_NODE_TEXT_FIELDS[node.kind] ?? []) {\n const value = next[field]\n if (Array.isArray(value)) next[field] = value.map(rewrite)\n if (typeof value === 'string' && value) next[field] = rewrite(value)\n }\n if ('nodes' in node && node.nodes) next.nodes = rewriteNodes(node.nodes, rewrite)\n return next as unknown as CodeNode\n })\n}\n","export { getRelativePath } from '../utils/combineFileMembers.ts'\nexport { inlineFiles as inline } from '../utils/inline.ts'\nexport { getNames, getSpace, isExported } from '../utils/moduleNames.ts'\n"],"mappings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AE,MAAM,IAAI,KAAK,IAAI,CAAC;EAAI;CAAM,CAAC,CAAC,IAAI,CAAC;AAC1H;AAGA,SAAS,aAAa,OAAoC,SAAgE;CACxH,OAAO,OAAO,KAAK,SAAmB;EAEpC,IAAI,OAAO,SAAS,UAAU,OAAO,QAAQ,IAAI;EACjD,IAAI,KAAK,SAASC,kBAAAA,UAAU,OAAO,OAAO;EAE1C,MAAM,OAAO,EAAE,GAAG,KAAK;EACvB,KAAK,MAAM,SAASE,iBAAAA,sBAAsB,KAAK,SAAS,CAAC,GAAG;GAC1D,MAAM,QAAQ,KAAK;GACnB,IAAI,MAAM,QAAQ,KAAK,GAAG,KAAK,SAAS,MAAM,IAAI,OAAO;GACzD,IAAI,OAAO,UAAU,YAAY,OAAO,KAAK,SAAS,QAAQ,KAAK;EACrE;EACA,IAAI,WAAW,QAAQ,KAAK,OAAO,KAAK,QAAQ,aAAa,KAAK,OAAO,OAAO;EAChF,OAAO;CACT,CAAC;AACH"}
@@ -1,7 +1,18 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BYyVTPww.js";
2
- import { c as getSpace, i as createImport, l as isExported, r as createFile, s as getNames, t as getRelativePath } from "./combineFileMembers-DJHNAZBN.js";
2
+ import { c as getSpace, i as createImport, l as isExported, r as createFile, s as getNames, t as getRelativePath } from "./combineFileMembers-B-mdjXrG.js";
3
3
  import { t as nodeKinds } from "./constants-UorsTFsa.js";
4
4
  import { n as getNodeText, t as CODE_NODE_TEXT_FIELDS } from "./nodeText-DFak5VpX.js";
5
+ // ../../internals/utils/src/text.ts
6
+ /**
7
+ * Returns `name` when it is free, otherwise the first free `name2`, `name3`, and so on.
8
+ * @example
9
+ * `uniqueName('Options', (name) => name === 'Options') // 'Options2'`
10
+ */
11
+ function uniqueName(name, isTaken) {
12
+ let candidate = name;
13
+ for (let suffix = 2; isTaken(candidate); suffix++) candidate = `${name}${suffix}`;
14
+ return candidate;
15
+ }
5
16
  // src/utils/inline.ts
6
17
  /**
7
18
  * Replaces every name a file imports from a virtual file (one marked `inline`, so it is never written) with the body of that name's
@@ -37,7 +48,10 @@ function inlineFiles(files, { language }) {
37
48
  }
38
49
  definitions.set(key, null);
39
50
  const imports = [];
40
- const { text, used } = replaceNames(expression, file, lang, imports);
51
+ const { text, used } = replaceNames(expression, file, lang, (inner) => {
52
+ imports.push(...inner.imports);
53
+ return inner.expression;
54
+ });
41
55
  imports.push(...file.imports.flatMap((imp) => virtualFiles.has(imp.path) ? [] : pickNames(imp, used)));
42
56
  const definition = {
43
57
  expression: text,
@@ -46,7 +60,7 @@ function inlineFiles(files, { language }) {
46
60
  definitions.set(key, definition);
47
61
  return definition;
48
62
  }
49
- function replaceNames(input, file, lang, imports) {
63
+ function replaceNames(input, file, lang, use) {
50
64
  const used = /* @__PURE__ */ new Set();
51
65
  return {
52
66
  text: lang.replaceIdentifiers(input, (local) => {
@@ -56,8 +70,7 @@ function inlineFiles(files, { language }) {
56
70
  used.add(local);
57
71
  return;
58
72
  }
59
- imports.push(...definition.imports);
60
- return lang.wrap(definition.expression);
73
+ return lang.wrap(use(definition));
61
74
  }),
62
75
  used
63
76
  };
@@ -86,9 +99,10 @@ function inlineFiles(files, { language }) {
86
99
  continue;
87
100
  }
88
101
  const carried = [];
102
+ const carry = carryImports(file, lang, carried);
89
103
  const sources = file.sources.map((source) => ({
90
104
  ...source,
91
- nodes: rewriteNodes(source.nodes, (text) => replaceNames(text, file, lang, carried).text)
105
+ nodes: rewriteNodes(source.nodes, (text) => replaceNames(text, file, lang, carry).text)
92
106
  }));
93
107
  const imports = [...file.imports.filter((imp) => !virtualFiles.has(imp.path)), ...carried.map((imp) => imp.root ? {
94
108
  ...imp,
@@ -102,6 +116,40 @@ function inlineFiles(files, { language }) {
102
116
  }
103
117
  return result;
104
118
  }
119
+ function carryImports(file, lang, carried) {
120
+ const bindings = /* @__PURE__ */ new Map();
121
+ for (const imp of file.imports) for (const item of getNames(imp)) bindings.set(item.alias ?? item.name, `${imp.path}\0${item.name}`);
122
+ for (const source of file.sources) {
123
+ if (source.name) bindings.set(source.name, file.path);
124
+ rewriteNodes(source.nodes, (text) => lang.replaceIdentifiers(text, (name) => {
125
+ if (!bindings.has(name)) bindings.set(name, "");
126
+ }));
127
+ }
128
+ return (definition) => {
129
+ const aliases = /* @__PURE__ */ new Map();
130
+ for (const imp of definition.imports) {
131
+ const before = aliases.size;
132
+ const names = getNames(imp).map((item) => {
133
+ const local = item.alias ?? item.name;
134
+ const binding = `${imp.path}\0${item.name}`;
135
+ const name = uniqueName(local, (candidate) => bindings.has(candidate) && bindings.get(candidate) !== binding);
136
+ bindings.set(name, binding);
137
+ if (name === local) return item;
138
+ aliases.set(local, name);
139
+ return {
140
+ ...item,
141
+ alias: name
142
+ };
143
+ });
144
+ carried.push(aliases.size > before ? createImport({
145
+ path: imp.path,
146
+ ...imp.root != null ? { root: imp.root } : {},
147
+ names
148
+ }) : imp);
149
+ }
150
+ return aliases.size ? lang.replaceIdentifiers(definition.expression, (name) => aliases.get(name)) : definition.expression;
151
+ };
152
+ }
105
153
  function isInlineFile(file) {
106
154
  return !!file.inline || file.sources.length > 0 && file.sources.every((source) => source.inline);
107
155
  }
@@ -143,4 +191,4 @@ var file_exports = /* @__PURE__ */ __exportAll({
143
191
  });
144
192
  export { inlineFiles as n, file_exports as t };
145
193
 
146
- //# sourceMappingURL=file-HwCmj--S.js.map
194
+ //# sourceMappingURL=file-F3pgfoe4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-F3pgfoe4.js","names":[],"sources":["../../../internals/utils/src/text.ts","../src/utils/inline.ts","../src/file/index.ts"],"sourcesContent":["/**\n * Indents every non-empty line of `text` by `unit`, leaving blank lines empty.\n * @example\n * `indent({ text: 'a\\n\\nb' }) // ' a\\n\\n b'`\n */\nexport function indent({ text, unit = ' ' }: { text: string; unit?: string }): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${unit}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Strips the common leading whitespace and the surrounding blank lines, counting tabs and spaces alike, so indented template literals start at column zero.\n */\nexport function dedent(text: string): string {\n if (!text) return ''\n // Most text nodes are one line, so the common indent is its leading whitespace.\n if (!text.includes('\\n')) return text.trim() ? text.trimStart() : ''\n\n const lines = text.split('\\n')\n const indents = lines.map((line) => {\n const indent = line.length - line.trimStart().length\n return indent === line.length ? -1 : indent\n })\n const start = indents.findIndex((indent) => indent !== -1)\n if (start === -1) return ''\n const end = indents.findLastIndex((indent) => indent !== -1)\n // `-1` marks a blank line. `reduce`, not `Math.min(...indents)`, which overflows the stack on very long text.\n const min = indents.reduce((lowest, indent) => (indent !== -1 && indent < lowest ? indent : lowest), Infinity)\n\n return lines\n .slice(start, end + 1)\n .map((line, i) => (indents[start + i] === -1 ? '' : line.slice(min)))\n .join('\\n')\n}\n\n/**\n * Strips one matching pair of `\"`, `'` or `` ` `` from both ends of `text`. Returns `text` unchanged without a matching pair.\n * @example\n * `unquote('\"hello\"') // 'hello'`\n */\nexport function unquote(text: string): string {\n if (text.length < 2) return text\n const first = text[0]\n return (first === '\"' || first === \"'\" || first === '`') && text.at(-1) === first ? text.slice(1, -1) : text\n}\n\n/**\n * Returns `name` when it is free, otherwise the first free `name2`, `name3`, and so on.\n * @example\n * `uniqueName('Options', (name) => name === 'Options') // 'Options2'`\n */\nexport function uniqueName(name: string, isTaken: (candidate: string) => boolean): string {\n let candidate = name\n for (let suffix = 2; isTaken(candidate); suffix++) candidate = `${name}${suffix}`\n return candidate\n}\n","import { nodeKinds } from '../constants.ts'\nimport type { CodeNode } from '../nodes/code.ts'\nimport { createFile, createImport } from '../nodes/file.ts'\nimport type { FileNode, ImportNode, SourceNode } from '../nodes/file.ts'\nimport { uniqueName } from '@internals/utils'\nimport { getNames } from './moduleNames.ts'\nimport { CODE_NODE_TEXT_FIELDS, getNodeText } from './nodeText.ts'\n\nexport type InlineFilesResult = {\n /**\n * Files that imported an inline name, rewritten to hold its definition.\n */\n files: Array<FileNode>\n /**\n * Paths of the virtual files, which are not written.\n */\n virtualPaths: Array<string>\n /**\n * One message per name that could not be inlined.\n */\n problems: Array<{ path: string; message: string }>\n}\n\ntype Definition = { expression: string; imports: Array<ImportNode> }\n\n/**\n * The language-specific half of {@link inlineFiles}, supplied by the parser that prints the file.\n */\nexport type InlineLanguage = {\n /**\n * Swaps in what `replace` returns for every identifier in `text` that references a name, skipping strings and comments.\n */\n replaceIdentifiers(text: string, replace: (name: string) => string | undefined): string\n /**\n * Makes `expression` safe to put where a name was, such as `(A | B)` in TypeScript.\n */\n wrap(expression: string): string\n}\n\nexport type InlineFilesOptions = {\n /**\n * The inline support for a file's language, or `undefined` when it has none.\n */\n language: (file: FileNode) => InlineLanguage | undefined\n}\n\n/**\n * Replaces every name a file imports from a virtual file (one marked `inline`, so it is never written) with the body of that name's\n * declaration, until no inline names are left. The definitions' own imports move to the importing file.\n */\nexport function inlineFiles(files: ReadonlyArray<FileNode>, { language }: InlineFilesOptions): InlineFilesResult {\n const virtualFiles = new Map(files.filter(isInlineFile).map((file) => [file.path, file]))\n const result: InlineFilesResult = { files: [], virtualPaths: [...virtualFiles.keys()], problems: [] }\n if (virtualFiles.size === 0) return result\n\n // `null` marks a definition that is being resolved, so a name that reaches itself is a cycle.\n const definitions = new Map<string, Definition | null>()\n\n function define(path: string, name: string, from: string, lang: InlineLanguage): Definition | undefined {\n const key = `${path}\\0${name}`\n if (definitions.has(key)) {\n const definition = definitions.get(key)\n if (definition === null) result.problems.push({ path: from, message: `\"${name}\" from \"${path}\" is defined in terms of itself.` })\n return definition ?? undefined\n }\n\n const file = virtualFiles.get(path)!\n const expression = bodyOf(file.sources.find((source) => source.name === name))\n if (expression === undefined) {\n result.problems.push({ path: from, message: `\"${name}\" is imported from \"${path}\", which never writes it and has no inline definition for it.` })\n return undefined\n }\n\n definitions.set(key, null)\n const imports: Array<ImportNode> = []\n const { text, used } = replaceNames(expression, file, lang, (inner) => {\n imports.push(...inner.imports)\n return inner.expression\n })\n imports.push(...file.imports.flatMap((imp) => (virtualFiles.has(imp.path) ? [] : pickNames(imp, used))))\n\n const definition = { expression: text, imports }\n definitions.set(key, definition)\n return definition\n }\n\n // `use` takes each replaced definition's imports and returns its text; `used` holds the names left as they are.\n function replaceNames(input: string, file: FileNode, lang: InlineLanguage, use: (definition: Definition) => string) {\n const used = new Set<string>()\n const text = lang.replaceIdentifiers(input, (local) => {\n const target = findTarget(file, local)\n const definition = target && define(target.path, target.name, file.path, lang)\n if (!definition) {\n used.add(local)\n return undefined\n }\n\n return lang.wrap(use(definition))\n })\n\n return { text, used }\n }\n\n function findTarget(file: FileNode, local: string): { path: string; name: string } | undefined {\n if (virtualFiles.has(file.path) && file.sources.some((source) => source.name === local)) return { path: file.path, name: local }\n\n for (const imp of file.imports) {\n const item = virtualFiles.has(imp.path) && getNames(imp).find((item) => (item.alias ?? item.name) === local)\n if (item) return { path: imp.path, name: item.name }\n }\n\n return undefined\n }\n\n for (const file of files) {\n if (virtualFiles.has(file.path) || !file.imports.some((imp) => virtualFiles.has(imp.path))) continue\n\n const lang = language(file)\n if (!lang) {\n result.problems.push({ path: file.path, message: `No parser for \"${file.extname}\" files supports inline sources.` })\n continue\n }\n\n const carried: Array<ImportNode> = []\n const carry = carryImports(file, lang, carried)\n const sources = file.sources.map((source) => ({ ...source, nodes: rewriteNodes(source.nodes, (text) => replaceNames(text, file, lang, carry).text) }))\n\n // A carried import keeps its target; `root` moves to the importing file so the relative path is computed from there.\n const imports = [...file.imports.filter((imp) => !virtualFiles.has(imp.path)), ...carried.map((imp) => (imp.root ? { ...imp, root: file.path } : imp))]\n\n result.files.push(createFile({ ...file, sources, imports }))\n }\n\n return result\n}\n\n// Moves each definition's imports into `carried` and returns the definition's text. A carried name the file already binds to\n// something else, such as a schema `Options` next to the client's own `Options`, gets an alias like `Options2`.\nfunction carryImports(file: FileNode, lang: InlineLanguage, carried: Array<ImportNode>) {\n // Each name the file uses, to the import (module and exported name) or declaration behind it. `''` marks a global, such as\n // the fetch `Response` next to a schema `Response`.\n const bindings = new Map<string, string>()\n for (const imp of file.imports) for (const item of getNames(imp)) bindings.set(item.alias ?? item.name, `${imp.path}\\0${item.name}`)\n for (const source of file.sources) {\n if (source.name) bindings.set(source.name, file.path)\n rewriteNodes(source.nodes, (text) =>\n lang.replaceIdentifiers(text, (name) => {\n if (!bindings.has(name)) bindings.set(name, '')\n return undefined\n }),\n )\n }\n\n return (definition: Definition): string => {\n const aliases = new Map<string, string>()\n for (const imp of definition.imports) {\n const before = aliases.size\n const names = getNames(imp).map((item) => {\n const local = item.alias ?? item.name\n const binding = `${imp.path}\\0${item.name}`\n const name = uniqueName(local, (candidate) => bindings.has(candidate) && bindings.get(candidate) !== binding)\n bindings.set(name, binding)\n if (name === local) return item\n aliases.set(local, name)\n return { ...item, alias: name }\n })\n carried.push(aliases.size > before ? createImport({ path: imp.path, ...(imp.root != null ? { root: imp.root } : {}), names }) : imp)\n }\n\n return aliases.size ? lang.replaceIdentifiers(definition.expression, (name) => aliases.get(name)) : definition.expression\n }\n}\n\n// A file of only deprecated per-source `inline` counts as inline too.\nfunction isInlineFile(file: FileNode): boolean {\n return !!file.inline || (file.sources.length > 0 && file.sources.every((source) => source.inline))\n}\n\n// The right-hand side of a `Const` or `Type`. A function body is not an expression, and printed text such as `Code` has none.\nfunction bodyOf(source: SourceNode | undefined): string | undefined {\n if (source?.inline) return source.inline.expression\n const node = source?.nodes?.length === 1 ? source.nodes[0] : undefined\n if (node?.kind !== nodeKinds.const && node?.kind !== nodeKinds.type) return undefined\n return getNodeText(node.nodes) || undefined\n}\n\nfunction pickNames(imp: ImportNode, used: ReadonlySet<string>): Array<ImportNode> {\n const names = getNames(imp).filter((item) => used.has(item.alias ?? item.name))\n return names.length > 0 ? [createImport({ path: imp.path, ...(imp.root != null ? { root: imp.root } : {}), names })] : []\n}\n\n// Rewrites the string fields `getNodeText` reads; JSDoc stays as written.\nfunction rewriteNodes(nodes: Array<CodeNode> | undefined, rewrite: (text: string) => string): Array<CodeNode> | undefined {\n return nodes?.map((node): CodeNode => {\n // Backward-compat: compiled plugins may still pass bare strings at runtime\n if (typeof node === 'string') return rewrite(node) as unknown as CodeNode\n if (node.kind === nodeKinds.break) return node\n\n const next = { ...node } as unknown as Record<string, unknown>\n for (const field of CODE_NODE_TEXT_FIELDS[node.kind] ?? []) {\n const value = next[field]\n if (Array.isArray(value)) next[field] = value.map(rewrite)\n if (typeof value === 'string' && value) next[field] = rewrite(value)\n }\n if ('nodes' in node && node.nodes) next.nodes = rewriteNodes(node.nodes, rewrite)\n return next as unknown as CodeNode\n })\n}\n","export { getRelativePath } from '../utils/combineFileMembers.ts'\nexport { inlineFiles as inline } from '../utils/inline.ts'\nexport { getNames, getSpace, isExported } from '../utils/moduleNames.ts'\n"],"mappings":";;;;;;;;;;AAsDA,SAAgB,WAAW,MAAc,SAAiD;CACxF,IAAI,YAAY;CAChB,KAAK,IAAI,SAAS,GAAG,QAAQ,SAAS,GAAG,UAAU,YAAY,GAAG,OAAO;CACzE,OAAO;AACT;;;;;;ACRA,SAAgB,YAAY,OAAgC,EAAE,YAAmD;CAC/G,MAAM,eAAe,IAAI,IAAI,MAAM,OAAO,YAAY,CAAC,CAAC,KAAK,SAAS,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC;CACxF,MAAM,SAA4B;EAAE,OAAO,CAAC;EAAG,cAAc,CAAC,GAAG,aAAa,KAAK,CAAC;EAAG,UAAU,CAAC;CAAE;CACpG,IAAI,aAAa,SAAS,GAAG,OAAO;CAGpC,MAAM,8BAAc,IAAI,IAA+B;CAEvD,SAAS,OAAO,MAAc,MAAc,MAAc,MAA8C;EACtG,MAAM,MAAM,GAAG,KAAK,IAAI;EACxB,IAAI,YAAY,IAAI,GAAG,GAAG;GACxB,MAAM,aAAa,YAAY,IAAI,GAAG;GACtC,IAAI,eAAe,MAAM,OAAO,SAAS,KAAK;IAAE,MAAM;IAAM,SAAS,IAAI,KAAK,UAAU,KAAK;GAAkC,CAAC;GAChI,OAAO,cAAc,KAAA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,IAAI,OAAO,MAAM,KAAK,KAAA;CAC7D,IAAI,MAAM,SAAS,UAAU,SAAS,MAAM,SAAS,UAAU,MAAM,OAAO,KAAA;CAC5E,OAAO,YAAY,KAAK,KAAK,KAAK,KAAA;AACpC;AAEA,SAAS,UAAU,KAAiB,MAA8C;CAChF,MAAM,QAAQ,SAAS,GAAG,CAAC,CAAC,QAAQ,SAAS,KAAK,IAAI,KAAK,SAAS,KAAK,IAAI,CAAC;CAC9E,OAAO,MAAM,SAAS,IAAI,CAAC,aAAa;EAAE,MAAM,IAAI;EAAM,GAAI,IAAI,QAAQ,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;EAAI;CAAM,CAAC,CAAC,IAAI,CAAC;AAC1H;AAGA,SAAS,aAAa,OAAoC,SAAgE;CACxH,OAAO,OAAO,KAAK,SAAmB;EAEpC,IAAI,OAAO,SAAS,UAAU,OAAO,QAAQ,IAAI;EACjD,IAAI,KAAK,SAAS,UAAU,OAAO,OAAO;EAE1C,MAAM,OAAO,EAAE,GAAG,KAAK;EACvB,KAAK,MAAM,SAAS,sBAAsB,KAAK,SAAS,CAAC,GAAG;GAC1D,MAAM,QAAQ,KAAK;GACnB,IAAI,MAAM,QAAQ,KAAK,GAAG,KAAK,SAAS,MAAM,IAAI,OAAO;GACzD,IAAI,OAAO,UAAU,YAAY,OAAO,KAAK,SAAS,QAAQ,KAAK;EACrE;EACA,IAAI,WAAW,QAAQ,KAAK,OAAO,KAAK,QAAQ,aAAa,KAAK,OAAO,OAAO;EAChF,OAAO;CACT,CAAC;AACH"}
package/dist/file.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_combineFileMembers = require("./combineFileMembers-DmmuOmY8.cjs");
3
- const require_file = require("./file-z3xToonr.cjs");
2
+ const require_file = require("./file-D9kqBrBl.cjs");
3
+ const require_combineFileMembers = require("./combineFileMembers-DZCKxAN0.cjs");
4
4
  exports.getNames = require_combineFileMembers.getNames;
5
5
  exports.getRelativePath = require_combineFileMembers.getRelativePath;
6
6
  exports.getSpace = require_combineFileMembers.getSpace;
package/dist/file.js CHANGED
@@ -1,3 +1,3 @@
1
- import { c as getSpace, l as isExported, s as getNames, t as getRelativePath } from "./combineFileMembers-DJHNAZBN.js";
2
- import { n as inlineFiles } from "./file-HwCmj--S.js";
1
+ import { n as inlineFiles } from "./file-F3pgfoe4.js";
2
+ import { c as getSpace, l as isExported, s as getNames, t as getRelativePath } from "./combineFileMembers-B-mdjXrG.js";
3
3
  export { getNames, getRelativePath, getSpace, inlineFiles as inline, isExported };
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
2
- const require_promise = require("./promise-DScaykew.cjs");
2
+ const require_promise = require("./promise-DMQPWp6M.cjs");
3
3
  const require_constants = require("./constants-BCRkFAiy.cjs");
4
4
  const require_visitor = require("./visitor-DhuKS-7x.cjs");
5
- const require_refs = require("./refs-rmr2LFV1.cjs");
5
+ const require_refs = require("./refs-CJZBa9hL.cjs");
6
6
  // src/utils/schemaGraph.ts
7
7
  const refEntries = require_promise.memo.create({ weak: true });
8
8
  const checkRefEntries = require_promise.memo.create({ weak: true });
@@ -167,4 +167,4 @@ Object.defineProperty(exports, "graph_exports", {
167
167
  }
168
168
  });
169
169
 
170
- //# sourceMappingURL=graph-D-0CbFIv.cjs.map
170
+ //# sourceMappingURL=graph-D6Ffy9YD.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-D-0CbFIv.cjs","names":["memo","nodeKinds","resolveRefName","visitChildNodes","collect"],"sources":["../src/utils/schemaGraph.ts","../src/graph/index.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport { nodeKinds } from '../constants.ts'\nimport type { Node } from '../nodes/index.ts'\nimport type { OperationNode } from '../nodes/operation.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { collect, visitChildNodes } from '../visitor.ts'\nimport { resolveRefName } from './refs.ts'\n\ntype RefEntry = { name: string; hasPointer: boolean }\n\nconst refEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst checkRefEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst schemaRefs = memo.create<SchemaNode, ReadonlySet<string>>({ weak: true })\nconst importedRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\nconst importedCheckRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\n\n/**\n * Walks a node's subtree once and lists every ref it holds, in traversal order, as the resolved\n * name plus whether the ref carries a `$ref` pointer. Memoized per node and per `checks` mode, so\n * each helper below scans a schema once.\n */\nfunction collectRefEntries(node: SchemaNode, { checks }: { checks: boolean }): ReadonlyArray<RefEntry> {\n return memo(checks ? checkRefEntries : refEntries, node, () => {\n const entries: Array<RefEntry> = []\n const walk = (current: Node): boolean => {\n if (current.kind === nodeKinds.schema && current.type === 'ref') {\n const name = resolveRefName(current)\n if (name) entries.push({ name, hasPointer: Boolean(current.ref) })\n }\n visitChildNodes(current, walk, { checks })\n return false\n }\n walk(node)\n return entries\n })\n}\n\n/**\n * Collects the names of every schema a node's subtree references, resolved with `ast.ref.getName`.\n * Each ref contributes its name only, so the schema it points to is never traversed. Memoized by\n * node identity, so repeated calls on one schema scan it once.\n *\n * @example\n * ```ts\n * collectSchemaRefs(petSchema)\n * // Set { 'Category', 'Tag' }\n * ```\n */\nexport function collectSchemaRefs(node: SchemaNode): ReadonlySet<string> {\n return memo(schemaRefs, node, () => new Set(collectRefEntries(node, { checks: true }).map((entry) => entry.name)))\n}\n\n/**\n * Collects the de-duplicated target names of every pointer-carrying ref in a node's subtree, in\n * first-occurrence order. Memoized by node identity, so `resolver.imports` reads the same result\n * across the ts, zod, and faker plugins instead of re-scanning the same schema per plugin.\n *\n * Only refs that carry a `$ref` pointer count, so a synthesized ref pointing at a sibling in the\n * same file (a union member created by name) is left out. That leaves exactly the set\n * `resolver.imports` emits. Refs inside `conditionals`, `contains` and `content` count only with\n * `checks: true`, for a plugin that prints those checks.\n *\n * @example\n * ```ts\n * collectImportedRefNames(petSchema)\n * // ['Category', 'Tag']\n * ```\n */\nexport function collectImportedRefNames(node: SchemaNode, { checks = false }: { checks?: boolean } = {}): ReadonlyArray<string> {\n return memo(checks ? importedCheckRefNames : importedRefNames, node, () => [\n ...new Set(collectRefEntries(node, { checks }).flatMap((entry) => (entry.hasPointer ? [entry.name] : []))),\n ])\n}\n\n/**\n * Collects the names of all top-level schemas transitively used by a set of operations or schemas.\n * A schema root counts the schemas it references, not itself.\n *\n * An operation uses a schema when its parameters, request body, or responses reference it, directly\n * or through other named schemas. Once a name is added to the result it is not revisited, so\n * reference cycles terminate.\n *\n * Pair it with `include` filters so schemas reachable only from excluded operations stay ungenerated.\n *\n * @example Only generate schemas referenced by included operations\n * ```ts\n * const includedOps = operations.filter((op) => resolver.default.options(op, { options, include }) !== null)\n * const allowed = collectUsedSchemaNames(includedOps, schemas)\n *\n * for (const schema of schemas) {\n * if (schema.name && !allowed.has(schema.name)) continue\n * // generate schema\n * }\n * ```\n */\nexport function collectUsedSchemaNames(roots: ReadonlyArray<OperationNode | SchemaNode>, schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const schemaMap = new Map<string, SchemaNode>()\n for (const schema of schemas) {\n if (schema.name) schemaMap.set(schema.name, schema)\n }\n\n const result = new Set<string>()\n\n function visitSchema(schema: SchemaNode): void {\n for (const name of collectSchemaRefs(schema)) {\n if (!result.has(name)) {\n result.add(name)\n const namedSchema = schemaMap.get(name)\n if (namedSchema) visitSchema(namedSchema)\n }\n }\n }\n\n for (const root of roots) {\n for (const schema of collect<SchemaNode>(root, { depth: 'shallow', schema: (node) => node })) {\n visitSchema(schema)\n }\n }\n\n return result\n}\n\n/**\n * Finds every schema that takes part in a circular dependency chain, including direct self-loops.\n *\n * Wrap the returned schema positions in a deferred construct (a lazy getter or `z.lazy(() => …)`) so\n * the generated code does not recurse forever. Refs are followed by name only, so the walk stays\n * linear in the size of the schema graph.\n *\n * @note Call this once on the full graph, then check a schema's `ast.graph.getRefNames` against the result.\n */\nexport function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const graph = new Map<string, ReadonlySet<string>>()\n for (const schema of schemas) {\n if (schema.name) graph.set(schema.name, collectSchemaRefs(schema))\n }\n\n return new Set([...graph.keys()].filter((start) => reachesItself(graph, start)))\n}\n\nfunction reachesItself(graph: ReadonlyMap<string, ReadonlySet<string>>, start: string): boolean {\n const visited = new Set<string>()\n const stack: Array<string> = [...(graph.get(start) ?? [])]\n while (stack.length > 0) {\n const node = stack.pop()!\n if (node === start) return true\n if (visited.has(node)) continue\n visited.add(node)\n for (const next of graph.get(node) ?? []) stack.push(next)\n }\n\n return false\n}\n","export {\n collectImportedRefNames as getImportedNames,\n collectSchemaRefs as getRefNames,\n collectUsedSchemaNames as getUsedNames,\n findCircularSchemas as getCircularNames,\n} from '../utils/schemaGraph.ts'\n"],"mappings":";;;;;;AAUA,MAAM,aAAaA,gBAAAA,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AAClF,MAAM,kBAAkBA,gBAAAA,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AACvF,MAAM,aAAaA,gBAAAA,KAAK,OAAwC,EAAE,MAAM,KAAK,CAAC;AAC9E,MAAM,mBAAmBA,gBAAAA,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;AACtF,MAAM,wBAAwBA,gBAAAA,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;;;;;;AAO3F,SAAS,kBAAkB,MAAkB,EAAE,UAAwD;CACrG,OAAOA,gBAAAA,KAAK,SAAS,kBAAkB,YAAY,YAAY;EAC7D,MAAM,UAA2B,CAAC;EAClC,MAAM,QAAQ,YAA2B;GACvC,IAAI,QAAQ,SAASC,kBAAAA,UAAU,UAAU,QAAQ,SAAS,OAAO;IAC/D,MAAM,OAAOC,aAAAA,eAAe,OAAO;IACnC,IAAI,MAAM,QAAQ,K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;;AAWA,SAAgB,oBAAoB,SAAiD;CACnF,MAAM,wBAAQ,IAAI,IAAiC;CACnD,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,MAAM,MAAM,IAAI,OAAO,MAAM,kBAAkB,MAAM,CAAC;CAGnE,OAAO,IAAI,IAAI,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,QAAQ,UAAU,cAAc,OAAO,KAAK,CAAC,CAAC;AACjF;AAEA,SAAS,cAAc,OAAiD,OAAwB;CAC9F,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,QAAuB,CAAC,GAAI,MAAM,IAAI,KAAK,KAAK,CAAC,CAAE;CACzD,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,OAAO,MAAM,IAAI;EACvB,IAAI,SAAS,OAAO,OAAO;EAC3B,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,QAAQ,IAAI,IAAI;EAChB,KAAK,MAAM,QAAQ,MAAM,IAAI,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,IAAI;CAC3D;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"graph-D6Ffy9YD.cjs","names":["memo","nodeKinds","resolveRefName","visitChildNodes","collect"],"sources":["../src/utils/schemaGraph.ts","../src/graph/index.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport { nodeKinds } from '../constants.ts'\nimport type { Node } from '../nodes/index.ts'\nimport type { OperationNode } from '../nodes/operation.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { collect, visitChildNodes } from '../visitor.ts'\nimport { resolveRefName } from './refs.ts'\n\ntype RefEntry = { name: string; hasPointer: boolean }\n\nconst refEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst checkRefEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst schemaRefs = memo.create<SchemaNode, ReadonlySet<string>>({ weak: true })\nconst importedRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\nconst importedCheckRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\n\n/**\n * Walks a node's subtree once and lists every ref it holds, in traversal order, as the resolved\n * name plus whether the ref carries a `$ref` pointer. Memoized per node and per `checks` mode, so\n * each helper below scans a schema once.\n */\nfunction collectRefEntries(node: SchemaNode, { checks }: { checks: boolean }): ReadonlyArray<RefEntry> {\n return memo(checks ? checkRefEntries : refEntries, node, () => {\n const entries: Array<RefEntry> = []\n const walk = (current: Node): boolean => {\n if (current.kind === nodeKinds.schema && current.type === 'ref') {\n const name = resolveRefName(current)\n if (name) entries.push({ name, hasPointer: Boolean(current.ref) })\n }\n visitChildNodes(current, walk, { checks })\n return false\n }\n walk(node)\n return entries\n })\n}\n\n/**\n * Collects the names of every schema a node's subtree references, resolved with `ast.ref.getName`.\n * Each ref contributes its name only, so the schema it points to is never traversed. Memoized by\n * node identity, so repeated calls on one schema scan it once.\n *\n * @example\n * ```ts\n * collectSchemaRefs(petSchema)\n * // Set { 'Category', 'Tag' }\n * ```\n */\nexport function collectSchemaRefs(node: SchemaNode): ReadonlySet<string> {\n return memo(schemaRefs, node, () => new Set(collectRefEntries(node, { checks: true }).map((entry) => entry.name)))\n}\n\n/**\n * Collects the de-duplicated target names of every pointer-carrying ref in a node's subtree, in\n * first-occurrence order. Memoized by node identity, so `resolver.imports` reads the same result\n * across the ts, zod, and faker plugins instead of re-scanning the same schema per plugin.\n *\n * Only refs that carry a `$ref` pointer count, so a synthesized ref pointing at a sibling in the\n * same file (a union member created by name) is left out. That leaves exactly the set\n * `resolver.imports` emits. Refs inside `conditionals`, `contains` and `content` count only with\n * `checks: true`, for a plugin that prints those checks.\n *\n * @example\n * ```ts\n * collectImportedRefNames(petSchema)\n * // ['Category', 'Tag']\n * ```\n */\nexport function collectImportedRefNames(node: SchemaNode, { checks = false }: { checks?: boolean } = {}): ReadonlyArray<string> {\n return memo(checks ? importedCheckRefNames : importedRefNames, node, () => [\n ...new Set(collectRefEntries(node, { checks }).flatMap((entry) => (entry.hasPointer ? [entry.name] : []))),\n ])\n}\n\n/**\n * Collects the names of all top-level schemas transitively used by a set of operations or schemas.\n * A schema root counts the schemas it references, not itself.\n *\n * An operation uses a schema when its parameters, request body, or responses reference it, directly\n * or through other named schemas. Once a name is added to the result it is not revisited, so\n * reference cycles terminate.\n *\n * Pair it with `include` filters so schemas reachable only from excluded operations stay ungenerated.\n *\n * @example Only generate schemas referenced by included operations\n * ```ts\n * const includedOps = operations.filter((op) => resolver.default.options(op, { options, include }) !== null)\n * const allowed = collectUsedSchemaNames(includedOps, schemas)\n *\n * for (const schema of schemas) {\n * if (schema.name && !allowed.has(schema.name)) continue\n * // generate schema\n * }\n * ```\n */\nexport function collectUsedSchemaNames(roots: ReadonlyArray<OperationNode | SchemaNode>, schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const schemaMap = new Map<string, SchemaNode>()\n for (const schema of schemas) {\n if (schema.name) schemaMap.set(schema.name, schema)\n }\n\n const result = new Set<string>()\n\n function visitSchema(schema: SchemaNode): void {\n for (const name of collectSchemaRefs(schema)) {\n if (!result.has(name)) {\n result.add(name)\n const namedSchema = schemaMap.get(name)\n if (namedSchema) visitSchema(namedSchema)\n }\n }\n }\n\n for (const root of roots) {\n for (const schema of collect<SchemaNode>(root, { depth: 'shallow', schema: (node) => node })) {\n visitSchema(schema)\n }\n }\n\n return result\n}\n\n/**\n * Finds every schema that takes part in a circular dependency chain, including direct self-loops.\n *\n * Wrap the returned schema positions in a deferred construct (a lazy getter or `z.lazy(() => …)`) so\n * the generated code does not recurse forever. Refs are followed by name only, so the walk stays\n * linear in the size of the schema graph.\n *\n * @note Call this once on the full graph, then check a schema's `ast.graph.getRefNames` against the result.\n */\nexport function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const graph = new Map<string, ReadonlySet<string>>()\n for (const schema of schemas) {\n if (schema.name) graph.set(schema.name, collectSchemaRefs(schema))\n }\n\n return new Set([...graph.keys()].filter((start) => reachesItself(graph, start)))\n}\n\nfunction reachesItself(graph: ReadonlyMap<string, ReadonlySet<string>>, start: string): boolean {\n const visited = new Set<string>()\n const stack: Array<string> = [...(graph.get(start) ?? [])]\n while (stack.length > 0) {\n const node = stack.pop()!\n if (node === start) return true\n if (visited.has(node)) continue\n visited.add(node)\n for (const next of graph.get(node) ?? []) stack.push(next)\n }\n\n return false\n}\n","export {\n collectImportedRefNames as getImportedNames,\n collectSchemaRefs as getRefNames,\n collectUsedSchemaNames as getUsedNames,\n findCircularSchemas as getCircularNames,\n} from '../utils/schemaGraph.ts'\n"],"mappings":";;;;;;AAUA,MAAM,aAAaA,gBAAAA,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AAClF,MAAM,kBAAkBA,gBAAAA,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AACvF,MAAM,aAAaA,gBAAAA,KAAK,OAAwC,EAAE,MAAM,KAAK,CAAC;AAC9E,MAAM,mBAAmBA,gBAAAA,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;AACtF,MAAM,wBAAwBA,gBAAAA,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;;;;;;AAO3F,SAAS,kBAAkB,MAAkB,EAAE,UAAwD;CACrG,OAAOA,gBAAAA,KAAK,SAAS,kBAAkB,YAAY,YAAY;EAC7D,MAAM,UAA2B,CAAC;EAClC,MAAM,QAAQ,YAA2B;GACvC,IAAI,QAAQ,SAASC,kBAAAA,UAAU,UAAU,QAAQ,SAAS,OAAO;IAC/D,MAAM,OAAOC,aAAAA,eAAe,OAAO;IACnC,IAAI,MAAM,QAAQ,KAAK;KAAE;KAAM,YAAY,QAAQ,QAAQ,GAAG;IAAE,CAAC;GACnE;GACAC,gBAAAA,gBAAgB,SAAS,MAAM,EAAE,OAAO,CAAC;GACzC,OAAO;EACT;EACA,KAAK,IAAI;EACT,OAAO;CACT,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,kBAAkB,MAAuC;CACvE,OAAOH,gBAAAA,KAAK,YAAY,YAAY,I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AAC,CAAC;AACjF;AAEA,SAAS,cAAc,OAAiD,OAAwB;CAC9F,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,QAAuB,CAAC,GAAI,MAAM,IAAI,KAAK,KAAK,CAAC,CAAE;CACzD,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,OAAO,MAAM,IAAI;EACvB,IAAI,SAAS,OAAO,OAAO;EAC3B,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,QAAQ,IAAI,IAAI;EAChB,KAAK,MAAM,QAAQ,MAAM,IAAI,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,IAAI;CAC3D;CAEA,OAAO;AACT"}
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BYyVTPww.js";
2
- import { t as memo } from "./promise-B3YkZ4C8.js";
2
+ import { t as memo } from "./promise-bi4pc8Xr.js";
3
3
  import { t as nodeKinds } from "./constants-UorsTFsa.js";
4
4
  import { i as visitChildNodes, t as collect } from "./visitor-DA5yfOJz.js";
5
- import { a as resolveRefName } from "./refs-Bgf8_9Ui.js";
5
+ import { a as resolveRefName } from "./refs-C0hb_qu-.js";
6
6
  // src/utils/schemaGraph.ts
7
7
  const refEntries = memo.create({ weak: true });
8
8
  const checkRefEntries = memo.create({ weak: true });
@@ -138,4 +138,4 @@ var graph_exports = /* @__PURE__ */ __exportAll({
138
138
  });
139
139
  export { findCircularSchemas as a, collectUsedSchemaNames as i, collectImportedRefNames as n, collectSchemaRefs as r, graph_exports as t };
140
140
 
141
- //# sourceMappingURL=graph-CePbhGIt.js.map
141
+ //# sourceMappingURL=graph-DWlCmvm6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-CePbhGIt.js","names":[],"sources":["../src/utils/schemaGraph.ts","../src/graph/index.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport { nodeKinds } from '../constants.ts'\nimport type { Node } from '../nodes/index.ts'\nimport type { OperationNode } from '../nodes/operation.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { collect, visitChildNodes } from '../visitor.ts'\nimport { resolveRefName } from './refs.ts'\n\ntype RefEntry = { name: string; hasPointer: boolean }\n\nconst refEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst checkRefEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst schemaRefs = memo.create<SchemaNode, ReadonlySet<string>>({ weak: true })\nconst importedRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\nconst importedCheckRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\n\n/**\n * Walks a node's subtree once and lists every ref it holds, in traversal order, as the resolved\n * name plus whether the ref carries a `$ref` pointer. Memoized per node and per `checks` mode, so\n * each helper below scans a schema once.\n */\nfunction collectRefEntries(node: SchemaNode, { checks }: { checks: boolean }): ReadonlyArray<RefEntry> {\n return memo(checks ? checkRefEntries : refEntries, node, () => {\n const entries: Array<RefEntry> = []\n const walk = (current: Node): boolean => {\n if (current.kind === nodeKinds.schema && current.type === 'ref') {\n const name = resolveRefName(current)\n if (name) entries.push({ name, hasPointer: Boolean(current.ref) })\n }\n visitChildNodes(current, walk, { checks })\n return false\n }\n walk(node)\n return entries\n })\n}\n\n/**\n * Collects the names of every schema a node's subtree references, resolved with `ast.ref.getName`.\n * Each ref contributes its name only, so the schema it points to is never traversed. Memoized by\n * node identity, so repeated calls on one schema scan it once.\n *\n * @example\n * ```ts\n * collectSchemaRefs(petSchema)\n * // Set { 'Category', 'Tag' }\n * ```\n */\nexport function collectSchemaRefs(node: SchemaNode): ReadonlySet<string> {\n return memo(schemaRefs, node, () => new Set(collectRefEntries(node, { checks: true }).map((entry) => entry.name)))\n}\n\n/**\n * Collects the de-duplicated target names of every pointer-carrying ref in a node's subtree, in\n * first-occurrence order. Memoized by node identity, so `resolver.imports` reads the same result\n * across the ts, zod, and faker plugins instead of re-scanning the same schema per plugin.\n *\n * Only refs that carry a `$ref` pointer count, so a synthesized ref pointing at a sibling in the\n * same file (a union member created by name) is left out. That leaves exactly the set\n * `resolver.imports` emits. Refs inside `conditionals`, `contains` and `content` count only with\n * `checks: true`, for a plugin that prints those checks.\n *\n * @example\n * ```ts\n * collectImportedRefNames(petSchema)\n * // ['Category', 'Tag']\n * ```\n */\nexport function collectImportedRefNames(node: SchemaNode, { checks = false }: { checks?: boolean } = {}): ReadonlyArray<string> {\n return memo(checks ? importedCheckRefNames : importedRefNames, node, () => [\n ...new Set(collectRefEntries(node, { checks }).flatMap((entry) => (entry.hasPointer ? [entry.name] : []))),\n ])\n}\n\n/**\n * Collects the names of all top-level schemas transitively used by a set of operations or schemas.\n * A schema root counts the schemas it references, not itself.\n *\n * An operation uses a schema when its parameters, request body, or responses reference it, directly\n * or through other named schemas. Once a name is added to the result it is not revisited, so\n * reference cycles terminate.\n *\n * Pair it with `include` filters so schemas reachable only from excluded operations stay ungenerated.\n *\n * @example Only generate schemas referenced by included operations\n * ```ts\n * const includedOps = operations.filter((op) => resolver.default.options(op, { options, include }) !== null)\n * const allowed = collectUsedSchemaNames(includedOps, schemas)\n *\n * for (const schema of schemas) {\n * if (schema.name && !allowed.has(schema.name)) continue\n * // generate schema\n * }\n * ```\n */\nexport function collectUsedSchemaNames(roots: ReadonlyArray<OperationNode | SchemaNode>, schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const schemaMap = new Map<string, SchemaNode>()\n for (const schema of schemas) {\n if (schema.name) schemaMap.set(schema.name, schema)\n }\n\n const result = new Set<string>()\n\n function visitSchema(schema: SchemaNode): void {\n for (const name of collectSchemaRefs(schema)) {\n if (!result.has(name)) {\n result.add(name)\n const namedSchema = schemaMap.get(name)\n if (namedSchema) visitSchema(namedSchema)\n }\n }\n }\n\n for (const root of roots) {\n for (const schema of collect<SchemaNode>(root, { depth: 'shallow', schema: (node) => node })) {\n visitSchema(schema)\n }\n }\n\n return result\n}\n\n/**\n * Finds every schema that takes part in a circular dependency chain, including direct self-loops.\n *\n * Wrap the returned schema positions in a deferred construct (a lazy getter or `z.lazy(() => …)`) so\n * the generated code does not recurse forever. Refs are followed by name only, so the walk stays\n * linear in the size of the schema graph.\n *\n * @note Call this once on the full graph, then check a schema's `ast.graph.getRefNames` against the result.\n */\nexport function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const graph = new Map<string, ReadonlySet<string>>()\n for (const schema of schemas) {\n if (schema.name) graph.set(schema.name, collectSchemaRefs(schema))\n }\n\n return new Set([...graph.keys()].filter((start) => reachesItself(graph, start)))\n}\n\nfunction reachesItself(graph: ReadonlyMap<string, ReadonlySet<string>>, start: string): boolean {\n const visited = new Set<string>()\n const stack: Array<string> = [...(graph.get(start) ?? [])]\n while (stack.length > 0) {\n const node = stack.pop()!\n if (node === start) return true\n if (visited.has(node)) continue\n visited.add(node)\n for (const next of graph.get(node) ?? []) stack.push(next)\n }\n\n return false\n}\n","export {\n collectImportedRefNames as getImportedNames,\n collectSchemaRefs as getRefNames,\n collectUsedSchemaNames as getUsedNames,\n findCircularSchemas as getCircularNames,\n} from '../utils/schemaGraph.ts'\n"],"mappings":";;;;;;AAUA,MAAM,aAAa,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AAClF,MAAM,kBAAkB,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AACvF,MAAM,aAAa,KAAK,OAAwC,EAAE,MAAM,KAAK,CAAC;AAC9E,MAAM,mBAAmB,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;AACtF,MAAM,wBAAwB,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;;;;;;AAO3F,SAAS,kBAAkB,MAAkB,EAAE,UAAwD;CACrG,OAAO,KAAK,SAAS,kBAAkB,YAAY,YAAY;EAC7D,MAAM,UAA2B,CAAC;EAClC,MAAM,QAAQ,YAA2B;GACvC,IAAI,QAAQ,SAAS,UAAU,UAAU,QAAQ,SAAS,OAAO;IAC/D,MAAM,OAAO,eAAe,OAAO;IACnC,IAAI,MAAM,QAAQ,KAAK;KAAE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Q,IAAI,IAAiC;CACnD,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,MAAM,MAAM,IAAI,OAAO,MAAM,kBAAkB,MAAM,CAAC;CAGnE,OAAO,IAAI,IAAI,CAAC,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,QAAQ,UAAU,cAAc,OAAO,KAAK,CAAC,CAAC;AACjF;AAEA,SAAS,cAAc,OAAiD,OAAwB;CAC9F,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,QAAuB,CAAC,GAAI,MAAM,IAAI,KAAK,KAAK,CAAC,CAAE;CACzD,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,OAAO,MAAM,IAAI;EACvB,IAAI,SAAS,OAAO,OAAO;EAC3B,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,QAAQ,IAAI,IAAI;EAChB,KAAK,MAAM,QAAQ,MAAM,IAAI,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,IAAI;CAC3D;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"graph-DWlCmvm6.js","names":[],"sources":["../src/utils/schemaGraph.ts","../src/graph/index.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport { nodeKinds } from '../constants.ts'\nimport type { Node } from '../nodes/index.ts'\nimport type { OperationNode } from '../nodes/operation.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { collect, visitChildNodes } from '../visitor.ts'\nimport { resolveRefName } from './refs.ts'\n\ntype RefEntry = { name: string; hasPointer: boolean }\n\nconst refEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst checkRefEntries = memo.create<SchemaNode, ReadonlyArray<RefEntry>>({ weak: true })\nconst schemaRefs = memo.create<SchemaNode, ReadonlySet<string>>({ weak: true })\nconst importedRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\nconst importedCheckRefNames = memo.create<SchemaNode, ReadonlyArray<string>>({ weak: true })\n\n/**\n * Walks a node's subtree once and lists every ref it holds, in traversal order, as the resolved\n * name plus whether the ref carries a `$ref` pointer. Memoized per node and per `checks` mode, so\n * each helper below scans a schema once.\n */\nfunction collectRefEntries(node: SchemaNode, { checks }: { checks: boolean }): ReadonlyArray<RefEntry> {\n return memo(checks ? checkRefEntries : refEntries, node, () => {\n const entries: Array<RefEntry> = []\n const walk = (current: Node): boolean => {\n if (current.kind === nodeKinds.schema && current.type === 'ref') {\n const name = resolveRefName(current)\n if (name) entries.push({ name, hasPointer: Boolean(current.ref) })\n }\n visitChildNodes(current, walk, { checks })\n return false\n }\n walk(node)\n return entries\n })\n}\n\n/**\n * Collects the names of every schema a node's subtree references, resolved with `ast.ref.getName`.\n * Each ref contributes its name only, so the schema it points to is never traversed. Memoized by\n * node identity, so repeated calls on one schema scan it once.\n *\n * @example\n * ```ts\n * collectSchemaRefs(petSchema)\n * // Set { 'Category', 'Tag' }\n * ```\n */\nexport function collectSchemaRefs(node: SchemaNode): ReadonlySet<string> {\n return memo(schemaRefs, node, () => new Set(collectRefEntries(node, { checks: true }).map((entry) => entry.name)))\n}\n\n/**\n * Collects the de-duplicated target names of every pointer-carrying ref in a node's subtree, in\n * first-occurrence order. Memoized by node identity, so `resolver.imports` reads the same result\n * across the ts, zod, and faker plugins instead of re-scanning the same schema per plugin.\n *\n * Only refs that carry a `$ref` pointer count, so a synthesized ref pointing at a sibling in the\n * same file (a union member created by name) is left out. That leaves exactly the set\n * `resolver.imports` emits. Refs inside `conditionals`, `contains` and `content` count only with\n * `checks: true`, for a plugin that prints those checks.\n *\n * @example\n * ```ts\n * collectImportedRefNames(petSchema)\n * // ['Category', 'Tag']\n * ```\n */\nexport function collectImportedRefNames(node: SchemaNode, { checks = false }: { checks?: boolean } = {}): ReadonlyArray<string> {\n return memo(checks ? importedCheckRefNames : importedRefNames, node, () => [\n ...new Set(collectRefEntries(node, { checks }).flatMap((entry) => (entry.hasPointer ? [entry.name] : []))),\n ])\n}\n\n/**\n * Collects the names of all top-level schemas transitively used by a set of operations or schemas.\n * A schema root counts the schemas it references, not itself.\n *\n * An operation uses a schema when its parameters, request body, or responses reference it, directly\n * or through other named schemas. Once a name is added to the result it is not revisited, so\n * reference cycles terminate.\n *\n * Pair it with `include` filters so schemas reachable only from excluded operations stay ungenerated.\n *\n * @example Only generate schemas referenced by included operations\n * ```ts\n * const includedOps = operations.filter((op) => resolver.default.options(op, { options, include }) !== null)\n * const allowed = collectUsedSchemaNames(includedOps, schemas)\n *\n * for (const schema of schemas) {\n * if (schema.name && !allowed.has(schema.name)) continue\n * // generate schema\n * }\n * ```\n */\nexport function collectUsedSchemaNames(roots: ReadonlyArray<OperationNode | SchemaNode>, schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const schemaMap = new Map<string, SchemaNode>()\n for (const schema of schemas) {\n if (schema.name) schemaMap.set(schema.name, schema)\n }\n\n const result = new Set<string>()\n\n function visitSchema(schema: SchemaNode): void {\n for (const name of collectSchemaRefs(schema)) {\n if (!result.has(name)) {\n result.add(name)\n const namedSchema = schemaMap.get(name)\n if (namedSchema) visitSchema(namedSchema)\n }\n }\n }\n\n for (const root of roots) {\n for (const schema of collect<SchemaNode>(root, { depth: 'shallow', schema: (node) => node })) {\n visitSchema(schema)\n }\n }\n\n return result\n}\n\n/**\n * Finds every schema that takes part in a circular dependency chain, including direct self-loops.\n *\n * Wrap the returned schema positions in a deferred construct (a lazy getter or `z.lazy(() => …)`) so\n * the generated code does not recurse forever. Refs are followed by name only, so the walk stays\n * linear in the size of the schema graph.\n *\n * @note Call this once on the full graph, then check a schema's `ast.graph.getRefNames` against the result.\n */\nexport function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<string> {\n const graph = new Map<string, ReadonlySet<string>>()\n for (const schema of schemas) {\n if (schema.name) graph.set(schema.name, collectSchemaRefs(schema))\n }\n\n return new Set([...graph.keys()].filter((start) => reachesItself(graph, start)))\n}\n\nfunction reachesItself(graph: ReadonlyMap<string, ReadonlySet<string>>, start: string): boolean {\n const visited = new Set<string>()\n const stack: Array<string> = [...(graph.get(start) ?? [])]\n while (stack.length > 0) {\n const node = stack.pop()!\n if (node === start) return true\n if (visited.has(node)) continue\n visited.add(node)\n for (const next of graph.get(node) ?? []) stack.push(next)\n }\n\n return false\n}\n","export {\n collectImportedRefNames as getImportedNames,\n collectSchemaRefs as getRefNames,\n collectUsedSchemaNames as getUsedNames,\n findCircularSchemas as getCircularNames,\n} from '../utils/schemaGraph.ts'\n"],"mappings":";;;;;;AAUA,MAAM,aAAa,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AAClF,MAAM,kBAAkB,KAAK,OAA4C,EAAE,MAAM,KAAK,CAAC;AACvF,MAAM,aAAa,KAAK,OAAwC,EAAE,MAAM,KAAK,CAAC;AAC9E,MAAM,mBAAmB,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;AACtF,MAAM,wBAAwB,KAAK,OAA0C,EAAE,MAAM,KAAK,CAAC;;;;;;AAO3F,SAAS,kBAAkB,MAAkB,EAAE,UAAwD;CACrG,OAAO,KAAK,SAAS,kBAAkB,YAAY,YAAY;EAC7D,MAAM,UAA2B,CAAC;EAClC,MAAM,QAAQ,YAA2B;GACvC,IAAI,QAAQ,SAAS,UAAU,UAAU,QAAQ,SAAS,OAAO;IAC/D,MAAM,OAAO,eAAe,OAAO;IACnC,IAAI,MAAM,QAAQ,KAAK;KAAE;KAAM,YAAY,QAAQ,QAAQ,GAAG;IAAE,CAAC;GACnE;GACA,gBAAgB,SAAS,MAAM,EAAE,OAAO,CAAC;GACzC,OAAO;EACT;EACA,KAAK,IAAI;EACT,OAAO;CACT,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,kBAAkB,MAAuC;CACvE,OAAO,KAAK,YAAY,YAAY,IAAI,IAAI,kBAAkB,MAAM,EAAE,QAAQ,KAAK,CAAC,CAAC,CAAC,KAAK,UAAU,MAAM,IAAI,CAAC,CAAC;AACnH;;;;;;;;;;;;;;;;;AAkBA,SAAgB,wBAAwB,MAAkB,EAAE,SAAS,UAAgC,CAAC,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AAM,IAAI;EACvB,IAAI,SAAS,OAAO,OAAO;EAC3B,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,QAAQ,IAAI,IAAI;EAChB,KAAK,MAAM,QAAQ,MAAM,IAAI,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,IAAI;CAC3D;CAEA,OAAO;AACT"}
package/dist/graph.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_graph = require("./graph-D-0CbFIv.cjs");
2
+ const require_graph = require("./graph-D6Ffy9YD.cjs");
3
3
  exports.getCircularNames = require_graph.findCircularSchemas;
4
4
  exports.getImportedNames = require_graph.collectImportedRefNames;
5
5
  exports.getRefNames = require_graph.collectSchemaRefs;
package/dist/graph.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as findCircularSchemas, i as collectUsedSchemaNames, n as collectImportedRefNames, r as collectSchemaRefs } from "./index-BNf4pYPx.cjs";
1
+ import { a as findCircularSchemas, i as collectUsedSchemaNames, n as collectImportedRefNames, r as collectSchemaRefs } from "./index-C4ZZnf_X.cjs";
2
2
  export { findCircularSchemas as getCircularNames, collectImportedRefNames as getImportedNames, collectSchemaRefs as getRefNames, collectUsedSchemaNames as getUsedNames };
package/dist/graph.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as findCircularSchemas, i as collectUsedSchemaNames, n as collectImportedRefNames, r as collectSchemaRefs } from "./index-BfNUrkK6.js";
1
+ import { a as findCircularSchemas, i as collectUsedSchemaNames, n as collectImportedRefNames, r as collectSchemaRefs } from "./index-BGhhO3z8.js";
2
2
  export { findCircularSchemas as getCircularNames, collectImportedRefNames as getImportedNames, collectSchemaRefs as getRefNames, collectUsedSchemaNames as getUsedNames };
package/dist/graph.js CHANGED
@@ -1 +1 @@
1
- export { a as getCircularNames, n as getImportedNames, r as getRefNames, i as getUsedNames } from "./graph-CePbhGIt.js";
1
+ export { a as getCircularNames, n as getImportedNames, r as getRefNames, i as getUsedNames } from "./graph-DWlCmvm6.js";
@@ -1,4 +1,4 @@
1
- import { G as SchemaNode, K as SchemaNodeByType, i as OperationNode, r as HttpOperationNode } from "./operation-Dd0-l2VB.js";
1
+ import { K as SchemaNode, i as OperationNode, q as SchemaNodeByType, r as HttpOperationNode } from "./operation-DJ7F0cFp.js";
2
2
  /**
3
3
  * Narrows a `SchemaNode` to the variant that matches `type`.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { G as SchemaNode, K as SchemaNodeByType, i as OperationNode, r as HttpOperationNode } from "./operation-De4lbIZS.cjs";
1
+ import { K as SchemaNode, i as OperationNode, q as SchemaNodeByType, r as HttpOperationNode } from "./operation-B86IER5K.cjs";
2
2
  /**
3
3
  * Narrows a `SchemaNode` to the variant that matches `type`.
4
4
  *
package/dist/http.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as isHttpOperationNode } from "./guards-B6LgmDhJ.cjs";
2
- import "./index-BiXrjYNm.cjs";
1
+ import { t as isHttpOperationNode } from "./guards-EpQMJGyF.cjs";
2
+ import "./index-DT-_5NUx.cjs";
3
3
  export { isHttpOperationNode as isOperation };
package/dist/http.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as isHttpOperationNode } from "./guards-l2AsKeHR.js";
2
- import "./index-CC5Rmgcm.js";
1
+ import { t as isHttpOperationNode } from "./guards-CTqHwyNs.js";
2
+ import "./index-kxuajWM1.js";
3
3
  export { isHttpOperationNode as isOperation };
@@ -1,4 +1,4 @@
1
- import { D as InputNode } from "./operation-Dd0-l2VB.js";
1
+ import { D as InputNode } from "./operation-DJ7F0cFp.js";
2
2
  declare namespace index_d_exports {
3
3
  export { parse, stringify };
4
4
  }
@@ -1,4 +1,4 @@
1
- import { G as SchemaNode, i as OperationNode } from "./operation-Dd0-l2VB.js";
1
+ import { K as SchemaNode, i as OperationNode } from "./operation-DJ7F0cFp.js";
2
2
  /**
3
3
  * Collects the names of every schema a node's subtree references, resolved with `ast.ref.getName`.
4
4
  * Each ref contributes its name only, so the schema it points to is never traversed. Memoized by
@@ -1,4 +1,4 @@
1
- import { G as SchemaNode, H as RefSchemaNode } from "./operation-De4lbIZS.cjs";
1
+ import { K as SchemaNode, U as RefSchemaNode } from "./operation-B86IER5K.cjs";
2
2
  /**
3
3
  * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { i as nodeKinds } from "./base-A-xF4pUL.js";
2
2
  import { g as CodeNode } from "./file-Dg70hXm3.js";
3
- import { a as collect, s as transform } from "./visitor-BNGMMmpe.js";
3
+ import { a as collect, s as transform } from "./visitor-xxcbpM5-.js";
4
4
  /**
5
5
  * Extracts all string content from a `CodeNode` tree recursively.
6
6
  * Collects the text fields and nested node content, to build the source string for import filtering.
@@ -1,4 +1,4 @@
1
- import { G as SchemaNode, i as OperationNode } from "./operation-De4lbIZS.cjs";
1
+ import { K as SchemaNode, i as OperationNode } from "./operation-B86IER5K.cjs";
2
2
  /**
3
3
  * Collects the names of every schema a node's subtree references, resolved with `ast.ref.getName`.
4
4
  * Each ref contributes its name only, so the schema it points to is never traversed. Memoized by
@@ -1,5 +1,5 @@
1
- import { t as Node } from "./index-BjmAaymt.cjs";
2
- import { i as VisitorKey, n as VisitorContext, r as VisitorDepth, t as Visitor } from "./visitor-BN5QJX7-.cjs";
1
+ import { t as Node } from "./index-DdD4PIY8.cjs";
2
+ import { i as VisitorKey, n as VisitorContext, r as VisitorDepth, t as Visitor } from "./visitor-BIldddZd.cjs";
3
3
  /**
4
4
  * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,
5
5
  * and `undefined` keeps declaration order.
@@ -1,7 +1,7 @@
1
- import { $ as PropertyNode, G as SchemaNode, J as StringSchemaNode } from "./operation-De4lbIZS.cjs";
1
+ import { K as SchemaNode, Y as StringSchemaNode, et as PropertyNode } from "./operation-B86IER5K.cjs";
2
2
  import { a as schemaTypes } from "./base-CyJhBRMi.cjs";
3
- import { n as narrowSchema } from "./guards-B6LgmDhJ.cjs";
4
- import { o as findSchema } from "./visitor-BN5QJX7-.cjs";
3
+ import { n as narrowSchema } from "./guards-EpQMJGyF.cjs";
4
+ import { o as findSchema } from "./visitor-BIldddZd.cjs";
5
5
  /**
6
6
  * Generic JSON Schema optionality: a non-required field is optional, and a
7
7
  * non-required nullable field is nullish.
@@ -1,6 +1,6 @@
1
1
  import { i as nodeKinds } from "./base-CyJhBRMi.cjs";
2
2
  import { g as CodeNode } from "./file-DJqd2j3y.cjs";
3
- import { a as collect, s as transform } from "./visitor-BN5QJX7-.cjs";
3
+ import { a as collect, s as transform } from "./visitor-BIldddZd.cjs";
4
4
  /**
5
5
  * Extracts all string content from a `CodeNode` tree recursively.
6
6
  * Collects the text fields and nested node content, to build the source string for import filtering.
@@ -1,4 +1,4 @@
1
- import { G as SchemaNode, H as RefSchemaNode } from "./operation-Dd0-l2VB.js";
1
+ import { K as SchemaNode, U as RefSchemaNode } from "./operation-DJ7F0cFp.js";
2
2
  /**
3
3
  * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { D as InputNode } from "./operation-De4lbIZS.cjs";
1
+ import { D as InputNode } from "./operation-B86IER5K.cjs";
2
2
  declare namespace index_d_exports {
3
3
  export { parse, stringify };
4
4
  }
@@ -0,0 +1,5 @@
1
+ import { t as isHttpOperationNode } from "./guards-EpQMJGyF.cjs";
2
+ declare namespace index_d_exports {
3
+ export { isHttpOperationNode as isOperation };
4
+ }
5
+ export { index_d_exports as t };
@@ -1,5 +1,5 @@
1
- import { t as Node } from "./index-Bz33tfQo.js";
2
- import { i as VisitorKey, n as VisitorContext, r as VisitorDepth, t as Visitor } from "./visitor-BNGMMmpe.js";
1
+ import { t as Node } from "./index-DjwCRndP.js";
2
+ import { i as VisitorKey, n as VisitorContext, r as VisitorDepth, t as Visitor } from "./visitor-xxcbpM5-.js";
3
3
  /**
4
4
  * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,
5
5
  * and `undefined` keeps declaration order.
@@ -1,5 +1,5 @@
1
1
  import { C as createArrowFunction, D as createJsx, E as createFunction, O as createText, S as TypeNode, T as createConst, _ as ConstNode, a as ImportNode, b as JsxNode, c as Space, d as createFile, f as createImport, h as BreakNode, i as ImportInput, k as createType, l as UserFileNode, m as ArrowFunctionNode, n as ExportNode, o as ModuleName, p as createSource, r as FileNode, s as SourceNode, t as ExportInput, u as createExport, v as FunctionNode, w as createBreak, x as TextNode } from "./file-DJqd2j3y.cjs";
2
- import { $ as PropertyNode, D as InputNode, G as SchemaNode, Q as createSchema, _ as createParameter, a as OperationsNode, d as createResponse, et as createProperty, f as RequestBodyNode, h as ParameterNode, i as OperationNode, j as createInput, l as ResponseNode, o as createOperation, p as createRequestBody, s as createOperations, v as ContentNode, x as createContent } from "./operation-De4lbIZS.cjs";
2
+ import { $ as createSchema, D as InputNode, K as SchemaNode, _ as createParameter, a as OperationsNode, d as createResponse, et as PropertyNode, f as RequestBodyNode, h as ParameterNode, i as OperationNode, j as createInput, l as ResponseNode, o as createOperation, p as createRequestBody, s as createOperations, tt as createProperty, v as ContentNode, x as createContent } from "./operation-B86IER5K.cjs";
3
3
  declare namespace index_d_exports {
4
4
  export { ExportInput, ImportInput, ModuleName, Node, Space, UserFileNode, createArrowFunction, createBreak, createConst, createContent, createExport, createFile, createFunction, createImport, createInput, createJsx, createOperation, createOperations, createParameter, createProperty, createRequestBody, createResponse, createSchema, createSource, createText, createType };
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { C as createArrowFunction, D as createJsx, E as createFunction, O as createText, S as TypeNode, T as createConst, _ as ConstNode, a as ImportNode, b as JsxNode, c as Space, d as createFile, f as createImport, h as BreakNode, i as ImportInput, k as createType, l as UserFileNode, m as ArrowFunctionNode, n as ExportNode, o as ModuleName, p as createSource, r as FileNode, s as SourceNode, t as ExportInput, u as createExport, v as FunctionNode, w as createBreak, x as TextNode } from "./file-Dg70hXm3.js";
2
- import { $ as PropertyNode, D as InputNode, G as SchemaNode, Q as createSchema, _ as createParameter, a as OperationsNode, d as createResponse, et as createProperty, f as RequestBodyNode, h as ParameterNode, i as OperationNode, j as createInput, l as ResponseNode, o as createOperation, p as createRequestBody, s as createOperations, v as ContentNode, x as createContent } from "./operation-Dd0-l2VB.js";
2
+ import { $ as createSchema, D as InputNode, K as SchemaNode, _ as createParameter, a as OperationsNode, d as createResponse, et as PropertyNode, f as RequestBodyNode, h as ParameterNode, i as OperationNode, j as createInput, l as ResponseNode, o as createOperation, p as createRequestBody, s as createOperations, tt as createProperty, v as ContentNode, x as createContent } from "./operation-DJ7F0cFp.js";
3
3
  declare namespace index_d_exports {
4
4
  export { ExportInput, ImportInput, ModuleName, Node, Space, UserFileNode, createArrowFunction, createBreak, createConst, createContent, createExport, createFile, createFunction, createImport, createInput, createJsx, createOperation, createOperations, createParameter, createProperty, createRequestBody, createResponse, createSchema, createSource, createText, createType };
5
5
  }
@@ -1,7 +1,7 @@
1
- import { $ as PropertyNode, G as SchemaNode, J as StringSchemaNode } from "./operation-Dd0-l2VB.js";
1
+ import { K as SchemaNode, Y as StringSchemaNode, et as PropertyNode } from "./operation-DJ7F0cFp.js";
2
2
  import { a as schemaTypes } from "./base-A-xF4pUL.js";
3
- import { n as narrowSchema } from "./guards-l2AsKeHR.js";
4
- import { o as findSchema } from "./visitor-BNGMMmpe.js";
3
+ import { n as narrowSchema } from "./guards-CTqHwyNs.js";
4
+ import { o as findSchema } from "./visitor-xxcbpM5-.js";
5
5
  /**
6
6
  * Generic JSON Schema optionality: a non-required field is optional, and a
7
7
  * non-required nullable field is nullish.
@@ -0,0 +1,5 @@
1
+ import { t as isHttpOperationNode } from "./guards-CTqHwyNs.js";
2
+ declare namespace index_d_exports {
3
+ export { isHttpOperationNode as isOperation };
4
+ }
5
+ export { index_d_exports as t };
package/dist/index.cjs CHANGED
@@ -1,18 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
3
+ const require_graph = require("./graph-D6Ffy9YD.cjs");
3
4
  const require_constants = require("./constants-BCRkFAiy.cjs");
4
- const require_graph = require("./graph-D-0CbFIv.cjs");
5
+ const require_ref = require("./ref-CGeCLkAk.cjs");
5
6
  const require_visitor = require("./visitor-DhuKS-7x.cjs");
6
- const require_ref = require("./ref-Ck-0j8NV.cjs");
7
- const require_schema = require("./schema-DfLGJ-oh.cjs");
7
+ const require_schema = require("./schema-XGRiAvok.cjs");
8
+ const require_refs = require("./refs-CJZBa9hL.cjs");
8
9
  const require_guards = require("./guards-4drgx10i.cjs");
9
- const require_refs = require("./refs-rmr2LFV1.cjs");
10
10
  const require_macro = require("./macro-Ywn4-0s5.cjs");
11
11
  const require_node = require("./node-BeccjrHH.cjs");
12
12
  const require_optionality = require("./optionality-C-qULYxo.cjs");
13
- const require_file = require("./file-z3xToonr.cjs");
13
+ const require_file = require("./file-D9kqBrBl.cjs");
14
+ const require_nodes = require("./nodes-BGxHocS_.cjs");
14
15
  const require_nodeText = require("./nodeText-DH4dLGUb.cjs");
15
- const require_nodes = require("./nodes-TtDfZ9qf.cjs");
16
16
  const require_http = require("./http-Dv8py6wh.cjs");
17
17
  const require_json = require("./json-KV2VhBue.cjs");
18
18
  const require_mediaType = require("./mediaType-BbIfudh0.cjs");