@guren/server 2.9.0 → 2.10.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.
|
@@ -33,6 +33,14 @@ export interface DiscoveryResult {
|
|
|
33
33
|
* Auto-discovery engine that scans application directories and discovers
|
|
34
34
|
* framework components (providers, listeners, jobs, events).
|
|
35
35
|
*
|
|
36
|
+
* Standalone by design: nothing in `Application` runs this scan, so
|
|
37
|
+
* registration stays explicit — `createApp({ providers: [...] })`, and
|
|
38
|
+
* `defineModule` lists for modules — which is what `guren check` verifies
|
|
39
|
+
* and what bundle-deploy targets (Workers, Vercel, Lambda) require, since a
|
|
40
|
+
* runtime directory scan finds nothing in a bundle. A caller that wants
|
|
41
|
+
* discovery runs the scan itself and feeds each result into the matching
|
|
42
|
+
* registry, as the example below does.
|
|
43
|
+
*
|
|
36
44
|
* Uses `Bun.Glob` to scan directories and dynamic `import()` to load modules.
|
|
37
45
|
*
|
|
38
46
|
* @example
|
|
@@ -72,7 +72,6 @@ export interface ApplicationOptions {
|
|
|
72
72
|
* is registered automatically.
|
|
73
73
|
*/
|
|
74
74
|
readonly i18n?: I18nPluginOptions;
|
|
75
|
-
readonly discover?: boolean;
|
|
76
75
|
readonly routes?: RouteRegistration;
|
|
77
76
|
/**
|
|
78
77
|
* Application modules (RFC 0002) — each module's providers are appended
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
logDevServerBanner,
|
|
6
6
|
parseImportMap,
|
|
7
7
|
startViteDevServer
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VSA3QY5Q.js";
|
|
9
9
|
import {
|
|
10
10
|
PendingSchedule,
|
|
11
11
|
Schedule,
|
|
@@ -221,6 +221,14 @@ import {
|
|
|
221
221
|
AuthenticationException,
|
|
222
222
|
HttpException
|
|
223
223
|
} from "./chunk-DAQKYKLH.js";
|
|
224
|
+
import {
|
|
225
|
+
CacheManager,
|
|
226
|
+
FileStore,
|
|
227
|
+
MemoryStore,
|
|
228
|
+
RedisStore,
|
|
229
|
+
TaggedCache,
|
|
230
|
+
createCacheManager
|
|
231
|
+
} from "./chunk-HPET6XY5.js";
|
|
224
232
|
import {
|
|
225
233
|
BroadcastManager,
|
|
226
234
|
Channel,
|
|
@@ -236,14 +244,6 @@ import {
|
|
|
236
244
|
parseRequestPayload,
|
|
237
245
|
setBroadcastManager
|
|
238
246
|
} from "./chunk-DRNPVBAA.js";
|
|
239
|
-
import {
|
|
240
|
-
CacheManager,
|
|
241
|
-
FileStore,
|
|
242
|
-
MemoryStore,
|
|
243
|
-
RedisStore,
|
|
244
|
-
TaggedCache,
|
|
245
|
-
createCacheManager
|
|
246
|
-
} from "./chunk-HPET6XY5.js";
|
|
247
247
|
import {
|
|
248
248
|
claimHotDisposable,
|
|
249
249
|
isHotReloadRuntime,
|
|
@@ -771,7 +771,7 @@ function substituteParams(path, params) {
|
|
|
771
771
|
}
|
|
772
772
|
function createContractHandler(path, options, handler) {
|
|
773
773
|
return async (ctx) => {
|
|
774
|
-
const params = parseRouteSegment(options.params, ctx.req.param(),
|
|
774
|
+
const params = parseRouteSegment(options.params, ctx.req.param(), 422);
|
|
775
775
|
if (params instanceof Response) {
|
|
776
776
|
return params;
|
|
777
777
|
}
|
|
@@ -844,6 +844,12 @@ function validationErrorResponse(error, status) {
|
|
|
844
844
|
headers: { "Content-Type": "application/json; charset=utf-8" }
|
|
845
845
|
});
|
|
846
846
|
}
|
|
847
|
+
function throwOnInvalid(schema, data) {
|
|
848
|
+
const result = schema.safeParse(data);
|
|
849
|
+
if (!result.success) {
|
|
850
|
+
throw ValidationException.withMessages(formatValidationErrors(result.error));
|
|
851
|
+
}
|
|
852
|
+
}
|
|
847
853
|
function createContractValidationMiddleware(route) {
|
|
848
854
|
if (!isControllerAction(route.handler)) {
|
|
849
855
|
return null;
|
|
@@ -854,21 +860,10 @@ function createContractValidationMiddleware(route) {
|
|
|
854
860
|
}
|
|
855
861
|
return async (c, next) => {
|
|
856
862
|
if (schemas.params) {
|
|
857
|
-
|
|
858
|
-
if (result instanceof Response) {
|
|
859
|
-
throw ValidationException.withMessages(
|
|
860
|
-
formatValidationErrors(schemas.params.safeParse(c.req.param()).error)
|
|
861
|
-
);
|
|
862
|
-
}
|
|
863
|
+
throwOnInvalid(schemas.params, c.req.param());
|
|
863
864
|
}
|
|
864
865
|
if (schemas.query) {
|
|
865
|
-
|
|
866
|
-
const result = parseRouteSegment(schemas.query, query, 422);
|
|
867
|
-
if (result instanceof Response) {
|
|
868
|
-
throw ValidationException.withMessages(
|
|
869
|
-
formatValidationErrors(schemas.query.safeParse(query).error)
|
|
870
|
-
);
|
|
871
|
-
}
|
|
866
|
+
throwOnInvalid(schemas.query, flattenRequestQueries(c));
|
|
872
867
|
}
|
|
873
868
|
await next();
|
|
874
869
|
if (schemas.output && c.res) {
|
|
@@ -2841,9 +2836,10 @@ function registerProcessTeardown(onSignal, onExit) {
|
|
|
2841
2836
|
process.once("SIGTERM", onSignal);
|
|
2842
2837
|
process.on("exit", onExit);
|
|
2843
2838
|
return () => {
|
|
2844
|
-
process
|
|
2845
|
-
|
|
2846
|
-
|
|
2839
|
+
const emitter = process;
|
|
2840
|
+
emitter.off("SIGINT", onSignal);
|
|
2841
|
+
emitter.off("SIGTERM", onSignal);
|
|
2842
|
+
emitter.off("exit", onExit);
|
|
2847
2843
|
};
|
|
2848
2844
|
}
|
|
2849
2845
|
function viteCloseTimeoutMs() {
|
package/dist/runtime/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
logDevServerBanner,
|
|
5
5
|
parseImportMap,
|
|
6
6
|
startViteDevServer
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-VSA3QY5Q.js";
|
|
8
8
|
import {
|
|
9
9
|
trimTrailingSlashes
|
|
10
10
|
} from "../chunk-AZOYI43J.js";
|
|
@@ -390,11 +390,20 @@ function configureInertiaAssets(app, options) {
|
|
|
390
390
|
}
|
|
391
391
|
const publicRoute = options.publicRoute ?? "/public/*";
|
|
392
392
|
const rewriteRequestPath = createStaticRewrite(publicRoute);
|
|
393
|
+
const hashedAssetsPrefix = `${publicRouteBase(publicRoute)}/assets/`;
|
|
393
394
|
app.use(
|
|
394
395
|
publicRoute,
|
|
395
396
|
serveStatic2({
|
|
396
397
|
root: publicDir,
|
|
397
|
-
rewriteRequestPath
|
|
398
|
+
rewriteRequestPath,
|
|
399
|
+
// Vite writes content-hashed filenames under `assets/`, so those
|
|
400
|
+
// responses can be cached forever. Files elsewhere in public/ keep
|
|
401
|
+
// stable names and must stay revalidatable.
|
|
402
|
+
onFound: (_path, ctx) => {
|
|
403
|
+
if (ctx.req.path.startsWith(hashedAssetsPrefix)) {
|
|
404
|
+
ctx.header("Cache-Control", "public, max-age=31536000, immutable");
|
|
405
|
+
}
|
|
406
|
+
}
|
|
398
407
|
})
|
|
399
408
|
);
|
|
400
409
|
if (options.favicon !== false) {
|
|
@@ -413,6 +422,11 @@ function configureInertiaAssets(app, options) {
|
|
|
413
422
|
}
|
|
414
423
|
}
|
|
415
424
|
}
|
|
425
|
+
function publicRouteBase(route) {
|
|
426
|
+
const wildcardIndex = route.indexOf("*");
|
|
427
|
+
const base = wildcardIndex >= 0 ? route.slice(0, wildcardIndex) : route;
|
|
428
|
+
return trimTrailingSlashes(base);
|
|
429
|
+
}
|
|
416
430
|
function registerBuiltInertiaClient(app, inertiaClientDir, inertiaClientPath) {
|
|
417
431
|
const {
|
|
418
432
|
base: inertiaClientBase,
|