@stacksjs/bun-router 0.0.17 → 0.0.19
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/chunk-2mx7fq49.js +4 -0
- package/dist/chunk-a8p83068.js +103 -0
- package/dist/{chunk-cgptvjdf.js → chunk-y3xq6wq6.js} +1 -1
- package/dist/cli.js +4 -3
- package/dist/container/index.js +1149 -211
- package/dist/container/service-provider.d.ts +3 -3
- package/dist/development/performance-profiler.d.ts +3 -3
- package/dist/development/route-debugger.d.ts +1 -1
- package/dist/development/route-inspector.d.ts +2 -2
- package/dist/index.js +369 -2209
- package/dist/observability/integration.d.ts +1 -1
- package/dist/response/macros.d.ts +1 -1
- package/dist/router/index.d.ts +7 -7
- package/dist/router/router.d.ts +0 -32
- package/dist/testing/performance-testing.d.ts +2 -2
- package/dist/testing/test-client.d.ts +1 -1
- package/dist/testing/websocket-testing.d.ts +1 -1
- package/package.json +7 -7
- package/dist/chunk-1ahs68ys.js +0 -18
- package/dist/chunk-g3ybefhg.js +0 -1923
- package/src/auth.ts +0 -489
- package/src/cache/lru-cache.ts +0 -457
- package/src/cache/middleware-memoization.ts +0 -531
- package/src/cache/route-cache-warmer.ts +0 -486
- package/src/cache/sqlite-cache.ts +0 -783
- package/src/cache/streaming-cache.ts +0 -572
- package/src/cli/colors.ts +0 -29
- package/src/cli/index.ts +0 -287
- package/src/cli/middleware.ts +0 -291
- package/src/cli/openapi.ts +0 -407
- package/src/cli/router.ts +0 -188
- package/src/cli/routes.ts +0 -265
- package/src/cli/utils.ts +0 -531
- package/src/cli.ts +0 -5
- package/src/config.ts +0 -322
- package/src/container/container.ts +0 -786
- package/src/container/contextual-binding.ts +0 -606
- package/src/container/decorators.ts +0 -368
- package/src/container/index.ts +0 -49
- package/src/container/service-provider.ts +0 -596
- package/src/development/hot-reload.ts +0 -673
- package/src/development/index.ts +0 -499
- package/src/development/performance-profiler.ts +0 -717
- package/src/development/route-debugger.ts +0 -527
- package/src/development/route-inspector.ts +0 -749
- package/src/development/typescript-utilities.ts +0 -682
- package/src/docs.ts +0 -397
- package/src/errors/circuit-breaker.ts +0 -733
- package/src/errors/error-handler.ts +0 -569
- package/src/errors/error-reporting.ts +0 -672
- package/src/errors/exceptions.ts +0 -536
- package/src/errors/graceful-degradation.ts +0 -623
- package/src/errors/index.ts +0 -21
- package/src/errors/router-errors.ts +0 -632
- package/src/file-serving/static-files.ts +0 -718
- package/src/index.ts +0 -66
- package/src/middleware/auth.ts +0 -220
- package/src/middleware/content_security_policy.ts +0 -215
- package/src/middleware/cors.ts +0 -142
- package/src/middleware/csrf.ts +0 -166
- package/src/middleware/ddos_protection.ts +0 -279
- package/src/middleware/file_security.ts +0 -191
- package/src/middleware/file_upload.ts +0 -275
- package/src/middleware/helmet.ts +0 -268
- package/src/middleware/index.ts +0 -117
- package/src/middleware/input_validation.ts +0 -453
- package/src/middleware/json_body.ts +0 -37
- package/src/middleware/performance_alerting.ts +0 -540
- package/src/middleware/performance_dashboard.ts +0 -661
- package/src/middleware/performance_monitor.ts +0 -945
- package/src/middleware/pipeline.ts +0 -489
- package/src/middleware/rate_limit.ts +0 -251
- package/src/middleware/request_id.ts +0 -36
- package/src/middleware/request_signing.ts +0 -638
- package/src/middleware/request_tracer.ts +0 -653
- package/src/middleware/response_cache.ts +0 -778
- package/src/middleware/security.ts +0 -482
- package/src/middleware/security_suite.ts +0 -257
- package/src/middleware/session.ts +0 -91
- package/src/model-binding/index.ts +0 -18
- package/src/model-binding/model-middleware.ts +0 -425
- package/src/model-binding/model-registry.ts +0 -550
- package/src/model-binding.ts +0 -370
- package/src/model-resolver-factory.ts +0 -106
- package/src/observability/correlation.ts +0 -691
- package/src/observability/health-checks.ts +0 -729
- package/src/observability/index.ts +0 -184
- package/src/observability/integration.ts +0 -548
- package/src/observability/metrics.ts +0 -753
- package/src/observability/tracing.ts +0 -638
- package/src/optimization/bun-utilities.ts +0 -778
- package/src/query-builder-integration.ts +0 -137
- package/src/request/context.ts +0 -109
- package/src/request/enhanced-request.ts +0 -876
- package/src/request/macros.ts +0 -822
- package/src/response/macros.ts +0 -665
- package/src/response/response-factory.ts +0 -596
- package/src/router/api-routes.ts +0 -243
- package/src/router/file-based-routing.ts +0 -697
- package/src/router/file-streaming.ts +0 -383
- package/src/router/fluent-routing.ts +0 -866
- package/src/router/group-organization.ts +0 -229
- package/src/router/handler-resolver.ts +0 -327
- package/src/router/http-methods.ts +0 -407
- package/src/router/index.ts +0 -193
- package/src/router/middleware-groups.ts +0 -222
- package/src/router/middleware-integration.ts +0 -399
- package/src/router/middleware.ts +0 -234
- package/src/router/model-binding.ts +0 -215
- package/src/router/optimized-route-matching.ts +0 -302
- package/src/router/route-building.ts +0 -221
- package/src/router/route-compiler.ts +0 -691
- package/src/router/route-matching.ts +0 -368
- package/src/router/route-trie.ts +0 -450
- package/src/router/router.ts +0 -1616
- package/src/router/server.ts +0 -684
- package/src/router/validation-integration.ts +0 -449
- package/src/router/view-rendering.ts +0 -233
- package/src/router/websocket.ts +0 -100
- package/src/routing/route-caching.ts +0 -402
- package/src/routing/route-throttling.ts +0 -469
- package/src/routing/subdomain-routing.ts +0 -492
- package/src/session/database-store.ts +0 -109
- package/src/session/file-store.ts +0 -148
- package/src/session/index.ts +0 -244
- package/src/session/memory-store.ts +0 -88
- package/src/session/redis-store.ts +0 -93
- package/src/streaming/index.ts +0 -17
- package/src/streaming/sse-handler.ts +0 -482
- package/src/streaming/stream-handler.ts +0 -552
- package/src/testing/auth-testing.ts +0 -448
- package/src/testing/file-upload-testing.ts +0 -543
- package/src/testing/index.ts +0 -10
- package/src/testing/middleware-testing.ts +0 -322
- package/src/testing/model-binding-testing.ts +0 -645
- package/src/testing/performance-testing.ts +0 -738
- package/src/testing/test-client.ts +0 -310
- package/src/testing/test-request.ts +0 -315
- package/src/testing/test-response.ts +0 -332
- package/src/testing/types.ts +0 -224
- package/src/testing/websocket-testing.ts +0 -590
- package/src/types/controller-types.ts +0 -385
- package/src/types/core.ts +0 -683
- package/src/types/middleware-types.ts +0 -422
- package/src/types/request-response-augmentation.ts +0 -489
- package/src/types/route-inference.ts +0 -372
- package/src/types.ts +0 -2123
- package/src/url.ts +0 -131
- package/src/utils/index.ts +0 -1
- package/src/utils/query-preservation.ts +0 -201
- package/src/utils.ts +0 -395
- package/src/validation/validator.ts +0 -688
- package/src/websocket/clustering.ts +0 -769
|
@@ -104,7 +104,7 @@ export declare const ObservabilityIntegration: {
|
|
|
104
104
|
manager: ObservabilityManager;
|
|
105
105
|
middleware: (req: EnhancedRequest, next: () => Promise<Response>) => Promise<Response>;
|
|
106
106
|
handlers: Record<string, (req: EnhancedRequest) => Promise<Response>>;
|
|
107
|
-
status: ReturnType<ObservabilityManager[
|
|
107
|
+
status: ReturnType<ObservabilityManager['getStatus']>;
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
110
|
* Create observability-enabled route builder
|
|
@@ -201,7 +201,7 @@ export declare const BuiltInResponseMacros: {
|
|
|
201
201
|
/**
|
|
202
202
|
* Health check response
|
|
203
203
|
*/
|
|
204
|
-
health: (status?:
|
|
204
|
+
health: (status?: 'healthy' | 'unhealthy' | 'degraded', checks?: Record<string, any>) => Response;
|
|
205
205
|
};
|
|
206
206
|
/**
|
|
207
207
|
* Register all built-in macros
|
package/dist/router/index.d.ts
CHANGED
|
@@ -55,11 +55,11 @@ declare module './router' {
|
|
|
55
55
|
clearAllCache: () => void;
|
|
56
56
|
getCacheStats: () => any;
|
|
57
57
|
};
|
|
58
|
-
matchRoute
|
|
58
|
+
matchRoute(path: string, method: string, domain?: string): {
|
|
59
59
|
route: Route;
|
|
60
60
|
params: Record<string, string>;
|
|
61
61
|
} | undefined;
|
|
62
|
-
getAllowedMethods
|
|
62
|
+
getAllowedMethods(path: string, domain?: string): string[];
|
|
63
63
|
clearRouteCache: () => void;
|
|
64
64
|
getCacheStats: () => any;
|
|
65
65
|
getRouteStats: () => any;
|
|
@@ -100,11 +100,11 @@ declare module './router' {
|
|
|
100
100
|
edit?: ActionHandler;
|
|
101
101
|
}) => Router;
|
|
102
102
|
head: (path: string, handler: ActionHandler, type?: 'api' | 'web', name?: string, middleware?: any[]) => Router;
|
|
103
|
-
onError
|
|
104
|
-
redirect
|
|
105
|
-
permanentRedirect
|
|
106
|
-
fallback
|
|
107
|
-
route
|
|
103
|
+
onError(handler: (error: Error) => Response | Promise<Response>): Router;
|
|
104
|
+
redirect(url: string, status?: 301 | 302 | 303 | 307 | 308): Response;
|
|
105
|
+
permanentRedirect(url: string): Response;
|
|
106
|
+
fallback(handler: ActionHandler): Router;
|
|
107
|
+
route(name: string, params?: Record<string, string>): string;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
export { Dependencies, FluentRouteBuilder, FluentRouter, globalMiddlewarePipeline, MiddlewareFactory, MiddlewarePipeline, RouteFactory, router, RouterUtils, SkipConditions };
|
package/dist/router/router.d.ts
CHANGED
|
@@ -155,26 +155,6 @@ export declare class Router {
|
|
|
155
155
|
* for `TPath`-driven param narrowing on inline handlers.
|
|
156
156
|
*/
|
|
157
157
|
any<TPath extends string>(path: TPath, handler: ActionHandler<TPath>, type?: 'api' | 'web', name?: string, middleware?: (string | MiddlewareHandler)[]): Router;
|
|
158
|
-
/**
|
|
159
|
-
* Set fallback handler for unmatched routes
|
|
160
|
-
*/
|
|
161
|
-
fallback(handler: ActionHandler): Router;
|
|
162
|
-
/**
|
|
163
|
-
* Generate URL for a named route
|
|
164
|
-
*/
|
|
165
|
-
route(name: string, params?: Record<string, string>): string;
|
|
166
|
-
/**
|
|
167
|
-
* Set error handler
|
|
168
|
-
*/
|
|
169
|
-
onError(handler: (error: Error) => Response | Promise<Response>): Router;
|
|
170
|
-
/**
|
|
171
|
-
* Create redirect response
|
|
172
|
-
*/
|
|
173
|
-
redirect(url: string, status?: 301 | 302 | 303 | 307 | 308): Response;
|
|
174
|
-
/**
|
|
175
|
-
* Create permanent redirect response
|
|
176
|
-
*/
|
|
177
|
-
permanentRedirect(url: string): Response;
|
|
178
158
|
/**
|
|
179
159
|
* Register redirect route
|
|
180
160
|
*/
|
|
@@ -190,18 +170,6 @@ export declare class Router {
|
|
|
190
170
|
* Handle an HTTP request
|
|
191
171
|
*/
|
|
192
172
|
handleRequest(req: Request): Promise<Response>;
|
|
193
|
-
/**
|
|
194
|
-
* Get all allowed HTTP methods for a given path
|
|
195
|
-
* Used to determine if a 405 Method Not Allowed should be returned instead of 404
|
|
196
|
-
*/
|
|
197
|
-
getAllowedMethods(path: string, domain?: string): string[];
|
|
198
|
-
/**
|
|
199
|
-
* Match a route based on the path, method, and domain
|
|
200
|
-
*/
|
|
201
|
-
matchRoute(path: string, method: string, domain?: string): {
|
|
202
|
-
route: Route;
|
|
203
|
-
params: Record<string, string>;
|
|
204
|
-
} | undefined;
|
|
205
173
|
/**
|
|
206
174
|
* Enhance a request with params and other utilities
|
|
207
175
|
*/
|
|
@@ -219,11 +219,11 @@ export declare const performanceUtils: {
|
|
|
219
219
|
/**
|
|
220
220
|
* Get current memory usage
|
|
221
221
|
*/
|
|
222
|
-
getCurrentMemoryUsage: () => PerformanceMetrics[
|
|
222
|
+
getCurrentMemoryUsage: () => PerformanceMetrics['memoryUsage'];
|
|
223
223
|
/**
|
|
224
224
|
* Get CPU usage
|
|
225
225
|
*/
|
|
226
|
-
getCPUUsage: () => PerformanceMetrics[
|
|
226
|
+
getCPUUsage: () => PerformanceMetrics['cpuUsage'];
|
|
227
227
|
/**
|
|
228
228
|
* Create performance metric snapshot
|
|
229
229
|
*/
|
|
@@ -109,7 +109,7 @@ export declare const testClient: {
|
|
|
109
109
|
/**
|
|
110
110
|
* Create a test client with authentication
|
|
111
111
|
*/
|
|
112
|
-
withAuth: (token: string, type?:
|
|
112
|
+
withAuth: (token: string, type?: 'Bearer' | 'Basic') => (router: Router) => TestClient;
|
|
113
113
|
/**
|
|
114
114
|
* Create a test client with custom headers
|
|
115
115
|
*/
|
|
@@ -172,7 +172,7 @@ export declare const wsAssertions: {
|
|
|
172
172
|
/**
|
|
173
173
|
* Assert message type
|
|
174
174
|
*/
|
|
175
|
-
messageType: (tester: WebSocketTester, index: number, expectedType:
|
|
175
|
+
messageType: (tester: WebSocketTester, index: number, expectedType: 'text' | 'binary') => void;
|
|
176
176
|
/**
|
|
177
177
|
* Assert ready state
|
|
178
178
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/bun-router",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"version": "0.0.19",
|
|
5
6
|
"description": "A fast, type-safe router for Bun.",
|
|
6
7
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
8
|
"license": "MIT",
|
|
@@ -24,13 +25,13 @@
|
|
|
24
25
|
],
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
27
|
-
"bun": "./dist/index.js",
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
|
+
"bun": "./dist/index.js",
|
|
29
30
|
"import": "./dist/index.js"
|
|
30
31
|
},
|
|
31
32
|
"./container": {
|
|
32
|
-
"bun": "./dist/container/index.js",
|
|
33
33
|
"types": "./dist/container/index.d.ts",
|
|
34
|
+
"bun": "./dist/container/index.js",
|
|
34
35
|
"import": "./dist/container/index.js"
|
|
35
36
|
},
|
|
36
37
|
"./*": {
|
|
@@ -41,13 +42,13 @@
|
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"exports": {
|
|
43
44
|
".": {
|
|
44
|
-
"bun": "./dist/index.js",
|
|
45
45
|
"types": "./dist/index.d.ts",
|
|
46
|
+
"bun": "./dist/index.js",
|
|
46
47
|
"import": "./dist/index.js"
|
|
47
48
|
},
|
|
48
49
|
"./container": {
|
|
49
|
-
"bun": "./dist/container/index.js",
|
|
50
50
|
"types": "./dist/container/index.d.ts",
|
|
51
|
+
"bun": "./dist/container/index.js",
|
|
51
52
|
"import": "./dist/container/index.js"
|
|
52
53
|
},
|
|
53
54
|
"./*": {
|
|
@@ -64,8 +65,7 @@
|
|
|
64
65
|
},
|
|
65
66
|
"files": [
|
|
66
67
|
"README.md",
|
|
67
|
-
"dist"
|
|
68
|
-
"src"
|
|
68
|
+
"dist"
|
|
69
69
|
],
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "bun --bun build.ts && bun run compile",
|
package/dist/chunk-1ahs68ys.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
var __require = import.meta.require;
|
|
17
|
-
|
|
18
|
-
export { __export, __require };
|