-.-
This commit is contained in:
parent
953af4564b
commit
945832b6c2
@ -10,6 +10,7 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Flummi",
|
"author": "Flummi",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"types": "types/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.13.10",
|
"@types/node": "^22.13.10",
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"removeComments": true
|
"removeComments": true,
|
||||||
|
"types": [
|
||||||
|
"node"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
|
49
types/index.d.ts
vendored
Normal file
49
types/index.d.ts
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import { Handler } from "../src/types.d.js";
|
||||||
|
|
||||||
|
declare class Flummpress {
|
||||||
|
constructor();
|
||||||
|
router: Router;
|
||||||
|
tpl: Template;
|
||||||
|
middleware: Handler[];
|
||||||
|
|
||||||
|
use(plugin: Router | Template | Handler): this;
|
||||||
|
listen(...args: any[]): this;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare class Router {
|
||||||
|
importRoutesFromPath(p: string, tpl?: Template | false): Promise<this>;
|
||||||
|
group(basePath: string | RegExp, callback: (methods: {
|
||||||
|
get: (path: string | RegExp, ...handlers: Handler[]) => void;
|
||||||
|
post: (path: string | RegExp, ...handlers: Handler[]) => void;
|
||||||
|
put: (path: string | RegExp, ...handlers: Handler[]) => void;
|
||||||
|
delete: (path: string | RegExp, ...handlers: Handler[]) => void;
|
||||||
|
patch: (path: string | RegExp, ...handlers: Handler[]) => void;
|
||||||
|
}) => void): this;
|
||||||
|
|
||||||
|
use(obj: Router | Template): void;
|
||||||
|
|
||||||
|
get(path: string | RegExp, ...handlers: Handler[]): this;
|
||||||
|
post(path: string | RegExp, ...handlers: Handler[]): this;
|
||||||
|
head(path: string | RegExp, ...handlers: Handler[]): this;
|
||||||
|
put(path: string | RegExp, ...handlers: Handler[]): this;
|
||||||
|
delete(path: string | RegExp, ...handlers: Handler[]): this;
|
||||||
|
patch(path: string | RegExp, ...handlers: Handler[]): this;
|
||||||
|
|
||||||
|
static(options: { dir?: string; route?: RegExp }): this;
|
||||||
|
|
||||||
|
getRoute(path: string, method: string): { path: string | RegExp; methods: { [method: string]: Handler[] } } | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare class Template {
|
||||||
|
setDebug(debug: boolean): void;
|
||||||
|
setViews(views: string): void;
|
||||||
|
setGlobals(globals: Record<string, any>): void;
|
||||||
|
setCache(cache: boolean): void;
|
||||||
|
|
||||||
|
render(file: string, data?: Record<string, any>, locals?: Record<string, any>): string;
|
||||||
|
escape(str: string): string;
|
||||||
|
getMtime(file: string): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Flummpress, Router, Template };
|
||||||
|
export default Flummpress;
|
Loading…
x
Reference in New Issue
Block a user