[{"data":1,"prerenderedAt":1925,"buildId":1926},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fresolvers":3},{"id":4,"title":5,"body":6,"description":1908,"extension":1909,"frontmatter":1910,"heading":1914,"meta":1916,"navigation":1918,"order":1899,"path":1919,"seo":1920,"sitemap":1921,"source":1922,"stem":1923,"__hash__":1924},"docs\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fresolvers.md","Resolvers - Name symbols, files, and imports",{"type":7,"value":8,"toc":1891},"minimark",[9,17,59,424,429,443,675,680,703,747,801,804,817,828,931,937,960,1046,1058,1062,1085,1208,1217,1239,1244,1321,1475,1485,1489,1508,1722,1848,1852,1855,1875],[10,11,13],"h2",{"id":12},"createresolver",[14,15,16],"code",{},"createResolver",[18,19,20,21,23,24,27,28,31,32,35,36,39,40,43,44,46,47,50,51,54,55,58],"p",{},"A resolver names every symbol and file your plugin generates, and decides where imports point. Build one with ",[14,22,16],{},", which requires ",[14,25,26],{},"pluginName",". Other plugins read it through ",[14,29,30],{},"ctx.getResolver(name)"," in a template, or ",[14,33,34],{},"getResolver(name)"," from ",[14,37,38],{},"kubb\u002Fkit"," in any plugin hook. ",[14,41,42],{},"getResolver"," reads the memo of the running hook; pass the memo as a second argument to read it outside a hook. Without a stored resolver, ",[14,45,42],{}," stores and returns the default one for that plugin. In a template or a hook after setup, a name that is neither a plugin in the config nor provided throws ",[14,48,49],{},"KUBB_PLUGIN_NOT_FOUND",". Read another plugin's resolver in a template or a later hook. A setup that reads it before that plugin's ",[14,52,53],{},"setResolver"," runs keeps the default resolver, and Kubb warns with ",[14,56,57],{},"KUBB_PLUGIN_WARNING",".",[60,61,66],"pre",{"language":62,"filename":63,"code":64,"class":65},"typescript","resolver.ts","import { createResolver } from 'kubb\u002Fkit'\nimport type { PluginType, Resolver } from 'kubb\u002Fkit'\n\n\u002F\u002F Extend the base Resolver with plugin-specific naming namespaces.\ntype MyResolver = Resolver & {\n schema: {\n name(node: { name: string }): string\n }\n}\n\ntype MyPlugin = PluginType\u003C'plugin-example', object, object, MyResolver>\n\nexport const resolver = createResolver\u003CMyPlugin>({\n pluginName: 'plugin-example',\n name(name) {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n },\n schema: {\n name(node) {\n return this.name(node.name)\n },\n },\n})","highlights",[14,67,69,96,97,96,122,96,124,96,130,96,148,96,161,96,194,96,201,96,205,96,207,96,241,96,243,96,268,96,281,96,294,96,351,96,359,96,369,96,381,96,405,96,412,96,420],{"class":68},"language-typescript",[70,71,74,78,82,86,89,92],"span",{"class":72,"style":73},"line","display: inline",[70,75,77],{"style":76},"color:#d73a49;--hls-dark:#f97583","import ",[70,79,81],{"style":80},"color:#005cc5;--hls-dark:#79b8ff","{ ",[70,83,85],{"style":84},"color:#24292e;--hls-dark:#e1e4e8","createResolver ",[70,87,88],{"style":80},"} ",[70,90,91],{"style":76},"from ",[70,93,95],{"style":94},"color:#032f62;--hls-dark:#9ecbff","'kubb\u002Fkit'","\n",[70,98,99,101,104,106,110,113,116,118,120],{"class":72,"style":73},[70,100,77],{"style":76},[70,102,103],{"style":84},"type ",[70,105,81],{"style":80},[70,107,109],{"style":108},"color:#6f42c1;--hls-dark:#b392f0","PluginType",[70,111,112],{"style":76},", ",[70,114,115],{"style":108},"Resolver ",[70,117,88],{"style":80},[70,119,91],{"style":76},[70,121,95],{"style":94},[70,123],{"class":72,"style":73},[70,125,126],{"class":72,"style":73},[70,127,129],{"style":128},"color:#6a737d;--hls-dark:#6a737d","\u002F\u002F Extend the base Resolver with plugin-specific naming namespaces.",[70,131,132,134,137,140,142,145],{"class":72,"style":73},[70,133,103],{"style":76},[70,135,136],{"style":108},"MyResolver ",[70,138,139],{"style":76},"= ",[70,141,115],{"style":108},[70,143,144],{"style":76},"& ",[70,146,147],{"style":80},"{",[70,149,150,153,156,159],{"class":72,"style":73},[70,151,152],{"style":80}," ",[70,154,155],{"style":80},"schema",[70,157,158],{"style":76},": ",[70,160,147],{"style":80},[70,162,163,166,169,172,175,177,179,181,183,186,189,191],{"class":72,"style":73},[70,164,165],{"style":80}," ",[70,167,168],{"style":108},"name",[70,170,171],{"style":80},"(",[70,173,174],{"style":84},"node",[70,176,158],{"style":76},[70,178,81],{"style":80},[70,180,168],{"style":80},[70,182,158],{"style":84},[70,184,185],{"style":108},"string ",[70,187,188],{"style":80},"})",[70,190,158],{"style":84},[70,192,193],{"style":108},"string",[70,195,196,198],{"class":72,"style":73},[70,197,152],{"style":108},[70,199,200],{"style":80},"}",[70,202,203],{"class":72,"style":73},[70,204,200],{"style":80},[70,206],{"class":72,"style":73},[70,208,209,211,214,216,218,221,224,226,229,231,233,235,238],{"class":72,"style":73},[70,210,103],{"style":76},[70,212,213],{"style":108},"MyPlugin ",[70,215,139],{"style":76},[70,217,109],{"style":108},[70,219,220],{"style":76},"\u003C",[70,222,223],{"style":94},"'plugin-example'",[70,225,112],{"style":76},[70,227,228],{"style":84},"object",[70,230,112],{"style":76},[70,232,228],{"style":84},[70,234,112],{"style":76},[70,236,237],{"style":108},"MyResolver",[70,239,240],{"style":76},">",[70,242],{"class":72,"style":73},[70,244,245,248,251,254,256,258,260,263,265],{"class":72,"style":73},[70,246,247],{"style":76},"export ",[70,249,250],{"style":76},"const ",[70,252,253],{"style":84},"resolver ",[70,255,139],{"style":76},[70,257,16],{"style":84},[70,259,220],{"style":76},[70,261,262],{"style":108},"MyPlugin",[70,264,240],{"style":76},[70,266,267],{"style":80},"({",[70,269,270,272,274,276,278],{"class":72,"style":73},[70,271,152],{"style":80},[70,273,26],{"style":80},[70,275,158],{"style":76},[70,277,223],{"style":94},[70,279,280],{"style":76},",",[70,282,283,285,287,289,291],{"class":72,"style":73},[70,284,152],{"style":76},[70,286,168],{"style":108},[70,288,171],{"style":80},[70,290,168],{"style":84},[70,292,293],{"style":80},") {",[70,295,296,298,301,304,307,309,311,314,316,319,322,324,327,330,333,335,337,340,342,345,347,349],{"class":72,"style":73},[70,297,165],{"style":80},[70,299,300],{"style":76},"return ",[70,302,303],{"style":94},"`",[70,305,306],{"style":84},"${",[70,308,168],{"style":84},[70,310,58],{"style":76},[70,312,313],{"style":108},"charAt",[70,315,171],{"style":80},[70,317,318],{"style":80},"0",[70,320,321],{"style":80},")",[70,323,58],{"style":76},[70,325,326],{"style":108},"toUpperCase",[70,328,329],{"style":80},"()",[70,331,332],{"style":84},"}${",[70,334,168],{"style":84},[70,336,58],{"style":76},[70,338,339],{"style":108},"slice",[70,341,171],{"style":80},[70,343,344],{"style":80},"1",[70,346,321],{"style":80},[70,348,200],{"style":84},[70,350,303],{"style":94},[70,352,353,355,357],{"class":72,"style":73},[70,354,152],{"style":94},[70,356,200],{"style":80},[70,358,280],{"style":76},[70,360,361,363,365,367],{"class":72,"style":73},[70,362,152],{"style":76},[70,364,155],{"style":80},[70,366,158],{"style":76},[70,368,147],{"style":80},[70,370,371,373,375,377,379],{"class":72,"style":73},[70,372,165],{"style":80},[70,374,168],{"style":108},[70,376,171],{"style":80},[70,378,174],{"style":84},[70,380,293],{"style":80},[70,382,383,386,388,391,393,395,397,399,401,403],{"class":72,"style":73},[70,384,385],{"style":80}," ",[70,387,300],{"style":76},[70,389,390],{"style":84},"this",[70,392,58],{"style":76},[70,394,168],{"style":108},[70,396,171],{"style":80},[70,398,174],{"style":84},[70,400,58],{"style":76},[70,402,168],{"style":80},[70,404,321],{"style":80},[70,406,407,410],{"class":72,"style":73},[70,408,409],{"style":80}," }",[70,411,280],{"style":76},[70,413,414,416,418],{"class":72,"style":73},[70,415,152],{"style":76},[70,417,200],{"style":80},[70,419,280],{"style":76},[70,421,422],{"class":72,"style":73},[70,423,188],{"style":80},[425,426,428],"h3",{"id":427},"auto-injected-resolver-defaults","Built-in members",[18,430,431,432,434,435,438,439,442],{},"Every resolver has these members. ",[14,433,168],{}," and ",[14,436,437],{},"file"," follow your overrides, and ",[14,440,441],{},"default"," always holds Kubb's built-ins.",[444,445,446,459],"table",{},[447,448,449],"thead",{},[450,451,452,456],"tr",{},[453,454,455],"th",{},"Member",[453,457,458],{},"Does",[460,461,462,476,499,520,530,547,564,576,597,617,636,661],"tbody",{},[450,463,464,470],{},[465,466,467],"td",{},[14,468,469],{},"name(name)",[465,471,472,473,58],{},"The identifier casing. Falls back to ",[14,474,475],{},"default.name",[450,477,478,483],{},[465,479,480],{},[14,481,482],{},"file(options)",[465,484,485,486,35,489,434,492,495,496,58],{},"Builds a ",[14,487,488],{},"FileNode",[14,490,491],{},"file.baseName",[14,493,494],{},"file.path",", or ",[14,497,498],{},"default.path",[450,500,501,506],{},[465,502,503],{},[14,504,505],{},"imports(options)",[465,507,508,509,512,513,58],{},"One import per ",[14,510,511],{},"$ref",". See ",[514,515,517],"a",{"href":516},"#imports",[14,518,519],{},"resolver.imports",[450,521,522,527],{},[465,523,524],{},[14,525,526],{},"memo(key, compute)",[465,528,529],{},"Caches a value for the rest of the build.",[450,531,532,540],{},[465,533,534,112,537],{},[14,535,536],{},"resolveName()",[14,538,539],{},"reserveNames()",[465,541,542,543,58],{},"Allocate names that do not collide. See ",[514,544,546],{"href":545},"#name-reservations","Name reservations",[450,548,549,554],{},[465,550,551],{},[14,552,553],{},"groupDir(group, value)",[465,555,556,557,563],{},"The folder a ",[514,558,560],{"href":559},"\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#group",[14,561,562],{},"group"," puts a file in.",[450,565,566,570],{},[465,567,568],{},[14,569,475],{},[465,571,572,573,58],{},"Kubb's ",[14,574,575],{},"camelCase",[450,577,578,583],{},[465,579,580],{},[14,581,582],{},"default.options",[465,584,585,586,112,589,592,593,596],{},"Applies the ",[14,587,588],{},"exclude",[14,590,591],{},"include",", and ",[14,594,595],{},"override"," filters.",[450,598,599,603],{},[465,600,601],{},[14,602,498],{},[465,604,605,606,609,610,613,614,616],{},"Resolves to ",[14,607,608],{},"output.path",". With ",[14,611,612],{},"mode: 'directory'"," it adds the base name, inside a tag or path folder when ",[14,615,562],{}," is set.",[450,618,619,624],{},[465,620,621],{},[14,622,623],{},"default.file",[465,625,485,626,628,629,632,633,58],{},[14,627,488],{},". The built-in base name camelCases each dotted segment, so ",[14,630,631],{},"pet.petId"," becomes ",[14,634,635],{},"pet\u002FpetId",[450,637,638,643],{},[465,639,640],{},[14,641,642],{},"default.banner",[465,644,645,646,649,650,653,654,657,658,58],{},"Returns ",[14,647,648],{},"output.banner",", or the \"Generated by Kubb\" header. ",[14,651,652],{},"null"," when ",[14,655,656],{},"output.defaultBanner"," is ",[14,659,660],{},"false",[450,662,663,668],{},[465,664,665],{},[14,666,667],{},"default.footer",[465,669,645,670,495,673,58],{},[14,671,672],{},"output.footer",[14,674,652],{},[425,676,678],{"id":677},"imports",[14,679,519],{},[18,681,682,684,685,687,688,691,692,434,694,592,696,699,700,58],{},[14,683,519],{}," returns one import per ",[14,686,511],{}," in a schema tree. It names each import from the ref's ",[14,689,690],{},"targetName",", or else the last segment of its pointer. Names and paths go through ",[14,693,168],{},[14,695,437],{},[14,697,698],{},"extname"," defaults to ",[14,701,702],{},".ts",[60,704,707],{"language":62,"filename":705,"code":706,"class":65},"imports.ts","const imports = resolver.imports({ node, root, output })\n\u002F\u002F → [{ kind: 'Import', name: ['pet'], path: '\u002Fsrc\u002Ftypes\u002Fpet.ts' }]",[14,708,709,96,742],{"class":68},[70,710,711,713,716,718,721,723,725,728,730,732,735,737,740],{"class":72,"style":73},[70,712,250],{"style":76},[70,714,715],{"style":84},"imports ",[70,717,139],{"style":76},[70,719,720],{"style":84},"resolver",[70,722,58],{"style":76},[70,724,677],{"style":108},[70,726,727],{"style":80},"({ ",[70,729,174],{"style":84},[70,731,112],{"style":76},[70,733,734],{"style":84},"root",[70,736,112],{"style":76},[70,738,739],{"style":84},"output ",[70,741,188],{"style":80},[70,743,744],{"class":72,"style":73},[70,745,746],{"style":128},"\u002F\u002F → [{ kind: 'Import', name: ['pet'], path: '\u002Fsrc\u002Ftypes\u002Fpet.ts' }]",[444,748,749,759],{},[447,750,751],{},[450,752,753,756],{},[453,754,755],{},"Option",[453,757,758],{},"Effect",[460,760,761,774],{},[450,762,763,767],{},[465,764,765],{},[14,766,168],{},[465,768,769,770,773],{},"Turns a referenced schema name into the imported identifier, for example ",[14,771,772],{},"(schemaName) => \\","${resolver.name(schemaName)}Type``.",[450,775,776,781],{},[465,777,778],{},[14,779,780],{},"checks",[465,782,783,786,787,112,790,793,794,512,797,58],{},[14,784,785],{},"true"," also imports refs inside ",[14,788,789],{},"conditionals",[14,791,792],{},"contains",", and a string's ",[14,795,796],{},"content",[514,798,800],{"href":799},"#ref-imports-in-checks","Ref imports in checks",[425,802,546],{"id":803},"name-reservations",[18,805,806,809,810,112,813,816],{},[14,807,808],{},"resolver.resolveName({ key, name })"," keeps the preferred name when it is free and adds ",[14,811,812],{},"2",[14,814,815],{},"3",", and so on when it is taken. Use the same key for a declaration and its references.",[18,818,819,820,823,824,827],{},"Kubb reserves component names itself, and ",[14,821,822],{},"resolver.name"," only applies casing. Reserve other identifiers, such as enum type aliases, with ",[14,825,826],{},"resolver.reserveNames"," first.",[60,829,832],{"language":62,"filename":830,"code":831,"class":65},"reserve-names.ts","resolver.reserveNames(['CreateContainerBody', 'CreateContainerBody2'])\nconst name = resolver.resolveName({\n key: ['operation', 'POST', '\u002Fcontainers', 'body'],\n name: 'CreateContainerBody',\n})\n\u002F\u002F 'CreateContainerBody3'",[14,833,834,96,857,96,875,96,910,96,922,96,926],{"class":68},[70,835,836,838,840,843,846,849,851,854],{"class":72,"style":73},[70,837,720],{"style":84},[70,839,58],{"style":76},[70,841,842],{"style":108},"reserveNames",[70,844,845],{"style":80},"([",[70,847,848],{"style":94},"'CreateContainerBody'",[70,850,112],{"style":76},[70,852,853],{"style":94},"'CreateContainerBody2'",[70,855,856],{"style":80},"])",[70,858,859,861,864,866,868,870,873],{"class":72,"style":73},[70,860,250],{"style":76},[70,862,863],{"style":84},"name ",[70,865,139],{"style":76},[70,867,720],{"style":84},[70,869,58],{"style":76},[70,871,872],{"style":108},"resolveName",[70,874,267],{"style":80},[70,876,877,879,882,884,887,890,892,895,897,900,902,905,908],{"class":72,"style":73},[70,878,152],{"style":80},[70,880,881],{"style":80},"key",[70,883,158],{"style":76},[70,885,886],{"style":80},"[",[70,888,889],{"style":94},"'operation'",[70,891,112],{"style":76},[70,893,894],{"style":94},"'POST'",[70,896,112],{"style":76},[70,898,899],{"style":94},"'\u002Fcontainers'",[70,901,112],{"style":76},[70,903,904],{"style":94},"'body'",[70,906,907],{"style":80},"]",[70,909,280],{"style":76},[70,911,912,914,916,918,920],{"class":72,"style":73},[70,913,152],{"style":76},[70,915,168],{"style":80},[70,917,158],{"style":76},[70,919,848],{"style":94},[70,921,280],{"style":76},[70,923,924],{"class":72,"style":73},[70,925,188],{"style":80},[70,927,928],{"class":72,"style":73},[70,929,930],{"style":128},"\u002F\u002F 'CreateContainerBody3'",[425,932,934],{"id":933},"resolvermerge",[14,935,936],{},"Resolver.merge",[18,938,939,942,943,946,947,949,950,952,953,956,957,58],{},[14,940,941],{},"Resolver.merge(base, ...patches)"," layers the patches over ",[14,944,945],{},"base"," in order and returns a new resolver. A top-level ",[14,948,168],{}," replaces. ",[14,951,437],{}," and each namespace merge per member, so overriding ",[14,954,955],{},"query.name"," keeps the base ",[14,958,959],{},"query.keyName",[60,961,964],{"language":62,"filename":962,"code":963,"class":65},"merge.ts","const patched = Resolver.merge(resolver, {\n name(name) {\n return `Custom${this.default.name(name)}`\n },\n})",[14,965,966,96,991,96,1003,96,1034,96,1042],{"class":68},[70,967,968,970,973,975,978,980,983,985,987,989],{"class":72,"style":73},[70,969,250],{"style":76},[70,971,972],{"style":84},"patched ",[70,974,139],{"style":76},[70,976,977],{"style":108},"Resolver",[70,979,58],{"style":76},[70,981,982],{"style":108},"merge",[70,984,171],{"style":80},[70,986,720],{"style":84},[70,988,112],{"style":76},[70,990,147],{"style":80},[70,992,993,995,997,999,1001],{"class":72,"style":73},[70,994,152],{"style":80},[70,996,168],{"style":108},[70,998,171],{"style":80},[70,1000,168],{"style":84},[70,1002,293],{"style":80},[70,1004,1005,1007,1009,1012,1014,1016,1018,1020,1022,1024,1026,1028,1030,1032],{"class":72,"style":73},[70,1006,165],{"style":80},[70,1008,300],{"style":76},[70,1010,1011],{"style":94},"`Custom",[70,1013,306],{"style":84},[70,1015,390],{"style":84},[70,1017,58],{"style":76},[70,1019,441],{"style":80},[70,1021,58],{"style":76},[70,1023,168],{"style":108},[70,1025,171],{"style":80},[70,1027,168],{"style":84},[70,1029,321],{"style":80},[70,1031,200],{"style":84},[70,1033,303],{"style":94},[70,1035,1036,1038,1040],{"class":72,"style":73},[70,1037,152],{"style":94},[70,1039,200],{"style":80},[70,1041,280],{"style":76},[70,1043,1044],{"class":72,"style":73},[70,1045,188],{"style":80},[1047,1048,1050,1051,1054,1055,1057],"blockquote",{"as":1049},"tip","Type a patch with ",[14,1052,1053],{},"ResolverPatch\u003CT>"," to check ",[14,1056,390],{}," and the namespace shapes against the target resolver.",[10,1059,1061],{"id":1060},"resolver-parts","Reusable resolver parts",[18,1063,1064,1065,1067,1068,1071,1072,1074,1075,1081,1082,58],{},"A resolver part is a partial resolver, such as one namespace or a ",[14,1066,437],{}," rule, that any plugin can merge in. Define one with ",[14,1069,1070],{},"defineResolver",". It types ",[14,1073,390],{}," as the full resolver plus the part and adds no runtime behavior, like ",[514,1076,1078],{"href":1077},"\u002Fdocs\u002F5.x\u002Fhow-to\u002Fcustomize#macros",[14,1079,1080],{},"defineMacro",". Name exports ",[14,1083,1084],{},"resolver\u003CName>",[60,1086,1089],{"language":62,"filename":1087,"code":1088,"class":65},"resolverHook.ts","import { defineResolver } from 'kubb\u002Fkit'\n\nexport const resolverHook = defineResolver({\n hook: {\n optionsName(): string {\n return this.resolveName({ key: ['hook', 'options'], name: 'HookOptions' })\n },\n },\n})",[14,1090,1091,96,1106,96,1108,96,1123,96,1134,96,1149,96,1190,96,1196,96,1204],{"class":68},[70,1092,1093,1095,1097,1100,1102,1104],{"class":72,"style":73},[70,1094,77],{"style":76},[70,1096,81],{"style":80},[70,1098,1099],{"style":84},"defineResolver ",[70,1101,88],{"style":80},[70,1103,91],{"style":76},[70,1105,95],{"style":94},[70,1107],{"class":72,"style":73},[70,1109,1110,1112,1114,1117,1119,1121],{"class":72,"style":73},[70,1111,247],{"style":76},[70,1113,250],{"style":76},[70,1115,1116],{"style":84},"resolverHook ",[70,1118,139],{"style":76},[70,1120,1070],{"style":108},[70,1122,267],{"style":80},[70,1124,1125,1127,1130,1132],{"class":72,"style":73},[70,1126,152],{"style":80},[70,1128,1129],{"style":80},"hook",[70,1131,158],{"style":76},[70,1133,147],{"style":80},[70,1135,1136,1138,1141,1143,1145,1147],{"class":72,"style":73},[70,1137,165],{"style":80},[70,1139,1140],{"style":108},"optionsName",[70,1142,329],{"style":80},[70,1144,158],{"style":84},[70,1146,185],{"style":108},[70,1148,147],{"style":80},[70,1150,1151,1153,1155,1157,1159,1161,1163,1165,1167,1169,1172,1174,1177,1179,1181,1183,1185,1188],{"class":72,"style":73},[70,1152,385],{"style":80},[70,1154,300],{"style":76},[70,1156,390],{"style":84},[70,1158,58],{"style":76},[70,1160,872],{"style":108},[70,1162,727],{"style":80},[70,1164,881],{"style":80},[70,1166,158],{"style":76},[70,1168,886],{"style":80},[70,1170,1171],{"style":94},"'hook'",[70,1173,112],{"style":76},[70,1175,1176],{"style":94},"'options'",[70,1178,907],{"style":80},[70,1180,112],{"style":76},[70,1182,168],{"style":80},[70,1184,158],{"style":76},[70,1186,1187],{"style":94},"'HookOptions' ",[70,1189,188],{"style":80},[70,1191,1192,1194],{"class":72,"style":73},[70,1193,409],{"style":80},[70,1195,280],{"style":76},[70,1197,1198,1200,1202],{"class":72,"style":73},[70,1199,152],{"style":76},[70,1201,200],{"style":80},[70,1203,280],{"style":76},[70,1205,1206],{"class":72,"style":73},[70,1207,188],{"style":80},[18,1209,1210,1211,1213,1214,1216],{},"Spread parts into ",[14,1212,16],{},", or pass a list to ",[14,1215,53],{},". The list merges left to right, so a later part wins per method:",[60,1218,1221],{"language":62,"filename":1219,"code":1220,"class":65},"plugin.ts","setResolver([resolverReactQuery, resolverHook])",[14,1222,1223],{"class":68},[70,1224,1225,1227,1229,1232,1234,1237],{"class":72,"style":73},[70,1226,53],{"style":108},[70,1228,845],{"style":80},[70,1230,1231],{"style":84},"resolverReactQuery",[70,1233,112],{"style":76},[70,1235,1236],{"style":84},"resolverHook",[70,1238,856],{"style":80},[18,1240,1241,1243],{},[14,1242,38],{}," ships the parts the official plugins share:",[444,1245,1246,1256],{},[447,1247,1248],{},[450,1249,1250,1253],{},[453,1251,1252],{},"Part",[453,1254,1255],{},"Adds",[460,1257,1258,1282,1306],{},[450,1259,1260,1265],{},[465,1261,1262],{},[14,1263,1264],{},"resolverOperationParams",[465,1266,1267,112,1270,112,1273,112,1276,112,1279],{},[14,1268,1269],{},"param.name",[14,1271,1272],{},"param.path",[14,1274,1275],{},"param.query",[14,1277,1278],{},"param.headers",[14,1280,1281],{},"param.cookies",[450,1283,1284,1289],{},[465,1285,1286],{},[14,1287,1288],{},"resolverOperationResponse",[465,1290,1291,112,1294,112,1297,112,1300,112,1303],{},[14,1292,1293],{},"response.status",[14,1295,1296],{},"response.headers",[14,1298,1299],{},"response.body",[14,1301,1302],{},"response.responses",[14,1304,1305],{},"response.response",[450,1307,1308,1313],{},[465,1309,1310],{},[14,1311,1312],{},"resolverCasedFile(caseLast)",[465,1314,1315,1317,1318],{},[14,1316,491],{}," that nests dotted names and cases the file name with ",[14,1319,1320],{},"caseLast",[60,1322,1325],{"language":62,"filename":1323,"code":1324,"class":65},"resolverTs.ts","import { casing, createResolver, resolverCasedFile, resolverOperationParams, resolverOperationResponse } from 'kubb\u002Fkit'\n\nexport const resolverTs = createResolver\u003CPluginTs>({\n pluginName: 'plugin-ts',\n name: (name) => casing.pascal(name),\n ...resolverOperationParams,\n ...resolverOperationResponse,\n ...resolverCasedFile(casing.pascal),\n})",[14,1326,1327,96,1360,96,1362,96,1384,96,1397,96,1430,96,1441,96,1451,96,1471],{"class":68},[70,1328,1329,1331,1333,1336,1338,1340,1342,1345,1347,1349,1351,1354,1356,1358],{"class":72,"style":73},[70,1330,77],{"style":76},[70,1332,81],{"style":80},[70,1334,1335],{"style":84},"casing",[70,1337,112],{"style":76},[70,1339,16],{"style":84},[70,1341,112],{"style":76},[70,1343,1344],{"style":84},"resolverCasedFile",[70,1346,112],{"style":76},[70,1348,1264],{"style":84},[70,1350,112],{"style":76},[70,1352,1353],{"style":84},"resolverOperationResponse ",[70,1355,88],{"style":80},[70,1357,91],{"style":76},[70,1359,95],{"style":94},[70,1361],{"class":72,"style":73},[70,1363,1364,1366,1368,1371,1373,1375,1377,1380,1382],{"class":72,"style":73},[70,1365,247],{"style":76},[70,1367,250],{"style":76},[70,1369,1370],{"style":84},"resolverTs ",[70,1372,139],{"style":76},[70,1374,16],{"style":84},[70,1376,220],{"style":76},[70,1378,1379],{"style":108},"PluginTs",[70,1381,240],{"style":76},[70,1383,267],{"style":80},[70,1385,1386,1388,1390,1392,1395],{"class":72,"style":73},[70,1387,152],{"style":80},[70,1389,26],{"style":80},[70,1391,158],{"style":76},[70,1393,1394],{"style":94},"'plugin-ts'",[70,1396,280],{"style":76},[70,1398,1399,1401,1403,1405,1407,1409,1412,1415,1417,1419,1422,1424,1426,1428],{"class":72,"style":73},[70,1400,152],{"style":76},[70,1402,168],{"style":80},[70,1404,158],{"style":76},[70,1406,171],{"style":80},[70,1408,168],{"style":84},[70,1410,1411],{"style":80},") ",[70,1413,1414],{"style":76},"=> ",[70,1416,1335],{"style":84},[70,1418,58],{"style":76},[70,1420,1421],{"style":108},"pascal",[70,1423,171],{"style":80},[70,1425,168],{"style":84},[70,1427,321],{"style":80},[70,1429,280],{"style":76},[70,1431,1432,1434,1437,1439],{"class":72,"style":73},[70,1433,152],{"style":76},[70,1435,1436],{"style":76},"...",[70,1438,1264],{"style":84},[70,1440,280],{"style":76},[70,1442,1443,1445,1447,1449],{"class":72,"style":73},[70,1444,152],{"style":76},[70,1446,1436],{"style":76},[70,1448,1288],{"style":84},[70,1450,280],{"style":76},[70,1452,1453,1455,1457,1459,1461,1463,1465,1467,1469],{"class":72,"style":73},[70,1454,152],{"style":76},[70,1456,1436],{"style":76},[70,1458,1344],{"style":108},[70,1460,171],{"style":80},[70,1462,1335],{"style":84},[70,1464,58],{"style":76},[70,1466,1421],{"style":80},[70,1468,321],{"style":80},[70,1470,280],{"style":76},[70,1472,1473],{"class":72,"style":73},[70,1474,188],{"style":80},[18,1476,1477,1478,1480,1481,1484],{},"Every name a part builds goes through the plugin's top-level ",[14,1479,168],{},", so the part follows that plugin's casing. Build your own keys with ",[14,1482,1483],{},"operationKey(node, ...scope)"," so two declarations of one operation never share a name.",[10,1486,1488],{"id":1487},"resolver-overrides","Resolver overrides",[18,1490,1491,1493,1494,112,1497,434,1499,1501,1502,58],{},[14,1492,168],{}," changes identifier casing, ",[14,1495,1496],{},"file.name",[14,1498,491],{},[14,1500,494],{}," control files, and plugin namespaces control specific symbols. Users pass the same shape to a plugin's ",[514,1503,1505,1507],{"href":1504},"\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#resolver",[14,1506,720],{}," option",[60,1509,1512],{"language":62,"filename":1510,"code":1511,"class":65},"Type definition","type ResolverPatch = {\n name?: (name: string) => string\n file?: {\n name?: (node: SchemaNode | OperationNode, exportName?: string) => string | undefined\n baseName?: (params: { name: string; extname: string }) => string\n path?: (params: { baseName: string; output: Output }) => string\n }\n imports?: Resolver['imports']\n \u002F\u002F plugin-specific namespaces, such as query.keyName or schema.typeName\n}",[14,1513,1514,96,1525,96,1550,96,1561,96,1607,96,1649,96,1688,96,1694,96,1711,96,1718],{"class":68},[70,1515,1516,1518,1521,1523],{"class":72,"style":73},[70,1517,103],{"style":76},[70,1519,1520],{"style":108},"ResolverPatch ",[70,1522,139],{"style":76},[70,1524,147],{"style":80},[70,1526,1527,1529,1531,1534,1536,1538,1540,1542,1544,1546,1548],{"class":72,"style":73},[70,1528,152],{"style":80},[70,1530,168],{"style":80},[70,1532,1533],{"style":84},"?",[70,1535,158],{"style":76},[70,1537,171],{"style":80},[70,1539,168],{"style":84},[70,1541,158],{"style":84},[70,1543,193],{"style":108},[70,1545,1411],{"style":80},[70,1547,1414],{"style":76},[70,1549,193],{"style":84},[70,1551,1552,1555,1557,1559],{"class":72,"style":73},[70,1553,1554],{"style":84}," file",[70,1556,1533],{"style":84},[70,1558,158],{"style":76},[70,1560,147],{"style":80},[70,1562,1563,1565,1567,1569,1571,1573,1575,1577,1580,1583,1586,1588,1591,1594,1596,1598,1600,1602,1604],{"class":72,"style":73},[70,1564,165],{"style":80},[70,1566,168],{"style":80},[70,1568,1533],{"style":84},[70,1570,158],{"style":76},[70,1572,171],{"style":80},[70,1574,174],{"style":84},[70,1576,158],{"style":84},[70,1578,1579],{"style":108},"SchemaNode ",[70,1581,1582],{"style":76},"| ",[70,1584,1585],{"style":108},"OperationNode",[70,1587,112],{"style":76},[70,1589,1590],{"style":84},"exportName",[70,1592,1593],{"style":84},"?: ",[70,1595,193],{"style":108},[70,1597,1411],{"style":80},[70,1599,1414],{"style":76},[70,1601,185],{"style":84},[70,1603,1582],{"style":76},[70,1605,1606],{"style":80},"undefined",[70,1608,1609,1611,1614,1616,1618,1620,1623,1625,1627,1629,1631,1633,1636,1638,1640,1642,1645,1647],{"class":72,"style":73},[70,1610,165],{"style":80},[70,1612,1613],{"style":84},"baseName",[70,1615,1533],{"style":84},[70,1617,158],{"style":76},[70,1619,171],{"style":80},[70,1621,1622],{"style":84},"params",[70,1624,158],{"style":76},[70,1626,81],{"style":80},[70,1628,168],{"style":80},[70,1630,158],{"style":84},[70,1632,193],{"style":108},[70,1634,1635],{"style":76},"; ",[70,1637,698],{"style":80},[70,1639,158],{"style":84},[70,1641,185],{"style":108},[70,1643,1644],{"style":80},"}) ",[70,1646,1414],{"style":76},[70,1648,193],{"style":84},[70,1650,1651,1654,1656,1658,1660,1662,1664,1666,1668,1670,1672,1674,1677,1679,1682,1684,1686],{"class":72,"style":73},[70,1652,1653],{"style":84}," path",[70,1655,1533],{"style":84},[70,1657,158],{"style":76},[70,1659,171],{"style":80},[70,1661,1622],{"style":84},[70,1663,158],{"style":76},[70,1665,81],{"style":80},[70,1667,1613],{"style":80},[70,1669,158],{"style":84},[70,1671,193],{"style":108},[70,1673,1635],{"style":76},[70,1675,1676],{"style":80},"output",[70,1678,158],{"style":84},[70,1680,1681],{"style":108},"Output ",[70,1683,1644],{"style":80},[70,1685,1414],{"style":76},[70,1687,193],{"style":84},[70,1689,1690,1692],{"class":72,"style":73},[70,1691,152],{"style":84},[70,1693,200],{"style":80},[70,1695,1696,1698,1700,1702,1704,1706,1709],{"class":72,"style":73},[70,1697,152],{"style":80},[70,1699,677],{"style":84},[70,1701,1593],{"style":84},[70,1703,977],{"style":108},[70,1705,886],{"style":80},[70,1707,1708],{"style":94},"'imports'",[70,1710,907],{"style":80},[70,1712,1713,1715],{"class":72,"style":73},[70,1714,152],{"style":80},[70,1716,1717],{"style":128},"\u002F\u002F plugin-specific namespaces, such as query.keyName or schema.typeName",[70,1719,1720],{"class":72,"style":73},[70,1721,200],{"style":80},[1723,1724,1725,1732,1746,1758,1770,1781,1795,1805,1821,1838],"ul",{},[1726,1727,1728,1729,1731],"li",{},"Write methods as regular functions, not arrow functions, so ",[14,1730,390],{}," is the merged resolver.",[1726,1733,1734,1736,1737,1739,1740,1743,1744,58],{},[14,1735,1496],{}," names a node's file before casing. Return ",[14,1738,1606],{}," to keep the default: the ",[14,1741,1742],{},"operationId"," or the schema ",[14,1745,168],{},[1726,1747,1748,1750,1751,1757],{},[14,1749,1590],{}," is the name another plugin imports with ",[514,1752,1754],{"href":1753},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Ftemplates#from",[14,1755,1756],{},"from",". A plugin that writes several files per node uses it to say which file holds that name.",[1726,1759,1760,434,1763,1766,1767,1769],{},[14,1761,1762],{},"file()",[14,1764,1765],{},"from()"," both read ",[14,1768,1496],{},", so the files a plugin writes match the imports other plugins point at.",[1726,1771,1772,1773,1776,1777,1780],{},"Kit adds ",[14,1774,1775],{},"Operation"," to an operation file that would land on a schema file, but only for a plugin with a ",[14,1778,1779],{},"Schema"," template.",[1726,1782,1783,1784,1786,1787,1789,1790,1792,1793,58],{},"Kubb resolves the path ",[14,1785,494],{}," returns against the root ",[14,1788,608],{},", and the result must stay inside it. The ",[14,1791,1676],{}," argument is the plugin's own ",[14,1794,1676],{},[1726,1796,1797,434,1799,1801,1802,1804],{},[14,1798,491],{},[14,1800,494],{}," must return the same result for the same arguments, because ",[14,1803,519],{}," keeps each import path for the rest of the build.",[1726,1806,1807,1810,1811,1813,1814,35,1819,58],{},[14,1808,1809],{},"this.default.name(name)"," always applies ",[14,1812,575],{},". For other casing, call ",[514,1815,1817],{"href":1816},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit#casing",[14,1818,1335],{},[14,1820,38],{},[1726,1822,1823,1824,1827,1828,1830,1831,1833,1834,1837],{},"From a namespaced method, ",[14,1825,1826],{},"this.name(name)"," calls the active top-level ",[14,1829,168],{},", including a user override. Inside the top-level ",[14,1832,168],{}," it recurses, so wrap an exported preset, such as ",[14,1835,1836],{},"resolverTs.name",", instead.",[1726,1839,1840,1843,1844,58],{},[14,1841,1842],{},"this.memo(key, compute)"," computes each value once per build. See ",[514,1845,1847],{"href":1846},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fplugins#memo-cache","Memo caches",[10,1849,1851],{"id":1850},"less-common-cases","Less common cases",[425,1853,800],{"id":1854},"ref-imports-in-checks",[18,1856,1857,1858,112,1860,1862,1863,1865,1866,1869,1870,1874],{},"When your plugin prints checks such as ",[14,1859,789],{},[14,1861,792],{},", or a string's ",[14,1864,796],{},", pass ",[14,1867,1868],{},"checks: true"," to ",[514,1871,1872],{"href":516},[14,1873,519],{},". It then also imports the refs inside them.",[18,1876,1877,1878,1880,1881,1884,1885,592,1888,1890],{},"Checks that cannot fail stay out: a ",[14,1879,792],{}," with ",[14,1882,1883],{},"min: 0"," and no ",[14,1886,1887],{},"max",[14,1889,796],{}," that is not JSON or is encoded.",{"title":1892,"searchDepth":1893,"depth":1893,"links":1894},"",5,[1895,1903,1904,1905],{"id":12,"depth":1896,"text":16,"children":1897},2,[1898,1900,1901,1902],{"id":427,"depth":1899,"text":428},3,{"id":677,"depth":1899,"text":519},{"id":803,"depth":1899,"text":546},{"id":933,"depth":1899,"text":936},{"id":1060,"depth":1896,"text":1061},{"id":1487,"depth":1896,"text":1488},{"id":1850,"depth":1896,"text":1851,"children":1906},[1907],{"id":1854,"depth":1899,"text":800},"createResolver builds the Resolver that names a plugin's symbols, files, and imports. Covers built-in members, name reservations, and merging.","md",{"layout":1911,"title":5,"description":1908,"outline":1912,"order":1899,"navigation":1913},"doc",[1896,1899],{"title":1914,"icon":1915},"Resolvers","i-iconoir-label",{"layout":1911,"outline":1917},[1896,1899],{"title":1914,"icon":1915},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fresolvers",{"title":5,"description":1908},{"loc":1919},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fresolvers.md","docs\u002F5.x\u002Freference\u002Fkit\u002Fresolvers","iuAGXbABzrkHAVo4lQgGexpxSBDDHKF7s-B3h-nOkEM",1795989038192,"2e8b4c62-5b8c-4587-97c0-530d08a9bd53"]