[{"data":1,"prerenderedAt":393},["ShallowReactive",2],{"page:\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Fguides\u002Fbarrel-rules":3},{"id":4,"frontmatter":5,"title":6,"heading":6,"body":7,"path":392,"source":4},"extensions\u002Fkubb-labs\u002Fplugin-barrel\u002Fguides\u002Fbarrel-rules.md",{},"Barrel rules",{"type":8,"value":9,"toc":383},"minimark",[10,19,24,42,75,191,195,253,257,310,321,325,340,357],[11,12,13,14,18],"p",{},"Which barrel setting applies to each plugin, when a plugin gets no barrel, and what each ",[15,16,17],"code",{},"index.ts"," re-exports.",[20,21,23],"h2",{"id":22},"which-barrel-setting-applies","Which barrel setting applies",[11,25,26,27,30,31,37,38,41],{},"The Barrel plugin runs after every other plugin, so each barrel sees the final set of files. For each plugin, Kubb reads its ",[15,28,29],{},"output.barrel"," first, then the root ",[32,33,35],"a",{"href":34},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#outputbarrel",[15,36,29],{},", then ",[15,39,40],{},"false",".",[43,44,45,64],"ul",{},[46,47,48,49,51,52,55,56,59,60,63],"li",{},"The root ",[15,50,29],{}," accepts only ",[15,53,54],{},"type"," and is always flat. It has no ",[15,57,58],{},"nested"," or ",[15,61,62],{},"namespace"," field.",[46,65,66,67,70,71,74],{},"Passing your own ",[15,68,69],{},"output"," to a plugin replaces its default ",[15,72,73],{},"barrel: { type: 'named' }",", so the plugin falls back to the root setting.",[76,77,78,101],"table",{},[79,80,81],"thead",{},[82,83,84,90,95,98],"tr",{},[85,86,87,88],"th",{},"Root ",[15,89,29],{},[85,91,92,93],{},"Plugin ",[15,94,29],{},[85,96,97],{},"Plugin barrels",[85,99,100],{},"Root barrel",[102,103,104,124,143,160,176],"tbody",{},[82,105,106,112,118,121],{},[107,108,109,111],"td",{},[15,110,40],{}," (default)",[107,113,114,115],{},"Plugin default ",[15,116,117],{},"{ type: 'named' }",[107,119,120],{},"Yes",[107,122,123],{},"No",[82,125,126,130,139,141],{},[107,127,128,111],{},[15,129,40],{},[107,131,132,133,135,136],{},"Unset, because your own ",[15,134,69],{}," replaced the default, as in ",[15,137,138],{},"pluginTs({ output: { path: 'types' } })",[107,140,123],{},[107,142,123],{},[82,144,145,150,153,158],{},[107,146,147],{},[15,148,149],{},"{ type }",[107,151,152],{},"Unset",[107,154,155,156],{},"Yes, with the root ",[15,157,54],{},[107,159,120],{},[82,161,162,166,171,174],{},[107,163,164],{},[15,165,149],{},[107,167,168],{},[15,169,170],{},"{ type, … }",[107,172,173],{},"Yes, with the plugin setting",[107,175,120],{},[82,177,178,182,186,188],{},[107,179,180],{},[15,181,149],{},[107,183,184],{},[15,185,40],{},[107,187,123],{},[107,189,190],{},"Yes, without this plugin's files",[20,192,194],{"id":193},"when-a-plugin-gets-no-barrel","When a plugin gets no barrel",[76,196,197,207],{},[79,198,199],{},[82,200,201,204],{},[85,202,203],{},"Case",[85,205,206],{},"Result",[102,208,209,219,230],{},[82,210,211,216],{},[107,212,213],{},[15,214,215],{},"output.mode: 'file'",[107,217,218],{},"The root barrel re-exports the single file directly.",[82,220,221,227],{},[107,222,223,224],{},"The plugin writes to the output root, with no own ",[15,225,226],{},"output.path",[107,228,229],{},"The root barrel picks up its files.",[82,231,232,239],{},[107,233,234,236,237],{},[15,235,226],{}," resolves outside the root ",[15,238,226],{},[107,240,241,242,245,246,59,249,252],{},"With a directory barrel, the build fails with ",[15,243,244],{},"KUBB_PATH_TRAVERSAL",". With ",[15,247,248],{},"barrel: false",[15,250,251],{},"mode: 'file'",", Kubb does not check it.",[20,254,256],{"id":255},"what-goes-into-a-barrel","What goes into a barrel",[43,258,259,280,285,292,298],{},[46,260,261,262,265,266,265,269,272,273,276,277,279],{},"Every ",[15,263,264],{},".ts",", ",[15,267,268],{},".tsx",[15,270,271],{},".js",", and ",[15,274,275],{},".jsx"," file below the folder, sorted by name. Other ",[15,278,17],{}," files are not re-exported as leaves.",[46,281,282,283,41],{},"The barrel file is always ",[15,284,17],{},[46,286,287,288,291],{},"With ",[15,289,290],{},"type: 'named'",", a file without sources is re-exported whole.",[46,293,287,294,297],{},[15,295,296],{},"type: 'all'",", a file whose sources are all marked as not indexable is left out.",[46,299,287,300,302,303,306,307,309],{},[15,301,58],{},", a subfolder barrel is always chained with ",[15,304,305],{},"export *",", also for ",[15,308,290],{},", because the child barrel already lists the names.",[11,311,312,313,316,317,320],{},"A plugin's barrels get its ",[15,314,315],{},"output.banner"," and ",[15,318,319],{},"output.footer"," only when the plugin sets them. They never get the default \"Generated by Kubb\" notice, and the root barrel gets neither.",[20,322,324],{"id":323},"namespaces-for-tag-groups","Namespaces for tag groups",[11,326,327,332,333,339],{},[32,328,330],{"href":329},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Foptions#namespace",[15,331,62],{}," exposes each immediate subfolder as a named namespace, next to its standalone exports. Combine it with tag ",[32,334,336],{"href":335},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#group",[15,337,338],{},"group","s to export each group as a named service.",[43,341,342,351,354],{},[46,343,344,345,348,349,41],{},"A namespace takes the PascalCase folder name. A name that does not start with a letter gets an ",[15,346,347],{},"_"," prefix, and a name with no letters or digits becomes ",[15,350,347],{},[46,352,353],{},"An enabled root barrel forwards the namespaces too.",[46,355,356],{},"Editors can offer auto-imports for these namespaces when the generated files belong to the TypeScript project.",[11,358,359,360,363,364,367,368,371,372,375,376,316,379,382],{},"For tag-grouped fetch clients, name the service folders with ",[15,361,362],{},"group.name",". Leave the fetch ",[15,365,366],{},"sdk"," option unset so React Query can import the standalone operation functions. For a ",[15,369,370],{},"pet"," tag, the operations land in ",[15,373,374],{},"src\u002Fgen\u002Fclient\u002FpetService\u002F",". Both calling styles, ",[15,377,378],{},"PetService.getPetById()",[15,380,381],{},"getPetById()",", work next to the generated hooks and query options.",{"title":384,"searchDepth":385,"depth":385,"links":386},"",5,[387,389,390,391],{"id":22,"depth":388,"text":23},2,{"id":193,"depth":388,"text":194},{"id":255,"depth":388,"text":256},{"id":323,"depth":388,"text":324},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel\u002Fguides\u002Fbarrel-rules",1794776436163]