@hono-filebased-route/core 0.2.1 → 0.3.0

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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Hono File-Based Routing
1
+ # Hono File-Based Routing Core
2
2
 
3
3
  一个基于 Hono 框架的文件路由系统,使用 Turborepo 管理的 monorepo 项目,支持类似 Next.js 的文件路由模式。
4
4
 
package/build.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import dts from 'bun-plugin-dts'
2
2
 
3
3
  await Bun.build({
4
- minify: true,
5
- target: 'node',
6
- outdir: './dist',
7
- plugins: [dts()],
8
- entrypoints: ['./index.ts'],
4
+ minify: true,
5
+ target: 'node',
6
+ outdir: './dist',
7
+ plugins: [dts()],
8
+ entrypoints: ['./index.ts'],
9
+ external: ['typescript'],
9
10
  })
package/dist/index.d.ts CHANGED
@@ -1,11 +1,26 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
+ declare const METHODS: readonly [
4
+ "GET",
5
+ "POST"
6
+ ];
7
+ export type Method = (typeof METHODS)[number];
8
+ export type ExportedMethods = {
9
+ [key in Method]: boolean;
10
+ };
11
+ export type Config = {
12
+ dir: string;
13
+ output: string;
14
+ write: boolean;
15
+ verbose: boolean;
16
+ externals: string[];
17
+ };
3
18
  /**
4
19
  * 遍历指定目录并获取所有文件路径
5
20
  * @param dir 要遍历的目录
6
21
  * @returns 目录内所有文件绝对路径的数组
7
22
  */
8
- export declare function getFiles(dir: string): Promise<string[]>;
23
+ export declare function getFiles(dir: string, externals?: string[]): Promise<string[]>;
9
24
  /**
10
25
  * 将文件路径转换为 Hono 路由路径
11
26
  * @param filePath 文件的绝对路径
@@ -13,6 +28,12 @@ export declare function getFiles(dir: string): Promise<string[]>;
13
28
  * @returns 转换后的 Hono 路由路径
14
29
  */
15
30
  export declare function getRoutePath(filePath: string, baseDir: string): string;
16
- export declare function generateRoutesFile(dir?: string, output?: string): Promise<void>;
31
+ /**
32
+ * 从文件中提取导出的 HTTP 方法
33
+ * @param filePath 文件的绝对路径
34
+ * @returns 导出的 HTTP 方法对象
35
+ */
36
+ export declare function getExportedHttpMethods(filePath: string): ExportedMethods;
37
+ export declare function generateRoutesFile(config?: Partial<Config>): Promise<string>;
17
38
 
18
39
  export {};