[{"data":1,"prerenderedAt":412},["ShallowReactive",2],{"page:\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel":3},{"id":4,"frontmatter":5,"title":6,"heading":6,"body":7,"path":411,"source":4},"extensions\u002Fkubb-labs\u002Fplugin-barrel\u002Findex.md",{},"Barrel",{"type":8,"value":9,"toc":402},"minimark",[10,27,32,118,138,142,156,160,171,206,225,233,237,244],[11,12,13,14,18,19,22,23,26],"p",{},"The Barrel plugin writes ",[15,16,17],"code",{},"index.ts"," files that re-export generated code, so you can import everything from a single entry point. It writes a barrel in every folder of each plugin output that has a barrel setting, plus a root barrel when you set ",[15,20,21],{},"output.barrel"," on ",[15,24,25],{},"defineConfig",".",[28,29,31],"h2",{"id":30},"installation","Installation",[33,34,36,65,83,101],"code-group",{"sync":35},"package-manager",[37,38,43],"pre",{"language":39,"filename":40,"code":41,"class":42},"shell","bun","bun add -d @kubb\u002Fplugin-barrel","highlights",[15,44,46],{"class":45},"language-shell",[47,48,51,55,59,62],"span",{"class":49,"style":50},"line","display: inline",[47,52,54],{"style":53},"color:#6f42c1;--hls-dark:#b392f0","bun ",[47,56,58],{"style":57},"color:#24292e;--hls-dark:#e1e4e8","add -d ",[47,60,61],{"style":57},"@",[47,63,64],{"style":57},"kubb\u002Fplugin-barrel",[37,66,69],{"language":39,"filename":67,"code":68,"class":42},"pnpm","pnpm add -D @kubb\u002Fplugin-barrel",[15,70,71],{"class":45},[47,72,73,76,79,81],{"class":49,"style":50},[47,74,75],{"style":53},"pnpm ",[47,77,78],{"style":57},"add -D ",[47,80,61],{"style":57},[47,82,64],{"style":57},[37,84,87],{"language":39,"filename":85,"code":86,"class":42},"npm","npm install --save-dev @kubb\u002Fplugin-barrel",[15,88,89],{"class":45},[47,90,91,94,97,99],{"class":49,"style":50},[47,92,93],{"style":53},"npm ",[47,95,96],{"style":57},"install --save-dev ",[47,98,61],{"style":57},[47,100,64],{"style":57},[37,102,105],{"language":39,"filename":103,"code":104,"class":42},"yarn","yarn add -D @kubb\u002Fplugin-barrel",[15,106,107],{"class":45},[47,108,109,112,114,116],{"class":49,"style":50},[47,110,111],{"style":53},"yarn ",[47,113,78],{"style":57},[47,115,61],{"style":57},[47,117,64],{"style":57},[11,119,120,121,124,125,130,131,134,135,26],{},"Or run ",[15,122,123],{},"kubb add plugin-barrel"," to install the version the ",[126,127,129],"a",{"href":128},"\u002Fregistry","Kubb registry"," pins and add ",[15,132,133],{},"pluginBarrel()"," to ",[15,136,137],{},"kubb.config.ts",[28,139,141],{"id":140},"setup","Setup",[11,143,144,145,148,149,152,153,155],{},"Kubb adds the plugin to ",[15,146,147],{},"plugins"," for you, so no setup is needed. Generator plugins such as ",[15,150,151],{},"pluginTs()"," turn on their own barrels by default. Plugins without their own ",[15,154,21],{}," inherit the root setting.",[28,157,159],{"id":158},"options-worth-knowing","Options worth knowing",[11,161,162,164,165,167,168,170],{},[15,163,133],{}," takes no arguments. You configure it through ",[15,166,21],{},", on ",[15,169,25],{}," or on a single plugin.",[172,173,174,188,194,200],"ul",{},[175,176,177,180,181,184,185,26],"li",{},[15,178,179],{},"type: 'named'"," re-exports each symbol by name, which suits tree-shaking. ",[15,182,183],{},"type: 'all'"," writes ",[15,186,187],{},"export *",[175,189,190,193],{},[15,191,192],{},"nested: true",", on a plugin only, makes each barrel re-export just its own folder and the barrels below it. The root barrel is always flat.",[175,195,196,199],{},[15,197,198],{},"namespace: true",", on a plugin only, enables nested barrels and adds named namespaces for immediate subdirectories, alongside standalone exports.",[175,201,202,205],{},[15,203,204],{},"false"," on a plugin turns its barrel off and leaves its files out of the root barrel.",[11,207,208,209,212,213,216,217,220,221,224],{},"A plugin with ",[15,210,211],{},"output.mode: 'file'"," gets no barrel of its own, and the root barrel re-exports that file directly. Passing your own ",[15,214,215],{},"output"," object to a plugin replaces its default ",[15,218,219],{},"barrel: { type: 'named' }",", so that plugin falls back to the root setting. When two files export the same name, Kubb reports an error, and a ",[15,222,223],{},"named"," barrel keeps only the first one.",[11,226,227,228,232],{},"See ",[126,229,231],{"href":230},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Foptions","Options"," for every option and its default.",[28,234,236],{"id":235},"example","Example",[11,238,239,240,243],{},"The config below writes a root ",[15,241,242],{},"src\u002Fgen\u002Findex.ts"," that re-exports the generated types by name.",[37,245,248],{"language":246,"filename":137,"code":247,"class":42},"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: [\n    pluginTs(),\n  ],\n})",[15,249,251,274,275,274,291,274,293,274,306,274,323,274,364,274,375,274,388,274,397],{"class":250},"language-typescript",[47,252,253,257,261,264,267,270],{"class":49,"style":50},[47,254,256],{"style":255},"color:#d73a49;--hls-dark:#f97583","import ",[47,258,260],{"style":259},"color:#005cc5;--hls-dark:#79b8ff","{ ",[47,262,263],{"style":57},"defineConfig ",[47,265,266],{"style":259},"} ",[47,268,269],{"style":255},"from ",[47,271,273],{"style":272},"color:#032f62;--hls-dark:#9ecbff","'kubb\u002Fconfig'","\n",[47,276,277,279,281,284,286,288],{"class":49,"style":50},[47,278,256],{"style":255},[47,280,260],{"style":259},[47,282,283],{"style":57},"pluginTs ",[47,285,266],{"style":259},[47,287,269],{"style":255},[47,289,290],{"style":272},"'@kubb\u002Fplugin-ts'",[47,292],{"class":49,"style":50},[47,294,295,298,301,303],{"class":49,"style":50},[47,296,297],{"style":255},"export ",[47,299,300],{"style":255},"default ",[47,302,25],{"style":53},[47,304,305],{"style":259},"({",[47,307,308,311,314,317,320],{"class":49,"style":50},[47,309,310],{"style":259},"  ",[47,312,313],{"style":259},"input",[47,315,316],{"style":255},": ",[47,318,319],{"style":272},"'.\u002FpetStore.yaml'",[47,321,322],{"style":255},",",[47,324,325,327,329,331,333,336,338,341,344,347,349,351,354,356,359,362],{"class":49,"style":50},[47,326,310],{"style":255},[47,328,215],{"style":259},[47,330,316],{"style":255},[47,332,260],{"style":259},[47,334,335],{"style":259},"path",[47,337,316],{"style":255},[47,339,340],{"style":272},"'.\u002Fsrc\u002Fgen'",[47,342,343],{"style":255},", ",[47,345,346],{"style":259},"barrel",[47,348,316],{"style":255},[47,350,260],{"style":259},[47,352,353],{"style":259},"type",[47,355,316],{"style":255},[47,357,358],{"style":272},"'named' ",[47,360,361],{"style":259},"} }",[47,363,322],{"style":255},[47,365,366,368,370,372],{"class":49,"style":50},[47,367,310],{"style":255},[47,369,147],{"style":259},[47,371,316],{"style":255},[47,373,374],{"style":259},"[",[47,376,377,380,383,386],{"class":49,"style":50},[47,378,379],{"style":259},"    ",[47,381,382],{"style":53},"pluginTs",[47,384,385],{"style":259},"()",[47,387,322],{"style":255},[47,389,390,392,395],{"class":49,"style":50},[47,391,310],{"style":255},[47,393,394],{"style":259},"]",[47,396,322],{"style":255},[47,398,399],{"class":49,"style":50},[47,400,401],{"style":259},"})",{"title":403,"searchDepth":404,"depth":404,"links":405},"",5,[406,408,409,410],{"id":30,"depth":407,"text":31},2,{"id":140,"depth":407,"text":141},{"id":158,"depth":407,"text":159},{"id":235,"depth":407,"text":236},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel",1793647021395]