@stacksjs/router 0.75.369 → 0.75.371
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/error-handler.js +1 -1
- package/package.json +16 -16
package/dist/error-handler.js
CHANGED
|
@@ -8,4 +8,4 @@ import process from"node:process";import{log}from"@stacksjs/logging/runtime";imp
|
|
|
8
8
|
<pre>${escapeHtml(error.stack||"")}</pre>
|
|
9
9
|
</body>
|
|
10
10
|
</html>
|
|
11
|
-
`,{status,headers:getErrorHeaders("text/html; charset=utf-8")})}}export async function createMiddlewareErrorResponse(error,request){const status=error.statusCode??error.status??500,isDevelopment=isDebugAllowed();if(status>=400&&status<500){const headers=getJsonHeaders(error.headers);return new Response(buildErrorJson({error:error.name||"ClientError",message:error.message,status}),{status,headers})}if(isDevelopment)return await createErrorResponse(error,request,{status});return new Response(buildErrorJson({error:"Internal Server Error",message:"An unexpected error occurred.",status}),{status,headers:getJsonHeaders()})}export function createValidationErrorResponse(errors,_request){return new Response(buildErrorJson({error:"ValidationError",message:"Validation failed",status:422,details:{errors}}),{status:422,headers:getJsonHeaders()})}export async function createNotFoundResponse(path,request){if(isDebugAllowed()){const error=Error(`Route not found: ${path}`);error.name="NotFoundError";return await createErrorResponse(error,request,{status:404})}if(isApiRequest(request))return new Response(buildErrorJson({error:"NotFound",message:`Route not found: ${path}`,status:404}),{status:404,headers:getJsonHeaders()});const{renderProductionErrorPage}=await import("@stacksjs/error-handling/error-page");return new Response(renderProductionErrorPage(404),{status:404,headers:getErrorHeaders("text/html; charset=utf-8")})}
|
|
11
|
+
`,{status,headers:getErrorHeaders("text/html; charset=utf-8")})}}export async function createMiddlewareErrorResponse(error,request){const status=error.statusCode??error.status??500,isDevelopment=isDebugAllowed();if(status>=400&&status<500){if(isApiRequest(request)){const headers=getJsonHeaders(error.headers);return new Response(buildErrorJson({error:error.name||"ClientError",message:error.message,status}),{status,headers})}if(isDevelopment)return await createErrorResponse(error,request,{status});const{renderProductionErrorPage}=await import("@stacksjs/error-handling/error-page");return new Response(renderProductionErrorPage(status),{status,headers:getErrorHeaders("text/html; charset=utf-8",error.headers)})}if(isDevelopment)return await createErrorResponse(error,request,{status});return new Response(buildErrorJson({error:"Internal Server Error",message:"An unexpected error occurred.",status}),{status,headers:getJsonHeaders()})}export function createValidationErrorResponse(errors,_request){return new Response(buildErrorJson({error:"ValidationError",message:"Validation failed",status:422,details:{errors}}),{status:422,headers:getJsonHeaders()})}export async function createNotFoundResponse(path,request){if(isDebugAllowed()){const error=Error(`Route not found: ${path}`);error.name="NotFoundError";return await createErrorResponse(error,request,{status:404})}if(isApiRequest(request))return new Response(buildErrorJson({error:"NotFound",message:`Route not found: ${path}`,status:404}),{status:404,headers:getJsonHeaders()});const{renderProductionErrorPage}=await import("@stacksjs/error-handling/error-page");return new Response(renderProductionErrorPage(404),{status:404,headers:getErrorHeaders("text/html; charset=utf-8")})}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/router",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.371",
|
|
6
6
|
"description": "The Stacks framework router.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -67,27 +67,27 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@stacksjs/bun-router": "^0.1.24",
|
|
70
|
-
"@stacksjs/cache": "0.75.
|
|
71
|
-
"@stacksjs/collections": "0.75.
|
|
72
|
-
"@stacksjs/config": "0.75.
|
|
73
|
-
"@stacksjs/error-handling": "0.75.
|
|
74
|
-
"@stacksjs/logging": "0.75.
|
|
75
|
-
"@stacksjs/pagination": "0.75.
|
|
76
|
-
"@stacksjs/path": "0.75.
|
|
77
|
-
"@stacksjs/security": "0.75.
|
|
78
|
-
"@stacksjs/storage": "0.75.
|
|
70
|
+
"@stacksjs/cache": "0.75.371",
|
|
71
|
+
"@stacksjs/collections": "0.75.371",
|
|
72
|
+
"@stacksjs/config": "0.75.371",
|
|
73
|
+
"@stacksjs/error-handling": "0.75.371",
|
|
74
|
+
"@stacksjs/logging": "0.75.371",
|
|
75
|
+
"@stacksjs/pagination": "0.75.371",
|
|
76
|
+
"@stacksjs/path": "0.75.371",
|
|
77
|
+
"@stacksjs/security": "0.75.371",
|
|
78
|
+
"@stacksjs/storage": "0.75.371",
|
|
79
79
|
"ts-rate-limiter": "^0.4.10"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@stacksjs/actions": "0.75.
|
|
83
|
-
"@stacksjs/types": "0.75.
|
|
82
|
+
"@stacksjs/actions": "0.75.371",
|
|
83
|
+
"@stacksjs/types": "0.75.371",
|
|
84
84
|
"better-dx": "^0.2.24"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@stacksjs/api": "0.75.
|
|
88
|
-
"@stacksjs/auth": "0.75.
|
|
89
|
-
"@stacksjs/database": "0.75.
|
|
90
|
-
"@stacksjs/validation": "0.75.
|
|
87
|
+
"@stacksjs/api": "0.75.371",
|
|
88
|
+
"@stacksjs/auth": "0.75.371",
|
|
89
|
+
"@stacksjs/database": "0.75.371",
|
|
90
|
+
"@stacksjs/validation": "0.75.371"
|
|
91
91
|
},
|
|
92
92
|
"peerDependenciesMeta": {
|
|
93
93
|
"@stacksjs/api": {
|