[{"data":1,"prerenderedAt":1669},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fplugins":3},{"id":4,"title":5,"body":6,"description":1651,"extension":1652,"frontmatter":1653,"heading":5,"meta":1659,"navigation":1661,"order":1656,"path":1662,"seo":1663,"sitemap":1664,"source":1665,"stem":1666,"__hash__":1667,"hasPopups":1668},"docs\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fplugins.md","Plugins",{"type":7,"value":8,"toc":1638},"minimark",[9,29,36,56,373,400,405,575,584,592,608,692,699,706,719,736,740,747,784,1387,1589,1603,1625],[10,11,12,13,18,19,23,24,28],"p",{},"Plugins are the main extension point in Kubb. A plugin owns its file naming, its output folder, its lifecycle hooks, and the ",[14,15,17],"a",{"href":16},".\u002Fgenerators","generators"," that walk the ",[14,20,22],{"href":21},"\u002Fdocs\u002F5.x\u002Fexplanation\u002Farchitecture#ast","AST"," and emit ",[25,26,27],"code",{},"FileNode"," objects.",[30,31,33],"h2",{"id":32},"defineextension",[25,34,35],{},"defineExtension",[10,37,38,40,41,44,45,48,49,52,53,55],{},[25,39,35],{}," with ",[25,42,43],{},"kind: 'plugin'"," takes a definition object and returns a factory. Call it with the user's options to get a ",[25,46,47],{},"Plugin",". Kubb runs ",[25,50,51],{},"setup"," before the plugin's generators, and the value ",[25,54,51],{}," returns becomes the plugin's resolved options.",[57,58,64],"pre",{"language":59,"meta":60,"code":61,"filename":62,"class":63},"typescript","twoslash","import { defineExtension, type PluginType } from 'kubb\u002Fkit'\n\ntype PluginExample = PluginType\u003C'plugin-example', { prefix?: string }, { prefix: string }>\n\nexport const pluginExample = defineExtension\u003CPluginExample>({\n  kind: 'plugin',\n  meta: { name: 'plugin-example', version: '1.0.0' },\n  dependencies: { 'plugin-ts': {} },\n  setup(options, kubb) {\n    \u002F\u002F Register resolvers, generators, and macros on `kubb`.\n    return { prefix: options.prefix ?? '' }\n  },\n})","plugin-example.ts","shiki shiki-themes github-light github-dark twoslash lsp dark:github-dark",[25,65,67,111,112,111,114,111,176,111,178,111,213,111,233,111,272,111,290,111,319,111,325,111,363,111,368],{"class":66},"language-typescript",[68,69,72,76,80,86,89,92,95,101,104,107],"span",{"class":70,"style":71},"line","display: inline",[68,73,75],{"style":74},"color:#D73A49;--shiki-dark:#F97583","import",[68,77,79],{"style":78},"color:#24292E;--shiki-dark:#E1E4E8"," { ",[68,81,82],{"style":78},[68,83,35],{"class":84,"data-popup":85},"twoslash-hover","0",[68,87,88],{"style":78},", ",[68,90,91],{"style":74},"type",[68,93,94],{"style":78}," ",[68,96,97],{"style":78},[68,98,100],{"class":84,"data-popup":99},"1","PluginType",[68,102,103],{"style":78}," } ",[68,105,106],{"style":74},"from",[68,108,110],{"style":109},"color:#032F62;--shiki-dark:#9ECBFF"," 'kubb\u002Fkit'","\n",[68,113],{"class":70,"style":71},[68,115,116,118,121,127,130,132,137,140,143,146,153,156,160,163,168,171,173],{"class":70,"style":71},[68,117,91],{"style":74},[68,119,94],{"style":120},"color:#6F42C1;--shiki-dark:#B392F0",[68,122,123],{"style":120},[68,124,126],{"class":84,"data-popup":125},"2","PluginExample",[68,128,129],{"style":74}," =",[68,131,94],{"style":120},[68,133,134],{"style":120},[68,135,100],{"class":84,"data-popup":136},"3",[68,138,139],{"style":78},"\u003C",[68,141,142],{"style":109},"'plugin-example'",[68,144,145],{"style":78},", { ",[68,147,149],{"style":148},"color:#E36209;--shiki-dark:#FFAB70",[68,150,152],{"class":84,"data-popup":151},"4","prefix",[68,154,155],{"style":74},"?:",[68,157,159],{"style":158},"color:#005CC5;--shiki-dark:#79B8FF"," string",[68,161,162],{"style":78}," }, { ",[68,164,165],{"style":148},[68,166,152],{"class":84,"data-popup":167},"5",[68,169,170],{"style":74},":",[68,172,159],{"style":158},[68,174,175],{"style":78}," }>",[68,177],{"class":70,"style":71},[68,179,180,183,186,188,194,196,198,203,205,210],{"class":70,"style":71},[68,181,182],{"style":74},"export",[68,184,185],{"style":74}," const",[68,187,94],{"style":158},[68,189,190],{"style":158},[68,191,193],{"class":84,"data-popup":192},"6","pluginExample",[68,195,129],{"style":74},[68,197,94],{"style":120},[68,199,200],{"style":120},[68,201,35],{"class":84,"data-popup":202},"7",[68,204,139],{"style":78},[68,206,207],{"style":120},[68,208,126],{"class":84,"data-popup":209},"8",[68,211,212],{"style":78},">({",[68,214,215,218,224,227,230],{"class":70,"style":71},[68,216,217],{"style":78},"  ",[68,219,220],{"style":78},[68,221,223],{"class":84,"data-popup":222},"9","kind",[68,225,226],{"style":78},": ",[68,228,229],{"style":109},"'plugin'",[68,231,232],{"style":78},",",[68,234,235,237,243,246,252,254,256,258,264,266,269],{"class":70,"style":71},[68,236,217],{"style":78},[68,238,239],{"style":78},[68,240,242],{"class":84,"data-popup":241},"10","meta",[68,244,245],{"style":78},": { ",[68,247,248],{"style":78},[68,249,251],{"class":84,"data-popup":250},"11","name",[68,253,226],{"style":78},[68,255,142],{"style":109},[68,257,88],{"style":78},[68,259,260],{"style":78},[68,261,263],{"class":84,"data-popup":262},"12","version",[68,265,226],{"style":78},[68,267,268],{"style":109},"'1.0.0'",[68,270,271],{"style":78}," },",[68,273,274,276,282,284,287],{"class":70,"style":71},[68,275,217],{"style":78},[68,277,278],{"style":78},[68,279,281],{"class":84,"data-popup":280},"13","dependencies",[68,283,245],{"style":78},[68,285,286],{"style":109},"'plugin-ts'",[68,288,289],{"style":78},": {} },",[68,291,292,294,299,302,308,310,316],{"class":70,"style":71},[68,293,217],{"style":120},[68,295,296],{"style":120},[68,297,51],{"class":84,"data-popup":298},"14",[68,300,301],{"style":78},"(",[68,303,304],{"style":148},[68,305,307],{"class":84,"data-popup":306},"15","options",[68,309,88],{"style":78},[68,311,312],{"style":148},[68,313,315],{"class":84,"data-popup":314},"16","kubb",[68,317,318],{"style":78},") {",[68,320,321],{"class":70,"style":71},[68,322,324],{"style":323},"color:#6A737D;--shiki-dark:#6A737D","    \u002F\u002F Register resolvers, generators, and macros on `kubb`.",[68,326,327,330,332,337,339,344,347,352,354,357,360],{"class":70,"style":71},[68,328,329],{"style":74},"    return",[68,331,79],{"style":78},[68,333,334],{"style":78},[68,335,152],{"class":84,"data-popup":336},"17",[68,338,226],{"style":78},[68,340,341],{"style":78},[68,342,307],{"class":84,"data-popup":343},"18",[68,345,346],{"style":78},".",[68,348,349],{"style":78},[68,350,152],{"class":84,"data-popup":351},"19",[68,353,94],{"style":78},[68,355,356],{"style":74},"??",[68,358,359],{"style":109}," ''",[68,361,362],{"style":78}," }",[68,364,365],{"class":70,"style":71},[68,366,367],{"style":78},"  },",[68,369,370],{"class":70,"style":71},[68,371,372],{"style":78},"})",[10,374,375,378,379,382,383,386,387,389,390,392,393,395,396,346],{},[25,376,377],{},"PluginType\u003CTName, TOptions, TResolvedOptions, TResolver>"," types the plugin. ",[25,380,381],{},"TOptions"," is what users pass, and ",[25,384,385],{},"TResolvedOptions"," is what ",[25,388,51],{}," returns and generators read. ",[25,391,242],{}," and ",[25,394,281],{}," are shared with parsers and described in ",[14,397,399],{"href":398},".\u002Fextensions","Extensions",[401,402,404],"h3",{"id":403},"definition-shape","Definition shape",[406,407,408,427],"table",{},[409,410,411],"thead",{},[412,413,414,418,421,424],"tr",{},[415,416,417],"th",{},"Property",[415,419,420],{},"Type",[415,422,423],{},"Required",[415,425,426],{},"Description",[428,429,430,450,483,503,522,547],"tbody",{},[412,431,432,437,441,444],{},[433,434,435],"td",{},[25,436,223],{},[433,438,439],{},[25,440,229],{},[433,442,443],{},"Yes",[433,445,446,447,449],{},"Tells ",[25,448,35],{}," to define a plugin.",[412,451,452,456,464,466],{},[433,453,454],{},[25,455,242],{},[433,457,458],{},[14,459,461],{"href":460},".\u002Fextensions#meta",[25,462,463],{},"ExtensionMeta",[433,465,443],{},[433,467,468,469,472,473,476,477,479,480,482],{},"Name, version, and compatibility. ",[25,470,471],{},"meta.name"," follows ",[25,474,475],{},"plugin-\u003Cfeature>",". The plugin's own ",[25,478,251],{}," is deprecated in favor of it, and optional when ",[25,481,471],{}," is set.",[412,484,485,489,494,497],{},[433,486,487],{},[25,488,51],{},[433,490,491],{},[25,492,493],{},"(options, kubb: KubbPluginSetupContext) => TResolvedOptions",[433,495,496],{},"No",[433,498,499,500,346],{},"Main plugin logic. Receives the user's options and returns the resolved options. Can be ",[25,501,502],{},"async",[412,504,505,509,517,519],{},[433,506,507],{},[25,508,281],{},[433,510,511],{},[14,512,514],{"href":513},".\u002Fextensions#dependencies",[25,515,516],{},"ExtensionDependencies",[433,518,496],{},[433,520,521],{},"Plugins this one builds on. They run first, and a missing required one fails the run.",[412,523,524,529,534,536],{},[433,525,526],{},[25,527,528],{},"enforce",[433,530,531],{},[25,532,533],{},"'pre' | 'post'",[433,535,496],{},[433,537,538,539,542,543,546],{},"Run this plugin before (",[25,540,541],{},"'pre'",") or after (",[25,544,545],{},"'post'",") the normal plugins. Dependency order still wins.",[412,548,549,554,559,561],{},[433,550,551],{},[25,552,553],{},"hooks",[433,555,556],{},[25,557,558],{},"{ 'kubb:plugin:setup'?: ...; ... }",[433,560,496],{},[433,562,563,564,568,569,572,573,346],{},"Lifecycle handlers (see ",[14,565,567],{"href":566},"\u002Fdocs\u002F5.x\u002Fexplanation\u002Fextensions#plugins","Plugin API","). ",[25,570,571],{},"kubb:plugin:setup"," runs after ",[25,574,51],{},[10,576,577,578,580,581,346],{},"The ",[25,579,47],{}," the factory returns keeps the user's raw options in ",[25,582,583],{},"plugin.options",[401,585,587,588,591],{"id":586},"read-compatibility-from-the-manifest","Read ",[25,589,590],{},"compatibility"," from the manifest",[10,593,594,595,601,602,604,605,607],{},"A published plugin ships a ",[14,596,598],{"href":597},".\u002Fmanifest",[25,599,600],{},"kubb-extension.json"," with its ",[25,603,590],{}," ranges. Import only that field into ",[25,606,242],{},", so Kubb checks the same ranges at runtime and a bundler leaves the rest of the manifest out of the build:",[57,609,613],{"language":59,"filename":610,"code":611,"class":612},"src\u002Fplugin.ts","import { defineExtension } from 'kubb\u002Fkit'\nimport { compatibility } from '..\u002Fkubb-extension.json'\nimport { version } from '..\u002Fpackage.json'\n\nexport const pluginExample = defineExtension({\n  kind: 'plugin',\n  meta: { name: 'plugin-example', version, compatibility },\n})","shiki shiki-themes github-light github-dark dark:github-dark",[25,614,615,111,626,111,638,111,650,111,652,111,669,111,678,111,688],{"class":66},[68,616,617,619,622,624],{"class":70,"style":71},[68,618,75],{"style":74},[68,620,621],{"style":78}," { defineExtension } ",[68,623,106],{"style":74},[68,625,110],{"style":109},[68,627,628,630,633,635],{"class":70,"style":71},[68,629,75],{"style":74},[68,631,632],{"style":78}," { compatibility } ",[68,634,106],{"style":74},[68,636,637],{"style":109}," '..\u002Fkubb-extension.json'",[68,639,640,642,645,647],{"class":70,"style":71},[68,641,75],{"style":74},[68,643,644],{"style":78}," { version } ",[68,646,106],{"style":74},[68,648,649],{"style":109}," '..\u002Fpackage.json'",[68,651],{"class":70,"style":71},[68,653,654,656,658,661,663,666],{"class":70,"style":71},[68,655,182],{"style":74},[68,657,185],{"style":74},[68,659,660],{"style":158}," pluginExample",[68,662,129],{"style":74},[68,664,665],{"style":120}," defineExtension",[68,667,668],{"style":78},"({",[68,670,671,674,676],{"class":70,"style":71},[68,672,673],{"style":78},"  kind: ",[68,675,229],{"style":109},[68,677,232],{"style":78},[68,679,680,683,685],{"class":70,"style":71},[68,681,682],{"style":78},"  meta: { name: ",[68,684,142],{"style":109},[68,686,687],{"style":78},", version, compatibility },",[68,689,690],{"class":70,"style":71},[68,691,372],{"style":78},[10,693,694,695,346],{},"Named imports from JSON need a bundler that inlines them. See ",[14,696,698],{"href":697},".\u002Fmanifest#import-compatibility-into-meta","Extension manifest",[401,700,702,705],{"id":701},"defineplugin-deprecated",[25,703,704],{},"definePlugin"," (deprecated)",[707,708,710,711,713,714,40,716,718],"blockquote",{"as":709},"warning","",[25,712,704],{}," is deprecated. Use ",[25,715,35],{},[25,717,43],{}," instead.",[10,720,721,723,724,726,727,729,730,732,733,346],{},[25,722,704],{}," takes the same definition object as ",[25,725,35],{},", without ",[25,728,223],{},". To move over, rename the call and add ",[25,731,43],{},". See ",[14,734,399],{"href":735},".\u002Fextensions#define-extension",[30,737,739],{"id":738},"setup-context","Setup context",[10,741,742,392,744,746],{},[25,743,51],{},[25,745,571],{}," register generators, the resolver, macros, and options through the setup context. A plugin reaches it in one of two ways:",[748,749,750,770],"ul",{},[751,752,753,226,757,759,760,762,763,766,767,769],"li",{},[754,755,756],"strong",{},"The context argument",[25,758,315],{}," in ",[25,761,51],{},", and ",[25,764,765],{},"ctx"," in the ",[25,768,571],{}," hook.",[751,771,772,775,776,779,780,783],{},[754,773,774],{},"Composables"," from ",[25,777,778],{},"kubb\u002Fkit",", such as ",[25,781,782],{},"addGenerator()",". They take no context argument, so helper functions that setup calls can use them too.",[785,786,787,1100],"code-group",{},[57,788,791],{"language":59,"meta":60,"code":789,"filename":790,"class":63},"import { createResolver, defineExtension, defineGenerator } from 'kubb\u002Fkit'\n\nconst resolver = createResolver({ pluginName: 'plugin-example' })\nconst generator = defineGenerator({ name: 'example', operation: () => [] })\n\nexport const pluginExample = defineExtension({\n  kind: 'plugin',\n  meta: { name: 'plugin-example' },\n  setup(options, kubb) {\n    kubb.requirePlugin('plugin-ts')\n    kubb.setResolver(resolver)\n    kubb.addGenerator(generator)\n    return options\n  },\n})","kubb argument",[25,792,793,111,826,111,828,111,866,111,916,111,918,111,942,111,957,111,979,111,1004,111,1029,111,1055,111,1081,111,1092,111,1096],{"class":66},[68,794,795,797,799,805,807,812,814,820,822,824],{"class":70,"style":71},[68,796,75],{"style":74},[68,798,79],{"style":78},[68,800,801],{"style":78},[68,802,804],{"class":84,"data-popup":803},"20","createResolver",[68,806,88],{"style":78},[68,808,809],{"style":78},[68,810,35],{"class":84,"data-popup":811},"21",[68,813,88],{"style":78},[68,815,816],{"style":78},[68,817,819],{"class":84,"data-popup":818},"22","defineGenerator",[68,821,103],{"style":78},[68,823,106],{"style":74},[68,825,110],{"style":109},[68,827],{"class":70,"style":71},[68,829,830,833,835,841,843,845,850,853,859,861,863],{"class":70,"style":71},[68,831,832],{"style":74},"const",[68,834,94],{"style":158},[68,836,837],{"style":158},[68,838,840],{"class":84,"data-popup":839},"23","resolver",[68,842,129],{"style":74},[68,844,94],{"style":120},[68,846,847],{"style":120},[68,848,804],{"class":84,"data-popup":849},"24",[68,851,852],{"style":78},"({ ",[68,854,855],{"style":78},[68,856,858],{"class":84,"data-popup":857},"25","pluginName",[68,860,226],{"style":78},[68,862,142],{"style":109},[68,864,865],{"style":78}," })",[68,867,868,870,872,878,880,882,887,889,894,896,899,901,907,910,913],{"class":70,"style":71},[68,869,832],{"style":74},[68,871,94],{"style":158},[68,873,874],{"style":158},[68,875,877],{"class":84,"data-popup":876},"26","generator",[68,879,129],{"style":74},[68,881,94],{"style":120},[68,883,884],{"style":120},[68,885,819],{"class":84,"data-popup":886},"27",[68,888,852],{"style":78},[68,890,891],{"style":78},[68,892,251],{"class":84,"data-popup":893},"28",[68,895,226],{"style":78},[68,897,898],{"style":109},"'example'",[68,900,88],{"style":78},[68,902,903],{"style":120},[68,904,906],{"class":84,"data-popup":905},"29","operation",[68,908,909],{"style":78},": () ",[68,911,912],{"style":74},"=>",[68,914,915],{"style":78}," [] })",[68,917],{"class":70,"style":71},[68,919,920,922,924,926,931,933,935,940],{"class":70,"style":71},[68,921,182],{"style":74},[68,923,185],{"style":74},[68,925,94],{"style":158},[68,927,928],{"style":158},[68,929,193],{"class":84,"data-popup":930},"30",[68,932,129],{"style":74},[68,934,94],{"style":120},[68,936,937],{"style":120},[68,938,35],{"class":84,"data-popup":939},"31",[68,941,668],{"style":78},[68,943,944,946,951,953,955],{"class":70,"style":71},[68,945,217],{"style":78},[68,947,948],{"style":78},[68,949,223],{"class":84,"data-popup":950},"32",[68,952,226],{"style":78},[68,954,229],{"style":109},[68,956,232],{"style":78},[68,958,959,961,966,968,973,975,977],{"class":70,"style":71},[68,960,217],{"style":78},[68,962,963],{"style":78},[68,964,242],{"class":84,"data-popup":965},"33",[68,967,245],{"style":78},[68,969,970],{"style":78},[68,971,251],{"class":84,"data-popup":972},"34",[68,974,226],{"style":78},[68,976,142],{"style":109},[68,978,271],{"style":78},[68,980,981,983,988,990,995,997,1002],{"class":70,"style":71},[68,982,217],{"style":120},[68,984,985],{"style":120},[68,986,51],{"class":84,"data-popup":987},"35",[68,989,301],{"style":78},[68,991,992],{"style":148},[68,993,307],{"class":84,"data-popup":994},"36",[68,996,88],{"style":78},[68,998,999],{"style":148},[68,1000,315],{"class":84,"data-popup":1001},"37",[68,1003,318],{"style":78},[68,1005,1006,1009,1014,1016,1022,1024,1026],{"class":70,"style":71},[68,1007,1008],{"style":78},"    ",[68,1010,1011],{"style":78},[68,1012,315],{"class":84,"data-popup":1013},"38",[68,1015,346],{"style":78},[68,1017,1018],{"style":120},[68,1019,1021],{"class":84,"data-popup":1020},"39","requirePlugin",[68,1023,301],{"style":78},[68,1025,286],{"style":109},[68,1027,1028],{"style":78},")",[68,1030,1031,1033,1038,1040,1046,1048,1053],{"class":70,"style":71},[68,1032,1008],{"style":78},[68,1034,1035],{"style":78},[68,1036,315],{"class":84,"data-popup":1037},"40",[68,1039,346],{"style":78},[68,1041,1042],{"style":120},[68,1043,1045],{"class":84,"data-popup":1044},"41","setResolver",[68,1047,301],{"style":78},[68,1049,1050],{"style":78},[68,1051,840],{"class":84,"data-popup":1052},"42",[68,1054,1028],{"style":78},[68,1056,1057,1059,1064,1066,1072,1074,1079],{"class":70,"style":71},[68,1058,1008],{"style":78},[68,1060,1061],{"style":78},[68,1062,315],{"class":84,"data-popup":1063},"43",[68,1065,346],{"style":78},[68,1067,1068],{"style":120},[68,1069,1071],{"class":84,"data-popup":1070},"44","addGenerator",[68,1073,301],{"style":78},[68,1075,1076],{"style":78},[68,1077,877],{"class":84,"data-popup":1078},"45",[68,1080,1028],{"style":78},[68,1082,1083,1085,1087],{"class":70,"style":71},[68,1084,329],{"style":74},[68,1086,94],{"style":78},[68,1088,1089],{"style":78},[68,1090,307],{"class":84,"data-popup":1091},"46",[68,1093,1094],{"class":70,"style":71},[68,1095,367],{"style":78},[68,1097,1098],{"class":70,"style":71},[68,1099,372],{"style":78},[57,1101,1103],{"language":59,"meta":60,"code":1102,"filename":774,"class":63},"import { addGenerator, createResolver, defineExtension, defineGenerator, requirePlugin, setResolver } from 'kubb\u002Fkit'\n\nconst resolver = createResolver({ pluginName: 'plugin-example' })\nconst generator = defineGenerator({ name: 'example', operation: () => [] })\n\nexport const pluginExample = defineExtension({\n  kind: 'plugin',\n  meta: { name: 'plugin-example' },\n  setup(options) {\n    requirePlugin('plugin-ts')\n    setResolver(resolver)\n    addGenerator(generator)\n    return options\n  },\n})",[25,1104,1105,111,1157,111,1159,111,1192,111,1236,111,1238,111,1262,111,1277,111,1299,111,1317,111,1332,111,1350,111,1368,111,1379,111,1383],{"class":66},[68,1106,1107,1109,1111,1116,1118,1123,1125,1130,1132,1137,1139,1144,1146,1151,1153,1155],{"class":70,"style":71},[68,1108,75],{"style":74},[68,1110,79],{"style":78},[68,1112,1113],{"style":78},[68,1114,1071],{"class":84,"data-popup":1115},"47",[68,1117,88],{"style":78},[68,1119,1120],{"style":78},[68,1121,804],{"class":84,"data-popup":1122},"48",[68,1124,88],{"style":78},[68,1126,1127],{"style":78},[68,1128,35],{"class":84,"data-popup":1129},"49",[68,1131,88],{"style":78},[68,1133,1134],{"style":78},[68,1135,819],{"class":84,"data-popup":1136},"50",[68,1138,88],{"style":78},[68,1140,1141],{"style":78},[68,1142,1021],{"class":84,"data-popup":1143},"51",[68,1145,88],{"style":78},[68,1147,1148],{"style":78},[68,1149,1045],{"class":84,"data-popup":1150},"52",[68,1152,103],{"style":78},[68,1154,106],{"style":74},[68,1156,110],{"style":109},[68,1158],{"class":70,"style":71},[68,1160,1161,1163,1165,1170,1172,1174,1179,1181,1186,1188,1190],{"class":70,"style":71},[68,1162,832],{"style":74},[68,1164,94],{"style":158},[68,1166,1167],{"style":158},[68,1168,840],{"class":84,"data-popup":1169},"53",[68,1171,129],{"style":74},[68,1173,94],{"style":120},[68,1175,1176],{"style":120},[68,1177,804],{"class":84,"data-popup":1178},"54",[68,1180,852],{"style":78},[68,1182,1183],{"style":78},[68,1184,858],{"class":84,"data-popup":1185},"55",[68,1187,226],{"style":78},[68,1189,142],{"style":109},[68,1191,865],{"style":78},[68,1193,1194,1196,1198,1203,1205,1207,1212,1214,1219,1221,1223,1225,1230,1232,1234],{"class":70,"style":71},[68,1195,832],{"style":74},[68,1197,94],{"style":158},[68,1199,1200],{"style":158},[68,1201,877],{"class":84,"data-popup":1202},"56",[68,1204,129],{"style":74},[68,1206,94],{"style":120},[68,1208,1209],{"style":120},[68,1210,819],{"class":84,"data-popup":1211},"57",[68,1213,852],{"style":78},[68,1215,1216],{"style":78},[68,1217,251],{"class":84,"data-popup":1218},"58",[68,1220,226],{"style":78},[68,1222,898],{"style":109},[68,1224,88],{"style":78},[68,1226,1227],{"style":120},[68,1228,906],{"class":84,"data-popup":1229},"59",[68,1231,909],{"style":78},[68,1233,912],{"style":74},[68,1235,915],{"style":78},[68,1237],{"class":70,"style":71},[68,1239,1240,1242,1244,1246,1251,1253,1255,1260],{"class":70,"style":71},[68,1241,182],{"style":74},[68,1243,185],{"style":74},[68,1245,94],{"style":158},[68,1247,1248],{"style":158},[68,1249,193],{"class":84,"data-popup":1250},"60",[68,1252,129],{"style":74},[68,1254,94],{"style":120},[68,1256,1257],{"style":120},[68,1258,35],{"class":84,"data-popup":1259},"61",[68,1261,668],{"style":78},[68,1263,1264,1266,1271,1273,1275],{"class":70,"style":71},[68,1265,217],{"style":78},[68,1267,1268],{"style":78},[68,1269,223],{"class":84,"data-popup":1270},"62",[68,1272,226],{"style":78},[68,1274,229],{"style":109},[68,1276,232],{"style":78},[68,1278,1279,1281,1286,1288,1293,1295,1297],{"class":70,"style":71},[68,1280,217],{"style":78},[68,1282,1283],{"style":78},[68,1284,242],{"class":84,"data-popup":1285},"63",[68,1287,245],{"style":78},[68,1289,1290],{"style":78},[68,1291,251],{"class":84,"data-popup":1292},"64",[68,1294,226],{"style":78},[68,1296,142],{"style":109},[68,1298,271],{"style":78},[68,1300,1301,1303,1308,1310,1315],{"class":70,"style":71},[68,1302,217],{"style":120},[68,1304,1305],{"style":120},[68,1306,51],{"class":84,"data-popup":1307},"65",[68,1309,301],{"style":78},[68,1311,1312],{"style":148},[68,1313,307],{"class":84,"data-popup":1314},"66",[68,1316,318],{"style":78},[68,1318,1319,1321,1326,1328,1330],{"class":70,"style":71},[68,1320,1008],{"style":120},[68,1322,1323],{"style":120},[68,1324,1021],{"class":84,"data-popup":1325},"67",[68,1327,301],{"style":78},[68,1329,286],{"style":109},[68,1331,1028],{"style":78},[68,1333,1334,1336,1341,1343,1348],{"class":70,"style":71},[68,1335,1008],{"style":120},[68,1337,1338],{"style":120},[68,1339,1045],{"class":84,"data-popup":1340},"68",[68,1342,301],{"style":78},[68,1344,1345],{"style":78},[68,1346,840],{"class":84,"data-popup":1347},"69",[68,1349,1028],{"style":78},[68,1351,1352,1354,1359,1361,1366],{"class":70,"style":71},[68,1353,1008],{"style":120},[68,1355,1356],{"style":120},[68,1357,1071],{"class":84,"data-popup":1358},"70",[68,1360,301],{"style":78},[68,1362,1363],{"style":78},[68,1364,877],{"class":84,"data-popup":1365},"71",[68,1367,1028],{"style":78},[68,1369,1370,1372,1374],{"class":70,"style":71},[68,1371,329],{"style":74},[68,1373,94],{"style":78},[68,1375,1376],{"style":78},[68,1377,307],{"class":84,"data-popup":1378},"72",[68,1380,1381],{"class":70,"style":71},[68,1382,367],{"style":78},[68,1384,1385],{"class":70,"style":71},[68,1386,372],{"style":78},[406,1388,1389,1407],{},[409,1390,1391],{},[412,1392,1393,1398,1401,1404],{},[415,1394,1395,1397],{},[25,1396,315],{}," member",[415,1399,1400],{},"Composable",[415,1402,1403],{},"Signature",[415,1405,1406],{},"Purpose",[428,1408,1409,1427,1446,1466,1486,1509,1529,1551,1571],{},[412,1410,1411,1415,1419,1424],{},[433,1412,1413],{},[25,1414,1071],{},[433,1416,1417],{},[25,1418,782],{},[433,1420,1421],{},[25,1422,1423],{},"(...generators: Array\u003CGenerator>) => void",[433,1425,1426],{},"Register one or more generators for this plugin",[412,1428,1429,1433,1438,1443],{},[433,1430,1431],{},[25,1432,1045],{},[433,1434,1435],{},[25,1436,1437],{},"setResolver()",[433,1439,1440],{},[25,1441,1442],{},"(resolver: ResolverPatch\u003CResolver> | Resolver) => void",[433,1444,1445],{},"Set or partially override the file naming resolver",[412,1447,1448,1453,1458,1463],{},[433,1449,1450],{},[25,1451,1452],{},"addMacro",[433,1454,1455],{},[25,1456,1457],{},"addMacro()",[433,1459,1460],{},[25,1461,1462],{},"(macro: Macro) => void",[433,1464,1465],{},"Add a macro that rewrites AST nodes before generators",[412,1467,1468,1473,1478,1483],{},[433,1469,1470],{},[25,1471,1472],{},"setMacros",[433,1474,1475],{},[25,1476,1477],{},"setMacros()",[433,1479,1480],{},[25,1481,1482],{},"(macros: Array\u003CMacro>) => void",[433,1484,1485],{},"Replace this plugin's macros with a new list",[412,1487,1488,1493,1498,1503],{},[433,1489,1490],{},[25,1491,1492],{},"setOptions",[433,1494,1495],{},[25,1496,1497],{},"setOptions()",[433,1499,1500],{},[25,1501,1502],{},"(options: ResolvedOptions) => void",[433,1504,1505,1506,1508],{},"Set the resolved options used by generators. In ",[25,1507,51],{},", return them instead.",[412,1510,1511,1516,1521,1526],{},[433,1512,1513],{},[25,1514,1515],{},"injectFile",[433,1517,1518],{},[25,1519,1520],{},"injectFile()",[433,1522,1523],{},[25,1524,1525],{},"(file: UserFileNode) => void",[433,1527,1528],{},"Inject a raw file into the build output, bypassing generation",[412,1530,1531,1535,1540,1545],{},[433,1532,1533],{},[25,1534,1021],{},[433,1536,1537],{},[25,1538,1539],{},"requirePlugin()",[433,1541,1542],{},[25,1543,1544],{},"(name: string) => Plugin",[433,1546,1547,1548],{},"Return another plugin, or fail the run with ",[25,1549,1550],{},"KUBB_PLUGIN_NOT_FOUND",[412,1552,1553,1558,1563,1568],{},[433,1554,1555],{},[25,1556,1557],{},"config",[433,1559,1560],{},[25,1561,1562],{},"useConfig()",[433,1564,1565],{},[25,1566,1567],{},"Config",[433,1569,1570],{},"The resolved build configuration at setup time",[412,1572,1573,1577,1582,1586],{},[433,1574,1575],{},[25,1576,307],{},[433,1578,1579],{},[25,1580,1581],{},"useOptions()",[433,1583,1584],{},[25,1585,381],{},[433,1587,1588],{},"The plugin's own options as passed by the user",[10,1590,1591,1594,1595,1598,1599,1602],{},[25,1592,1593],{},"useKubb()"," returns the whole setup context. ",[25,1596,1597],{},"tryUseKubb()"," does the same, but returns ",[25,1600,1601],{},"undefined"," outside setup instead of throwing.",[10,1604,1605,1606,1609,1610,392,1612,1614,1615,1621,1622,1624],{},"Composables read the context of the plugin whose setup is running, also after an ",[25,1607,1608],{},"await",". Each plugin gets its own context, so composables in one plugin's setup never reach another plugin. Outside ",[25,1611,51],{},[25,1613,571],{},", they throw ",[14,1616,1618],{"href":1617},"\u002Fdocs\u002F5.x\u002Freference\u002Fdiagnostics#kubb-no-context",[25,1619,1620],{},"KUBB_NO_CONTEXT",". That includes generators and later hooks, which run after setup and receive their own ",[25,1623,765],{},". Both ways can be used in the same setup.",[707,1626,1628,1629,779,1631,1634,1635,346],{"as":1627},"important","Plugin names follow the convention ",[25,1630,475],{},[25,1632,1633],{},"plugin-react-query"," or ",[25,1636,1637],{},"plugin-zod",{"title":710,"searchDepth":1639,"depth":1639,"links":1640},5,[1641,1650],{"id":32,"depth":1642,"text":35,"children":1643},2,[1644,1646,1648],{"id":403,"depth":1645,"text":404},3,{"id":586,"depth":1645,"text":1647},"Read compatibility from the manifest",{"id":701,"depth":1645,"text":1649},"definePlugin (deprecated)",{"id":738,"depth":1642,"text":739},"defineExtension with kind plugin defines a Kubb plugin from one object with meta, dependencies, and a setup function that returns the resolved options, plus the KubbPluginSetupContext that registers generators, resolvers, and macros.","md",{"layout":1654,"title":5,"description":1651,"outline":1655,"order":1656,"navigation":1657},"doc",[1642,1645],1,{"title":5,"icon":1658},"i-iconoir-ev-plug",{"layout":1654,"outline":1660},[1642,1645],{"title":5,"icon":1658},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fplugins",{"title":5,"description":1651},{"loc":1662},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fplugins.md","docs\u002F5.x\u002Freference\u002Fkit\u002Fplugins","Jql3EBcOgnm0Squ-iS0ow2SdAmOxo87LGzY8LfumEno",true,1792352128494]