[{"data":1,"prerenderedAt":1680,"buildId":1681},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fengine":3},{"id":4,"title":5,"body":6,"description":1662,"extension":1663,"frontmatter":1664,"heading":1669,"meta":1671,"navigation":1673,"order":1667,"path":1674,"seo":1675,"sitemap":1676,"source":1677,"stem":1678,"__hash__":1679},"docs\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fengine.md","Engine - Run Kubb from code with createKubb",{"type":7,"value":8,"toc":1646},"minimark",[9,27,33,54,138,145,639,663,670,673,677,868,874,900,1033,1076,1083,1197,1236,1240,1260,1421,1428,1558,1562,1566],[10,11,12,16,17,20,21,26],"p",{},[13,14,15],"code",{},"createKubb"," from the ",[13,18,19],{},"kubb"," package runs Kubb from your own code. ",[22,23,25],"a",{"href":24},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration","Configuration"," covers the config shape and its defaults.",[28,29,31],"h2",{"id":30},"createkubb",[13,32,15],{},[10,34,35,38,39,42,43,46,47,49,50,53],{},[13,36,37],{},"createKubb(config, options?)"," returns a ",[13,40,41],{},"Kubb"," instance with the same defaults as ",[13,44,45],{},"defineConfig",", so a config generates the same files from the CLI and from a script. ",[13,48,15],{}," from ",[13,51,52],{},"@kubb\u002Fcore"," skips those defaults.",[55,56,57,73],"table",{},[58,59,60],"thead",{},[61,62,63,67,70],"tr",{},[64,65,66],"th",{},"Option",[64,68,69],{},"Type",[64,71,72],{},"Does",[74,75,76,97,112],"tbody",{},[61,77,78,84,89],{},[79,80,81],"td",{},[13,82,83],{},"hooks",[79,85,86],{},[13,87,88],{},"Hookable\u003CKubbHooks>",[79,90,91,92,96],{},"Shares one ",[22,93,95],{"href":94},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fhooks","hook"," emitter between builds.",[61,98,99,104,109],{},[79,100,101],{},[13,102,103],{},"signal",[79,105,106],{},[13,107,108],{},"AbortSignal",[79,110,111],{},"Stops the build at the next safe checkpoint.",[61,113,114,119,124],{},[79,115,116],{},[13,117,118],{},"harness",[79,120,121],{},[13,122,123],{},"Harness",[79,125,126,127,133,134,137],{},"What the input may make Kubb read. It wins over the config's ",[22,128,130],{"href":129},"\u002Fdocs\u002F5.x\u002Freference\u002Fsecurity",[13,131,132],{},"security",". Build one with ",[13,135,136],{},"createHarness",".",[10,139,140,141,144],{},"This script builds ",[13,142,143],{},"petStore.yaml"," and exits on any error:",[146,147,152],"pre",{"language":148,"filename":149,"code":150,"class":151},"typescript","build.ts","import { createKubb } from 'kubb'\nimport { Diagnostics } from 'kubb\u002Fkit'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\nimport { pluginAxios } from '@kubb\u002Fplugin-axios'\n\nconst kubb = createKubb({\n input: '.\u002FpetStore.yaml',\n output: { path: '.\u002Fgen' },\n plugins: [pluginTs(), pluginAxios()],\n})\n\nconst { files, diagnostics } = await kubb.safeBuild()\n\nif (Diagnostics.hasError(diagnostics)) {\n for (const diagnostic of diagnostics.filter(Diagnostics.isProblem)) {\n if (diagnostic.severity === 'error') {\n console.error(`${diagnostic.plugin ?? 'kubb'}: ${diagnostic.message}`)\n }\n }\n process.exit(1)\n}\n\nfor (const { plugin, duration } of diagnostics.filter(Diagnostics.isPerformance)) {\n console.log(`${plugin}: ${duration}ms`)\n}\nconsole.log(`Generated ${files.length} files`)","highlights",[13,153,155,182,183,182,200,182,216,182,232,182,234,182,250,182,267,182,291,182,320,182,325,182,327,182,357,182,359,182,383,182,418,182,444,182,497,182,502,182,507,182,526,182,530,182,532,182,571,182,606,182,610],{"class":154},"language-typescript",[156,157,160,164,168,172,175,178],"span",{"class":158,"style":159},"line","display: inline",[156,161,163],{"style":162},"color:#d73a49;--hls-dark:#f97583","import ",[156,165,167],{"style":166},"color:#005cc5;--hls-dark:#79b8ff","{ ",[156,169,171],{"style":170},"color:#24292e;--hls-dark:#e1e4e8","createKubb ",[156,173,174],{"style":166},"} ",[156,176,177],{"style":162},"from ",[156,179,181],{"style":180},"color:#032f62;--hls-dark:#9ecbff","'kubb'","\n",[156,184,185,187,189,193,195,197],{"class":158,"style":159},[156,186,163],{"style":162},[156,188,167],{"style":166},[156,190,192],{"style":191},"color:#6f42c1;--hls-dark:#b392f0","Diagnostics ",[156,194,174],{"style":166},[156,196,177],{"style":162},[156,198,199],{"style":180},"'kubb\u002Fkit'",[156,201,202,204,206,209,211,213],{"class":158,"style":159},[156,203,163],{"style":162},[156,205,167],{"style":166},[156,207,208],{"style":170},"pluginTs ",[156,210,174],{"style":166},[156,212,177],{"style":162},[156,214,215],{"style":180},"'@kubb\u002Fplugin-ts'",[156,217,218,220,222,225,227,229],{"class":158,"style":159},[156,219,163],{"style":162},[156,221,167],{"style":166},[156,223,224],{"style":170},"pluginAxios ",[156,226,174],{"style":166},[156,228,177],{"style":162},[156,230,231],{"style":180},"'@kubb\u002Fplugin-axios'",[156,233],{"class":158,"style":159},[156,235,236,239,242,245,247],{"class":158,"style":159},[156,237,238],{"style":162},"const ",[156,240,241],{"style":170},"kubb ",[156,243,244],{"style":162},"= ",[156,246,15],{"style":191},[156,248,249],{"style":166},"({",[156,251,252,255,258,261,264],{"class":158,"style":159},[156,253,254],{"style":166}," ",[156,256,257],{"style":166},"input",[156,259,260],{"style":162},": ",[156,262,263],{"style":180},"'.\u002FpetStore.yaml'",[156,265,266],{"style":162},",",[156,268,269,271,274,276,278,281,283,286,289],{"class":158,"style":159},[156,270,254],{"style":162},[156,272,273],{"style":166},"output",[156,275,260],{"style":162},[156,277,167],{"style":166},[156,279,280],{"style":166},"path",[156,282,260],{"style":162},[156,284,285],{"style":180},"'.\u002Fgen' ",[156,287,288],{"style":166},"}",[156,290,266],{"style":162},[156,292,293,295,298,300,303,306,309,312,315,318],{"class":158,"style":159},[156,294,254],{"style":162},[156,296,297],{"style":166},"plugins",[156,299,260],{"style":162},[156,301,302],{"style":166},"[",[156,304,305],{"style":191},"pluginTs",[156,307,308],{"style":166},"()",[156,310,311],{"style":162},", ",[156,313,314],{"style":191},"pluginAxios",[156,316,317],{"style":166},"()]",[156,319,266],{"style":162},[156,321,322],{"class":158,"style":159},[156,323,324],{"style":166},"})",[156,326],{"class":158,"style":159},[156,328,329,331,333,336,338,341,343,345,348,350,352,355],{"class":158,"style":159},[156,330,238],{"style":162},[156,332,167],{"style":166},[156,334,335],{"style":170},"files",[156,337,311],{"style":162},[156,339,340],{"style":170},"diagnostics ",[156,342,174],{"style":166},[156,344,244],{"style":162},[156,346,347],{"style":162},"await ",[156,349,19],{"style":170},[156,351,137],{"style":162},[156,353,354],{"style":191},"safeBuild",[156,356,308],{"style":166},[156,358],{"class":158,"style":159},[156,360,361,364,367,370,372,375,377,380],{"class":158,"style":159},[156,362,363],{"style":162},"if ",[156,365,366],{"style":166},"(",[156,368,369],{"style":191},"Diagnostics",[156,371,137],{"style":162},[156,373,374],{"style":191},"hasError",[156,376,366],{"style":166},[156,378,379],{"style":170},"diagnostics",[156,381,382],{"style":166},")) {",[156,384,385,387,390,392,394,397,400,402,404,407,409,411,413,416],{"class":158,"style":159},[156,386,254],{"style":166},[156,388,389],{"style":162},"for ",[156,391,366],{"style":166},[156,393,238],{"style":162},[156,395,396],{"style":170},"diagnostic ",[156,398,399],{"style":162},"of ",[156,401,379],{"style":170},[156,403,137],{"style":162},[156,405,406],{"style":191},"filter",[156,408,366],{"style":166},[156,410,369],{"style":191},[156,412,137],{"style":162},[156,414,415],{"style":166},"isProblem",[156,417,382],{"style":166},[156,419,420,423,425,427,430,432,435,438,441],{"class":158,"style":159},[156,421,422],{"style":166}," ",[156,424,363],{"style":162},[156,426,366],{"style":166},[156,428,429],{"style":170},"diagnostic",[156,431,137],{"style":162},[156,433,434],{"style":166},"severity ",[156,436,437],{"style":162},"=== ",[156,439,440],{"style":180},"'error'",[156,442,443],{"style":166},") {",[156,445,446,449,452,454,457,459,462,465,467,469,472,475,477,479,481,483,485,487,490,492,494],{"class":158,"style":159},[156,447,448],{"style":166}," ",[156,450,451],{"style":170},"console",[156,453,137],{"style":162},[156,455,456],{"style":191},"error",[156,458,366],{"style":166},[156,460,461],{"style":180},"`",[156,463,464],{"style":170},"${",[156,466,429],{"style":170},[156,468,137],{"style":162},[156,470,471],{"style":166},"plugin ",[156,473,474],{"style":162},"?? ",[156,476,181],{"style":180},[156,478,288],{"style":170},[156,480,260],{"style":180},[156,482,464],{"style":170},[156,484,429],{"style":170},[156,486,137],{"style":162},[156,488,489],{"style":166},"message",[156,491,288],{"style":170},[156,493,461],{"style":180},[156,495,496],{"style":166},")",[156,498,499],{"class":158,"style":159},[156,500,501],{"style":166}," }",[156,503,504],{"class":158,"style":159},[156,505,506],{"style":166}," }",[156,508,509,511,514,516,519,521,524],{"class":158,"style":159},[156,510,254],{"style":166},[156,512,513],{"style":170},"process",[156,515,137],{"style":162},[156,517,518],{"style":191},"exit",[156,520,366],{"style":166},[156,522,523],{"style":166},"1",[156,525,496],{"style":166},[156,527,528],{"class":158,"style":159},[156,529,288],{"style":166},[156,531],{"class":158,"style":159},[156,533,534,536,538,540,542,545,547,550,552,554,556,558,560,562,564,566,569],{"class":158,"style":159},[156,535,389],{"style":162},[156,537,366],{"style":166},[156,539,238],{"style":162},[156,541,167],{"style":166},[156,543,544],{"style":170},"plugin",[156,546,311],{"style":162},[156,548,549],{"style":170},"duration ",[156,551,174],{"style":166},[156,553,399],{"style":162},[156,555,379],{"style":170},[156,557,137],{"style":162},[156,559,406],{"style":191},[156,561,366],{"style":166},[156,563,369],{"style":191},[156,565,137],{"style":162},[156,567,568],{"style":166},"isPerformance",[156,570,382],{"style":166},[156,572,573,575,577,579,582,584,586,588,590,592,594,596,599,601,604],{"class":158,"style":159},[156,574,254],{"style":166},[156,576,451],{"style":170},[156,578,137],{"style":162},[156,580,581],{"style":191},"log",[156,583,366],{"style":166},[156,585,461],{"style":180},[156,587,464],{"style":170},[156,589,544],{"style":170},[156,591,288],{"style":170},[156,593,260],{"style":180},[156,595,464],{"style":170},[156,597,598],{"style":170},"duration",[156,600,288],{"style":170},[156,602,603],{"style":180},"ms`",[156,605,496],{"style":166},[156,607,608],{"class":158,"style":159},[156,609,288],{"style":166},[156,611,612,614,616,618,620,623,625,627,629,632,634,637],{"class":158,"style":159},[156,613,451],{"style":170},[156,615,137],{"style":162},[156,617,581],{"style":191},[156,619,366],{"style":166},[156,621,622],{"style":180},"`Generated ",[156,624,464],{"style":170},[156,626,335],{"style":170},[156,628,137],{"style":162},[156,630,631],{"style":166},"length",[156,633,288],{"style":170},[156,635,636],{"style":180}," files`",[156,638,496],{"style":166},[640,641,643,644,647,648,651,652,655,656,659,660,137],"blockquote",{"as":642},"warning","",[13,645,646],{},"safeBuild()"," does not throw when the pipeline fails. Check ",[13,649,650],{},"Diagnostics.hasError(diagnostics)"," before you use the files. Setup can still reject, for example when a plugin's ",[13,653,654],{},"dependencies"," callback throws or the signal aborts, so wrap the call in ",[13,657,658],{},"try","\u002F",[13,661,662],{},"catch",[664,665,667,669],"h3",{"id":666},"kubb-instance-members",[13,668,41],{}," instance members",[10,671,672],{},"The build methods build on each other:",[674,675],"mermaid",{"svg":676},"\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"pele pele-flowchart\" viewBox=\"0 0 1045 152\" width=\"1045\" height=\"152\" style=\"--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,monospace);font:16px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,sans-serif)\" fill=\"var(--_fg)\" role=\"graphics-document document\" aria-roledescription=\"flowchart\">\u003Cg class=\"pele-edges\" fill=\"none\" stroke=\"var(--_l)\" stroke-linecap=\"round\">\u003Cg class=\"pele-edge\" data-id=\"L_many_generate_0\">\u003Cpath d=\"M210.3,32L334.9,32\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M341.9,32L333.9,35.36L333.9,28.64Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_generate_safeBuild_0\">\u003Cpath d=\"M456.16,32L657.54,32C665.23,32 665.23,68 672.91,68L678.04,68\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M685.04,68L677.04,71.36L677.04,64.64Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_build_safeBuild_0\">\u003Cpath d=\"M441.48,120L657.54,120C665.23,120 665.23,84 672.91,84L678.04,84\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M685.04,84L677.04,87.36L677.04,80.64Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_safeBuild_setup_0\">\u003Cpath d=\"M801.95,76L939.01,76\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M946.01,76L938.01,79.36L938.01,72.64Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"pele-edge-labels\" font-size=\"14\">\u003Cg class=\"pele-edge-label\" data-id=\"L_many_generate_0\">\u003Crect x=\"232.8\" y=\"21.5\" width=\"79.6\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"272.6\" y=\"36.9\" text-anchor=\"middle\">each config\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_generate_safeBuild_0\">\u003Crect x=\"478.66\" y=\"14\" width=\"176.88\" height=\"36\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"567.1\" y=\"27.9\">adds generation hooks and\u003C\u002Ftspan>\u003Ctspan x=\"567.1\" y=\"45.9\">output passes\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_build_safeBuild_0\">\u003Crect x=\"512.53\" y=\"109.5\" width=\"109.14\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"567.1\" y=\"124.9\" text-anchor=\"middle\">throws on errors\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_safeBuild_setup_0\">\u003Crect x=\"824.45\" y=\"65.5\" width=\"92.06\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"870.48\" y=\"80.9\" text-anchor=\"middle\">when needed\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"pele-nodes\">\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"many\" transform=\"translate(109.15,32)\">\u003Crect x=\"-101.15\" y=\"-24\" width=\"202.3\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">Kubb.generate(configs)\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"generate\" transform=\"translate(399.03,32)\">\u003Crect x=\"-57.13\" y=\"-24\" width=\"114.26\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">.generate()\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect core\" data-id=\"safeBuild\" transform=\"translate(743.49,76)\">\u003Crect x=\"-58.46\" y=\"-24\" width=\"116.91\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">.safeBuild()\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"build\" transform=\"translate(399.03,120)\">\u003Crect x=\"-42.45\" y=\"-24\" width=\"84.9\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">.build()\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"setup\" transform=\"translate(991.13,76)\">\u003Crect x=\"-45.12\" y=\"-24\" width=\"90.24\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">.setup()\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003C\u002Fsvg>",[55,678,679,691],{},[58,680,681],{},[61,682,683,686,688],{},[64,684,685],{},"Member",[64,687,69],{},[64,689,690],{},"Description",[74,692,693,714,735,762,777,796,814,831,851],{},[61,694,695,700,705],{},[79,696,697],{},[13,698,699],{},".safeBuild()",[79,701,702],{},[13,703,704],{},"() => Promise\u003CBuildOutput>",[79,706,707,708,710,711,713],{},"The main call. Runs the pipeline and collects its problems in ",[13,709,379],{}," instead of throwing. Setup can still reject, for example when a plugin's ",[13,712,654],{}," callback throws or the signal aborts, so catch it.",[61,715,716,721,725],{},[79,717,718],{},[13,719,720],{},".build()",[79,722,723],{},[13,724,704],{},[79,726,727,728,730,731,734],{},"Runs ",[13,729,646],{},", then throws an ",[13,732,733],{},"AggregateError"," of every error diagnostic.",[61,736,737,742,747],{},[79,738,739],{},[13,740,741],{},".generate()",[79,743,744],{},[13,745,746],{},"(options?) => Promise\u003CGenerateResult>",[79,748,749,750,753,754,757,758,761],{},"Runs one full generation: the ",[13,751,752],{},"kubb:generation:*"," and ",[13,755,756],{},"kubb:setup:*"," hooks, the build, and the output passes. Returns ",[13,759,760],{},"{ success, files, diagnostics, input }"," and never throws on a build error.",[61,763,764,769,774],{},[79,765,766],{},[13,767,768],{},".setup()",[79,770,771],{},[13,772,773],{},"() => Promise\u003Cvoid>",[79,775,776],{},"Sets up the driver and storage. The build methods call it when needed.",[61,778,779,784,789],{},[79,780,781],{},[13,782,783],{},".dispose()",[79,785,786],{},[13,787,788],{},"() => void",[79,790,791,792,795],{},"Releases the driver. The next build sets up a new one. ",[13,793,794],{},"using kubb = createKubb(config)"," disposes it too.",[61,797,798,803,807],{},[79,799,800],{},[13,801,802],{},".hooks",[79,804,805],{},[13,806,88],{},[79,808,809,810,813],{},"Read-only. The hook emitter. Call ",[13,811,812],{},".hook(name, handler)"," before a build.",[61,815,816,821,826],{},[79,817,818],{},[13,819,820],{},".config",[79,822,823],{},[13,824,825],{},"Config",[79,827,828,829,137],{},"Read-only. The resolved config, available right after ",[13,830,15],{},[61,832,833,838,843],{},[79,834,835],{},[13,836,837],{},".storage",[79,839,840],{},[13,841,842],{},"Storage",[79,844,845,846,850],{},"Read-only. The ",[22,847,849],{"href":848},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fstorage","storage"," backend, keyed by absolute path.",[61,852,853,858,861],{},[79,854,855],{},[13,856,857],{},".driver",[79,859,860],{},"driver handle",[79,862,863,864,867],{},"The plugin driver, from ",[13,865,866],{},"setup()"," until the build ends. Throws outside that window.",[664,869,871],{"id":870},"kubb-generate",[13,872,873],{},"Kubb.generate(configs)",[10,875,876,877,49,880,882,883,890,891,894,895,753,897,899],{},"The static ",[13,878,879],{},"Kubb.generate",[13,881,52],{}," builds every config in a ",[22,884,886,889],{"href":885},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#multiple-configurations-array",[13,887,888],{},"defineConfig([...])"," array",", as ",[13,892,893],{},"kubb generate"," does. Pass ",[13,896,83],{},[13,898,103],{}," as the second argument.",[146,901,903],{"language":148,"filename":149,"code":902,"class":151},"import { Kubb } from '@kubb\u002Fcore'\nimport configs from '.\u002Fkubb.config.ts'\n\nfor await (const { success, files, kubb } of Kubb.generate(configs)) {\n console.log(kubb.config.name, success ? `${files.length} files` : 'failed')\n}",[13,904,905,182,921,182,933,182,935,182,975,182,1029],{"class":154},[156,906,907,909,911,914,916,918],{"class":158,"style":159},[156,908,163],{"style":162},[156,910,167],{"style":166},[156,912,913],{"style":191},"Kubb ",[156,915,174],{"style":166},[156,917,177],{"style":162},[156,919,920],{"style":180},"'@kubb\u002Fcore'",[156,922,923,925,928,930],{"class":158,"style":159},[156,924,163],{"style":162},[156,926,927],{"style":170},"configs ",[156,929,177],{"style":162},[156,931,932],{"style":180},"'.\u002Fkubb.config.ts'",[156,934],{"class":158,"style":159},[156,936,937,940,942,944,946,949,951,953,955,957,959,961,963,965,968,970,973],{"class":158,"style":159},[156,938,939],{"style":162},"for await ",[156,941,366],{"style":166},[156,943,238],{"style":162},[156,945,167],{"style":166},[156,947,948],{"style":170},"success",[156,950,311],{"style":162},[156,952,335],{"style":170},[156,954,311],{"style":162},[156,956,241],{"style":170},[156,958,174],{"style":166},[156,960,399],{"style":162},[156,962,41],{"style":191},[156,964,137],{"style":162},[156,966,967],{"style":191},"generate",[156,969,366],{"style":166},[156,971,972],{"style":170},"configs",[156,974,382],{"style":166},[156,976,977,979,981,983,985,987,989,991,994,996,999,1001,1004,1007,1009,1011,1013,1015,1017,1019,1022,1024,1027],{"class":158,"style":159},[156,978,254],{"style":166},[156,980,451],{"style":170},[156,982,137],{"style":162},[156,984,581],{"style":191},[156,986,366],{"style":166},[156,988,19],{"style":170},[156,990,137],{"style":162},[156,992,993],{"style":166},"config",[156,995,137],{"style":162},[156,997,998],{"style":166},"name",[156,1000,311],{"style":162},[156,1002,1003],{"style":170},"success ",[156,1005,1006],{"style":162},"? ",[156,1008,461],{"style":180},[156,1010,464],{"style":170},[156,1012,335],{"style":170},[156,1014,137],{"style":162},[156,1016,631],{"style":166},[156,1018,288],{"style":170},[156,1020,1021],{"style":180}," files` ",[156,1023,260],{"style":162},[156,1025,1026],{"style":180},"'failed'",[156,1028,496],{"style":166},[156,1030,1031],{"class":158,"style":159},[156,1032,288],{"style":166},[1034,1035,1036,1040,1050,1060,1070],"ul",{},[1037,1038,1039],"li",{},"Kubb builds one config at a time and yields its result when it finishes.",[1037,1041,1042,1043,1046,1047,1049],{},"Each result is a ",[13,1044,1045],{},"GenerateResult"," plus the ",[13,1048,19],{}," instance that built it.",[1037,1051,1052,1053,1056,1057,1059],{},"A failing config does not stop the others. Its result has ",[13,1054,1055],{},"success: false",". Only an aborted ",[13,1058,103],{}," rejects.",[1037,1061,1062,1063,1069],{},"Configs with the same ",[22,1064,1066],{"href":1065},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#shared",[13,1067,1068],{},"shared"," path are compared first, and each build writes its shared schemas there.",[1037,1071,1072,1075],{},[13,1073,1074],{},"{ only: index }"," builds one config. It is still compared with the others and never empties the shared directory.",[664,1077,1079,1082],{"id":1078},"buildoutput-fields",[13,1080,1081],{},"BuildOutput"," fields",[55,1084,1085,1096],{},[58,1086,1087],{},[61,1088,1089,1092,1094],{},[64,1090,1091],{},"Field",[64,1093,69],{},[64,1095,690],{},[74,1097,1098,1112,1125,1142,1160,1178],{},[61,1099,1100,1104,1109],{},[79,1101,1102],{},[13,1103,335],{},[79,1105,1106],{},[13,1107,1108],{},"Array\u003CFileNode>",[79,1110,1111],{},"The generated files.",[61,1113,1114,1118,1122],{},[79,1115,1116],{},[13,1117,849],{},[79,1119,1120],{},[13,1121,842],{},[79,1123,1124],{},"The storage backend.",[61,1126,1127,1132,1134],{},[79,1128,1129],{},[13,1130,1131],{},"driver",[79,1133,860],{},[79,1135,1136,1137,753,1139,1141],{},"Deprecated. The plugin driver, already disposed: only ",[13,1138,297],{},[13,1140,993],{}," keep their values.",[61,1143,1144,1148,1153],{},[79,1145,1146],{},[13,1147,379],{},[79,1149,1150],{},[13,1151,1152],{},"Array\u003CDiagnostic>",[79,1154,1155,1156,1159],{},"Problems from the build, plus a ",[13,1157,1158],{},"performance"," diagnostic per plugin.",[61,1161,1162,1166,1171],{},[79,1163,1164],{},[13,1165,257],{},[79,1167,1168],{},[13,1169,1170],{},"InputNode | null",[79,1172,1173,1174,1177],{},"The parsed spec, or ",[13,1175,1176],{},"null"," when there was none to parse.",[61,1179,1180,1185,1190],{},[79,1181,1182],{},[13,1183,1184],{},"sources",[79,1186,1187],{},[13,1188,1189],{},"Array\u003Cstring>",[79,1191,1192,1193,1196],{},"The files and URLs the adapter read for the spec. ",[13,1194,1195],{},"undefined"," when the adapter does not track them or nothing was parsed.",[10,1198,1199,1200,1202,1203,1206,1207,311,1209,1211,1212,1215,1216,1218,1219,1221,1222,311,1225,1228,1229,1232,1233,137],{},"A problem diagnostic has a ",[13,1201,13],{},", a ",[13,1204,1205],{},"severity"," (",[13,1208,456],{},[13,1210,642],{},", or ",[13,1213,1214],{},"info","), a ",[13,1217,489],{},", and the ",[13,1220,544],{}," that produced it. It can add a ",[13,1223,1224],{},"location",[13,1226,1227],{},"help",", and an ",[13,1230,1231],{},"issues"," URL. A failed plugin keeps its original error on ",[13,1234,1235],{},"cause",[28,1237,1238],{"id":379},[13,1239,369],{},[10,1241,1242,49,1244,1247,1248,1251,1252,1255,1256,1259],{},[13,1243,369],{},[13,1245,1246],{},"kubb\u002Fkit"," creates and narrows the problems a build collects. To give an error a stable code, a severity, and a location, throw a ",[13,1249,1250],{},"Diagnostics.Error"," instead of a bare ",[13,1253,1254],{},"Error",". ",[22,1257,369],{"href":1258},"\u002Fdocs\u002F5.x\u002Freference\u002Fdiagnostics"," lists every code.",[55,1261,1262,1270],{},[58,1263,1264],{},[61,1265,1266,1268],{},[64,1267,685],{},[64,1269,72],{},[74,1271,1272,1281,1294,1308,1324,1340,1354,1369,1382,1392,1411],{},[61,1273,1274,1278],{},[79,1275,1276],{},[13,1277,1250],{},[79,1279,1280],{},"Error class that carries a problem diagnostic.",[61,1282,1283,1288],{},[79,1284,1285],{},[13,1286,1287],{},"Diagnostics.code",[79,1289,1290,1291,137],{},"The code catalog, such as ",[13,1292,1293],{},"Diagnostics.code.refNotFound",[61,1295,1296,1301],{},[79,1297,1298],{},[13,1299,1300],{},"Diagnostics.report",[79,1302,1303,1304,1307],{},"Adds a diagnostic to the running build without throwing. Returns ",[13,1305,1306],{},"false"," outside a build.",[61,1309,1310,1315],{},[79,1311,1312],{},[13,1313,1314],{},"Diagnostics.from",[79,1316,1317,1318,1321,1322,137],{},"Turns any thrown value into a problem diagnostic, ",[13,1319,1320],{},"KUBB_UNKNOWN"," unless it is a ",[13,1323,1250],{},[61,1325,1326,1331],{},[79,1327,1328],{},[13,1329,1330],{},"Diagnostics.hasError",[79,1332,1333,1336,1337,137],{},[13,1334,1335],{},"true"," when any diagnostic has ",[13,1338,1339],{},"severity: 'error'",[61,1341,1342,1347],{},[79,1343,1344],{},[13,1345,1346],{},"Diagnostics.isProblem",[79,1348,1349,1350,1353],{},"Narrows to the ",[13,1351,1352],{},"problem"," kind.",[61,1355,1356,1361],{},[79,1357,1358],{},[13,1359,1360],{},"Diagnostics.isPerformance",[79,1362,1349,1363,1365,1366,1368],{},[13,1364,1158],{}," kind, with a per-plugin ",[13,1367,598],{}," in milliseconds.",[61,1370,1371,1376],{},[79,1372,1373],{},[13,1374,1375],{},"Diagnostics.isUpdate",[79,1377,1349,1378,1381],{},[13,1379,1380],{},"update"," kind, emitted when a newer Kubb version exists.",[61,1383,1384,1389],{},[79,1385,1386],{},[13,1387,1388],{},"Diagnostics.count",[79,1390,1391],{},"Counts errors, warnings, and infos.",[61,1393,1394,1399],{},[79,1395,1396],{},[13,1397,1398],{},"Diagnostics.explain",[79,1400,1401,1402,311,1405,1407,1408,137],{},"Returns a code's catalog entry: ",[13,1403,1404],{},"title",[13,1406,1235],{},", and ",[13,1409,1410],{},"fix",[61,1412,1413,1418],{},[79,1414,1415],{},[13,1416,1417],{},"Diagnostics.docsUrl",[79,1419,1420],{},"Returns a code's kubb.dev URL.",[10,1422,1423,1424,1427],{},"An adapter throws this error when a ",[13,1425,1426],{},"$ref"," has no target:",[146,1429,1432],{"language":148,"filename":1430,"code":1431,"class":151},"adapter.ts","import { Diagnostics } from 'kubb\u002Fkit'\n\nthrow new Diagnostics.Error({\n code: Diagnostics.code.refNotFound,\n severity: 'error',\n message: 'Could not find a definition for #\u002Fcomponents\u002Fschemas\u002FPet.',\n location: { kind: 'schema', pointer: '#\u002Fcomponents\u002Fschemas\u002FPet', ref: '#\u002Fcomponents\u002Fschemas\u002FPet' },\n})",[13,1433,1434,182,1448,182,1450,182,1466,182,1487,182,1499,182,1512,182,1554],{"class":154},[156,1435,1436,1438,1440,1442,1444,1446],{"class":158,"style":159},[156,1437,163],{"style":162},[156,1439,167],{"style":166},[156,1441,192],{"style":191},[156,1443,174],{"style":166},[156,1445,177],{"style":162},[156,1447,199],{"style":180},[156,1449],{"class":158,"style":159},[156,1451,1452,1455,1458,1460,1462,1464],{"class":158,"style":159},[156,1453,1454],{"style":162},"throw ",[156,1456,1457],{"style":162},"new ",[156,1459,369],{"style":191},[156,1461,137],{"style":162},[156,1463,1254],{"style":191},[156,1465,249],{"style":166},[156,1467,1468,1470,1472,1474,1476,1478,1480,1482,1485],{"class":158,"style":159},[156,1469,254],{"style":166},[156,1471,13],{"style":166},[156,1473,260],{"style":170},[156,1475,369],{"style":191},[156,1477,137],{"style":162},[156,1479,13],{"style":166},[156,1481,137],{"style":162},[156,1483,1484],{"style":166},"refNotFound",[156,1486,266],{"style":162},[156,1488,1489,1491,1493,1495,1497],{"class":158,"style":159},[156,1490,254],{"style":162},[156,1492,1205],{"style":166},[156,1494,260],{"style":162},[156,1496,440],{"style":180},[156,1498,266],{"style":162},[156,1500,1501,1503,1505,1507,1510],{"class":158,"style":159},[156,1502,254],{"style":162},[156,1504,489],{"style":166},[156,1506,260],{"style":162},[156,1508,1509],{"style":180},"'Could not find a definition for #\u002Fcomponents\u002Fschemas\u002FPet.'",[156,1511,266],{"style":162},[156,1513,1514,1516,1518,1520,1522,1525,1527,1530,1532,1535,1537,1540,1542,1545,1547,1550,1552],{"class":158,"style":159},[156,1515,254],{"style":162},[156,1517,1224],{"style":166},[156,1519,260],{"style":162},[156,1521,167],{"style":166},[156,1523,1524],{"style":166},"kind",[156,1526,260],{"style":162},[156,1528,1529],{"style":180},"'schema'",[156,1531,311],{"style":162},[156,1533,1534],{"style":166},"pointer",[156,1536,260],{"style":162},[156,1538,1539],{"style":180},"'#\u002Fcomponents\u002Fschemas\u002FPet'",[156,1541,311],{"style":162},[156,1543,1544],{"style":166},"ref",[156,1546,260],{"style":162},[156,1548,1549],{"style":180},"'#\u002Fcomponents\u002Fschemas\u002FPet' ",[156,1551,288],{"style":166},[156,1553,266],{"style":162},[156,1555,1556],{"class":158,"style":159},[156,1557,324],{"style":166},[28,1559,1561],{"id":1560},"less-common-cases","Less common cases",[664,1563,1565],{"id":1564},"programmatic-builds","Programmatic builds",[1034,1567,1568,1586,1594,1603,1635],{},[1037,1569,1570,1571,1573,1574,1576,1577,1579,1580,137],{},"A config needs ",[13,1572,257],{}," whenever it has an adapter. ",[13,1575,45],{}," always sets one, so a config without ",[13,1578,257],{}," stops with ",[22,1581,1583],{"href":1582},"\u002Fdocs\u002F5.x\u002Freference\u002Fdiagnostics#kubb-input-required",[13,1584,1585],{},"KUBB_INPUT_REQUIRED",[1037,1587,1588,1589,49,1591,1593],{},"Only ",[13,1590,15],{},[13,1592,52],{}," runs without an adapter, in plugin-only mode.",[1037,1595,1596,1597,311,1599,1602],{},"On ",[13,1598,741],{},[13,1600,1601],{},"options.processOutput"," replaces the output passes.",[1037,1604,1605,49,1608,1610,1611,1617,1618,1621,1622,1625,1626,1629,1630,753,1632,1634],{},[13,1606,1607],{},"assertValidConfig(config)",[13,1609,1246],{}," throws ",[22,1612,1614],{"href":1613},"\u002Fdocs\u002F5.x\u002Freference\u002Fdiagnostics#kubb-invalid-config",[13,1615,1616],{},"KUBB_INVALID_CONFIG"," for a config without ",[13,1619,1620],{},"output.path",", or with an unknown ",[13,1623,1624],{},"output.format"," or ",[13,1627,1628],{},"output.lint"," tool. ",[13,1631,768],{},[13,1633,741],{}," run the same check.",[1037,1636,1637,1642,1643,1645],{},[22,1638,1640],{"href":1639},"#kubb-generate",[13,1641,873],{}," holds one config in memory at a time. A failing config's result has ",[13,1644,456],{},", with what it threw outside its diagnostics.",{"title":643,"searchDepth":1647,"depth":1647,"links":1648},5,[1649,1658,1659],{"id":30,"depth":1650,"text":15,"children":1651},2,[1652,1655,1656],{"id":666,"depth":1653,"text":1654},3,"Kubb instance members",{"id":870,"depth":1653,"text":873},{"id":1078,"depth":1653,"text":1657},"BuildOutput fields",{"id":379,"depth":1650,"text":369},{"id":1560,"depth":1650,"text":1561,"children":1660},[1661],{"id":1564,"depth":1653,"text":1565},"The programmatic engine in the kubb package: createKubb, the Kubb instance and its build methods, Kubb.generate, BuildOutput, and Diagnostics.","md",{"layout":1665,"title":5,"description":1662,"outline":1666,"order":1667,"navigation":1668},"doc",[1650,1653],10,{"title":1669,"icon":1670},"Engine","i-iconoir-cpu",{"layout":1665,"outline":1672},[1650,1653],{"title":1669,"icon":1670},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fengine",{"title":5,"description":1662},{"loc":1674},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fengine.md","docs\u002F5.x\u002Freference\u002Fkit\u002Fengine","iEL0uMz3v-wswMQpwHBkDL4vetbtBS0p06gzMbrsmRs",1795989037150,"2e8b4c62-5b8c-4587-97c0-530d08a9bd53"]