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