@wxn0brp/falcon-frame 0.8.6 → 0.8.7

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/debug.d.ts CHANGED
@@ -3,5 +3,6 @@ import { RouteHandler } from "./types.js";
3
3
  export interface DebugOptions {
4
4
  url?: string;
5
5
  hosts?: string[];
6
+ logs?: boolean;
6
7
  }
7
8
  export declare function createDebug(opts?: DebugOptions): Router | RouteHandler;
package/dist/debug.html CHANGED
@@ -392,6 +392,13 @@
392
392
  }
393
393
  }
394
394
 
395
+ function formatBody(e) {
396
+ if (e.method === "POST" && e.url.startsWith("/logs") && Array.isArray(e.body)) {
397
+ return e.body.join("\n");
398
+ }
399
+ return formatJSON(e.body);
400
+ }
401
+
395
402
  function isEmpty(obj) {
396
403
  if (!obj || typeof obj !== "object") return true;
397
404
  const keys = Object.keys(obj);
@@ -468,7 +475,7 @@
468
475
  if (!isEmpty(e.headers)) html += `<div class="detail-section"><div class="detail-section-header"><h4>Headers</h4><button class="copy-btn" data-copy>Copy</button></div><pre>${esc(formatJSON(e.headers))}</pre></div>`;
469
476
  if (!isEmpty(e.query)) html += `<div class="detail-section"><div class="detail-section-header"><h4>Query</h4><button class="copy-btn" data-copy>Copy</button></div><pre>${esc(formatJSON(e.query))}</pre></div>`;
470
477
  if (!isEmpty(e.cookies)) html += `<div class="detail-section"><div class="detail-section-header"><h4>Cookies</h4><button class="copy-btn" data-copy>Copy</button></div><pre>${esc(formatJSON(e.cookies))}</pre></div>`;
471
- if (!isEmpty(e.body)) html += `<div class="detail-section"><div class="detail-section-header"><h4>Body</h4><button class="copy-btn" data-copy>Copy</button></div><pre>${esc(formatJSON(e.body))}</pre></div>`;
478
+ if (!isEmpty(e.body)) html += `<div class="detail-section"><div class="detail-section-header"><h4>Body</h4><button class="copy-btn" data-copy>Copy</button></div><pre>${esc(formatBody(e))}</pre></div>`;
472
479
  html += `</div></td></tr>`;
473
480
  }
474
481
 
package/dist/debug.js CHANGED
@@ -5,7 +5,7 @@ export function createDebug(opts = {}) {
5
5
  "localhost",
6
6
  "127.0.0.1",
7
7
  "::1",
8
- ], } = opts;
8
+ ], logs = true, } = opts;
9
9
  if (process.env.NODE_ENV === "production" &&
10
10
  !process.env.FF_DEBUG_PRODUCTION_ENABLED)
11
11
  return (req, res, next) => {
@@ -54,5 +54,7 @@ export function createDebug(opts = {}) {
54
54
  };
55
55
  next();
56
56
  });
57
+ if (logs)
58
+ router.post("/logs", () => "ok");
57
59
  return router;
58
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/falcon-frame",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "wxn0brP",