@hono-filebased-route/core 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ $ bun run build.ts
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # Hono File-Based Routing
2
+
3
+ 一个基于 Hono 框架的文件路由系统,使用 Turborepo 管理的 monorepo 项目,支持类似 Next.js 的文件路由模式。
4
+
5
+ ## 特性
6
+
7
+ - 🚀 **文件路由系统**: 基于文件结构自动生成路由
8
+ - ⚡ **Bun 运行时**: 快速的 JavaScript 运行时
9
+ - 🔥 **热重载**: 开发时自动重新加载
10
+ - 📁 **动态路由**: 支持动态参数和通配符路由
11
+ - 🎯 **类型安全**: 完整的 TypeScript 支持
12
+ - 🛠️ **自动生成**: 路由配置自动生成,无需手动维护
13
+ - 📦 **Monorepo**: 使用 Turborepo 管理多包项目
14
+ - ⚡ **构建缓存**: 智能缓存和并行构建优化
15
+
16
+ ## 路由规则
17
+
18
+ ### 基本路由实例
19
+
20
+ | 文件路径 | 路由路径 | 说明 |
21
+ | ---------------------------------- | ------------- | ------------ |
22
+ | `src/routes/index.ts` | `/` | 根路由 |
23
+ | `src/routes/about.ts` | `/about` | 静态路由 |
24
+ | `src/routes/users/index.ts` | `/users` | 嵌套路由 |
25
+ | `src/routes/users/[id].ts` | `/users/:id` | 动态参数路由 |
26
+ | `src/routes/articles/[...slug].ts` | `/articles/*` | 通配符路由 |
27
+
28
+ ## 安装
29
+
30
+ 安装项目依赖:
31
+
32
+ ```bash
33
+ npm install
34
+ # or
35
+ yarn add
36
+ # or
37
+ pnpm add
38
+ # or
39
+ bun add
40
+ ```
41
+
42
+ ## 使用方法
43
+
44
+ ### Turborepo 命令
45
+
46
+ 本项目使用 Turborepo 进行 monorepo 管理,支持以下命令:
47
+
48
+ ```bash
49
+ # 构建所有包
50
+ bun run build
51
+
52
+ # 启动所有开发服务
53
+ bun run dev
54
+
55
+ # 运行所有测试
56
+ bun run test
57
+
58
+ # 类型检查
59
+ bun run type-check
60
+
61
+ # 清理构建产物
62
+ bun run clean
63
+ ```
64
+
65
+ ### 开发模式
66
+
67
+ ```bash
68
+ # 使用 Turborepo 启动开发服务器
69
+ bun run dev
70
+
71
+ # 或者直接启动示例项目
72
+ cd examples/bun
73
+ bun run dev
74
+ ```
75
+
76
+ 这将启动开发服务器,支持热重载,访问 <http://localhost:3000>
77
+
78
+ ### 生产模式
79
+
80
+ ```bash
81
+ # 先构建所有包
82
+ bun run build
83
+
84
+ # 启动示例应用
85
+ cd examples/bun
86
+ bun run start
87
+ ```
88
+
89
+ ### 手动生成路由
90
+
91
+ ```bash
92
+ bun run generate-routes
93
+ ```
94
+
95
+ ## 创建路由
96
+
97
+ 在 `src/routes` 目录下创建 TypeScript 文件,导出 HTTP 方法处理函数:
98
+
99
+ ```typescript
100
+ import { Context } from 'hono'
101
+
102
+ // GET 请求处理
103
+ export function GET(c: Context) {
104
+ return c.json({ message: 'Hello from GET' })
105
+ }
106
+
107
+ // POST 请求处理
108
+ export function POST(c: Context) {
109
+ return c.json({ message: 'Hello from POST' })
110
+ }
111
+ ```
112
+
113
+ ### 动态路由
114
+
115
+ 使用方括号创建动态路由:
116
+
117
+ ```typescript
118
+ import { Context } from 'hono'
119
+
120
+ export function GET(c: Context) {
121
+ const id = c.req.param('id')
122
+ return c.json({ userId: id })
123
+ }
124
+ ```
125
+
126
+ ### 通配符路由
127
+
128
+ 使用 `[...slug]` 创建通配符路由:
129
+
130
+ 该项目通过 `c.req.path` 填充 `slug` 参数,自动为 `GET/POST` 函数提供第二个参数。
131
+
132
+ ```typescript
133
+ import { Context } from 'hono'
134
+
135
+ export function GET(c: Context, slug: string[]) {
136
+ return c.json({ slug })
137
+ }
138
+ ```
139
+
140
+ ## 工作原理
141
+
142
+ 1. **路由扫描**: `scripts/generate-routes.ts` 扫描 `src/routes` 目录
143
+ 2. **路径转换**: 将文件路径转换为 Hono 路由路径
144
+ 3. **代码生成**: 生成 `src/generated-routes.ts` 文件
145
+ 4. **自动注册**: 主应用自动注册所有生成的路由
146
+
147
+ ## 开发脚本
148
+
149
+ ### 根目录脚本(Turborepo)
150
+
151
+ - `bun run build`: 构建所有包(支持缓存和并行构建)
152
+ - `bun run dev`: 启动所有开发服务
153
+ - `bun run test`: 运行所有测试
154
+ - `bun run lint`: 代码检查
155
+ - `bun run type-check`: TypeScript 类型检查
156
+ - `bun run clean`: 清理所有构建产物
157
+ - `bun run test:basic`: 快速启动基础示例
158
+
159
+ ### 包级别脚本
160
+
161
+ - `bun run build`: 构建当前包
162
+ - `bun run dev`: 开发模式(包含热重载)
163
+ - `bun run clean`: 清理构建产物
164
+ - `bun run generate-routes`: 生成路由配置(仅示例项目)
165
+
166
+ ## 技术栈
167
+
168
+ - **[Hono](https://hono.dev/)**: 轻量级 Web 框架
169
+ - **[bun](https://bun.sh/)**: 快速的 JavaScript 运行时
170
+ - **[Turborepo](https://turbo.build/)**: 高性能 monorepo 构建系统
171
+ - **TypeScript**: 类型安全的 JavaScript
172
+
173
+ ## 许可证
174
+
175
+ MIT License
176
+
177
+ ## 贡献
178
+
179
+ 欢迎提交 Issue 和 Pull Request!
180
+
181
+ ---
182
+
183
+ **注意**: `src/generated-routes.ts` 文件是自动生成的,请不要手动编辑。如需修改路由,请直接修改 `src/routes` 目录下的文件。
package/build.ts ADDED
@@ -0,0 +1,9 @@
1
+ import dts from 'bun-plugin-dts'
2
+
3
+ await Bun.build({
4
+ minify: true,
5
+ target: 'node',
6
+ outdir: './dist',
7
+ plugins: [dts()],
8
+ entrypoints: ['./index.ts'],
9
+ })
@@ -0,0 +1,18 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ /**
4
+ * 遍历指定目录并获取所有文件路径
5
+ * @param dir 要遍历的目录
6
+ * @returns 目录内所有文件绝对路径的数组
7
+ */
8
+ export declare function getFiles(dir: string): Promise<string[]>;
9
+ /**
10
+ * 将文件路径转换为 Hono 路由路径
11
+ * @param filePath 文件的绝对路径
12
+ * @param baseDir 路由文件的根目录的绝对路径
13
+ * @returns 转换后的 Hono 路由路径
14
+ */
15
+ export declare function getRoutePath(filePath: string, baseDir: string): string;
16
+ export declare function generateRoutesFile(dir?: string, output?: string): Promise<void>;
17
+
18
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ import{createRequire as Ew}from"node:module";var Zw=Object.create;var{getPrototypeOf:Jw,defineProperty:l_,getOwnPropertyNames:Uw}=Object;var Qw=Object.prototype.hasOwnProperty;var zw=(f,_,h)=>{h=f!=null?Zw(Jw(f)):{};let y=_||!f||!f.__esModule?l_(h,"default",{value:f,enumerable:!0}):h;for(let S of Uw(f))if(!Qw.call(y,S))l_(y,S,{get:()=>f[S],enumerable:!0});return y};var Q=(f,_)=>()=>(_||f((_={exports:{}}).exports,_),_.exports);var u=Ew(import.meta.url);var u_=Q((A_)=>{Object.defineProperty(A_,"__esModule",{value:!0});A_.splitWhen=A_.flatten=void 0;function Xw(f){return f.reduce((_,h)=>[].concat(_,h),[])}A_.flatten=Xw;function Lw(f,_){let h=[[]],y=0;for(let S of f)if(_(S))y++,h[y]=[];else h[y].push(S);return h}A_.splitWhen=Lw});var r_=Q((x_)=>{Object.defineProperty(x_,"__esModule",{value:!0});x_.isEnoentCodeError=void 0;function Kw(f){return f.code==="ENOENT"}x_.isEnoentCodeError=Kw});var b_=Q((m_)=>{Object.defineProperty(m_,"__esModule",{value:!0});m_.createDirentFromStats=void 0;class c_{constructor(f,_){this.name=f,this.isBlockDevice=_.isBlockDevice.bind(_),this.isCharacterDevice=_.isCharacterDevice.bind(_),this.isDirectory=_.isDirectory.bind(_),this.isFIFO=_.isFIFO.bind(_),this.isFile=_.isFile.bind(_),this.isSocket=_.isSocket.bind(_),this.isSymbolicLink=_.isSymbolicLink.bind(_)}}function Iw(f,_){return new c_(f,_)}m_.createDirentFromStats=Iw});var a_=Q((s_)=>{Object.defineProperty(s_,"__esModule",{value:!0});s_.convertPosixPathToPattern=s_.convertWindowsPathToPattern=s_.convertPathToPattern=s_.escapePosixPath=s_.escapeWindowsPath=s_.escape=s_.removeLeadingDotSegment=s_.makeAbsolute=s_.unixify=void 0;var Dw=u("os"),Cw=u("path"),v_=Dw.platform()==="win32",Nw=2,Ow=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,Pw=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,Gw=/^\\\\([.?])/,gw=/\\(?![!()+@[\]{}])/g;function Hw(f){return f.replace(/\\/g,"/")}s_.unixify=Hw;function lw(f,_){return Cw.resolve(f,_)}s_.makeAbsolute=lw;function Aw(f){if(f.charAt(0)==="."){let _=f.charAt(1);if(_==="/"||_==="\\")return f.slice(Nw)}return f}s_.removeLeadingDotSegment=Aw;s_.escape=v_?mf:kf;function mf(f){return f.replace(Pw,"\\$2")}s_.escapeWindowsPath=mf;function kf(f){return f.replace(Ow,"\\$2")}s_.escapePosixPath=kf;s_.convertPathToPattern=v_?n_:e_;function n_(f){return mf(f).replace(Gw,"//$1").replace(gw,"/")}s_.convertWindowsPathToPattern=n_;function e_(f){return kf(f)}s_.convertPosixPathToPattern=e_});var t_=Q((Xj,p_)=>{/*!
2
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
3
+ *
4
+ * Copyright (c) 2014-2016, Jon Schlinkert.
5
+ * Licensed under the MIT License.
6
+ */p_.exports=function f(_){if(typeof _!=="string"||_==="")return!1;var h;while(h=/(\\).|([@?!+*]\(.*\))/g.exec(_)){if(h[2])return!0;_=_.slice(h.index+h[0].length)}return!1}});var hh=Q((Lj,_h)=>{/*!
7
+ * is-glob <https://github.com/jonschlinkert/is-glob>
8
+ *
9
+ * Copyright (c) 2014-2017, Jon Schlinkert.
10
+ * Released under the MIT License.
11
+ */var bw=t_(),fh={"{":"}","(":")","[":"]"},vw=function(f){if(f[0]==="!")return!0;var _=0,h=-2,y=-2,S=-2,w=-2,i=-2;while(_<f.length){if(f[_]==="*")return!0;if(f[_+1]==="?"&&/[\].+)]/.test(f[_]))return!0;if(y!==-1&&f[_]==="["&&f[_+1]!=="]"){if(y<_)y=f.indexOf("]",_);if(y>_){if(i===-1||i>y)return!0;if(i=f.indexOf("\\",_),i===-1||i>y)return!0}}if(S!==-1&&f[_]==="{"&&f[_+1]!=="}"){if(S=f.indexOf("}",_),S>_){if(i=f.indexOf("\\",_),i===-1||i>S)return!0}}if(w!==-1&&f[_]==="("&&f[_+1]==="?"&&/[:!=]/.test(f[_+2])&&f[_+3]!==")"){if(w=f.indexOf(")",_),w>_){if(i=f.indexOf("\\",_),i===-1||i>w)return!0}}if(h!==-1&&f[_]==="("&&f[_+1]!=="|"){if(h<_)h=f.indexOf("|",_);if(h!==-1&&f[h+1]!==")"){if(w=f.indexOf(")",h),w>h){if(i=f.indexOf("\\",h),i===-1||i>w)return!0}}}if(f[_]==="\\"){var q=f[_+1];_+=2;var j=fh[q];if(j){var d=f.indexOf(j,_);if(d!==-1)_=d+1}if(f[_]==="!")return!0}else _++}return!1},nw=function(f){if(f[0]==="!")return!0;var _=0;while(_<f.length){if(/[*?{}()[\]]/.test(f[_]))return!0;if(f[_]==="\\"){var h=f[_+1];_+=2;var y=fh[h];if(y){var S=f.indexOf(y,_);if(S!==-1)_=S+1}if(f[_]==="!")return!0}else _++}return!1};_h.exports=function f(_,h){if(typeof _!=="string"||_==="")return!1;if(bw(_))return!0;var y=vw;if(h&&h.strict===!1)y=nw;return y(_)}});var Sh=Q((Bj,yh)=>{var ew=hh(),sw=u("path").posix.dirname,ow=u("os").platform()==="win32",bf="/",aw=/\\/g,pw=/[\{\[].*[\}\]]$/,tw=/(^|[^\\])([\{\[]|\([^\)]+$)/,fi=/\\([\!\*\?\|\[\]\(\)\{\}])/g;yh.exports=function f(_,h){var y=Object.assign({flipBackslashes:!0},h);if(y.flipBackslashes&&ow&&_.indexOf(bf)<0)_=_.replace(aw,bf);if(pw.test(_))_+=bf;_+="a";do _=sw(_);while(ew(_)||tw.test(_));return _.replace(fi,"$1")}});var Lf=Q((_i)=>{_i.isInteger=(f)=>{if(typeof f==="number")return Number.isInteger(f);if(typeof f==="string"&&f.trim()!=="")return Number.isInteger(Number(f));return!1};_i.find=(f,_)=>f.nodes.find((h)=>h.type===_);_i.exceedsLimit=(f,_,h=1,y)=>{if(y===!1)return!1;if(!_i.isInteger(f)||!_i.isInteger(_))return!1;return(Number(_)-Number(f))/Number(h)>=y};_i.escapeNode=(f,_=0,h)=>{let y=f.nodes[_];if(!y)return;if(h&&y.type===h||y.type==="open"||y.type==="close"){if(y.escaped!==!0)y.value="\\"+y.value,y.escaped=!0}};_i.encloseBrace=(f)=>{if(f.type!=="brace")return!1;if(f.commas>>0+f.ranges>>0===0)return f.invalid=!0,!0;return!1};_i.isInvalidBrace=(f)=>{if(f.type!=="brace")return!1;if(f.invalid===!0||f.dollar)return!0;if(f.commas>>0+f.ranges>>0===0)return f.invalid=!0,!0;if(f.open!==!0||f.close!==!0)return f.invalid=!0,!0;return!1};_i.isOpenOrClose=(f)=>{if(f.type==="open"||f.type==="close")return!0;return f.open===!0||f.close===!0};_i.reduce=(f)=>f.reduce((_,h)=>{if(h.type==="text")_.push(h.value);if(h.type==="range")h.type="text";return _},[]);_i.flatten=(...f)=>{let _=[],h=(y)=>{for(let S=0;S<y.length;S++){let w=y[S];if(Array.isArray(w)){h(w);continue}if(w!==void 0)_.push(w)}return _};return h(f),_}});var Bf=Q((Ij,ih)=>{var wh=Lf();ih.exports=(f,_={})=>{let h=(y,S={})=>{let w=_.escapeInvalid&&wh.isInvalidBrace(S),i=y.invalid===!0&&_.escapeInvalid===!0,q="";if(y.value){if((w||i)&&wh.isOpenOrClose(y))return"\\"+y.value;return y.value}if(y.value)return y.value;if(y.nodes)for(let j of y.nodes)q+=h(j);return q};return h(f)}});var Fh=Q((Dj,qh)=>{/*!
12
+ * is-number <https://github.com/jonschlinkert/is-number>
13
+ *
14
+ * Copyright (c) 2014-present, Jon Schlinkert.
15
+ * Released under the MIT License.
16
+ */qh.exports=function(f){if(typeof f==="number")return f-f===0;if(typeof f==="string"&&f.trim()!=="")return Number.isFinite?Number.isFinite(+f):isFinite(+f);return!1}});var Jh=Q((Cj,Zh)=>{/*!
17
+ * to-regex-range <https://github.com/micromatch/to-regex-range>
18
+ *
19
+ * Copyright (c) 2015-present, Jon Schlinkert.
20
+ * Released under the MIT License.
21
+ */var $h=Fh(),qf=(f,_,h)=>{if($h(f)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(_===void 0||f===_)return String(f);if($h(_)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let y={relaxZeros:!0,...h};if(typeof y.strictZeros==="boolean")y.relaxZeros=y.strictZeros===!1;let S=String(y.relaxZeros),w=String(y.shorthand),i=String(y.capture),q=String(y.wrap),j=f+":"+_+"="+S+w+i+q;if(qf.cache.hasOwnProperty(j))return qf.cache[j].result;let d=Math.min(f,_),F=Math.max(f,_);if(Math.abs(d-F)===1){let U=f+"|"+_;if(y.capture)return`(${U})`;if(y.wrap===!1)return U;return`(?:${U})`}let W=Wh(f)||Wh(_),$={min:f,max:_,a:d,b:F},E=[],Z=[];if(W)$.isPadded=W,$.maxLen=String($.max).length;if(d<0){let U=F<0?Math.abs(F):1;Z=jh(U,Math.abs(d),$,y),d=$.a=0}if(F>=0)E=jh(d,F,$,y);if($.negatives=Z,$.positives=E,$.result=ji(Z,E,y),y.capture===!0)$.result=`(${$.result})`;else if(y.wrap!==!1&&E.length+Z.length>1)$.result=`(?:${$.result})`;return qf.cache[j]=$,$.result};function ji(f,_,h){let y=nf(f,_,"-",!1,h)||[],S=nf(_,f,"",!1,h)||[],w=nf(f,_,"-?",!0,h)||[];return y.concat(w).concat(S).join("|")}function Mi(f,_){let h=1,y=1,S=Vh(f,h),w=new Set([_]);while(f<=S&&S<=_)w.add(S),h+=1,S=Vh(f,h);S=dh(_+1,y)-1;while(f<S&&S<=_)w.add(S),y+=1,S=dh(_+1,y)-1;return w=[...w],w.sort(Yi),w}function Vi(f,_,h){if(f===_)return{pattern:f,count:[],digits:0};let y=di(f,_),S=y.length,w="",i=0;for(let q=0;q<S;q++){let[j,d]=y[q];if(j===d)w+=j;else if(j!=="0"||d!=="9")w+=Wi(j,d,h);else i++}if(i)w+=h.shorthand===!0?"\\d":"[0-9]";return{pattern:w,count:[i],digits:S}}function jh(f,_,h,y){let S=Mi(f,_),w=[],i=f,q;for(let j=0;j<S.length;j++){let d=S[j],F=Vi(String(i),String(d),y),W="";if(!h.isPadded&&q&&q.pattern===F.pattern){if(q.count.length>1)q.count.pop();q.count.push(F.count[0]),q.string=q.pattern+Yh(q.count),i=d+1;continue}if(h.isPadded)W=Zi(d,h,y);F.string=W+F.pattern+Yh(F.count),w.push(F),i=d+1,q=F}return w}function nf(f,_,h,y,S){let w=[];for(let i of f){let{string:q}=i;if(!y&&!Mh(_,"string",q))w.push(h+q);if(y&&Mh(_,"string",q))w.push(h+q)}return w}function di(f,_){let h=[];for(let y=0;y<f.length;y++)h.push([f[y],_[y]]);return h}function Yi(f,_){return f>_?1:_>f?-1:0}function Mh(f,_,h){return f.some((y)=>y[_]===h)}function Vh(f,_){return Number(String(f).slice(0,-_)+"9".repeat(_))}function dh(f,_){return f-f%Math.pow(10,_)}function Yh(f){let[_=0,h=""]=f;if(h||_>1)return`{${_+(h?","+h:"")}}`;return""}function Wi(f,_,h){return`[${f}${_-f===1?"":"-"}${_}]`}function Wh(f){return/^-?(0+)\d/.test(f)}function Zi(f,_,h){if(!_.isPadded)return f;let y=Math.abs(_.maxLen-String(f).length),S=h.relaxZeros!==!1;switch(y){case 0:return"";case 1:return S?"0?":"0";case 2:return S?"0{0,2}":"00";default:return S?`0{0,${y}}`:`0{${y}}`}}qf.cache={};qf.clearCache=()=>qf.cache={};Zh.exports=qf});var of=Q((Nj,Bh)=>{/*!
22
+ * fill-range <https://github.com/jonschlinkert/fill-range>
23
+ *
24
+ * Copyright (c) 2014-present, Jon Schlinkert.
25
+ * Licensed under the MIT License.
26
+ */var Ji=u("util"),Qh=Jh(),Uh=(f)=>f!==null&&typeof f==="object"&&!Array.isArray(f),Ui=(f)=>{return(_)=>f===!0?Number(_):String(_)},ef=(f)=>{return typeof f==="number"||typeof f==="string"&&f!==""},Yf=(f)=>Number.isInteger(+f),sf=(f)=>{let _=`${f}`,h=-1;if(_[0]==="-")_=_.slice(1);if(_==="0")return!1;while(_[++h]==="0");return h>0},Qi=(f,_,h)=>{if(typeof f==="string"||typeof _==="string")return!0;return h.stringify===!0},zi=(f,_,h)=>{if(_>0){let y=f[0]==="-"?"-":"";if(y)f=f.slice(1);f=y+f.padStart(y?_-1:_,"0")}if(h===!1)return String(f);return f},If=(f,_)=>{let h=f[0]==="-"?"-":"";if(h)f=f.slice(1),_--;while(f.length<_)f="0"+f;return h?"-"+f:f},Ei=(f,_,h)=>{f.negatives.sort((q,j)=>q<j?-1:q>j?1:0),f.positives.sort((q,j)=>q<j?-1:q>j?1:0);let y=_.capture?"":"?:",S="",w="",i;if(f.positives.length)S=f.positives.map((q)=>If(String(q),h)).join("|");if(f.negatives.length)w=`-(${y}${f.negatives.map((q)=>If(String(q),h)).join("|")})`;if(S&&w)i=`${S}|${w}`;else i=S||w;if(_.wrap)return`(${y}${i})`;return i},zh=(f,_,h,y)=>{if(h)return Qh(f,_,{wrap:!1,...y});let S=String.fromCharCode(f);if(f===_)return S;let w=String.fromCharCode(_);return`[${S}-${w}]`},Eh=(f,_,h)=>{if(Array.isArray(f)){let y=h.wrap===!0,S=h.capture?"":"?:";return y?`(${S}${f.join("|")})`:f.join("|")}return Qh(f,_,h)},Xh=(...f)=>{return new RangeError("Invalid range arguments: "+Ji.inspect(...f))},Lh=(f,_,h)=>{if(h.strictRanges===!0)throw Xh([f,_]);return[]},Xi=(f,_)=>{if(_.strictRanges===!0)throw new TypeError(`Expected step "${f}" to be a number`);return[]},Li=(f,_,h=1,y={})=>{let S=Number(f),w=Number(_);if(!Number.isInteger(S)||!Number.isInteger(w)){if(y.strictRanges===!0)throw Xh([f,_]);return[]}if(S===0)S=0;if(w===0)w=0;let i=S>w,q=String(f),j=String(_),d=String(h);h=Math.max(Math.abs(h),1);let F=sf(q)||sf(j)||sf(d),W=F?Math.max(q.length,j.length,d.length):0,$=F===!1&&Qi(f,_,y)===!1,E=y.transform||Ui($);if(y.toRegex&&h===1)return zh(If(f,W),If(_,W),!0,y);let Z={negatives:[],positives:[]},U=(c)=>Z[c<0?"negatives":"positives"].push(Math.abs(c)),D=[],C=0;while(i?S>=w:S<=w){if(y.toRegex===!0&&h>1)U(S);else D.push(zi(E(S,C),W,$));S=i?S-h:S+h,C++}if(y.toRegex===!0)return h>1?Ei(Z,y,W):Eh(D,null,{wrap:!1,...y});return D},Bi=(f,_,h=1,y={})=>{if(!Yf(f)&&f.length>1||!Yf(_)&&_.length>1)return Lh(f,_,y);let S=y.transform||(($)=>String.fromCharCode($)),w=`${f}`.charCodeAt(0),i=`${_}`.charCodeAt(0),q=w>i,j=Math.min(w,i),d=Math.max(w,i);if(y.toRegex&&h===1)return zh(j,d,!1,y);let F=[],W=0;while(q?w>=i:w<=i)F.push(S(w,W)),w=q?w-h:w+h,W++;if(y.toRegex===!0)return Eh(F,null,{wrap:!1,options:y});return F},Kf=(f,_,h,y={})=>{if(_==null&&ef(f))return[f];if(!ef(f)||!ef(_))return Lh(f,_,y);if(typeof h==="function")return Kf(f,_,1,{transform:h});if(Uh(h))return Kf(f,_,0,h);let S={...y};if(S.capture===!0)S.wrap=!0;if(h=h||S.step||1,!Yf(h)){if(h!=null&&!Uh(h))return Xi(h,S);return Kf(f,_,1,h)}if(Yf(f)&&Yf(_))return Li(f,_,h,S);return Bi(f,_,Math.max(Math.abs(h),1),S)};Bh.exports=Kf});var Dh=Q((Oj,Ih)=>{var Ki=of(),Kh=Lf(),Ii=(f,_={})=>{let h=(y,S={})=>{let w=Kh.isInvalidBrace(S),i=y.invalid===!0&&_.escapeInvalid===!0,q=w===!0||i===!0,j=_.escapeInvalid===!0?"\\":"",d="";if(y.isOpen===!0)return j+y.value;if(y.isClose===!0)return console.log("node.isClose",j,y.value),j+y.value;if(y.type==="open")return q?j+y.value:"(";if(y.type==="close")return q?j+y.value:")";if(y.type==="comma")return y.prev.type==="comma"?"":q?y.value:"|";if(y.value)return y.value;if(y.nodes&&y.ranges>0){let F=Kh.reduce(y.nodes),W=Ki(...F,{..._,wrap:!1,toRegex:!0,strictZeros:!0});if(W.length!==0)return F.length>1&&W.length>1?`(${W})`:W}if(y.nodes)for(let F of y.nodes)d+=h(F,y);return d};return h(f)};Ih.exports=Ii});var Oh=Q((Pj,Nh)=>{var Di=of(),Ch=Bf(),jf=Lf(),Ff=(f="",_="",h=!1)=>{let y=[];if(f=[].concat(f),_=[].concat(_),!_.length)return f;if(!f.length)return h?jf.flatten(_).map((S)=>`{${S}}`):_;for(let S of f)if(Array.isArray(S))for(let w of S)y.push(Ff(w,_,h));else for(let w of _){if(h===!0&&typeof w==="string")w=`{${w}}`;y.push(Array.isArray(w)?Ff(S,w,h):S+w)}return jf.flatten(y)},Ci=(f,_={})=>{let h=_.rangeLimit===void 0?1000:_.rangeLimit,y=(S,w={})=>{S.queue=[];let i=w,q=w.queue;while(i.type!=="brace"&&i.type!=="root"&&i.parent)i=i.parent,q=i.queue;if(S.invalid||S.dollar){q.push(Ff(q.pop(),Ch(S,_)));return}if(S.type==="brace"&&S.invalid!==!0&&S.nodes.length===2){q.push(Ff(q.pop(),["{}"]));return}if(S.nodes&&S.ranges>0){let W=jf.reduce(S.nodes);if(jf.exceedsLimit(...W,_.step,h))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let $=Di(...W,_);if($.length===0)$=Ch(S,_);q.push(Ff(q.pop(),$)),S.nodes=[];return}let j=jf.encloseBrace(S),d=S.queue,F=S;while(F.type!=="brace"&&F.type!=="root"&&F.parent)F=F.parent,d=F.queue;for(let W=0;W<S.nodes.length;W++){let $=S.nodes[W];if($.type==="comma"&&S.type==="brace"){if(W===1)d.push("");d.push("");continue}if($.type==="close"){q.push(Ff(q.pop(),d,j));continue}if($.value&&$.type!=="open"){d.push(Ff(d.pop(),$.value));continue}if($.nodes)y($,S)}return d};return jf.flatten(y(f))};Nh.exports=Ci});var Gh=Q((Gj,Ph)=>{Ph.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
27
+ `,CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Th=Q((gj,Ah)=>{var Ni=Bf(),{MAX_LENGTH:gh,CHAR_BACKSLASH:af,CHAR_BACKTICK:Oi,CHAR_COMMA:Pi,CHAR_DOT:Gi,CHAR_LEFT_PARENTHESES:gi,CHAR_RIGHT_PARENTHESES:Hi,CHAR_LEFT_CURLY_BRACE:li,CHAR_RIGHT_CURLY_BRACE:Ai,CHAR_LEFT_SQUARE_BRACKET:Hh,CHAR_RIGHT_SQUARE_BRACKET:lh,CHAR_DOUBLE_QUOTE:Ti,CHAR_SINGLE_QUOTE:ui,CHAR_NO_BREAK_SPACE:xi,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Ri}=Gh(),ri=(f,_={})=>{if(typeof f!=="string")throw new TypeError("Expected a string");let h=_||{},y=typeof h.maxLength==="number"?Math.min(gh,h.maxLength):gh;if(f.length>y)throw new SyntaxError(`Input length (${f.length}), exceeds max characters (${y})`);let S={type:"root",input:f,nodes:[]},w=[S],i=S,q=S,j=0,d=f.length,F=0,W=0,$,E=()=>f[F++],Z=(U)=>{if(U.type==="text"&&q.type==="dot")q.type="text";if(q&&q.type==="text"&&U.type==="text"){q.value+=U.value;return}return i.nodes.push(U),U.parent=i,U.prev=q,q=U,U};Z({type:"bos"});while(F<d){if(i=w[w.length-1],$=E(),$===Ri||$===xi)continue;if($===af){Z({type:"text",value:(_.keepEscaping?$:"")+E()});continue}if($===lh){Z({type:"text",value:"\\"+$});continue}if($===Hh){j++;let U;while(F<d&&(U=E())){if($+=U,U===Hh){j++;continue}if(U===af){$+=E();continue}if(U===lh){if(j--,j===0)break}}Z({type:"text",value:$});continue}if($===gi){i=Z({type:"paren",nodes:[]}),w.push(i),Z({type:"text",value:$});continue}if($===Hi){if(i.type!=="paren"){Z({type:"text",value:$});continue}i=w.pop(),Z({type:"text",value:$}),i=w[w.length-1];continue}if($===Ti||$===ui||$===Oi){let U=$,D;if(_.keepQuotes!==!0)$="";while(F<d&&(D=E())){if(D===af){$+=D+E();continue}if(D===U){if(_.keepQuotes===!0)$+=D;break}$+=D}Z({type:"text",value:$});continue}if($===li){W++;let D={type:"brace",open:!0,close:!1,dollar:q.value&&q.value.slice(-1)==="$"||i.dollar===!0,depth:W,commas:0,ranges:0,nodes:[]};i=Z(D),w.push(i),Z({type:"open",value:$});continue}if($===Ai){if(i.type!=="brace"){Z({type:"text",value:$});continue}let U="close";i=w.pop(),i.close=!0,Z({type:U,value:$}),W--,i=w[w.length-1];continue}if($===Pi&&W>0){if(i.ranges>0){i.ranges=0;let U=i.nodes.shift();i.nodes=[U,{type:"text",value:Ni(i)}]}Z({type:"comma",value:$}),i.commas++;continue}if($===Gi&&W>0&&i.commas===0){let U=i.nodes;if(W===0||U.length===0){Z({type:"text",value:$});continue}if(q.type==="dot"){if(i.range=[],q.value+=$,q.type="range",i.nodes.length!==3&&i.nodes.length!==5){i.invalid=!0,i.ranges=0,q.type="text";continue}i.ranges++,i.args=[];continue}if(q.type==="range"){U.pop();let D=U[U.length-1];D.value+=q.value+$,q=D,i.ranges--;continue}Z({type:"dot",value:$});continue}Z({type:"text",value:$})}do if(i=w.pop(),i.type!=="root"){i.nodes.forEach((C)=>{if(!C.nodes){if(C.type==="open")C.isOpen=!0;if(C.type==="close")C.isClose=!0;if(!C.nodes)C.type="text";C.invalid=!0}});let U=w[w.length-1],D=U.nodes.indexOf(i);U.nodes.splice(D,1,...i.nodes)}while(w.length>0);return Z({type:"eos"}),S};Ah.exports=ri});var Rh=Q((Hj,xh)=>{var uh=Bf(),ci=Dh(),mi=Oh(),ki=Th(),v=(f,_={})=>{let h=[];if(Array.isArray(f))for(let y of f){let S=v.create(y,_);if(Array.isArray(S))h.push(...S);else h.push(S)}else h=[].concat(v.create(f,_));if(_&&_.expand===!0&&_.nodupes===!0)h=[...new Set(h)];return h};v.parse=(f,_={})=>ki(f,_);v.stringify=(f,_={})=>{if(typeof f==="string")return uh(v.parse(f,_),_);return uh(f,_)};v.compile=(f,_={})=>{if(typeof f==="string")f=v.parse(f,_);return ci(f,_)};v.expand=(f,_={})=>{if(typeof f==="string")f=v.parse(f,_);let h=mi(f,_);if(_.noempty===!0)h=h.filter(Boolean);if(_.nodupes===!0)h=[...new Set(h)];return h};v.create=(f,_={})=>{if(f===""||f.length<3)return[f];return _.expand!==!0?v.compile(f,_):v.expand(f,_)};xh.exports=v});var Wf=Q((lj,ch)=>{var bi=u("path"),rh={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},vi={...rh,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"},ni={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};ch.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:ni,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:bi.sep,extglobChars(f){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${f.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(f){return f===!0?vi:rh}}});var Zf=Q((f0)=>{var ei=u("path"),si=process.platform==="win32",{REGEX_BACKSLASH:oi,REGEX_REMOVE_BACKSLASH:ai,REGEX_SPECIAL_CHARS:pi,REGEX_SPECIAL_CHARS_GLOBAL:ti}=Wf();f0.isObject=(f)=>f!==null&&typeof f==="object"&&!Array.isArray(f);f0.hasRegexChars=(f)=>pi.test(f);f0.isRegexChar=(f)=>f.length===1&&f0.hasRegexChars(f);f0.escapeRegex=(f)=>f.replace(ti,"\\$1");f0.toPosixSlashes=(f)=>f.replace(oi,"/");f0.removeBackslashes=(f)=>{return f.replace(ai,(_)=>{return _==="\\"?"":_})};f0.supportsLookbehinds=()=>{let f=process.version.slice(1).split(".").map(Number);if(f.length===3&&f[0]>=9||f[0]===8&&f[1]>=10)return!0;return!1};f0.isWindows=(f)=>{if(f&&typeof f.windows==="boolean")return f.windows;return si===!0||ei.sep==="\\"};f0.escapeLast=(f,_,h)=>{let y=f.lastIndexOf(_,h);if(y===-1)return f;if(f[y-1]==="\\")return f0.escapeLast(f,_,y-1);return`${f.slice(0,y)}\\${f.slice(y)}`};f0.removePrefix=(f,_={})=>{let h=f;if(h.startsWith("./"))h=h.slice(2),_.prefix="./";return h};f0.wrapOutput=(f,_={},h={})=>{let y=h.contains?"":"^",S=h.contains?"":"$",w=`${y}(?:${f})${S}`;if(_.negated===!0)w=`(?:^(?!${w}).*$)`;return w}});var ph=Q((Tj,ah)=>{var bh=Zf(),{CHAR_ASTERISK:pf,CHAR_AT:j0,CHAR_BACKWARD_SLASH:Jf,CHAR_COMMA:M0,CHAR_DOT:tf,CHAR_EXCLAMATION_MARK:f_,CHAR_FORWARD_SLASH:oh,CHAR_LEFT_CURLY_BRACE:__,CHAR_LEFT_PARENTHESES:h_,CHAR_LEFT_SQUARE_BRACKET:V0,CHAR_PLUS:d0,CHAR_QUESTION_MARK:vh,CHAR_RIGHT_CURLY_BRACE:Y0,CHAR_RIGHT_PARENTHESES:nh,CHAR_RIGHT_SQUARE_BRACKET:W0}=Wf(),eh=(f)=>{return f===oh||f===Jf},sh=(f)=>{if(f.isPrefix!==!0)f.depth=f.isGlobstar?1/0:1},Z0=(f,_)=>{let h=_||{},y=f.length-1,S=h.parts===!0||h.scanToEnd===!0,w=[],i=[],q=[],j=f,d=-1,F=0,W=0,$=!1,E=!1,Z=!1,U=!1,D=!1,C=!1,c=!1,H=!1,e=!1,K=!1,l=0,L,X,O={value:"",depth:0,isGlob:!1},r=()=>d>=y,Y=()=>j.charCodeAt(d+1),A=()=>{return L=X,j.charCodeAt(++d)};while(d<y){X=A();let m;if(X===Jf){if(c=O.backslashes=!0,X=A(),X===__)C=!0;continue}if(C===!0||X===__){l++;while(r()!==!0&&(X=A())){if(X===Jf){c=O.backslashes=!0,A();continue}if(X===__){l++;continue}if(C!==!0&&X===tf&&(X=A())===tf){if($=O.isBrace=!0,Z=O.isGlob=!0,K=!0,S===!0)continue;break}if(C!==!0&&X===M0){if($=O.isBrace=!0,Z=O.isGlob=!0,K=!0,S===!0)continue;break}if(X===Y0){if(l--,l===0){C=!1,$=O.isBrace=!0,K=!0;break}}}if(S===!0)continue;break}if(X===oh){if(w.push(d),i.push(O),O={value:"",depth:0,isGlob:!1},K===!0)continue;if(L===tf&&d===F+1){F+=2;continue}W=d+1;continue}if(h.noext!==!0){if((X===d0||X===j0||X===pf||X===vh||X===f_)===!0&&Y()===h_){if(Z=O.isGlob=!0,U=O.isExtglob=!0,K=!0,X===f_&&d===F)e=!0;if(S===!0){while(r()!==!0&&(X=A())){if(X===Jf){c=O.backslashes=!0,X=A();continue}if(X===nh){Z=O.isGlob=!0,K=!0;break}}continue}break}}if(X===pf){if(L===pf)D=O.isGlobstar=!0;if(Z=O.isGlob=!0,K=!0,S===!0)continue;break}if(X===vh){if(Z=O.isGlob=!0,K=!0,S===!0)continue;break}if(X===V0){while(r()!==!0&&(m=A())){if(m===Jf){c=O.backslashes=!0,A();continue}if(m===W0){E=O.isBracket=!0,Z=O.isGlob=!0,K=!0;break}}if(S===!0)continue;break}if(h.nonegate!==!0&&X===f_&&d===F){H=O.negated=!0,F++;continue}if(h.noparen!==!0&&X===h_){if(Z=O.isGlob=!0,S===!0){while(r()!==!0&&(X=A())){if(X===h_){c=O.backslashes=!0,X=A();continue}if(X===nh){K=!0;break}}continue}break}if(Z===!0){if(K=!0,S===!0)continue;break}}if(h.noext===!0)U=!1,Z=!1;let P=j,yf="",M="";if(F>0)yf=j.slice(0,F),j=j.slice(F),W-=F;if(P&&Z===!0&&W>0)P=j.slice(0,W),M=j.slice(W);else if(Z===!0)P="",M=j;else P=j;if(P&&P!==""&&P!=="/"&&P!==j){if(eh(P.charCodeAt(P.length-1)))P=P.slice(0,-1)}if(h.unescape===!0){if(M)M=bh.removeBackslashes(M);if(P&&c===!0)P=bh.removeBackslashes(P)}let V={prefix:yf,input:f,start:F,base:P,glob:M,isBrace:$,isBracket:E,isGlob:Z,isExtglob:U,isGlobstar:D,negated:H,negatedExtglob:e};if(h.tokens===!0){if(V.maxDepth=0,!eh(X))i.push(O);V.tokens=i}if(h.parts===!0||h.tokens===!0){let m;for(let N=0;N<w.length;N++){let t=m?m+1:F,ff=w[N],b=f.slice(t,ff);if(h.tokens){if(N===0&&F!==0)i[N].isPrefix=!0,i[N].value=yf;else i[N].value=b;sh(i[N]),V.maxDepth+=i[N].depth}if(N!==0||b!=="")q.push(b);m=ff}if(m&&m+1<f.length){let N=f.slice(m+1);if(q.push(N),h.tokens)i[i.length-1].value=N,sh(i[i.length-1]),V.maxDepth+=i[i.length-1].depth}V.slashes=w,V.parts=q}return V};ah.exports=Z0});var _1=Q((uj,f1)=>{var Df=Wf(),n=Zf(),{MAX_LENGTH:Cf,POSIX_REGEX_SOURCE:J0,REGEX_NON_SPECIAL_CHARS:U0,REGEX_SPECIAL_CHARS_BACKREF:Q0,REPLACEMENTS:th}=Df,z0=(f,_)=>{if(typeof _.expandRange==="function")return _.expandRange(...f,_);f.sort();let h=`[${f.join("-")}]`;try{new RegExp(h)}catch(y){return f.map((S)=>n.escapeRegex(S)).join("..")}return h},Mf=(f,_)=>{return`Missing ${f}: "${_}" - use "\\\\${_}" to match literal characters`},y_=(f,_)=>{if(typeof f!=="string")throw new TypeError("Expected a string");f=th[f]||f;let h={..._},y=typeof h.maxLength==="number"?Math.min(Cf,h.maxLength):Cf,S=f.length;if(S>y)throw new SyntaxError(`Input length: ${S}, exceeds maximum allowed length: ${y}`);let w={type:"bos",value:"",output:h.prepend||""},i=[w],q=h.capture?"":"?:",j=n.isWindows(_),d=Df.globChars(j),F=Df.extglobChars(d),{DOT_LITERAL:W,PLUS_LITERAL:$,SLASH_LITERAL:E,ONE_CHAR:Z,DOTS_SLASH:U,NO_DOT:D,NO_DOT_SLASH:C,NO_DOTS_SLASH:c,QMARK:H,QMARK_NO_DOT:e,STAR:K,START_ANCHOR:l}=d,L=(z)=>{return`(${q}(?:(?!${l}${z.dot?U:W}).)*?)`},X=h.dot?"":D,O=h.dot?H:e,r=h.bash===!0?L(h):K;if(h.capture)r=`(${r})`;if(typeof h.noext==="boolean")h.noextglob=h.noext;let Y={input:f,index:-1,start:0,dot:h.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};f=n.removePrefix(f,Y),S=f.length;let A=[],P=[],yf=[],M=w,V,m=()=>Y.index===S-1,N=Y.peek=(z=1)=>f[Y.index+z],t=Y.advance=()=>f[++Y.index]||"",ff=()=>f.slice(Y.index+1),b=(z="",G=0)=>{Y.consumed+=z,Y.index+=G},Qf=(z)=>{Y.output+=z.output!=null?z.output:z.value,b(z.value)},Yw=()=>{let z=1;while(N()==="!"&&(N(2)!=="("||N(3)==="?"))t(),Y.start++,z++;if(z%2===0)return!1;return Y.negated=!0,Y.start++,!0},zf=(z)=>{Y[z]++,yf.push(z)},wf=(z)=>{Y[z]--,yf.pop()},I=(z)=>{if(M.type==="globstar"){let G=Y.braces>0&&(z.type==="comma"||z.type==="brace"),J=z.extglob===!0||A.length&&(z.type==="pipe"||z.type==="paren");if(z.type!=="slash"&&z.type!=="paren"&&!G&&!J)Y.output=Y.output.slice(0,-M.output.length),M.type="star",M.value="*",M.output=r,Y.output+=M.output}if(A.length&&z.type!=="paren")A[A.length-1].inner+=z.value;if(z.value||z.output)Qf(z);if(M&&M.type==="text"&&z.type==="text"){M.value+=z.value,M.output=(M.output||"")+z.value;return}z.prev=M,i.push(z),M=z},Ef=(z,G)=>{let J={...F[G],conditions:1,inner:""};J.prev=M,J.parens=Y.parens,J.output=Y.output;let B=(h.capture?"(":"")+J.open;zf("parens"),I({type:z,value:G,output:Y.output?"":Z}),I({type:"paren",extglob:!0,value:t(),output:B}),A.push(J)},Ww=(z)=>{let G=z.close+(h.capture?")":""),J;if(z.type==="negate"){let B=r;if(z.inner&&z.inner.length>1&&z.inner.includes("/"))B=L(h);if(B!==r||m()||/^\)+$/.test(ff()))G=z.close=`)$))${B}`;if(z.inner.includes("*")&&(J=ff())&&/^\.[^\\/.]+$/.test(J)){let T=y_(J,{..._,fastpaths:!1}).output;G=z.close=`)${T})${B})`}if(z.prev.type==="bos")Y.negatedExtglob=!0}I({type:"paren",extglob:!0,value:V,output:G}),wf("parens")};if(h.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(f)){let z=!1,G=f.replace(Q0,(J,B,T,k,R,cf)=>{if(k==="\\")return z=!0,J;if(k==="?"){if(B)return B+k+(R?H.repeat(R.length):"");if(cf===0)return O+(R?H.repeat(R.length):"");return H.repeat(T.length)}if(k===".")return W.repeat(T.length);if(k==="*"){if(B)return B+k+(R?r:"");return r}return B?J:`\\${J}`});if(z===!0)if(h.unescape===!0)G=G.replace(/\\/g,"");else G=G.replace(/\\+/g,(J)=>{return J.length%2===0?"\\\\":J?"\\":""});if(G===f&&h.contains===!0)return Y.output=f,Y;return Y.output=n.wrapOutput(G,Y,_),Y}while(!m()){if(V=t(),V==="\x00")continue;if(V==="\\"){let J=N();if(J==="/"&&h.bash!==!0)continue;if(J==="."||J===";")continue;if(!J){V+="\\",I({type:"text",value:V});continue}let B=/^\\+/.exec(ff()),T=0;if(B&&B[0].length>2){if(T=B[0].length,Y.index+=T,T%2!==0)V+="\\"}if(h.unescape===!0)V=t();else V+=t();if(Y.brackets===0){I({type:"text",value:V});continue}}if(Y.brackets>0&&(V!=="]"||M.value==="["||M.value==="[^")){if(h.posix!==!1&&V===":"){let J=M.value.slice(1);if(J.includes("[")){if(M.posix=!0,J.includes(":")){let B=M.value.lastIndexOf("["),T=M.value.slice(0,B),k=M.value.slice(B+2),R=J0[k];if(R){if(M.value=T+R,Y.backtrack=!0,t(),!w.output&&i.indexOf(M)===1)w.output=Z;continue}}}}if(V==="["&&N()!==":"||V==="-"&&N()==="]")V=`\\${V}`;if(V==="]"&&(M.value==="["||M.value==="[^"))V=`\\${V}`;if(h.posix===!0&&V==="!"&&M.value==="[")V="^";M.value+=V,Qf({value:V});continue}if(Y.quotes===1&&V!=='"'){V=n.escapeRegex(V),M.value+=V,Qf({value:V});continue}if(V==='"'){if(Y.quotes=Y.quotes===1?0:1,h.keepQuotes===!0)I({type:"text",value:V});continue}if(V==="("){zf("parens"),I({type:"paren",value:V});continue}if(V===")"){if(Y.parens===0&&h.strictBrackets===!0)throw new SyntaxError(Mf("opening","("));let J=A[A.length-1];if(J&&Y.parens===J.parens+1){Ww(A.pop());continue}I({type:"paren",value:V,output:Y.parens?")":"\\)"}),wf("parens");continue}if(V==="["){if(h.nobracket===!0||!ff().includes("]")){if(h.nobracket!==!0&&h.strictBrackets===!0)throw new SyntaxError(Mf("closing","]"));V=`\\${V}`}else zf("brackets");I({type:"bracket",value:V});continue}if(V==="]"){if(h.nobracket===!0||M&&M.type==="bracket"&&M.value.length===1){I({type:"text",value:V,output:`\\${V}`});continue}if(Y.brackets===0){if(h.strictBrackets===!0)throw new SyntaxError(Mf("opening","["));I({type:"text",value:V,output:`\\${V}`});continue}wf("brackets");let J=M.value.slice(1);if(M.posix!==!0&&J[0]==="^"&&!J.includes("/"))V=`/${V}`;if(M.value+=V,Qf({value:V}),h.literalBrackets===!1||n.hasRegexChars(J))continue;let B=n.escapeRegex(M.value);if(Y.output=Y.output.slice(0,-M.value.length),h.literalBrackets===!0){Y.output+=B,M.value=B;continue}M.value=`(${q}${B}|${M.value})`,Y.output+=M.value;continue}if(V==="{"&&h.nobrace!==!0){zf("braces");let J={type:"brace",value:V,output:"(",outputIndex:Y.output.length,tokensIndex:Y.tokens.length};P.push(J),I(J);continue}if(V==="}"){let J=P[P.length-1];if(h.nobrace===!0||!J){I({type:"text",value:V,output:V});continue}let B=")";if(J.dots===!0){let T=i.slice(),k=[];for(let R=T.length-1;R>=0;R--){if(i.pop(),T[R].type==="brace")break;if(T[R].type!=="dots")k.unshift(T[R].value)}B=z0(k,h),Y.backtrack=!0}if(J.comma!==!0&&J.dots!==!0){let T=Y.output.slice(0,J.outputIndex),k=Y.tokens.slice(J.tokensIndex);J.value=J.output="\\{",V=B="\\}",Y.output=T;for(let R of k)Y.output+=R.output||R.value}I({type:"brace",value:V,output:B}),wf("braces"),P.pop();continue}if(V==="|"){if(A.length>0)A[A.length-1].conditions++;I({type:"text",value:V});continue}if(V===","){let J=V,B=P[P.length-1];if(B&&yf[yf.length-1]==="braces")B.comma=!0,J="|";I({type:"comma",value:V,output:J});continue}if(V==="/"){if(M.type==="dot"&&Y.index===Y.start+1){Y.start=Y.index+1,Y.consumed="",Y.output="",i.pop(),M=w;continue}I({type:"slash",value:V,output:E});continue}if(V==="."){if(Y.braces>0&&M.type==="dot"){if(M.value===".")M.output=W;let J=P[P.length-1];M.type="dots",M.output+=V,M.value+=V,J.dots=!0;continue}if(Y.braces+Y.parens===0&&M.type!=="bos"&&M.type!=="slash"){I({type:"text",value:V,output:W});continue}I({type:"dot",value:V,output:W});continue}if(V==="?"){if(!(M&&M.value==="(")&&h.noextglob!==!0&&N()==="("&&N(2)!=="?"){Ef("qmark",V);continue}if(M&&M.type==="paren"){let B=N(),T=V;if(B==="<"&&!n.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");if(M.value==="("&&!/[!=<:]/.test(B)||B==="<"&&!/<([!=]|\w+>)/.test(ff()))T=`\\${V}`;I({type:"text",value:V,output:T});continue}if(h.dot!==!0&&(M.type==="slash"||M.type==="bos")){I({type:"qmark",value:V,output:e});continue}I({type:"qmark",value:V,output:H});continue}if(V==="!"){if(h.noextglob!==!0&&N()==="("){if(N(2)!=="?"||!/[!=<:]/.test(N(3))){Ef("negate",V);continue}}if(h.nonegate!==!0&&Y.index===0){Yw();continue}}if(V==="+"){if(h.noextglob!==!0&&N()==="("&&N(2)!=="?"){Ef("plus",V);continue}if(M&&M.value==="("||h.regex===!1){I({type:"plus",value:V,output:$});continue}if(M&&(M.type==="bracket"||M.type==="paren"||M.type==="brace")||Y.parens>0){I({type:"plus",value:V});continue}I({type:"plus",value:$});continue}if(V==="@"){if(h.noextglob!==!0&&N()==="("&&N(2)!=="?"){I({type:"at",extglob:!0,value:V,output:""});continue}I({type:"text",value:V});continue}if(V!=="*"){if(V==="$"||V==="^")V=`\\${V}`;let J=U0.exec(ff());if(J)V+=J[0],Y.index+=J[0].length;I({type:"text",value:V});continue}if(M&&(M.type==="globstar"||M.star===!0)){M.type="star",M.star=!0,M.value+=V,M.output=r,Y.backtrack=!0,Y.globstar=!0,b(V);continue}let z=ff();if(h.noextglob!==!0&&/^\([^?]/.test(z)){Ef("star",V);continue}if(M.type==="star"){if(h.noglobstar===!0){b(V);continue}let J=M.prev,B=J.prev,T=J.type==="slash"||J.type==="bos",k=B&&(B.type==="star"||B.type==="globstar");if(h.bash===!0&&(!T||z[0]&&z[0]!=="/")){I({type:"star",value:V,output:""});continue}let R=Y.braces>0&&(J.type==="comma"||J.type==="brace"),cf=A.length&&(J.type==="pipe"||J.type==="paren");if(!T&&J.type!=="paren"&&!R&&!cf){I({type:"star",value:V,output:""});continue}while(z.slice(0,3)==="/**"){let Xf=f[Y.index+4];if(Xf&&Xf!=="/")break;z=z.slice(3),b("/**",3)}if(J.type==="bos"&&m()){M.type="globstar",M.value+=V,M.output=L(h),Y.output=M.output,Y.globstar=!0,b(V);continue}if(J.type==="slash"&&J.prev.type!=="bos"&&!k&&m()){Y.output=Y.output.slice(0,-(J.output+M.output).length),J.output=`(?:${J.output}`,M.type="globstar",M.output=L(h)+(h.strictSlashes?")":"|$)"),M.value+=V,Y.globstar=!0,Y.output+=J.output+M.output,b(V);continue}if(J.type==="slash"&&J.prev.type!=="bos"&&z[0]==="/"){let Xf=z[1]!==void 0?"|$":"";Y.output=Y.output.slice(0,-(J.output+M.output).length),J.output=`(?:${J.output}`,M.type="globstar",M.output=`${L(h)}${E}|${E}${Xf})`,M.value+=V,Y.output+=J.output+M.output,Y.globstar=!0,b(V+t()),I({type:"slash",value:"/",output:""});continue}if(J.type==="bos"&&z[0]==="/"){M.type="globstar",M.value+=V,M.output=`(?:^|${E}|${L(h)}${E})`,Y.output=M.output,Y.globstar=!0,b(V+t()),I({type:"slash",value:"/",output:""});continue}Y.output=Y.output.slice(0,-M.output.length),M.type="globstar",M.output=L(h),M.value+=V,Y.output+=M.output,Y.globstar=!0,b(V);continue}let G={type:"star",value:V,output:r};if(h.bash===!0){if(G.output=".*?",M.type==="bos"||M.type==="slash")G.output=X+G.output;I(G);continue}if(M&&(M.type==="bracket"||M.type==="paren")&&h.regex===!0){G.output=V,I(G);continue}if(Y.index===Y.start||M.type==="slash"||M.type==="dot"){if(M.type==="dot")Y.output+=C,M.output+=C;else if(h.dot===!0)Y.output+=c,M.output+=c;else Y.output+=X,M.output+=X;if(N()!=="*")Y.output+=Z,M.output+=Z}I(G)}while(Y.brackets>0){if(h.strictBrackets===!0)throw new SyntaxError(Mf("closing","]"));Y.output=n.escapeLast(Y.output,"["),wf("brackets")}while(Y.parens>0){if(h.strictBrackets===!0)throw new SyntaxError(Mf("closing",")"));Y.output=n.escapeLast(Y.output,"("),wf("parens")}while(Y.braces>0){if(h.strictBrackets===!0)throw new SyntaxError(Mf("closing","}"));Y.output=n.escapeLast(Y.output,"{"),wf("braces")}if(h.strictSlashes!==!0&&(M.type==="star"||M.type==="bracket"))I({type:"maybe_slash",value:"",output:`${E}?`});if(Y.backtrack===!0){Y.output="";for(let z of Y.tokens)if(Y.output+=z.output!=null?z.output:z.value,z.suffix)Y.output+=z.suffix}return Y};y_.fastpaths=(f,_)=>{let h={..._},y=typeof h.maxLength==="number"?Math.min(Cf,h.maxLength):Cf,S=f.length;if(S>y)throw new SyntaxError(`Input length: ${S}, exceeds maximum allowed length: ${y}`);f=th[f]||f;let w=n.isWindows(_),{DOT_LITERAL:i,SLASH_LITERAL:q,ONE_CHAR:j,DOTS_SLASH:d,NO_DOT:F,NO_DOTS:W,NO_DOTS_SLASH:$,STAR:E,START_ANCHOR:Z}=Df.globChars(w),U=h.dot?W:F,D=h.dot?$:F,C=h.capture?"":"?:",c={negated:!1,prefix:""},H=h.bash===!0?".*?":E;if(h.capture)H=`(${H})`;let e=(X)=>{if(X.noglobstar===!0)return H;return`(${C}(?:(?!${Z}${X.dot?d:i}).)*?)`},K=(X)=>{switch(X){case"*":return`${U}${j}${H}`;case".*":return`${i}${j}${H}`;case"*.*":return`${U}${H}${i}${j}${H}`;case"*/*":return`${U}${H}${q}${j}${D}${H}`;case"**":return U+e(h);case"**/*":return`(?:${U}${e(h)}${q})?${D}${j}${H}`;case"**/*.*":return`(?:${U}${e(h)}${q})?${D}${H}${i}${j}${H}`;case"**/.*":return`(?:${U}${e(h)}${q})?${i}${j}${H}`;default:{let O=/^(.*?)\.(\w+)$/.exec(X);if(!O)return;let r=K(O[1]);if(!r)return;return r+i+O[2]}}},l=n.removePrefix(f,c),L=K(l);if(L&&h.strictSlashes!==!0)L+=`${q}?`;return L};f1.exports=y_});var y1=Q((xj,h1)=>{var E0=u("path"),X0=ph(),S_=_1(),w_=Zf(),L0=Wf(),B0=(f)=>f&&typeof f==="object"&&!Array.isArray(f),x=(f,_,h=!1)=>{if(Array.isArray(f)){let F=f.map(($)=>x($,_,h));return($)=>{for(let E of F){let Z=E($);if(Z)return Z}return!1}}let y=B0(f)&&f.tokens&&f.input;if(f===""||typeof f!=="string"&&!y)throw new TypeError("Expected pattern to be a non-empty string");let S=_||{},w=w_.isWindows(_),i=y?x.compileRe(f,_):x.makeRe(f,_,!1,!0),q=i.state;delete i.state;let j=()=>!1;if(S.ignore){let F={..._,ignore:null,onMatch:null,onResult:null};j=x(S.ignore,F,h)}let d=(F,W=!1)=>{let{isMatch:$,match:E,output:Z}=x.test(F,i,_,{glob:f,posix:w}),U={glob:f,state:q,regex:i,posix:w,input:F,output:Z,match:E,isMatch:$};if(typeof S.onResult==="function")S.onResult(U);if($===!1)return U.isMatch=!1,W?U:!1;if(j(F)){if(typeof S.onIgnore==="function")S.onIgnore(U);return U.isMatch=!1,W?U:!1}if(typeof S.onMatch==="function")S.onMatch(U);return W?U:!0};if(h)d.state=q;return d};x.test=(f,_,h,{glob:y,posix:S}={})=>{if(typeof f!=="string")throw new TypeError("Expected input to be a string");if(f==="")return{isMatch:!1,output:""};let w=h||{},i=w.format||(S?w_.toPosixSlashes:null),q=f===y,j=q&&i?i(f):f;if(q===!1)j=i?i(f):f,q=j===y;if(q===!1||w.capture===!0)if(w.matchBase===!0||w.basename===!0)q=x.matchBase(f,_,h,S);else q=_.exec(j);return{isMatch:Boolean(q),match:q,output:j}};x.matchBase=(f,_,h,y=w_.isWindows(h))=>{return(_ instanceof RegExp?_:x.makeRe(_,h)).test(E0.basename(f))};x.isMatch=(f,_,h)=>x(_,h)(f);x.parse=(f,_)=>{if(Array.isArray(f))return f.map((h)=>x.parse(h,_));return S_(f,{..._,fastpaths:!1})};x.scan=(f,_)=>X0(f,_);x.compileRe=(f,_,h=!1,y=!1)=>{if(h===!0)return f.output;let S=_||{},w=S.contains?"":"^",i=S.contains?"":"$",q=`${w}(?:${f.output})${i}`;if(f&&f.negated===!0)q=`^(?!${q}).*$`;let j=x.toRegex(q,_);if(y===!0)j.state=f;return j};x.makeRe=(f,_={},h=!1,y=!1)=>{if(!f||typeof f!=="string")throw new TypeError("Expected a non-empty string");let S={negated:!1,fastpaths:!0};if(_.fastpaths!==!1&&(f[0]==="."||f[0]==="*"))S.output=S_.fastpaths(f,_);if(!S.output)S=S_(f,_);return x.compileRe(S,_,h,y)};x.toRegex=(f,_)=>{try{let h=_||{};return new RegExp(f,h.flags||(h.nocase?"i":""))}catch(h){if(_&&_.debug===!0)throw h;return/$^/}};x.constants=L0;h1.exports=x});var $1=Q((Rj,F1)=>{var w1=u("util"),i1=Rh(),_f=y1(),i_=Zf(),S1=(f)=>f===""||f==="./",q1=(f)=>{let _=f.indexOf("{");return _>-1&&f.indexOf("}",_)>-1},g=(f,_,h)=>{_=[].concat(_),f=[].concat(f);let y=new Set,S=new Set,w=new Set,i=0,q=(F)=>{if(w.add(F.output),h&&h.onResult)h.onResult(F)};for(let F=0;F<_.length;F++){let W=_f(String(_[F]),{...h,onResult:q},!0),$=W.state.negated||W.state.negatedExtglob;if($)i++;for(let E of f){let Z=W(E,!0);if(!($?!Z.isMatch:Z.isMatch))continue;if($)y.add(Z.output);else y.delete(Z.output),S.add(Z.output)}}let d=(i===_.length?[...w]:[...S]).filter((F)=>!y.has(F));if(h&&d.length===0){if(h.failglob===!0)throw new Error(`No matches found for "${_.join(", ")}"`);if(h.nonull===!0||h.nullglob===!0)return h.unescape?_.map((F)=>F.replace(/\\/g,"")):_}return d};g.match=g;g.matcher=(f,_)=>_f(f,_);g.isMatch=(f,_,h)=>_f(_,h)(f);g.any=g.isMatch;g.not=(f,_,h={})=>{_=[].concat(_).map(String);let y=new Set,S=[],i=new Set(g(f,_,{...h,onResult:(q)=>{if(h.onResult)h.onResult(q);S.push(q.output)}}));for(let q of S)if(!i.has(q))y.add(q);return[...y]};g.contains=(f,_,h)=>{if(typeof f!=="string")throw new TypeError(`Expected a string: "${w1.inspect(f)}"`);if(Array.isArray(_))return _.some((y)=>g.contains(f,y,h));if(typeof _==="string"){if(S1(f)||S1(_))return!1;if(f.includes(_)||f.startsWith("./")&&f.slice(2).includes(_))return!0}return g.isMatch(f,_,{...h,contains:!0})};g.matchKeys=(f,_,h)=>{if(!i_.isObject(f))throw new TypeError("Expected the first argument to be an object");let y=g(Object.keys(f),_,h),S={};for(let w of y)S[w]=f[w];return S};g.some=(f,_,h)=>{let y=[].concat(f);for(let S of[].concat(_)){let w=_f(String(S),h);if(y.some((i)=>w(i)))return!0}return!1};g.every=(f,_,h)=>{let y=[].concat(f);for(let S of[].concat(_)){let w=_f(String(S),h);if(!y.every((i)=>w(i)))return!1}return!0};g.all=(f,_,h)=>{if(typeof f!=="string")throw new TypeError(`Expected a string: "${w1.inspect(f)}"`);return[].concat(_).every((y)=>_f(y,h)(f))};g.capture=(f,_,h)=>{let y=i_.isWindows(h),w=_f.makeRe(String(f),{...h,capture:!0}).exec(y?i_.toPosixSlashes(_):_);if(w)return w.slice(1).map((i)=>i===void 0?"":i)};g.makeRe=(...f)=>_f.makeRe(...f);g.scan=(...f)=>_f.scan(...f);g.parse=(f,_)=>{let h=[];for(let y of[].concat(f||[]))for(let S of i1(String(y),_))h.push(_f.parse(S,_));return h};g.braces=(f,_)=>{if(typeof f!=="string")throw new TypeError("Expected a string");if(_&&_.nobrace===!0||!q1(f))return[f];return i1(f,_)};g.braceExpand=(f,_)=>{if(typeof f!=="string")throw new TypeError("Expected a string");return g.braces(f,{..._,expand:!0})};g.hasBraces=q1;F1.exports=g});var E1=Q((Q1)=>{Object.defineProperty(Q1,"__esModule",{value:!0});Q1.isAbsolute=Q1.partitionAbsoluteAndRelative=Q1.removeDuplicateSlashes=Q1.matchAny=Q1.convertPatternsToRe=Q1.makeRe=Q1.getPatternParts=Q1.expandBraceExpansion=Q1.expandPatternsWithBraceExpansion=Q1.isAffectDepthOfReadingPattern=Q1.endsWithSlashGlobStar=Q1.hasGlobStar=Q1.getBaseDirectory=Q1.isPatternRelatedToParentDirectory=Q1.getPatternsOutsideCurrentDirectory=Q1.getPatternsInsideCurrentDirectory=Q1.getPositivePatterns=Q1.getNegativePatterns=Q1.isPositivePattern=Q1.isNegativePattern=Q1.convertToNegativePattern=Q1.convertToPositivePattern=Q1.isDynamicPattern=Q1.isStaticPattern=void 0;var j1=u("path"),K0=Sh(),q_=$1(),M1="**",I0="\\",D0=/[*?]|^!/,C0=/\[[^[]*]/,N0=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,O0=/[!*+?@]\([^(]*\)/,P0=/,|\.\./,G0=/(?!^)\/{2,}/g;function V1(f,_={}){return!d1(f,_)}Q1.isStaticPattern=V1;function d1(f,_={}){if(f==="")return!1;if(_.caseSensitiveMatch===!1||f.includes(I0))return!0;if(D0.test(f)||C0.test(f)||N0.test(f))return!0;if(_.extglob!==!1&&O0.test(f))return!0;if(_.braceExpansion!==!1&&g0(f))return!0;return!1}Q1.isDynamicPattern=d1;function g0(f){let _=f.indexOf("{");if(_===-1)return!1;let h=f.indexOf("}",_+1);if(h===-1)return!1;let y=f.slice(_,h);return P0.test(y)}function H0(f){return Nf(f)?f.slice(1):f}Q1.convertToPositivePattern=H0;function l0(f){return"!"+f}Q1.convertToNegativePattern=l0;function Nf(f){return f.startsWith("!")&&f[1]!=="("}Q1.isNegativePattern=Nf;function Y1(f){return!Nf(f)}Q1.isPositivePattern=Y1;function A0(f){return f.filter(Nf)}Q1.getNegativePatterns=A0;function T0(f){return f.filter(Y1)}Q1.getPositivePatterns=T0;function u0(f){return f.filter((_)=>!F_(_))}Q1.getPatternsInsideCurrentDirectory=u0;function x0(f){return f.filter(F_)}Q1.getPatternsOutsideCurrentDirectory=x0;function F_(f){return f.startsWith("..")||f.startsWith("./..")}Q1.isPatternRelatedToParentDirectory=F_;function R0(f){return K0(f,{flipBackslashes:!1})}Q1.getBaseDirectory=R0;function r0(f){return f.includes(M1)}Q1.hasGlobStar=r0;function W1(f){return f.endsWith("/"+M1)}Q1.endsWithSlashGlobStar=W1;function c0(f){let _=j1.basename(f);return W1(f)||V1(_)}Q1.isAffectDepthOfReadingPattern=c0;function m0(f){return f.reduce((_,h)=>{return _.concat(Z1(h))},[])}Q1.expandPatternsWithBraceExpansion=m0;function Z1(f){let _=q_.braces(f,{expand:!0,nodupes:!0,keepEscaping:!0});return _.sort((h,y)=>h.length-y.length),_.filter((h)=>h!=="")}Q1.expandBraceExpansion=Z1;function k0(f,_){let{parts:h}=q_.scan(f,Object.assign(Object.assign({},_),{parts:!0}));if(h.length===0)h=[f];if(h[0].startsWith("/"))h[0]=h[0].slice(1),h.unshift("");return h}Q1.getPatternParts=k0;function J1(f,_){return q_.makeRe(f,_)}Q1.makeRe=J1;function b0(f,_){return f.map((h)=>J1(h,_))}Q1.convertPatternsToRe=b0;function v0(f,_){return _.some((h)=>h.test(f))}Q1.matchAny=v0;function n0(f){return f.replace(G0,"/")}Q1.removeDuplicateSlashes=n0;function e0(f){let _=[],h=[];for(let y of f)if(U1(y))_.push(y);else h.push(y);return[_,h]}Q1.partitionAbsoluteAndRelative=e0;function U1(f){return j1.isAbsolute(f)}Q1.isAbsolute=U1});var K1=Q((cj,B1)=>{var Uq=u("stream"),X1=Uq.PassThrough,Qq=Array.prototype.slice;B1.exports=zq;function zq(){let f=[],_=Qq.call(arguments),h=!1,y=_[_.length-1];if(y&&!Array.isArray(y)&&y.pipe==null)_.pop();else y={};let S=y.end!==!1,w=y.pipeError===!0;if(y.objectMode==null)y.objectMode=!0;if(y.highWaterMark==null)y.highWaterMark=65536;let i=X1(y);function q(){for(let F=0,W=arguments.length;F<W;F++)f.push(L1(arguments[F],y));return j(),this}function j(){if(h)return;h=!0;let F=f.shift();if(!F){process.nextTick(d);return}if(!Array.isArray(F))F=[F];let W=F.length+1;function $(){if(--W>0)return;h=!1,j()}function E(Z){function U(){if(Z.removeListener("merge2UnpipeEnd",U),Z.removeListener("end",U),w)Z.removeListener("error",D);$()}function D(C){i.emit("error",C)}if(Z._readableState.endEmitted)return $();if(Z.on("merge2UnpipeEnd",U),Z.on("end",U),w)Z.on("error",D);Z.pipe(i,{end:!1}),Z.resume()}for(let Z=0;Z<F.length;Z++)E(F[Z]);$()}function d(){if(h=!1,i.emit("queueDrain"),S)i.end()}if(i.setMaxListeners(0),i.add=q,i.on("unpipe",function(F){F.emit("merge2UnpipeEnd")}),_.length)q.apply(null,_);return i}function L1(f,_){if(!Array.isArray(f)){if(!f._readableState&&f.pipe)f=f.pipe(X1(_));if(!f._readableState||!f.pause||!f.pipe)throw new Error("Only readable stream can be merged.");f.pause()}else for(let h=0,y=f.length;h<y;h++)f[h]=L1(f[h],_);return f}});var N1=Q((D1)=>{Object.defineProperty(D1,"__esModule",{value:!0});D1.merge=void 0;var Eq=K1();function Xq(f){let _=Eq(f);return f.forEach((h)=>{h.once("error",(y)=>_.emit("error",y))}),_.once("close",()=>I1(f)),_.once("end",()=>I1(f)),_}D1.merge=Xq;function I1(f){f.forEach((_)=>_.emit("close"))}});var G1=Q((O1)=>{Object.defineProperty(O1,"__esModule",{value:!0});O1.isEmpty=O1.isString=void 0;function Lq(f){return typeof f==="string"}O1.isString=Lq;function Bq(f){return f===""}O1.isEmpty=Bq});var hf=Q((g1)=>{Object.defineProperty(g1,"__esModule",{value:!0});g1.string=g1.stream=g1.pattern=g1.path=g1.fs=g1.errno=g1.array=void 0;var Iq=u_();g1.array=Iq;var Dq=r_();g1.errno=Dq;var Cq=b_();g1.fs=Cq;var Nq=a_();g1.path=Nq;var Oq=E1();g1.pattern=Oq;var Pq=N1();g1.stream=Pq;var Gq=G1();g1.string=Gq});var R1=Q((u1)=>{Object.defineProperty(u1,"__esModule",{value:!0});u1.convertPatternGroupToTask=u1.convertPatternGroupsToTasks=u1.groupPatternsByBaseDirectory=u1.getNegativePatternsAsPositive=u1.getPositivePatterns=u1.convertPatternsToTasks=u1.generate=void 0;var a=hf();function xq(f,_){let h=l1(f,_),y=l1(_.ignore,_),S=A1(h),w=T1(h,y),i=S.filter((F)=>a.pattern.isStaticPattern(F,_)),q=S.filter((F)=>a.pattern.isDynamicPattern(F,_)),j=$_(i,w,!1),d=$_(q,w,!0);return j.concat(d)}u1.generate=xq;function l1(f,_){let h=f;if(_.braceExpansion)h=a.pattern.expandPatternsWithBraceExpansion(h);if(_.baseNameMatch)h=h.map((y)=>y.includes("/")?y:`**/${y}`);return h.map((y)=>a.pattern.removeDuplicateSlashes(y))}function $_(f,_,h){let y=[],S=a.pattern.getPatternsOutsideCurrentDirectory(f),w=a.pattern.getPatternsInsideCurrentDirectory(f),i=j_(S),q=j_(w);if(y.push(...M_(i,_,h)),"."in q)y.push(V_(".",w,_,h));else y.push(...M_(q,_,h));return y}u1.convertPatternsToTasks=$_;function A1(f){return a.pattern.getPositivePatterns(f)}u1.getPositivePatterns=A1;function T1(f,_){return a.pattern.getNegativePatterns(f).concat(_).map(a.pattern.convertToPositivePattern)}u1.getNegativePatternsAsPositive=T1;function j_(f){let _={};return f.reduce((h,y)=>{let S=a.pattern.getBaseDirectory(y);if(S in h)h[S].push(y);else h[S]=[y];return h},_)}u1.groupPatternsByBaseDirectory=j_;function M_(f,_,h){return Object.keys(f).map((y)=>{return V_(y,f[y],_,h)})}u1.convertPatternGroupsToTasks=M_;function V_(f,_,h,y){return{dynamic:y,positive:_,negative:h,base:f,patterns:[].concat(_,h.map(a.pattern.convertToNegativePattern))}}u1.convertPatternGroupToTask=V_});var k1=Q((c1)=>{Object.defineProperty(c1,"__esModule",{value:!0});c1.read=void 0;function vq(f,_,h){_.fs.lstat(f,(y,S)=>{if(y!==null){r1(h,y);return}if(!S.isSymbolicLink()||!_.followSymbolicLink){d_(h,S);return}_.fs.stat(f,(w,i)=>{if(w!==null){if(_.throwErrorOnBrokenSymbolicLink){r1(h,w);return}d_(h,S);return}if(_.markSymbolicLink)i.isSymbolicLink=()=>!0;d_(h,i)})})}c1.read=vq;function r1(f,_){f(_)}function d_(f,_){f(null,_)}});var n1=Q((b1)=>{Object.defineProperty(b1,"__esModule",{value:!0});b1.read=void 0;function nq(f,_){let h=_.fs.lstatSync(f);if(!h.isSymbolicLink()||!_.followSymbolicLink)return h;try{let y=_.fs.statSync(f);if(_.markSymbolicLink)y.isSymbolicLink=()=>!0;return y}catch(y){if(!_.throwErrorOnBrokenSymbolicLink)return h;throw y}}b1.read=nq});var o1=Q((e1)=>{Object.defineProperty(e1,"__esModule",{value:!0});e1.createFileSystemAdapter=e1.FILE_SYSTEM_ADAPTER=void 0;var Of=u("fs");e1.FILE_SYSTEM_ADAPTER={lstat:Of.lstat,stat:Of.stat,lstatSync:Of.lstatSync,statSync:Of.statSync};function eq(f){if(f===void 0)return e1.FILE_SYSTEM_ADAPTER;return Object.assign(Object.assign({},e1.FILE_SYSTEM_ADAPTER),f)}e1.createFileSystemAdapter=eq});var t1=Q((p1)=>{Object.defineProperty(p1,"__esModule",{value:!0});var sq=o1();class a1{constructor(f={}){this._options=f,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=sq.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(f,_){return f!==null&&f!==void 0?f:_}}p1.default=a1});var $f=Q((_y)=>{Object.defineProperty(_y,"__esModule",{value:!0});_y.statSync=_y.stat=_y.Settings=void 0;var fy=k1(),aq=n1(),W_=t1();_y.Settings=W_.default;function pq(f,_,h){if(typeof _==="function"){fy.read(f,Z_(),_);return}fy.read(f,Z_(_),h)}_y.stat=pq;function tq(f,_){let h=Z_(_);return aq.read(f,h)}_y.statSync=tq;function Z_(f={}){if(f instanceof W_.default)return f;return new W_.default(f)}});var wy=Q((pj,Sy)=>{/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var yy;Sy.exports=typeof queueMicrotask==="function"?queueMicrotask.bind(typeof window!=="undefined"?window:global):(f)=>(yy||(yy=Promise.resolve())).then(f).catch((_)=>setTimeout(()=>{throw _},0))});var qy=Q((tj,iy)=>{/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */iy.exports=yF;var hF=wy();function yF(f,_){let h,y,S,w=!0;if(Array.isArray(f))h=[],y=f.length;else S=Object.keys(f),h={},y=S.length;function i(j){function d(){if(_)_(j,h);_=null}if(w)hF(d);else d()}function q(j,d,F){if(h[j]=F,--y===0||d)i(d)}if(!y)i(null);else if(S)S.forEach(function(j){f[j](function(d,F){q(j,d,F)})});else f.forEach(function(j,d){j(function(F,W){q(d,F,W)})});w=!1}});var J_=Q((jy)=>{Object.defineProperty(jy,"__esModule",{value:!0});jy.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var Pf=process.versions.node.split(".");if(Pf[0]===void 0||Pf[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var Fy=Number.parseInt(Pf[0],10),SF=Number.parseInt(Pf[1],10),$y=10,wF=10,iF=Fy>$y,qF=Fy===$y&&SF>=wF;jy.IS_SUPPORT_READDIR_WITH_FILE_TYPES=iF||qF});var Wy=Q((dy)=>{Object.defineProperty(dy,"__esModule",{value:!0});dy.createDirentFromStats=void 0;class Vy{constructor(f,_){this.name=f,this.isBlockDevice=_.isBlockDevice.bind(_),this.isCharacterDevice=_.isCharacterDevice.bind(_),this.isDirectory=_.isDirectory.bind(_),this.isFIFO=_.isFIFO.bind(_),this.isFile=_.isFile.bind(_),this.isSocket=_.isSocket.bind(_),this.isSymbolicLink=_.isSymbolicLink.bind(_)}}function FF(f,_){return new Vy(f,_)}dy.createDirentFromStats=FF});var U_=Q((Zy)=>{Object.defineProperty(Zy,"__esModule",{value:!0});Zy.fs=void 0;var $F=Wy();Zy.fs=$F});var Q_=Q((Uy)=>{Object.defineProperty(Uy,"__esModule",{value:!0});Uy.joinPathSegments=void 0;function jF(f,_,h){if(f.endsWith(h))return f+_;return f+h+_}Uy.joinPathSegments=jF});var Dy=Q((Ky)=>{Object.defineProperty(Ky,"__esModule",{value:!0});Ky.readdir=Ky.readdirWithFileTypes=Ky.read=void 0;var MF=$f(),zy=qy(),VF=J_(),Ey=U_(),Xy=Q_();function dF(f,_,h){if(!_.stats&&VF.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Ly(f,_,h);return}By(f,_,h)}Ky.read=dF;function Ly(f,_,h){_.fs.readdir(f,{withFileTypes:!0},(y,S)=>{if(y!==null){Gf(h,y);return}let w=S.map((q)=>({dirent:q,name:q.name,path:Xy.joinPathSegments(f,q.name,_.pathSegmentSeparator)}));if(!_.followSymbolicLinks){z_(h,w);return}let i=w.map((q)=>YF(q,_));zy(i,(q,j)=>{if(q!==null){Gf(h,q);return}z_(h,j)})})}Ky.readdirWithFileTypes=Ly;function YF(f,_){return(h)=>{if(!f.dirent.isSymbolicLink()){h(null,f);return}_.fs.stat(f.path,(y,S)=>{if(y!==null){if(_.throwErrorOnBrokenSymbolicLink){h(y);return}h(null,f);return}f.dirent=Ey.fs.createDirentFromStats(f.name,S),h(null,f)})}}function By(f,_,h){_.fs.readdir(f,(y,S)=>{if(y!==null){Gf(h,y);return}let w=S.map((i)=>{let q=Xy.joinPathSegments(f,i,_.pathSegmentSeparator);return(j)=>{MF.stat(q,_.fsStatSettings,(d,F)=>{if(d!==null){j(d);return}let W={name:i,path:q,dirent:Ey.fs.createDirentFromStats(i,F)};if(_.stats)W.stats=F;j(null,W)})}});zy(w,(i,q)=>{if(i!==null){Gf(h,i);return}z_(h,q)})})}Ky.readdir=By;function Gf(f,_){f(_)}function z_(f,_){f(null,_)}});var Hy=Q((Gy)=>{Object.defineProperty(Gy,"__esModule",{value:!0});Gy.readdir=Gy.readdirWithFileTypes=Gy.read=void 0;var JF=$f(),UF=J_(),Cy=U_(),Ny=Q_();function QF(f,_){if(!_.stats&&UF.IS_SUPPORT_READDIR_WITH_FILE_TYPES)return Oy(f,_);return Py(f,_)}Gy.read=QF;function Oy(f,_){return _.fs.readdirSync(f,{withFileTypes:!0}).map((y)=>{let S={dirent:y,name:y.name,path:Ny.joinPathSegments(f,y.name,_.pathSegmentSeparator)};if(S.dirent.isSymbolicLink()&&_.followSymbolicLinks)try{let w=_.fs.statSync(S.path);S.dirent=Cy.fs.createDirentFromStats(S.name,w)}catch(w){if(_.throwErrorOnBrokenSymbolicLink)throw w}return S})}Gy.readdirWithFileTypes=Oy;function Py(f,_){return _.fs.readdirSync(f).map((y)=>{let S=Ny.joinPathSegments(f,y,_.pathSegmentSeparator),w=JF.statSync(S,_.fsStatSettings),i={name:y,path:S,dirent:Cy.fs.createDirentFromStats(y,w)};if(_.stats)i.stats=w;return i})}Gy.readdir=Py});var Ty=Q((ly)=>{Object.defineProperty(ly,"__esModule",{value:!0});ly.createFileSystemAdapter=ly.FILE_SYSTEM_ADAPTER=void 0;var Vf=u("fs");ly.FILE_SYSTEM_ADAPTER={lstat:Vf.lstat,stat:Vf.stat,lstatSync:Vf.lstatSync,statSync:Vf.statSync,readdir:Vf.readdir,readdirSync:Vf.readdirSync};function XF(f){if(f===void 0)return ly.FILE_SYSTEM_ADAPTER;return Object.assign(Object.assign({},ly.FILE_SYSTEM_ADAPTER),f)}ly.createFileSystemAdapter=XF});var Ry=Q((xy)=>{Object.defineProperty(xy,"__esModule",{value:!0});var LF=u("path"),BF=$f(),KF=Ty();class uy{constructor(f={}){this._options=f,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=KF.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,LF.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new BF.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(f,_){return f!==null&&f!==void 0?f:_}}xy.default=uy});var gf=Q((cy)=>{Object.defineProperty(cy,"__esModule",{value:!0});cy.Settings=cy.scandirSync=cy.scandir=void 0;var ry=Dy(),DF=Hy(),X_=Ry();cy.Settings=X_.default;function CF(f,_,h){if(typeof _==="function"){ry.read(f,L_(),_);return}ry.read(f,L_(_),h)}cy.scandir=CF;function NF(f,_){let h=L_(_);return DF.read(f,h)}cy.scandirSync=NF;function L_(f={}){if(f instanceof X_.default)return f;return new X_.default(f)}});var by=Q(($M,ky)=>{function GF(f){var _=new f,h=_;function y(){var w=_;if(w.next)_=w.next;else _=new f,h=_;return w.next=null,w}function S(w){h.next=w,h=w}return{get:y,release:S}}ky.exports=GF});var ny=Q((jM,B_)=>{var gF=by();function vy(f,_,h){if(typeof f==="function")h=_,_=f,f=null;if(!(h>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var y=gF(HF),S=null,w=null,i=0,q=null,j={push:U,drain:s,saturated:s,pause:F,paused:!1,get concurrency(){return h},set concurrency(K){if(!(K>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(h=K,j.paused)return;for(;S&&i<h;)i++,C()},running:d,resume:E,idle:Z,length:W,getQueue:$,unshift:D,empty:s,kill:c,killAndDrain:H,error:e};return j;function d(){return i}function F(){j.paused=!0}function W(){var K=S,l=0;while(K)K=K.next,l++;return l}function $(){var K=S,l=[];while(K)l.push(K.value),K=K.next;return l}function E(){if(!j.paused)return;if(j.paused=!1,S===null){i++,C();return}for(;S&&i<h;)i++,C()}function Z(){return i===0&&j.length()===0}function U(K,l){var L=y.get();if(L.context=f,L.release=C,L.value=K,L.callback=l||s,L.errorHandler=q,i>=h||j.paused)if(w)w.next=L,w=L;else S=L,w=L,j.saturated();else i++,_.call(f,L.value,L.worked)}function D(K,l){var L=y.get();if(L.context=f,L.release=C,L.value=K,L.callback=l||s,L.errorHandler=q,i>=h||j.paused)if(S)L.next=S,S=L;else S=L,w=L,j.saturated();else i++,_.call(f,L.value,L.worked)}function C(K){if(K)y.release(K);var l=S;if(l&&i<=h)if(!j.paused){if(w===S)w=null;if(S=l.next,l.next=null,_.call(f,l.value,l.worked),w===null)j.empty()}else i--;else if(--i===0)j.drain()}function c(){S=null,w=null,j.drain=s}function H(){S=null,w=null,j.drain(),j.drain=s}function e(K){q=K}}function s(){}function HF(){this.value=null,this.callback=s,this.next=null,this.release=s,this.context=null,this.errorHandler=null;var f=this;this.worked=function _(h,y){var{callback:S,errorHandler:w,value:i}=f;if(f.value=null,f.callback=s,f.errorHandler)w(h,i);S.call(f.context,h,y),f.release(f)}}function lF(f,_,h){if(typeof f==="function")h=_,_=f,f=null;function y(F,W){_.call(this,F).then(function($){W(null,$)},W)}var S=vy(f,y,h),w=S.push,i=S.unshift;return S.push=q,S.unshift=j,S.drained=d,S;function q(F){var W=new Promise(function($,E){w(F,function(Z,U){if(Z){E(Z);return}$(U)})});return W.catch(s),W}function j(F){var W=new Promise(function($,E){i(F,function(Z,U){if(Z){E(Z);return}$(U)})});return W.catch(s),W}function d(){var F=new Promise(function(W){process.nextTick(function(){if(S.idle())W();else{var $=S.drain;S.drain=function(){if(typeof $==="function")$();W(),S.drain=$}}})});return F}}B_.exports=vy;B_.exports.promise=lF});var Hf=Q((ey)=>{Object.defineProperty(ey,"__esModule",{value:!0});ey.joinPathSegments=ey.replacePathSegmentSeparator=ey.isAppliedFilter=ey.isFatalError=void 0;function AF(f,_){if(f.errorFilter===null)return!0;return!f.errorFilter(_)}ey.isFatalError=AF;function TF(f,_){return f===null||f(_)}ey.isAppliedFilter=TF;function uF(f,_){return f.split(/[/\\]/).join(_)}ey.replacePathSegmentSeparator=uF;function xF(f,_,h){if(f==="")return _;if(f.endsWith(h))return f+_;return f+h+_}ey.joinPathSegments=xF});var K_=Q((ay)=>{Object.defineProperty(ay,"__esModule",{value:!0});var mF=Hf();class oy{constructor(f,_){this._root=f,this._settings=_,this._root=mF.replacePathSegmentSeparator(f,_.pathSegmentSeparator)}}ay.default=oy});var I_=Q((ty)=>{Object.defineProperty(ty,"__esModule",{value:!0});var bF=u("events"),vF=gf(),nF=ny(),lf=Hf(),eF=K_();class py extends eF.default{constructor(f,_){super(f,_);this._settings=_,this._scandir=vF.scandir,this._emitter=new bF.EventEmitter,this._queue=nF(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{if(!this._isFatalError)this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(f){this._emitter.on("entry",f)}onError(f){this._emitter.once("error",f)}onEnd(f){this._emitter.once("end",f)}_pushToQueue(f,_){let h={directory:f,base:_};this._queue.push(h,(y)=>{if(y!==null)this._handleError(y)})}_worker(f,_){this._scandir(f.directory,this._settings.fsScandirSettings,(h,y)=>{if(h!==null){_(h,void 0);return}for(let S of y)this._handleEntry(S,f.base);_(null,void 0)})}_handleError(f){if(this._isDestroyed||!lf.isFatalError(this._settings,f))return;this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",f)}_handleEntry(f,_){if(this._isDestroyed||this._isFatalError)return;let h=f.path;if(_!==void 0)f.path=lf.joinPathSegments(_,f.name,this._settings.pathSegmentSeparator);if(lf.isAppliedFilter(this._settings.entryFilter,f))this._emitEntry(f);if(f.dirent.isDirectory()&&lf.isAppliedFilter(this._settings.deepFilter,f))this._pushToQueue(h,_===void 0?void 0:f.path)}_emitEntry(f){this._emitter.emit("entry",f)}}ty.default=py});var hS=Q((_S)=>{Object.defineProperty(_S,"__esModule",{value:!0});var oF=I_();class fS{constructor(f,_){this._root=f,this._settings=_,this._reader=new oF.default(this._root,this._settings),this._storage=[]}read(f){this._reader.onError((_)=>{aF(f,_)}),this._reader.onEntry((_)=>{this._storage.push(_)}),this._reader.onEnd(()=>{pF(f,this._storage)}),this._reader.read()}}_S.default=fS;function aF(f,_){f(_)}function pF(f,_){f(null,_)}});var wS=Q((SS)=>{Object.defineProperty(SS,"__esModule",{value:!0});var f$=u("stream"),_$=I_();class yS{constructor(f,_){this._root=f,this._settings=_,this._reader=new _$.default(this._root,this._settings),this._stream=new f$.Readable({objectMode:!0,read:()=>{},destroy:()=>{if(!this._reader.isDestroyed)this._reader.destroy()}})}read(){return this._reader.onError((f)=>{this._stream.emit("error",f)}),this._reader.onEntry((f)=>{this._stream.push(f)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}}SS.default=yS});var FS=Q((qS)=>{Object.defineProperty(qS,"__esModule",{value:!0});var y$=gf(),Af=Hf(),S$=K_();class iS extends S$.default{constructor(){super(...arguments);this._scandir=y$.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(f,_){this._queue.add({directory:f,base:_})}_handleQueue(){for(let f of this._queue.values())this._handleDirectory(f.directory,f.base)}_handleDirectory(f,_){try{let h=this._scandir(f,this._settings.fsScandirSettings);for(let y of h)this._handleEntry(y,_)}catch(h){this._handleError(h)}}_handleError(f){if(!Af.isFatalError(this._settings,f))return;throw f}_handleEntry(f,_){let h=f.path;if(_!==void 0)f.path=Af.joinPathSegments(_,f.name,this._settings.pathSegmentSeparator);if(Af.isAppliedFilter(this._settings.entryFilter,f))this._pushToStorage(f);if(f.dirent.isDirectory()&&Af.isAppliedFilter(this._settings.deepFilter,f))this._pushToQueue(h,_===void 0?void 0:f.path)}_pushToStorage(f){this._storage.push(f)}}qS.default=iS});var MS=Q((jS)=>{Object.defineProperty(jS,"__esModule",{value:!0});var i$=FS();class $S{constructor(f,_){this._root=f,this._settings=_,this._reader=new i$.default(this._root,this._settings)}read(){return this._reader.read()}}jS.default=$S});var YS=Q((dS)=>{Object.defineProperty(dS,"__esModule",{value:!0});var F$=u("path"),$$=gf();class VS{constructor(f={}){this._options=f,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,F$.sep),this.fsScandirSettings=new $$.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(f,_){return f!==null&&f!==void 0?f:_}}dS.default=VS});var uf=Q((ZS)=>{Object.defineProperty(ZS,"__esModule",{value:!0});ZS.Settings=ZS.walkStream=ZS.walkSync=ZS.walk=void 0;var WS=hS(),M$=wS(),V$=MS(),D_=YS();ZS.Settings=D_.default;function d$(f,_,h){if(typeof _==="function"){new WS.default(f,Tf()).read(_);return}new WS.default(f,Tf(_)).read(h)}ZS.walk=d$;function Y$(f,_){let h=Tf(_);return new V$.default(f,h).read()}ZS.walkSync=Y$;function W$(f,_){let h=Tf(_);return new M$.default(f,h).read()}ZS.walkStream=W$;function Tf(f={}){if(f instanceof D_.default)return f;return new D_.default(f)}});var xf=Q((zS)=>{Object.defineProperty(zS,"__esModule",{value:!0});var Q$=u("path"),z$=$f(),US=hf();class QS{constructor(f){this._settings=f,this._fsStatSettings=new z$.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(f){return Q$.resolve(this._settings.cwd,f)}_makeEntry(f,_){let h={name:_,path:_,dirent:US.fs.createDirentFromStats(_,f)};if(this._settings.stats)h.stats=f;return h}_isFatalError(f){return!US.errno.isEnoentCodeError(f)&&!this._settings.suppressErrors}}zS.default=QS});var C_=Q((XS)=>{Object.defineProperty(XS,"__esModule",{value:!0});var X$=u("stream"),L$=$f(),B$=uf(),K$=xf();class ES extends K$.default{constructor(){super(...arguments);this._walkStream=B$.walkStream,this._stat=L$.stat}dynamic(f,_){return this._walkStream(f,_)}static(f,_){let h=f.map(this._getFullEntryPath,this),y=new X$.PassThrough({objectMode:!0});y._write=(S,w,i)=>{return this._getEntry(h[S],f[S],_).then((q)=>{if(q!==null&&_.entryFilter(q))y.push(q);if(S===h.length-1)y.end();i()}).catch(i)};for(let S=0;S<h.length;S++)y.write(S);return y}_getEntry(f,_,h){return this._getStat(f).then((y)=>this._makeEntry(y,_)).catch((y)=>{if(h.errorFilter(y))return null;throw y})}_getStat(f){return new Promise((_,h)=>{this._stat(f,this._fsStatSettings,(y,S)=>{return y===null?_(S):h(y)})})}}XS.default=ES});var KS=Q((BS)=>{Object.defineProperty(BS,"__esModule",{value:!0});var D$=uf(),C$=xf(),N$=C_();class LS extends C$.default{constructor(){super(...arguments);this._walkAsync=D$.walk,this._readerStream=new N$.default(this._settings)}dynamic(f,_){return new Promise((h,y)=>{this._walkAsync(f,_,(S,w)=>{if(S===null)h(w);else y(S)})})}async static(f,_){let h=[],y=this._readerStream.static(f,_);return new Promise((S,w)=>{y.once("error",w),y.on("data",(i)=>h.push(i)),y.once("end",()=>S(h))})}}BS.default=LS});var CS=Q((DS)=>{Object.defineProperty(DS,"__esModule",{value:!0});var Uf=hf();class IS{constructor(f,_,h){this._patterns=f,this._settings=_,this._micromatchOptions=h,this._storage=[],this._fillStorage()}_fillStorage(){for(let f of this._patterns){let _=this._getPatternSegments(f),h=this._splitSegmentsIntoSections(_);this._storage.push({complete:h.length<=1,pattern:f,segments:_,sections:h})}}_getPatternSegments(f){return Uf.pattern.getPatternParts(f,this._micromatchOptions).map((h)=>{if(!Uf.pattern.isDynamicPattern(h,this._settings))return{dynamic:!1,pattern:h};return{dynamic:!0,pattern:h,patternRe:Uf.pattern.makeRe(h,this._micromatchOptions)}})}_splitSegmentsIntoSections(f){return Uf.array.splitWhen(f,(_)=>_.dynamic&&Uf.pattern.hasGlobStar(_.pattern))}}DS.default=IS});var PS=Q((OS)=>{Object.defineProperty(OS,"__esModule",{value:!0});var G$=CS();class NS extends G$.default{match(f){let _=f.split("/"),h=_.length,y=this._storage.filter((S)=>!S.complete||S.segments.length>h);for(let S of y){let w=S.sections[0];if(!S.complete&&h>w.length)return!0;if(_.every((q,j)=>{let d=S.segments[j];if(d.dynamic&&d.patternRe.test(q))return!0;if(!d.dynamic&&d.pattern===q)return!0;return!1}))return!0}return!1}}OS.default=NS});var HS=Q((gS)=>{Object.defineProperty(gS,"__esModule",{value:!0});var Rf=hf(),H$=PS();class GS{constructor(f,_){this._settings=f,this._micromatchOptions=_}getFilter(f,_,h){let y=this._getMatcher(_),S=this._getNegativePatternsRe(h);return(w)=>this._filter(f,w,y,S)}_getMatcher(f){return new H$.default(f,this._settings,this._micromatchOptions)}_getNegativePatternsRe(f){let _=f.filter(Rf.pattern.isAffectDepthOfReadingPattern);return Rf.pattern.convertPatternsToRe(_,this._micromatchOptions)}_filter(f,_,h,y){if(this._isSkippedByDeep(f,_.path))return!1;if(this._isSkippedSymbolicLink(_))return!1;let S=Rf.path.removeLeadingDotSegment(_.path);if(this._isSkippedByPositivePatterns(S,h))return!1;return this._isSkippedByNegativePatterns(S,y)}_isSkippedByDeep(f,_){if(this._settings.deep===1/0)return!1;return this._getEntryLevel(f,_)>=this._settings.deep}_getEntryLevel(f,_){let h=_.split("/").length;if(f==="")return h;let y=f.split("/").length;return h-y}_isSkippedSymbolicLink(f){return!this._settings.followSymbolicLinks&&f.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(f,_){return!this._settings.baseNameMatch&&!_.match(f)}_isSkippedByNegativePatterns(f,_){return!Rf.pattern.matchAny(f,_)}}gS.default=GS});var TS=Q((AS)=>{Object.defineProperty(AS,"__esModule",{value:!0});var Sf=hf();class lS{constructor(f,_){this._settings=f,this._micromatchOptions=_,this.index=new Map}getFilter(f,_){let[h,y]=Sf.pattern.partitionAbsoluteAndRelative(_),S={positive:{all:Sf.pattern.convertPatternsToRe(f,this._micromatchOptions)},negative:{absolute:Sf.pattern.convertPatternsToRe(h,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Sf.pattern.convertPatternsToRe(y,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return(w)=>this._filter(w,S)}_filter(f,_){let h=Sf.path.removeLeadingDotSegment(f.path);if(this._settings.unique&&this._isDuplicateEntry(h))return!1;if(this._onlyFileFilter(f)||this._onlyDirectoryFilter(f))return!1;let y=this._isMatchToPatternsSet(h,_,f.dirent.isDirectory());if(this._settings.unique&&y)this._createIndexRecord(h);return y}_isDuplicateEntry(f){return this.index.has(f)}_createIndexRecord(f){this.index.set(f,void 0)}_onlyFileFilter(f){return this._settings.onlyFiles&&!f.dirent.isFile()}_onlyDirectoryFilter(f){return this._settings.onlyDirectories&&!f.dirent.isDirectory()}_isMatchToPatternsSet(f,_,h){if(!this._isMatchToPatterns(f,_.positive.all,h))return!1;if(this._isMatchToPatterns(f,_.negative.relative,h))return!1;if(this._isMatchToAbsoluteNegative(f,_.negative.absolute,h))return!1;return!0}_isMatchToAbsoluteNegative(f,_,h){if(_.length===0)return!1;let y=Sf.path.makeAbsolute(this._settings.cwd,f);return this._isMatchToPatterns(y,_,h)}_isMatchToPatterns(f,_,h){if(_.length===0)return!1;let y=Sf.pattern.matchAny(f,_);if(!y&&h)return Sf.pattern.matchAny(f+"/",_);return y}}AS.default=lS});var RS=Q((xS)=>{Object.defineProperty(xS,"__esModule",{value:!0});var T$=hf();class uS{constructor(f){this._settings=f}getFilter(){return(f)=>this._isNonFatalError(f)}_isNonFatalError(f){return T$.errno.isEnoentCodeError(f)||this._settings.suppressErrors}}xS.default=uS});var kS=Q((mS)=>{Object.defineProperty(mS,"__esModule",{value:!0});var rS=hf();class cS{constructor(f){this._settings=f}getTransformer(){return(f)=>this._transform(f)}_transform(f){let _=f.path;if(this._settings.absolute)_=rS.path.makeAbsolute(this._settings.cwd,_),_=rS.path.unixify(_);if(this._settings.markDirectories&&f.dirent.isDirectory())_+="/";if(!this._settings.objectMode)return _;return Object.assign(Object.assign({},f),{path:_})}}mS.default=cS});var rf=Q((vS)=>{Object.defineProperty(vS,"__esModule",{value:!0});var R$=u("path"),r$=HS(),c$=TS(),m$=RS(),k$=kS();class bS{constructor(f){this._settings=f,this.errorFilter=new m$.default(this._settings),this.entryFilter=new c$.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new r$.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new k$.default(this._settings)}_getRootDirectory(f){return R$.resolve(this._settings.cwd,f.base)}_getReaderOptions(f){let _=f.base==="."?"":f.base;return{basePath:_,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(_,f.positive,f.negative),entryFilter:this.entryFilter.getFilter(f.positive,f.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}}vS.default=bS});var sS=Q((eS)=>{Object.defineProperty(eS,"__esModule",{value:!0});var v$=KS(),n$=rf();class nS extends n$.default{constructor(){super(...arguments);this._reader=new v$.default(this._settings)}async read(f){let _=this._getRootDirectory(f),h=this._getReaderOptions(f);return(await this.api(_,f,h)).map((S)=>h.transform(S))}api(f,_,h){if(_.dynamic)return this._reader.dynamic(f,h);return this._reader.static(_.patterns,h)}}eS.default=nS});var pS=Q((aS)=>{Object.defineProperty(aS,"__esModule",{value:!0});var s$=u("stream"),o$=C_(),a$=rf();class oS extends a$.default{constructor(){super(...arguments);this._reader=new o$.default(this._settings)}read(f){let _=this._getRootDirectory(f),h=this._getReaderOptions(f),y=this.api(_,f,h),S=new s$.Readable({objectMode:!0,read:()=>{}});return y.once("error",(w)=>S.emit("error",w)).on("data",(w)=>S.emit("data",h.transform(w))).once("end",()=>S.emit("end")),S.once("close",()=>y.destroy()),S}api(f,_,h){if(_.dynamic)return this._reader.dynamic(f,h);return this._reader.static(_.patterns,h)}}aS.default=oS});var _w=Q((fw)=>{Object.defineProperty(fw,"__esModule",{value:!0});var t$=$f(),fj=uf(),_j=xf();class tS extends _j.default{constructor(){super(...arguments);this._walkSync=fj.walkSync,this._statSync=t$.statSync}dynamic(f,_){return this._walkSync(f,_)}static(f,_){let h=[];for(let y of f){let S=this._getFullEntryPath(y),w=this._getEntry(S,y,_);if(w===null||!_.entryFilter(w))continue;h.push(w)}return h}_getEntry(f,_,h){try{let y=this._getStat(f);return this._makeEntry(y,_)}catch(y){if(h.errorFilter(y))return null;throw y}}_getStat(f){return this._statSync(f,this._fsStatSettings)}}fw.default=tS});var Sw=Q((yw)=>{Object.defineProperty(yw,"__esModule",{value:!0});var yj=_w(),Sj=rf();class hw extends Sj.default{constructor(){super(...arguments);this._reader=new yj.default(this._settings)}read(f){let _=this._getRootDirectory(f),h=this._getReaderOptions(f);return this.api(_,f,h).map(h.transform)}api(f,_,h){if(_.dynamic)return this._reader.dynamic(f,h);return this._reader.static(_.patterns,h)}}yw.default=hw});var qw=Q((iw)=>{Object.defineProperty(iw,"__esModule",{value:!0});iw.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var df=u("fs"),ij=u("os"),qj=Math.max(ij.cpus().length,1);iw.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:df.lstat,lstatSync:df.lstatSync,stat:df.stat,statSync:df.statSync,readdir:df.readdir,readdirSync:df.readdirSync};class ww{constructor(f={}){if(this._options=f,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,qj),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories)this.onlyFiles=!1;if(this.stats)this.objectMode=!0;this.ignore=[].concat(this.ignore)}_getValue(f,_){return f===void 0?_:f}_getFileSystemMethods(f={}){return Object.assign(Object.assign({},iw.DEFAULT_FILE_SYSTEM_ADAPTER),f)}}iw.default=ww});var jw=Q((lM,$w)=>{var Fw=R1(),$j=sS(),jj=pS(),Mj=Sw(),O_=qw(),o=hf();async function P_(f,_){p(f);let h=G_(f,$j.default,_),y=await Promise.all(h);return o.array.flatten(y)}(function(f){f.glob=f,f.globSync=_,f.globStream=h,f.async=f;function _(d,F){p(d);let W=G_(d,Mj.default,F);return o.array.flatten(W)}f.sync=_;function h(d,F){p(d);let W=G_(d,jj.default,F);return o.stream.merge(W)}f.stream=h;function y(d,F){p(d);let W=[].concat(d),$=new O_.default(F);return Fw.generate(W,$)}f.generateTasks=y;function S(d,F){p(d);let W=new O_.default(F);return o.pattern.isDynamicPattern(d,W)}f.isDynamicPattern=S;function w(d){return p(d),o.path.escape(d)}f.escapePath=w;function i(d){return p(d),o.path.convertPathToPattern(d)}f.convertPathToPattern=i;let q;(function(d){function F($){return p($),o.path.escapePosixPath($)}d.escapePath=F;function W($){return p($),o.path.convertPosixPathToPattern($)}d.convertPathToPattern=W})(q=f.posix||(f.posix={}));let j;(function(d){function F($){return p($),o.path.escapeWindowsPath($)}d.escapePath=F;function W($){return p($),o.path.convertWindowsPathToPattern($)}d.convertPathToPattern=W})(j=f.win32||(f.win32={}))})(P_||(P_={}));function G_(f,_,h){let y=[].concat(f),S=new O_.default(h),w=Fw.generate(y,S),i=new _(S);return w.map(i.read,i)}function p(f){if(![].concat(f).every((y)=>o.string.isString(y)&&!o.string.isEmpty(y)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}$w.exports=P_});var Mw=zw(jw(),1);import g_ from"path";async function Vw(f){let _=g_.resolve(f),h=g_.join(_,"**","*.{ts,js}").replace(/\\/g,"/");return await Mw.default(h,{absolute:!0,onlyFiles:!0})}function dw(f,_){let h=g_.relative(_,f).replace(/\.(ts|js)$/,"");if(h=h.replace(/\[\.\.\.(\w+)\]/g,"*").replace(/\[(\w+)\]/g,":$1"),h==="index")return"/";else if(h.endsWith("/index"))return`/${h.slice(0,-6)}`;return`/${h}`}import{writeFile as Vj}from"fs/promises";import H_ from"path";import{pathToFileURL as dj}from"url";var Yj="./src/routes",Wj="./src/generated-routes.ts";async function cM(f=Yj,_=Wj){console.log("Generating routes file...",f,_);let h=H_.resolve(f),y=await Vw(h),S=[],w=[],i=["GET","POST"];S.push("import { Hono } from 'hono';");let q=0;for(let d of y){let F=dw(d,h).replace(/\\/g,"/").replace(/\/index$/,""),W=H_.relative(H_.dirname(_),d).replace(/\.(ts)$/,"").replace(/\\/g,"/"),$=`routeModule${q++}`;S.push(`import * as ${$} from './${W}';`);let E=`honoApp${$}`;w.push(` const ${E} = new Hono();`);for await(let Z of i)if(typeof(await import(dj(d).href))[Z]==="function")if(F.endsWith("/*")){let C=F.replace(/\/\*$/g,"").length+1;w.push(` ${E}.${Z.toLowerCase()}('/', async (c) => ${$}.${Z}(c, c.req.path.substring(${C}).split('/')));`)}else w.push(` ${E}.${Z.toLowerCase()}('/', ${$}.${Z});`);if(F==="/")w.push(` mainApp.route('${F}', ${E});`);else w.push(` mainApp.route('${F}', ${E});`)}let j=`
28
+ // THIS FILE IS AUTO-GENERATED BY scripts/generate-routes.ts. DO NOT EDIT.
29
+
30
+ ${S.join(`
31
+ `)}
32
+
33
+ /**
34
+ * Registers all generated file-based routes to the main Hono application.
35
+ * @param mainApp The main Hono application instance.
36
+ */
37
+ export function registerGeneratedRoutes(mainApp: Hono) {
38
+ ${w.join(`
39
+ `)}
40
+ }
41
+ `;await Vj(_,j.trimStart()),console.log(`Generated routes file: ${_} with ${y.length} routes.`)}export{dw as getRoutePath,Vw as getFiles,cM as generateRoutesFile};
package/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './utils/load-routes-utils'
2
+ export * from './scripts/generate-routes'
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@hono-filebased-route/core",
3
+ "version": "0.2.1",
4
+ "type": "module",
5
+ "description": "A core utility for file-based routing in Hono applications.",
6
+ "author": "HM Suiji <hmsuiji@gmail.com>",
7
+ "keywords": [
8
+ "hono",
9
+ "router",
10
+ "file-based",
11
+ "routing",
12
+ "backend",
13
+ "framework",
14
+ "typescript",
15
+ "file-based-route"
16
+ ],
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/HM-Suiji/hono-filebased-route.git"
21
+ },
22
+ "main": "dist/index.js",
23
+ "types": "dist/index.d.ts",
24
+ "scripts": {
25
+ "build": "bun run build.ts",
26
+ "clean": "rm -rf dist"
27
+ },
28
+ "dependencies": {
29
+ "fast-glob": "^3.3.3",
30
+ "fs": "0.0.1-security",
31
+ "hono": "^4.9.2",
32
+ "path": "^0.12.7"
33
+ },
34
+ "devDependencies": {
35
+ "@types/bun": "^1.2.20",
36
+ "@types/node": "^24.3.0",
37
+ "bun-plugin-dts": "^0.3.0",
38
+ "typescript": "^5.0.0"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "hono": {
42
+ "optional": false
43
+ }
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
48
+ }
@@ -0,0 +1,79 @@
1
+ import { writeFile } from 'fs/promises'
2
+ import { getFiles, getRoutePath } from '../utils/load-routes-utils'
3
+ import path from 'path'
4
+ import { pathToFileURL } from 'url'
5
+
6
+ const ROUTES_DIR = './src/routes'
7
+ const OUTPUT_FILE = './src/generated-routes.ts'
8
+
9
+ export async function generateRoutesFile(
10
+ dir: string = ROUTES_DIR,
11
+ output: string = OUTPUT_FILE
12
+ ) {
13
+ console.log('Generating routes file...', dir, output)
14
+ const absoluteRoutesDir = path.resolve(dir)
15
+ const files = await getFiles(absoluteRoutesDir)
16
+
17
+ const importStatements: string[] = []
18
+ const routeDefinitions: string[] = []
19
+ const methods = ['GET', 'POST']
20
+
21
+ importStatements.push(`import { Hono } from 'hono';`)
22
+
23
+ let counter = 0
24
+ for (const file of files) {
25
+ const routePath = getRoutePath(file, absoluteRoutesDir)
26
+ .replace(/\\/g, '/')
27
+ .replace(/\/index$/, '')
28
+ const relativePath = path
29
+ .relative(path.dirname(output), file)
30
+ .replace(/\.(ts)$/, '')
31
+ .replace(/\\/g, '/')
32
+ const moduleName = `routeModule${counter++}`
33
+
34
+ importStatements.push(`import * as ${moduleName} from './${relativePath}';`)
35
+
36
+ const tempHonoVar = `honoApp${moduleName}`
37
+ routeDefinitions.push(` const ${tempHonoVar} = new Hono();`)
38
+
39
+ for await (const method of methods) {
40
+ const fileUrl = pathToFileURL(file).href
41
+ const module = await import(fileUrl)
42
+ if (typeof module[method] === 'function') {
43
+ if (routePath.endsWith('/*')) {
44
+ const len = routePath.replace(/\/\*$/g, '').length + 1
45
+ routeDefinitions.push(
46
+ ` ${tempHonoVar}.${method.toLowerCase()}('/', async (c) => ${moduleName}.${method}(c, c.req.path.substring(${len}).split('/')));`
47
+ )
48
+ } else
49
+ routeDefinitions.push(
50
+ ` ${tempHonoVar}.${method.toLowerCase()}('/', ${moduleName}.${method});`
51
+ )
52
+ }
53
+ }
54
+
55
+ if (routePath === '/') {
56
+ routeDefinitions.push(` mainApp.route('${routePath}', ${tempHonoVar});`)
57
+ } else {
58
+ routeDefinitions.push(` mainApp.route('${routePath}', ${tempHonoVar});`)
59
+ }
60
+ }
61
+
62
+ const fileContent = `
63
+ // THIS FILE IS AUTO-GENERATED BY scripts/generate-routes.ts. DO NOT EDIT.
64
+
65
+ ${importStatements.join('\n')}
66
+
67
+ /**
68
+ * Registers all generated file-based routes to the main Hono application.
69
+ * @param mainApp The main Hono application instance.
70
+ */
71
+ export function registerGeneratedRoutes(mainApp: Hono) {
72
+ ${routeDefinitions.join('\n')}
73
+ }
74
+ `
75
+
76
+ await writeFile(output, fileContent.trimStart())
77
+
78
+ console.log(`Generated routes file: ${output} with ${files.length} routes.`)
79
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": ".",
5
+ "outDir": "./dist",
6
+ "composite": true
7
+ },
8
+ "include": [
9
+ "utils/**/*.ts",
10
+ "scripts/**/*.ts",
11
+ "index.ts"
12
+ ],
13
+ "exclude": [
14
+ "node_modules",
15
+ "dist",
16
+ "**/*.test.ts"
17
+ ]
18
+ }
@@ -0,0 +1,41 @@
1
+ import path from 'path'
2
+ import fg from 'fast-glob'
3
+
4
+ /**
5
+ * 遍历指定目录并获取所有文件路径
6
+ * @param dir 要遍历的目录
7
+ * @returns 目录内所有文件绝对路径的数组
8
+ */
9
+ export async function getFiles(dir: string): Promise<string[]> {
10
+ const absoluteDir = path.resolve(dir)
11
+ const pattern = path.join(absoluteDir, '**', '*.{ts,js}').replace(/\\/g, '/')
12
+
13
+ const files = await fg(pattern, {
14
+ absolute: true,
15
+ onlyFiles: true
16
+ })
17
+
18
+ return files
19
+ }
20
+
21
+ /**
22
+ * 将文件路径转换为 Hono 路由路径
23
+ * @param filePath 文件的绝对路径
24
+ * @param baseDir 路由文件的根目录的绝对路径
25
+ * @returns 转换后的 Hono 路由路径
26
+ */
27
+ export function getRoutePath(filePath: string, baseDir: string): string {
28
+ let routeName = path.relative(baseDir, filePath).replace(/\.(ts|js)$/, '')
29
+
30
+ routeName = routeName
31
+ .replace(/\[\.\.\.(\w+)\]/g, '*') // 捕获所有:[...slug] => *
32
+ .replace(/\[(\w+)\]/g, ':$1') // 动态参数:[id] => :id
33
+
34
+ if (routeName === 'index') {
35
+ return '/'
36
+ } else if (routeName.endsWith('/index')) {
37
+ return `/${routeName.slice(0, -6)}`
38
+ }
39
+
40
+ return `/${routeName}`
41
+ }