@batijs/cli 0.0.223 → 0.0.224
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.
|
@@ -54,6 +54,7 @@ var require_package = __commonJS({
|
|
|
54
54
|
"@hono/vite-dev-server": "^0.13.0",
|
|
55
55
|
"@trpc/server": "^10.45.2",
|
|
56
56
|
"@types/node": "^18.19.14",
|
|
57
|
+
"@universal-middleware/hono": "^0.1.1",
|
|
57
58
|
"cross-env": "^7.0.3",
|
|
58
59
|
dotenv: "^16.4.5",
|
|
59
60
|
hono: "^4.4.13",
|
|
@@ -119,6 +120,7 @@ async function getPackageJson(props) {
|
|
|
119
120
|
devDependencies: ["@hono/vite-dev-server", "@types/node"],
|
|
120
121
|
dependencies: [
|
|
121
122
|
"@hono/node-server",
|
|
123
|
+
"@universal-middleware/hono",
|
|
122
124
|
"cross-env",
|
|
123
125
|
"hono",
|
|
124
126
|
"tsx",
|
|
@@ -14,32 +14,7 @@ import { tsRestHandler } from "@batijs/ts-rest/server/ts-rest-handler";
|
|
|
14
14
|
import { type FetchCreateContextFnOptions, fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
|
15
15
|
import { Hono } from "hono";
|
|
16
16
|
import { handle } from "hono/vercel";
|
|
17
|
-
import { createMiddleware } from "hono
|
|
18
|
-
|
|
19
|
-
interface Middleware<Context extends Record<string | number | symbol, unknown>> {
|
|
20
|
-
(request: Request, context: Context): Response | void | Promise<Response> | Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function handlerAdapter<Context extends Record<string | number | symbol, unknown>>(
|
|
24
|
-
handler: Middleware<Context>,
|
|
25
|
-
) {
|
|
26
|
-
return createMiddleware(async (context, next) => {
|
|
27
|
-
let ctx = context.get("context");
|
|
28
|
-
if (!ctx) {
|
|
29
|
-
ctx = {};
|
|
30
|
-
context.set("context", ctx);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const res = await handler(context.req.raw, ctx as Context);
|
|
34
|
-
context.set("context", ctx);
|
|
35
|
-
|
|
36
|
-
if (!res) {
|
|
37
|
-
await next();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return res;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
17
|
+
import { createHandler, createMiddleware } from "@universal-middleware/hono";
|
|
43
18
|
|
|
44
19
|
const app = new Hono();
|
|
45
20
|
|
|
@@ -47,19 +22,19 @@ if (BATI.has("authjs") || BATI.has("auth0")) {
|
|
|
47
22
|
/**
|
|
48
23
|
* Append Auth.js session to context
|
|
49
24
|
**/
|
|
50
|
-
app.use(
|
|
25
|
+
app.use(createMiddleware(authjsSessionMiddleware));
|
|
51
26
|
|
|
52
27
|
/**
|
|
53
28
|
* Auth.js route
|
|
54
29
|
* @link {@see https://authjs.dev/getting-started/installation}
|
|
55
30
|
**/
|
|
56
|
-
app.use("/api/auth/**",
|
|
31
|
+
app.use("/api/auth/**", createHandler(authjsHandler));
|
|
57
32
|
}
|
|
58
33
|
|
|
59
34
|
if (BATI.has("firebase-auth")) {
|
|
60
|
-
app.use(
|
|
61
|
-
app.post("/api/sessionLogin",
|
|
62
|
-
app.post("/api/sessionLogout",
|
|
35
|
+
app.use(createMiddleware(firebaseAuthMiddleware));
|
|
36
|
+
app.post("/api/sessionLogin", createHandler(firebaseAuthLoginHandler));
|
|
37
|
+
app.post("/api/sessionLogout", createHandler(firebaseAuthLogoutHandler));
|
|
63
38
|
}
|
|
64
39
|
|
|
65
40
|
if (BATI.has("trpc")) {
|
|
@@ -86,15 +61,15 @@ if (BATI.has("telefunc")) {
|
|
|
86
61
|
*
|
|
87
62
|
* @link {@see https://telefunc.com}
|
|
88
63
|
**/
|
|
89
|
-
app.post("/_telefunc",
|
|
64
|
+
app.post("/_telefunc", createHandler(telefuncHandler));
|
|
90
65
|
}
|
|
91
66
|
|
|
92
67
|
if (BATI.has("ts-rest")) {
|
|
93
|
-
app.all("/api/*",
|
|
68
|
+
app.all("/api/*", createHandler(tsRestHandler));
|
|
94
69
|
}
|
|
95
70
|
|
|
96
71
|
if (!BATI.has("telefunc") && !BATI.has("trpc") && !BATI.has("ts-rest")) {
|
|
97
|
-
app.post("/api/todo/create",
|
|
72
|
+
app.post("/api/todo/create", createHandler(createTodoHandler));
|
|
98
73
|
}
|
|
99
74
|
|
|
100
75
|
/**
|
|
@@ -102,7 +77,7 @@ if (!BATI.has("telefunc") && !BATI.has("trpc") && !BATI.has("ts-rest")) {
|
|
|
102
77
|
*
|
|
103
78
|
* @link {@see https://vike.dev}
|
|
104
79
|
**/
|
|
105
|
-
app.all("*",
|
|
80
|
+
app.all("*", createHandler(vikeHandler));
|
|
106
81
|
|
|
107
82
|
//# BATI.has("vercel")
|
|
108
83
|
export const GET = handle(app);
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
interface Middleware<Context extends Record<string | number | symbol, unknown>> {
|
|
4
|
-
(request: Request, context: Context): Response | void | Promise<Response> | Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare function handlerAdapter<Context extends Record<string | number | symbol, unknown>>(handler: Middleware<Context>): import("hono").MiddlewareHandler<any, string, {}>;
|
|
7
3
|
export declare const GET: (req: Request, requestContext: import("hono/types").FetchEventLike) => Response | Promise<Response>;
|
|
8
4
|
export declare const POST: (req: Request, requestContext: import("hono/types").FetchEventLike) => Response | Promise<Response>;
|
|
9
5
|
declare const _default: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/"> | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1614,7 +1614,7 @@ var import_which_pm_runs = __toESM(require_which_pm_runs(), 1);
|
|
|
1614
1614
|
// package.json
|
|
1615
1615
|
var package_default = {
|
|
1616
1616
|
name: "@batijs/cli",
|
|
1617
|
-
version: "0.0.
|
|
1617
|
+
version: "0.0.224",
|
|
1618
1618
|
type: "module",
|
|
1619
1619
|
scripts: {
|
|
1620
1620
|
"check-types": "tsc --noEmit",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.224",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"unplugin-purge-polyfills": "^0.0.4",
|
|
23
23
|
"vite": "^5.3.3",
|
|
24
24
|
"which-pm-runs": "^1.1.0",
|
|
25
|
-
"@batijs/
|
|
26
|
-
"@batijs/
|
|
25
|
+
"@batijs/build": "0.0.224",
|
|
26
|
+
"@batijs/compile": "0.0.224"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@batijs/
|
|
30
|
-
"@batijs/
|
|
29
|
+
"@batijs/features": "0.0.224",
|
|
30
|
+
"@batijs/core": "0.0.224"
|
|
31
31
|
},
|
|
32
32
|
"bin": "./dist/index.js",
|
|
33
33
|
"exports": {
|