This commit is contained in:
Rizky 2024-12-24 14:22:04 +07:00
parent a750f602a6
commit 7f5a8a552c
2 changed files with 41 additions and 1 deletions

38
internal/init-compiled.js Normal file
View File

@ -0,0 +1,38 @@
// @bun
// internal/main/handler/http-handler.ts
var createHttpHandler = () => {
return async () => {
return new Response("wuwu");
};
};
// internal/main/handler/ws-handler.ts
var createWsHandler = () => {
return { message(ws, message) {
} };
};
// internal/main/prasi-var.ts
if (!globalThis.prasi) {
globalThis.prasi = {};
}
var prasi = globalThis.prasi;
// internal/main/init.ts
var init = async ({
root_dir,
script_path,
port
}) => {
prasi.dir.root = root_dir;
delete import.meta.require.cache[script_path];
prasi.server = import.meta.require(script_path).server;
if (prasi.server?.init && port) {
await prasi.server.init({ port });
}
prasi.handler.http = createHttpHandler();
prasi.handler.ws = createWsHandler();
};
export {
init
};

View File

@ -2,7 +2,9 @@
"name": "prasi-srv",
"module": "index.ts",
"type": "module",
"scripts": {},
"scripts": {
"dev": "bun build --watch --target bun --entry ./internal/main/init.ts --outfile ./internal/init-compiled.js"
},
"devDependencies": {
"@types/bun": "latest"
},