[{"data":1,"prerenderedAt":562,"buildId":563},["ShallowReactive",2],{"page:\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel":3},{"id":4,"frontmatter":5,"title":6,"heading":6,"body":7,"path":561,"source":4},"extensions\u002Fkubb-labs\u002Fplugin-barrel\u002Findex.md",{},"Barrel",{"type":8,"value":9,"toc":552},"minimark",[10,19,30,35,135,165,169,192,196,207,305,317,327,334,338,345],[11,12,13,14,18],"p",{},"The Barrel plugin writes ",[15,16,17],"code",{},"index.ts"," files that re-export the generated code, so you import everything from one entry point.",[11,20,21,22,25,26,29],{},"It writes a barrel in every folder of each plugin output that has a barrel setting, plus a root barrel when you set ",[15,23,24],{},"output.barrel"," on ",[15,27,28],{},"defineConfig",".",[31,32,34],"h2",{"id":33},"installation","Installation",[36,37,39,62,82,100,118],"code-group",{"sync":38},"install",[40,41,46],"pre",{"language":42,"filename":43,"code":44,"class":45},"shell","kubb","kubb add plugin-barrel","highlights",[15,47,49],{"class":48},"language-shell",[50,51,54,58],"span",{"class":52,"style":53},"line","display: inline",[50,55,57],{"style":56},"color:#6f42c1;--hls-dark:#b392f0","kubb ",[50,59,61],{"style":60},"color:#24292e;--hls-dark:#e1e4e8","add plugin-barrel",[40,63,66],{"language":42,"filename":64,"code":65,"class":45},"bun","bun add -d @kubb\u002Fplugin-barrel",[15,67,68],{"class":48},[50,69,70,73,76,79],{"class":52,"style":53},[50,71,72],{"style":56},"bun ",[50,74,75],{"style":60},"add -d ",[50,77,78],{"style":60},"@",[50,80,81],{"style":60},"kubb\u002Fplugin-barrel",[40,83,86],{"language":42,"filename":84,"code":85,"class":45},"pnpm","pnpm add -D @kubb\u002Fplugin-barrel",[15,87,88],{"class":48},[50,89,90,93,96,98],{"class":52,"style":53},[50,91,92],{"style":56},"pnpm ",[50,94,95],{"style":60},"add -D ",[50,97,78],{"style":60},[50,99,81],{"style":60},[40,101,104],{"language":42,"filename":102,"code":103,"class":45},"npm","npm install --save-dev @kubb\u002Fplugin-barrel",[15,105,106],{"class":48},[50,107,108,111,114,116],{"class":52,"style":53},[50,109,110],{"style":56},"npm ",[50,112,113],{"style":60},"install --save-dev ",[50,115,78],{"style":60},[50,117,81],{"style":60},[40,119,122],{"language":42,"filename":120,"code":121,"class":45},"yarn","yarn add -D @kubb\u002Fplugin-barrel",[15,123,124],{"class":48},[50,125,126,129,131,133],{"class":52,"style":53},[50,127,128],{"style":56},"yarn ",[50,130,95],{"style":60},[50,132,78],{"style":60},[50,134,81],{"style":60},[11,136,137,140,141,146,147,150,151,154,155,157,158,164],{},[15,138,139],{},"kubb add"," installs the version the ",[142,143,145],"a",{"href":144},"\u002Fregistry","Kubb registry"," pins and adds ",[15,148,149],{},"pluginBarrel()"," to ",[15,152,153],{},"kubb.config.ts",". It needs a ",[15,156,153],{},", so run ",[142,159,161],{"href":160},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Finit",[15,162,163],{},"kubb init"," first in a new project.",[31,166,168],{"id":167},"setup","Setup",[11,170,171,172,174,175,150,177,180,181,184,185,188,189,191],{},"No setup is needed. ",[15,173,28],{}," adds ",[15,176,149],{},[15,178,179],{},"plugins"," when it is missing. Generator plugins such as ",[15,182,183],{},"pluginTs()"," turn on their own barrels in their default ",[15,186,187],{},"output",", and a plugin without its own ",[15,190,24],{}," inherits the root setting.",[31,193,195],{"id":194},"options-worth-knowing","Options worth knowing",[11,197,198,200,201,203,204,206],{},[15,199,149],{}," takes no arguments. Configure it with ",[15,202,24],{},", on ",[15,205,28],{}," or on one plugin.",[208,209,210,226],"table",{},[211,212,213],"thead",{},[214,215,216,220,223],"tr",{},[217,218,219],"th",{},"Setting",[217,221,222],{},"Default",[217,224,225],{},"What it does",[227,228,229,256,274,294],"tbody",{},[214,230,231,240,243],{},[232,233,234],"td",{},[142,235,237],{"href":236},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Foptions#type",[15,238,239],{},"type",[232,241,242],{},"Required",[232,244,245,248,249,252,253,29],{},[15,246,247],{},"'named'"," re-exports each symbol by name, which suits tree-shaking. ",[15,250,251],{},"'all'"," writes ",[15,254,255],{},"export *",[214,257,258,266,271],{},[232,259,260],{},[142,261,263],{"href":262},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Foptions#nested",[15,264,265],{},"nested",[232,267,268],{},[15,269,270],{},"false",[232,272,273],{},"Plugin only. Each barrel re-exports only its own folder and the barrels below it.",[214,275,276,284,288],{},[232,277,278],{},[142,279,281],{"href":280},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Foptions#namespace",[15,282,283],{},"namespace",[232,285,286],{},[15,287,270],{},[232,289,290,291,29],{},"Plugin only. Turns on nested barrels and adds a named namespace per subfolder, such as ",[15,292,293],{},"PetService",[214,295,296,300,302],{},[232,297,298],{},[15,299,270],{},[232,301],{},[232,303,304],{},"On a plugin, writes no barrel and leaves the plugin's files out of the root barrel.",[306,307,309,310,312,313,316],"blockquote",{"as":308},"warning","Passing your own ",[15,311,187],{}," to a plugin replaces its default ",[15,314,315],{},"barrel: { type: 'named' }",", so the plugin falls back to the root setting.",[11,318,319,320,326],{},"With ",[142,321,323],{"href":322},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#shared",[15,324,325],{},"shared",", barrels also re-export the shared schemas a config defines, and the shared directory gets none.",[11,328,329,330,29],{},"See ",[142,331,333],{"href":332},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Fguides\u002Fbarrel-rules#which-barrel-setting-applies","Barrel rules",[31,335,337],{"id":336},"example","Example",[11,339,340,341,344],{},"This config writes a root ",[15,342,343],{},"src\u002Fgen\u002Findex.ts"," that re-exports the generated types by name.",[36,346,347,490],{},[40,348,351],{"language":349,"filename":153,"code":350,"class":45},"typescript","import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\n\nexport default defineConfig({\n input: '.\u002FpetStore.yaml',\n output: { path: '.\u002Fsrc\u002Fgen', barrel: { type: 'named' } },\n plugins: [pluginTs()],\n})",[15,352,354,377,378,377,394,377,396,377,409,377,426,377,466,377,485],{"class":353},"language-typescript",[50,355,356,360,364,367,370,373],{"class":52,"style":53},[50,357,359],{"style":358},"color:#d73a49;--hls-dark:#f97583","import ",[50,361,363],{"style":362},"color:#005cc5;--hls-dark:#79b8ff","{ ",[50,365,366],{"style":60},"defineConfig ",[50,368,369],{"style":362},"} ",[50,371,372],{"style":358},"from ",[50,374,376],{"style":375},"color:#032f62;--hls-dark:#9ecbff","'kubb\u002Fconfig'","\n",[50,379,380,382,384,387,389,391],{"class":52,"style":53},[50,381,359],{"style":358},[50,383,363],{"style":362},[50,385,386],{"style":60},"pluginTs ",[50,388,369],{"style":362},[50,390,372],{"style":358},[50,392,393],{"style":375},"'@kubb\u002Fplugin-ts'",[50,395],{"class":52,"style":53},[50,397,398,401,404,406],{"class":52,"style":53},[50,399,400],{"style":358},"export ",[50,402,403],{"style":358},"default ",[50,405,28],{"style":56},[50,407,408],{"style":362},"({",[50,410,411,414,417,420,423],{"class":52,"style":53},[50,412,413],{"style":362}," ",[50,415,416],{"style":362},"input",[50,418,419],{"style":358},": ",[50,421,422],{"style":375},"'.\u002FpetStore.yaml'",[50,424,425],{"style":358},",",[50,427,428,430,432,434,436,439,441,444,447,450,452,454,456,458,461,464],{"class":52,"style":53},[50,429,413],{"style":358},[50,431,187],{"style":362},[50,433,419],{"style":358},[50,435,363],{"style":362},[50,437,438],{"style":362},"path",[50,440,419],{"style":358},[50,442,443],{"style":375},"'.\u002Fsrc\u002Fgen'",[50,445,446],{"style":358},", ",[50,448,449],{"style":362},"barrel",[50,451,419],{"style":358},[50,453,363],{"style":362},[50,455,239],{"style":362},[50,457,419],{"style":358},[50,459,460],{"style":375},"'named' ",[50,462,463],{"style":362},"} }",[50,465,425],{"style":358},[50,467,468,470,472,474,477,480,483],{"class":52,"style":53},[50,469,413],{"style":358},[50,471,179],{"style":362},[50,473,419],{"style":358},[50,475,476],{"style":362},"[",[50,478,479],{"style":56},"pluginTs",[50,481,482],{"style":362},"()]",[50,484,425],{"style":358},[50,486,487],{"class":52,"style":53},[50,488,489],{"style":362},"})",[40,491,493],{"language":349,"filename":343,"code":492,"class":45},"export type { Category } from '.\u002Ftypes\u002FCategory'\nexport { petStatusEnum } from '.\u002Ftypes\u002FPet'\nexport type { Pet, PetStatusEnumKey } from '.\u002Ftypes\u002FPet'",[15,494,495,377,514,377,530],{"class":353},[50,496,497,499,502,504,507,509,511],{"class":52,"style":53},[50,498,400],{"style":358},[50,500,501],{"style":60},"type ",[50,503,363],{"style":362},[50,505,506],{"style":56},"Category ",[50,508,369],{"style":362},[50,510,372],{"style":358},[50,512,513],{"style":375},"'.\u002Ftypes\u002FCategory'",[50,515,516,518,520,523,525,527],{"class":52,"style":53},[50,517,400],{"style":358},[50,519,363],{"style":362},[50,521,522],{"style":60},"petStatusEnum ",[50,524,369],{"style":362},[50,526,372],{"style":358},[50,528,529],{"style":375},"'.\u002Ftypes\u002FPet'",[50,531,532,534,536,538,541,543,546,548,550],{"class":52,"style":53},[50,533,400],{"style":358},[50,535,501],{"style":60},[50,537,363],{"style":362},[50,539,540],{"style":56},"Pet",[50,542,446],{"style":358},[50,544,545],{"style":56},"PetStatusEnumKey ",[50,547,369],{"style":362},[50,549,372],{"style":358},[50,551,529],{"style":375},{"title":553,"searchDepth":554,"depth":554,"links":555},"",5,[556,558,559,560],{"id":33,"depth":557,"text":34},2,{"id":167,"depth":557,"text":168},{"id":194,"depth":557,"text":195},{"id":336,"depth":557,"text":337},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel",1795727680217,"1b64b1eb-29b7-4f90-ad41-6f24721e1669"]