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