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