@guren/server 2.20.0 → 2.21.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/dist/auth/index.js +1 -1
- package/dist/auth/password/DefaultHasher.d.ts +1 -0
- package/dist/{auth-BXcHQwHf.js → auth-CjE2oO50.js} +21 -2
- package/dist/cache/index.js +1 -1
- package/dist/http/Application.d.ts +15 -0
- package/dist/http/middleware/index.d.ts +1 -1
- package/dist/http/middleware/session-manager.d.ts +7 -0
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +606 -415
- package/dist/lambda/index.js +1 -1
- package/dist/mvc/Router.d.ts +18 -15
- package/dist/mvc/prototype.d.ts +105 -0
- package/dist/runtime/index.js +2 -2
- package/dist/storage/index.js +1 -1
- package/dist/vite/index.js +147 -0
- package/dist/vite/plugin.d.ts +39 -0
- package/dist/{vite-manifest-BZQ-75hf.js → vite-manifest-CdfPfQdj.js} +1 -1
- package/package.json +4 -4
- package/dist/{DocsViewerServiceProvider-D2cuVgtN.js → DocsViewerServiceProvider-DWnlXx_y.js} +1 -1
- package/dist/{cache-DUhlolkJ.js → cache-thXRnaju.js} +1 -1
- package/dist/{i18n-Cg1aajRP.js → i18n-BZ2VrSud.js} +1 -1
- package/dist/{storage-BB59f07j.js → storage-D_yNe54O.js} +1 -1
package/dist/lambda/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as getJob } from "../Job-CvDwk2Gj.js";
|
|
2
1
|
import { n as detectServerlessRuntime } from "../serverless-D96rJb6x.js";
|
|
2
|
+
import { r as getJob } from "../Job-CvDwk2Gj.js";
|
|
3
3
|
import { handle } from "hono/aws-lambda";
|
|
4
4
|
//#region src/lambda/index.ts
|
|
5
5
|
/** Create an AWS Lambda handler from an already booted Guren application. */
|
package/dist/mvc/Router.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Controller } from './Controller.js';
|
|
|
3
3
|
import type { Container } from '../container/Container.js';
|
|
4
4
|
import type { ValidationSchema } from '../http/middleware/validation.js';
|
|
5
5
|
import { type MiddlewareCapabilities } from '../http/middleware/capabilities.js';
|
|
6
|
+
import { type PrototypeRouteHandler } from './prototype.js';
|
|
6
7
|
/** Constructor type for Controller classes. */
|
|
7
8
|
export type ControllerConstructor<T extends Controller = Controller> = (new (...args: any[]) => T) & {
|
|
8
9
|
inject?: readonly string[];
|
|
@@ -17,7 +18,7 @@ export type RouteResult = Response | string | number | boolean | Record<string,
|
|
|
17
18
|
* Inline handlers receive `next`, so Hono middleware (e.g.
|
|
18
19
|
* `broadcast.sseMiddleware()`) can mount directly as a terminal handler.
|
|
19
20
|
*/
|
|
20
|
-
export type RouteHandler<C extends ControllerConstructor = ControllerConstructor> = ((c: Context, next: Next) => RouteResult | Promise<RouteResult>) | ControllerAction<C
|
|
21
|
+
export type RouteHandler<C extends ControllerConstructor = ControllerConstructor> = ((c: Context, next: Next) => RouteResult | Promise<RouteResult>) | ControllerAction<C> | PrototypeRouteHandler;
|
|
21
22
|
type ModelBindingResolver = (value: string) => Promise<unknown>;
|
|
22
23
|
/** Model class with a findOrFail static method. */
|
|
23
24
|
export interface BindableModel {
|
|
@@ -158,6 +159,8 @@ export interface RouteDefinition {
|
|
|
158
159
|
bindings?: Record<string, string>;
|
|
159
160
|
/** Agent metadata as declared (RFC 0016), no defaults applied. Absent: not a tool. */
|
|
160
161
|
agent?: AgentRouteMetadata;
|
|
162
|
+
/** Still on its fixture (RFC 0021): registered with the `prototype` handler rather than a controller. */
|
|
163
|
+
prototype?: true;
|
|
161
164
|
summary?: string;
|
|
162
165
|
description?: string;
|
|
163
166
|
tags?: string[];
|
|
@@ -222,22 +225,22 @@ export declare class Router<M extends string = never> {
|
|
|
222
225
|
bind(param: string, modelOrResolver: RouteModelBinding | ModelBindingResolver): this;
|
|
223
226
|
on<C extends ControllerConstructor>(method: string, path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
224
227
|
on<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
225
|
-
on<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
228
|
+
on<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
226
229
|
get<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
227
230
|
get<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
228
|
-
get<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
231
|
+
get<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
229
232
|
post<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
230
233
|
post<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
231
|
-
post<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
234
|
+
post<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
232
235
|
put<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
233
236
|
put<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
234
|
-
put<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
237
|
+
put<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
235
238
|
patch<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
236
239
|
patch<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
237
|
-
patch<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
240
|
+
patch<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
238
241
|
delete<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
239
242
|
delete<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
240
|
-
delete<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
243
|
+
delete<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
241
244
|
/**
|
|
242
245
|
* HTTP QUERY (RFC 10008): safe and idempotent like GET, but carries a body.
|
|
243
246
|
* Handlers must not mutate state — CSRF protection deliberately skips QUERY
|
|
@@ -245,7 +248,7 @@ export declare class Router<M extends string = never> {
|
|
|
245
248
|
*/
|
|
246
249
|
query<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
247
250
|
query<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
248
|
-
query<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
251
|
+
query<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
249
252
|
group(prefix: string, callback: (router: Router<M>) => void): this;
|
|
250
253
|
route(name: string, params?: Record<string, string | number>): string;
|
|
251
254
|
hasRoute(name: string): boolean;
|
|
@@ -273,24 +276,24 @@ declare class RouterMiddlewareGroupBuilder<M extends string = never> {
|
|
|
273
276
|
group(callback: (router: Router<M>) => void): Router<M>;
|
|
274
277
|
get<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
275
278
|
get<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
276
|
-
get<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
279
|
+
get<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
277
280
|
post<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
278
281
|
post<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
279
|
-
post<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
282
|
+
post<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
280
283
|
put<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
281
284
|
put<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
282
|
-
put<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
285
|
+
put<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
283
286
|
patch<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
284
287
|
patch<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
285
|
-
patch<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
288
|
+
patch<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
286
289
|
delete<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
287
290
|
delete<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
288
|
-
delete<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
291
|
+
delete<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
289
292
|
query<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
290
293
|
query<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
291
|
-
query<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
294
|
+
query<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
292
295
|
on<C extends ControllerConstructor>(method: string, path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
|
|
293
296
|
on<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
|
|
294
|
-
on<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
|
|
297
|
+
on<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C> | PrototypeRouteHandler): RouteBuilder<M>;
|
|
295
298
|
}
|
|
296
299
|
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server side of prototype mode (RFC 0021 Part 2): a route registered with the
|
|
3
|
+
* `prototype` handler answers from the app's fixture module until a
|
|
4
|
+
* controller replaces it. Development only; `Application` refuses to boot such
|
|
5
|
+
* routes in production without `GUREN_PROTOTYPE_ROUTES=1`. The fixture
|
|
6
|
+
* contract is consumed structurally, so this never imports the client package.
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from 'hono';
|
|
9
|
+
import type { ValidationSchema } from '../http/middleware/validation.js';
|
|
10
|
+
import type { ContainerLike } from '../container/types.js';
|
|
11
|
+
declare const PROTOTYPE_HANDLER: unique symbol;
|
|
12
|
+
/** The branded object `router.get(path, prototype)` registers; never a function, so contract wrapping cannot hide it. */
|
|
13
|
+
export interface PrototypeRouteHandler {
|
|
14
|
+
readonly [PROTOTYPE_HANDLER]: true;
|
|
15
|
+
}
|
|
16
|
+
export declare const prototype: PrototypeRouteHandler;
|
|
17
|
+
export declare function isPrototypeHandler(value: unknown): value is PrototypeRouteHandler;
|
|
18
|
+
export type PrototypeResult = {
|
|
19
|
+
kind: 'page';
|
|
20
|
+
component: string;
|
|
21
|
+
props: Record<string, unknown>;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'redirect';
|
|
24
|
+
to: string;
|
|
25
|
+
params?: Record<string, string | number>;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'location';
|
|
28
|
+
url: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'errors';
|
|
31
|
+
errors: Record<string, string>;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'not-found';
|
|
34
|
+
};
|
|
35
|
+
export interface PrototypeServerContext {
|
|
36
|
+
method: string;
|
|
37
|
+
url: string;
|
|
38
|
+
params: Record<string, string>;
|
|
39
|
+
query: Record<string, unknown>;
|
|
40
|
+
/** The raw request body, as the browser client hands it over; the route's schema has already validated it. */
|
|
41
|
+
body: unknown;
|
|
42
|
+
state: unknown;
|
|
43
|
+
shared: Record<string, unknown>;
|
|
44
|
+
page(contract: {
|
|
45
|
+
id: string;
|
|
46
|
+
component?: string;
|
|
47
|
+
}, props: Record<string, unknown>): PrototypeResult;
|
|
48
|
+
redirect(to: string, params?: Record<string, string | number>): PrototypeResult;
|
|
49
|
+
location(url: string): PrototypeResult;
|
|
50
|
+
/** No error bag: the framework's `ValidationException` has none, so the client-side `bag` is ignored here. */
|
|
51
|
+
errors(errors: Record<string, string>): PrototypeResult;
|
|
52
|
+
notFound(): PrototypeResult;
|
|
53
|
+
flash(key: string, value: unknown): void;
|
|
54
|
+
}
|
|
55
|
+
export type PrototypeServerHandler = (ctx: PrototypeServerContext) => PrototypeResult | Promise<PrototypeResult>;
|
|
56
|
+
/**
|
|
57
|
+
* What `definePrototype()` from `@guren/inertia-client/prototype` produces,
|
|
58
|
+
* seen from the server. Handlers are accepted at `(ctx: never) => unknown`:
|
|
59
|
+
* the client types each one against its own manifest and page contracts,
|
|
60
|
+
* which is contravariant with any concrete context declared here, and the
|
|
61
|
+
* runtime hands over {@link PrototypeServerContext} and checks the result's `kind`.
|
|
62
|
+
*/
|
|
63
|
+
export interface PrototypeFixture {
|
|
64
|
+
manifest: Record<string, {
|
|
65
|
+
method: string;
|
|
66
|
+
path: string;
|
|
67
|
+
}>;
|
|
68
|
+
shared?: Record<string, unknown>;
|
|
69
|
+
state?: () => unknown;
|
|
70
|
+
notFoundPage?: {
|
|
71
|
+
id: string;
|
|
72
|
+
component?: string;
|
|
73
|
+
};
|
|
74
|
+
routes: Record<string, ((ctx: never) => unknown) | undefined>;
|
|
75
|
+
}
|
|
76
|
+
export type PrototypeFixtureModule = {
|
|
77
|
+
default: PrototypeFixture;
|
|
78
|
+
} | PrototypeFixture;
|
|
79
|
+
export type PrototypeFixtureLoader = () => Promise<PrototypeFixtureModule>;
|
|
80
|
+
/** Container key the loaded fixture is bound under once `Application` has validated the prototype routes. */
|
|
81
|
+
export declare const PROTOTYPE_FIXTURE_BINDING = "prototype.fixture";
|
|
82
|
+
export declare function loadPrototypeFixture(loader: PrototypeFixtureLoader): Promise<PrototypeFixture>;
|
|
83
|
+
export interface PrototypeRouteLike {
|
|
84
|
+
method: string;
|
|
85
|
+
path: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
schemas?: {
|
|
88
|
+
params?: ValidationSchema<unknown>;
|
|
89
|
+
query?: ValidationSchema<unknown>;
|
|
90
|
+
body?: ValidationSchema<unknown>;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface PrototypeRouteDependencies {
|
|
94
|
+
container?: ContainerLike;
|
|
95
|
+
/** `Router.route()`, for a `redirect()` naming a route. */
|
|
96
|
+
routeUrl(name: string, params?: Record<string, string | number>): string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The route's handler: the fixture entry for the route name, run against the
|
|
100
|
+
* same context shape the browser client builds. The route contract is enforced
|
|
101
|
+
* first (`params`, `query`, `body`; not `output`, which only a response has), so `guren
|
|
102
|
+
* audit`'s "runtime-enforced" verdict stays true here.
|
|
103
|
+
*/
|
|
104
|
+
export declare function createPrototypeRouteHandler(route: PrototypeRouteLike, deps: PrototypeRouteDependencies): (c: Context) => Promise<Response>;
|
|
105
|
+
export {};
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as trimTrailingSlashes } from "../trim-slashes-BLY9hKAa.js";
|
|
2
|
+
import { _ as parseImportMap, a as getManifestCss, c as isViteProduction, d as startViteDevServer, f as GUREN_ASCII_ART, h as logDevServerBanner, i as clientManifestCandidates, l as loadViteManifest, o as getManifestFile, r as PUBLIC_ASSETS_URL_PREFIX, u as normalizeDevServerUrl } from "../vite-manifest-CdfPfQdj.js";
|
|
2
3
|
import { n as hash } from "../Hash-D2DFd8xX.js";
|
|
3
|
-
import { _ as parseImportMap, a as getManifestCss, c as isViteProduction, d as startViteDevServer, f as GUREN_ASCII_ART, h as logDevServerBanner, i as clientManifestCandidates, l as loadViteManifest, o as getManifestFile, r as PUBLIC_ASSETS_URL_PREFIX, u as normalizeDevServerUrl } from "../vite-manifest-BZQ-75hf.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import { realpath } from "node:fs/promises";
|
|
6
5
|
import { dirname, extname, join, resolve, sep } from "node:path";
|
|
7
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { realpath } from "node:fs/promises";
|
|
8
8
|
import { serveStatic } from "hono/bun";
|
|
9
9
|
import { getMimeType } from "hono/utils/mime";
|
|
10
10
|
//#region src/support/contained-path.ts
|
package/dist/storage/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-
|
|
1
|
+
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-D_yNe54O.js";
|
|
2
2
|
export { LocalDriver, MemoryDriver, S3Driver, StorageManager, createStorageManager };
|
package/dist/vite/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
2
3
|
//#region src/vite/plugin.ts
|
|
4
|
+
/** Where the generated shell goes; `.guren/` is already gitignored and codegen-owned. */
|
|
5
|
+
const PROTOTYPE_SHELL_FILE = ".guren/prototype/index.html";
|
|
6
|
+
/** The override a project may ship instead of the generated shell. */
|
|
7
|
+
const PROTOTYPE_SHELL_OVERRIDE = "resources/js/prototype/index.html";
|
|
3
8
|
const defaultOptions = {
|
|
4
9
|
appAlias: "@",
|
|
5
10
|
appDir: ".",
|
|
@@ -20,16 +25,149 @@ function gurenVitePlugin(options = {}) {
|
|
|
20
25
|
...defaultOptions,
|
|
21
26
|
...options
|
|
22
27
|
};
|
|
28
|
+
let prototype;
|
|
23
29
|
return {
|
|
24
30
|
name: "guren:vite-config",
|
|
25
31
|
enforce: "pre",
|
|
26
32
|
config(config, env) {
|
|
33
|
+
if (env?.mode === "prototype") {
|
|
34
|
+
prototype = ensurePrototype(config, resolved);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
prototype = void 0;
|
|
27
38
|
ensureDefaults(config, resolved, env);
|
|
39
|
+
},
|
|
40
|
+
configResolved(config) {
|
|
41
|
+
if (prototype) prototype.outDir = path.resolve(config.root ?? prototype.root, config.build?.outDir ?? prototype.outDir);
|
|
42
|
+
},
|
|
43
|
+
configureServer(server) {
|
|
44
|
+
if (!prototype) return;
|
|
45
|
+
const shellPath = prototype.shellPath;
|
|
46
|
+
return () => {
|
|
47
|
+
server.middlewares.use(async (req, res, next) => {
|
|
48
|
+
if (req.method !== "GET" && req.method !== "HEAD") return next();
|
|
49
|
+
if (!String(req.headers.accept ?? "").includes("text/html")) return next();
|
|
50
|
+
const url = req.url ?? "/";
|
|
51
|
+
if (/\.[a-z0-9]+$/iu.test(url.split("?")[0] ?? "")) return next();
|
|
52
|
+
try {
|
|
53
|
+
const html = await server.transformIndexHtml(url, readFileSync(shellPath, "utf8"), req.originalUrl);
|
|
54
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
55
|
+
res.end(html);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
next(error);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
writeBundle() {
|
|
63
|
+
if (prototype) finishPrototypeBuild(prototype);
|
|
28
64
|
}
|
|
29
65
|
};
|
|
30
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* The prototype branch, taken before the ordinary client defaults so none of
|
|
69
|
+
* `ensureBuild`'s outDir/base/publicDir reasoning applies: there is no server
|
|
70
|
+
* to serve `public/`, no manifest to read, and the entry is an HTML shell.
|
|
71
|
+
*/
|
|
72
|
+
function ensurePrototype(config, options) {
|
|
73
|
+
const root = resolveRoot(config.root);
|
|
74
|
+
const prototype = options.prototype ?? {};
|
|
75
|
+
ensureAliases(config, options, root);
|
|
76
|
+
ensureServer(config, options);
|
|
77
|
+
ensurePreview(config, options);
|
|
78
|
+
config.define ??= {};
|
|
79
|
+
config.define["import.meta.env.GUREN_PROTOTYPE"] ??= "true";
|
|
80
|
+
config.appType ??= "custom";
|
|
81
|
+
config.base ??= prototype.base ?? "/";
|
|
82
|
+
if (typeof config.publicDir !== "string") config.publicDir = path.resolve(root, "public");
|
|
83
|
+
const copiedBuildDir = relativeIfInside(path.resolve(root, config.publicDir), resolveBuildOutputDirectory(root, options.outDir));
|
|
84
|
+
config.build ??= {};
|
|
85
|
+
config.build.outDir ??= prototype.outDir ?? "dist/prototype";
|
|
86
|
+
config.build.emptyOutDir ??= true;
|
|
87
|
+
config.build.copyPublicDir = true;
|
|
88
|
+
config.build.manifest ??= false;
|
|
89
|
+
config.build.ssrManifest ??= false;
|
|
90
|
+
const shellPath = resolvePrototypeShell(root, prototype.shell, options.entry);
|
|
91
|
+
config.build.rollupOptions ??= {};
|
|
92
|
+
config.build.rollupOptions.input ??= shellPath;
|
|
93
|
+
const output = normalizeRollupOutput(config.build.rollupOptions.output);
|
|
94
|
+
output.entryFileNames ??= options.entryFileNames;
|
|
95
|
+
output.chunkFileNames ??= options.chunkFileNames;
|
|
96
|
+
output.assetFileNames ??= options.assetFileNames;
|
|
97
|
+
output.manualChunks ??= createDefaultManualChunks(root);
|
|
98
|
+
config.build.rollupOptions.output = output;
|
|
99
|
+
return {
|
|
100
|
+
root,
|
|
101
|
+
outDir: path.resolve(root, config.build.outDir),
|
|
102
|
+
shellPath,
|
|
103
|
+
copiedBuildDir
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function resolvePrototypeShell(root, shell, entry) {
|
|
107
|
+
if (shell) return path.resolve(root, shell);
|
|
108
|
+
const override = path.resolve(root, PROTOTYPE_SHELL_OVERRIDE);
|
|
109
|
+
if (existsSync(override)) return override;
|
|
110
|
+
const generated = path.resolve(root, PROTOTYPE_SHELL_FILE);
|
|
111
|
+
const contents = renderPrototypeShell(entry);
|
|
112
|
+
if (readShell(generated) !== contents) {
|
|
113
|
+
mkdirSync(path.dirname(generated), { recursive: true });
|
|
114
|
+
writeFileSync(generated, contents);
|
|
115
|
+
}
|
|
116
|
+
return generated;
|
|
117
|
+
}
|
|
118
|
+
/** The shell on disk, or null when there is none; read directly so no check-then-read window exists. */
|
|
119
|
+
function readShell(file) {
|
|
120
|
+
try {
|
|
121
|
+
return readFileSync(file, "utf8");
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function renderPrototypeShell(entry) {
|
|
127
|
+
return `<!doctype html>
|
|
128
|
+
<html lang="en">
|
|
129
|
+
<head>
|
|
130
|
+
<meta charset="utf-8" />
|
|
131
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
132
|
+
<meta name="robots" content="noindex, nofollow" />
|
|
133
|
+
<title>Prototype</title>
|
|
134
|
+
</head>
|
|
135
|
+
<body>
|
|
136
|
+
<div id="app"></div>
|
|
137
|
+
<script type="module" src="${`/${entry.replace(/^\.?\//u, "")}`}"><\/script>
|
|
138
|
+
</body>
|
|
139
|
+
</html>
|
|
140
|
+
`;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Vite emits an HTML input at its path relative to the root, so the shell
|
|
144
|
+
* lands nested; move it to the top, then add the SPA fallbacks: `404.html`
|
|
145
|
+
* (GitHub Pages) and `_redirects` (Netlify, Cloudflare Pages).
|
|
146
|
+
*/
|
|
147
|
+
function finishPrototypeBuild(prototype) {
|
|
148
|
+
const relative = path.relative(prototype.root, prototype.shellPath);
|
|
149
|
+
const nested = path.resolve(prototype.outDir, relative);
|
|
150
|
+
const top = path.resolve(prototype.outDir, "index.html");
|
|
151
|
+
if (nested !== top && existsSync(nested)) {
|
|
152
|
+
renameSync(nested, top);
|
|
153
|
+
const topLevelDir = relative.split(path.sep)[0];
|
|
154
|
+
if (topLevelDir && topLevelDir !== "." && topLevelDir !== "..") rmSync(path.resolve(prototype.outDir, topLevelDir), {
|
|
155
|
+
recursive: true,
|
|
156
|
+
force: true
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (!existsSync(top)) throw new Error(`Prototype build produced no index.html in ${prototype.outDir}`);
|
|
160
|
+
if (prototype.copiedBuildDir) rmSync(path.resolve(prototype.outDir, prototype.copiedBuildDir), {
|
|
161
|
+
recursive: true,
|
|
162
|
+
force: true
|
|
163
|
+
});
|
|
164
|
+
writeFileSync(path.resolve(prototype.outDir, "404.html"), readFileSync(top));
|
|
165
|
+
writeFileSync(path.resolve(prototype.outDir, "_redirects"), "/* /index.html 200\n");
|
|
166
|
+
}
|
|
31
167
|
function ensureDefaults(config, options, env) {
|
|
32
168
|
const root = resolveRoot(config.root);
|
|
169
|
+
config.define ??= {};
|
|
170
|
+
config.define["import.meta.env.GUREN_PROTOTYPE"] ??= "false";
|
|
33
171
|
ensureAliases(config, options, root);
|
|
34
172
|
ensureServer(config, options);
|
|
35
173
|
ensurePreview(config, options);
|
|
@@ -88,10 +226,13 @@ function ensureBuild(config, options, root, env) {
|
|
|
88
226
|
if (!isSsrBuild && output.manualChunks === void 0) output.manualChunks = createDefaultManualChunks(root);
|
|
89
227
|
config.build.rollupOptions.output = output;
|
|
90
228
|
}
|
|
229
|
+
/** `@guren/inertia-client`'s prototype entry (src or dist) and the Hono router it alone imports. */
|
|
230
|
+
const PROTOTYPE_RUNTIME_MODULE = /\/inertia-client\/(?:src|dist)\/prototype(?:-[^/]+)?\.[jt]sx?$|\/node_modules\/hono\/dist\/router\//u;
|
|
91
231
|
function createDefaultManualChunks(root) {
|
|
92
232
|
const normalizedRoot = root.replace(/\\/gu, "/");
|
|
93
233
|
return (id) => {
|
|
94
234
|
const normalizedId = id.replace(/\\/gu, "/");
|
|
235
|
+
if (PROTOTYPE_RUNTIME_MODULE.test(normalizedId)) return;
|
|
95
236
|
if (normalizedId.includes("/packages/inertia-client/")) return "inertia-vendor";
|
|
96
237
|
if (normalizedId.includes("/packages/core/") || normalizedId.includes("/packages/server/") || normalizedId.includes("/packages/orm/")) return "framework-vendor";
|
|
97
238
|
if (!normalizedId.includes("/node_modules/")) {
|
|
@@ -108,6 +249,12 @@ function createDefaultManualChunks(root) {
|
|
|
108
249
|
function resolveBuildOutputDirectory(root, outDir) {
|
|
109
250
|
return path.isAbsolute(outDir) ? outDir : path.resolve(root, outDir);
|
|
110
251
|
}
|
|
252
|
+
/** The path from `parent` down to `child`, or undefined when `child` is not below it. */
|
|
253
|
+
function relativeIfInside(parent, child) {
|
|
254
|
+
const relative = path.relative(parent, child);
|
|
255
|
+
if (relative === "" || relative.startsWith("..") || path.isAbsolute(relative)) return void 0;
|
|
256
|
+
return relative;
|
|
257
|
+
}
|
|
111
258
|
function deriveHttpBaseFromOutDir(outDir) {
|
|
112
259
|
const normalized = outDir.replace(/\\/gu, "/").replace(/^\.\//u, "");
|
|
113
260
|
if (normalized === "public") return "/public/";
|
package/dist/vite/plugin.d.ts
CHANGED
|
@@ -25,10 +25,49 @@ export interface GurenVitePluginOptions {
|
|
|
25
25
|
chunkFileNames?: string;
|
|
26
26
|
/** Rollup naming pattern for extracted assets (defaults to `[name]-[hash][extname]`). */
|
|
27
27
|
assetFileNames?: string;
|
|
28
|
+
/** Prototype mode (`vite --mode prototype`, RFC 0021): the static, server-less build. */
|
|
29
|
+
prototype?: GurenPrototypeOptions;
|
|
28
30
|
}
|
|
31
|
+
export interface GurenPrototypeOptions {
|
|
32
|
+
/** Vite `base` for a build hosted under a subpath (a GitHub project page, a preview URL). Defaults to `/`. */
|
|
33
|
+
base?: string;
|
|
34
|
+
/** Output directory (defaults to `dist/prototype`). */
|
|
35
|
+
outDir?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The HTML shell, relative to the project root. Defaults to
|
|
38
|
+
* `resources/js/prototype/index.html` when that file exists, else a
|
|
39
|
+
* generated shell under `.guren/prototype/`.
|
|
40
|
+
*/
|
|
41
|
+
shell?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Where the generated shell goes; `.guren/` is already gitignored and codegen-owned. */
|
|
44
|
+
export declare const PROTOTYPE_SHELL_FILE = ".guren/prototype/index.html";
|
|
45
|
+
/** The override a project may ship instead of the generated shell. */
|
|
46
|
+
export declare const PROTOTYPE_SHELL_OVERRIDE = "resources/js/prototype/index.html";
|
|
47
|
+
export declare const PROTOTYPE_MODE = "prototype";
|
|
29
48
|
export declare function gurenVitePlugin(options?: GurenVitePluginOptions): {
|
|
30
49
|
name: string;
|
|
31
50
|
enforce: 'pre';
|
|
32
51
|
config(config: Record<string, any>, env: Record<string, any>): void;
|
|
52
|
+
configResolved(config: Record<string, any>): void;
|
|
53
|
+
configureServer(server: ViteDevServerLike): (() => void) | undefined;
|
|
54
|
+
writeBundle(): void;
|
|
33
55
|
};
|
|
56
|
+
interface ViteDevServerLike {
|
|
57
|
+
middlewares: {
|
|
58
|
+
use(handler: (req: IncomingLike, res: ResponseLike, next: (error?: unknown) => void) => void): void;
|
|
59
|
+
};
|
|
60
|
+
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
61
|
+
}
|
|
62
|
+
interface IncomingLike {
|
|
63
|
+
method?: string;
|
|
64
|
+
url?: string;
|
|
65
|
+
originalUrl?: string;
|
|
66
|
+
headers: Record<string, string | string[] | undefined>;
|
|
67
|
+
}
|
|
68
|
+
interface ResponseLike {
|
|
69
|
+
setHeader(name: string, value: string): void;
|
|
70
|
+
end(body: string): void;
|
|
71
|
+
}
|
|
72
|
+
export declare function renderPrototypeShell(entry: string): string;
|
|
34
73
|
export default gurenVitePlugin;
|
|
@@ -34,7 +34,7 @@ function parseImportMap(value, options = {}) {
|
|
|
34
34
|
const DEFAULT_DEV_STYLES_ENTRY = "/resources/css/app.css";
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region package.json
|
|
37
|
-
var version = "2.
|
|
37
|
+
var version = "2.21.0";
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/http/dev-banner.ts
|
|
40
40
|
figlet.parseFont("Standard", standard);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guren/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -142,14 +142,14 @@
|
|
|
142
142
|
"test": "bun test"
|
|
143
143
|
},
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@guren/orm": "^2.7.
|
|
145
|
+
"@guren/orm": "^2.7.1",
|
|
146
146
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
147
147
|
"chalk": "^5.3.0",
|
|
148
148
|
"consola": "^3.4.2",
|
|
149
149
|
"figlet": "^1.7.0",
|
|
150
|
-
"hono": "^4.13.
|
|
150
|
+
"hono": "^4.13.7",
|
|
151
151
|
"ioredis": "^5.11.1",
|
|
152
|
-
"nodemailer": "^9.
|
|
152
|
+
"nodemailer": "^9.1.1"
|
|
153
153
|
},
|
|
154
154
|
"peerDependencies": {
|
|
155
155
|
"@aws-sdk/client-s3": "^3.0.0",
|
package/dist/{DocsViewerServiceProvider-D2cuVgtN.js → DocsViewerServiceProvider-DWnlXx_y.js}
RENAMED
|
@@ -2,8 +2,8 @@ import { r as ServiceProvider } from "./loopback-guard-DT9gHF0F.js";
|
|
|
2
2
|
import { n as createDocsViewerAccessGuard, r as isDocsViewerEnabled, t as DOCS_VIEWER_PATH } from "./endpoint-BXipU2Jj.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { readFile } from "node:fs/promises";
|
|
6
5
|
import { join } from "node:path";
|
|
6
|
+
import { readFile } from "node:fs/promises";
|
|
7
7
|
//#region src/docs-viewer/DocsViewerServiceProvider.ts
|
|
8
8
|
/**
|
|
9
9
|
* How long a built `data.json` payload answers requests. Longer than the UI's
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as isPromiseLike } from "./Logger-DFifRAtc.js";
|
|
2
2
|
import { n as isHotReloadRuntime, t as claimHotDisposable } from "./hot-disposables-B5BXqaIH.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { mkdir, readFile, readdir, rm, unlink, writeFile } from "node:fs/promises";
|
|
5
4
|
import { dirname, join } from "node:path";
|
|
5
|
+
import { mkdir, readFile, readdir, rm, unlink, writeFile } from "node:fs/promises";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
//#region src/redis/lazy-client.ts
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readFile, readdir } from "node:fs/promises";
|
|
2
1
|
import { basename, extname, join } from "node:path";
|
|
2
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
3
3
|
//#region src/i18n/pluralization.ts
|
|
4
4
|
/**
|
|
5
5
|
* Default pluralization rules per language, each returning the index of the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as trimSlashes } from "./trim-slashes-BLY9hKAa.js";
|
|
2
|
-
import { copyFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
2
|
import { dirname, join, resolve, sep } from "node:path";
|
|
3
|
+
import { copyFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { Readable } from "node:stream";
|
|
6
6
|
//#region src/support/warn-once.ts
|