@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 +1 -1
- package/build.ts +6 -5
- package/dist/index.d.ts +23 -2
- package/dist/index.js +111 -10
- package/package.json +50 -47
- package/scripts/generate-routes.ts +53 -52
- package/tsconfig.json +18 -17
- package/types/index.ts +14 -0
- package/utils/load-routes-utils.ts +59 -18
- package/utils/logger.ts +18 -0
package/README.md
CHANGED
package/build.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import dts from 'bun-plugin-dts'
|
|
2
2
|
|
|
3
3
|
await Bun.build({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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 {};
|