keiro
Version:
A filesystem routing middleware
2 lines • 675 B
JavaScript
import{a as c}from"./chunk-F2YAVI33.js";var r=class{},o=class extends r{#t;constructor(e){super();let{matching:a=c()}=e||{};this.#t=a}toPath(e){return e.replace(/(index)?\.[cm]?(ts|js)x?/,"").split("/").filter(Boolean).filter((n,t,i)=>!/\(.+\)/.test(n)&&t<i.length).map((n,t,i)=>this.toRouteSegment(n,i))}toRouteSegment(e,a){let n=this.#t,t;return(t=n.matchOptionalCatchAll(e,a))?{path:t,type:"catch-all",optional:!0}:(t=n.matchOptionalDynamic(e,a))?{path:t,type:"dynamic",optional:!0}:(t=n.matchCatchAll(e,a))?{path:t,type:"catch-all"}:(t=n.matchDynamic(e,a))?{path:t,type:"dynamic"}:{path:e,type:"static"}}};export{r as a,o as b};
//# sourceMappingURL=chunk-PP5SNXX7.js.map