nestjs-devtools 1.2.1 → 1.2.3

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.
@@ -4,7 +4,7 @@ export declare class DevtoolsController {
4
4
  private readonly devtoolsService;
5
5
  private readonly collectors;
6
6
  constructor(devtoolsService: DevtoolsService, collectors?: AbstractCollector[]);
7
- getProfiler(): string;
7
+ getProfiler(res: any): void;
8
8
  getToolbarData(): Record<string, unknown>;
9
9
  getHistory(): {
10
10
  id: string;
@@ -22,8 +22,14 @@ let DevtoolsController = class DevtoolsController {
22
22
  this.devtoolsService = devtoolsService;
23
23
  this.collectors = collectors;
24
24
  }
25
- getProfiler() {
26
- return (0, profiler_1.PROFILER_PAGE)();
25
+ getProfiler(res) {
26
+ try {
27
+ res.type('text/html');
28
+ }
29
+ catch {
30
+ res.header('content-type', 'text/html');
31
+ }
32
+ res.send((0, profiler_1.PROFILER_PAGE)());
27
33
  }
28
34
  getToolbarData() {
29
35
  const panels = {};
@@ -48,9 +54,9 @@ let DevtoolsController = class DevtoolsController {
48
54
  exports.DevtoolsController = DevtoolsController;
49
55
  __decorate([
50
56
  (0, common_1.Get)(),
51
- (0, common_1.Header)('content-type', 'text/html'),
57
+ __param(0, (0, common_1.Res)()),
52
58
  __metadata("design:type", Function),
53
- __metadata("design:paramtypes", []),
59
+ __metadata("design:paramtypes", [Object]),
54
60
  __metadata("design:returntype", void 0)
55
61
  ], DevtoolsController.prototype, "getProfiler", null);
56
62
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"devtools.controller.js","sourceRoot":"","sources":["../devtools.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2E;AAC3E,yDAAqD;AAErD,uDAA6D;AAC7D,iDAAmD;AAG5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YACmB,eAAgC,EAGhC,aAAkC,EAAE;QAHpC,oBAAe,GAAf,eAAe,CAAiB;QAGhC,eAAU,GA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IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC;IAClD,CAAC;CACF,CAAA;AArCY,gDAAkB;AAS7B;IADC,IAAA,YAAG,GAAE;IACO,WAAA,IAAA,YAAG,GAAE,CAAA;;;;qDAGjB;AAGD;IADC,IAAA,YAAG,EAAC,MAAM,CAAC;;;;wDAWX;AAGD;IADC,IAAA,YAAG,EAAC,SAAS,CAAC;;;;oDAGd;AAGD;IADC,IAAA,YAAG,EAAC,aAAa,CAAC;;;;0DAIlB;6BApCU,kBAAkB;IAD9B,IAAA,mBAAU,EAAC,YAAY,CAAC;IAIpB,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,0CAAwB,CAAC,CAAA;qCAFC,kCAAe;GAFxC,kBAAkB,CAqC9B"}
@@ -97,7 +97,7 @@ const PROFILER_PAGE = () => `<!DOCTYPE html>
97
97
  </div>
98
98
  <script>
99
99
  (function() {
100
- var BASE = window.location.pathname.replace(/\/__devtools\/?$/, '');
100
+ var BASE = window.location.pathname.replace(/\\/__devtools\\/?$/, '');
101
101
  function escape(s) { return s==null?'':String(s).replace(/[&<>"]/g,function(m){return {'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[m]}); }
102
102
 
103
103
  document.querySelectorAll('[data-tab]').forEach(function(btn){
@@ -7,9 +7,9 @@ const TOOLBAR_TEMPLATE = () => {
7
7
  return `<script id="${id}">
8
8
  (function(){
9
9
  var D=document, B=D.body, C='__nestDt'+'${uid}';
10
- var p = window.location.pathname.replace(/\\/[^\\/]*$/,'') + '/__devtools';
10
+ var p = window.location.pathname.replace(\/[^\/]*$/,'') + '/__devtools';
11
11
  var c=D.createElement('div'); c.id=C;
12
- c.innerHTML='<div style="position:fixed;bottom:0;left:0;z-index:99999;font-family:-apple-system,BlinkMacSystemFont,\'Segoe UI\',Roboto,sans-serif;font-size:12px;background:#1f2937;color:#f3f4f6;border-top:2px solid #3b82f6;width:100%;box-shadow:0 -4px 12px rgba(0,0,0,0.35)"><div style="display:flex;align-items:center;height:34px;padding:0 8px;gap:4px;overflow-x:auto;white-space:nowrap;scrollbar-width:none"><span style="font-weight:800;font-size:13px;color:#60a5fa;padding:0 10px 0 4px;letter-spacing:-0.5px">NDev</span><div id="'+C+'-bar"></div><a href="'+p+'" target="_blank" style="color:#6b7280;text-decoration:none;padding:4px 8px;font-size:11px;margin-left:auto" title="Open profiler">&#x25A3;</a><span id="'+C+'-toggle" style="color:#6b7280;cursor:pointer;padding:4px 8px;font-size:14px">&#x2039;</span></div><div id="'+C+'-panel" style="display:none;border-top:1px solid #374151;background:#111827;font-size:12px;line-height:1.5"></div></div>';
12
+ c.innerHTML='<div style="position:fixed;bottom:0;left:0;z-index:99999;font-family:system-ui,BlinkMacSystemFont,sans-serif;font-size:12px;background:#1f2937;color:#f3f4f6;border-top:2px solid #3b82f6;width:100%;box-shadow:0 -4px 12px rgba(0,0,0,0.35)"><div style="display:flex;align-items:center;height:34px;padding:0 8px;gap:4px;overflow-x:auto;white-space:nowrap;scrollbar-width:none"><span style="font-weight:800;font-size:13px;color:#60a5fa;padding:0 10px 0 4px;letter-spacing:-0.5px">NDev</span><div id="'+C+'-bar"></div><a href="'+p+'" target="_blank" style="color:#6b7280;text-decoration:none;padding:4px 8px;font-size:11px;margin-left:auto" title="Open profiler">&#x25A3;</a><span id="'+C+'-toggle" style="color:#6b7280;cursor:pointer;padding:4px 8px;font-size:14px">&#x2039;</span></div><div id="'+C+'-panel" style="display:none;border-top:1px solid #374151;background:#111827;font-size:12px;line-height:1.5"></div></div>';
13
13
  B.appendChild(c);
14
14
 
15
15
  var lastActive=null;
@@ -21,7 +21,7 @@ const TOOLBAR_TEMPLATE = () => {
21
21
  h+='<div style="display:flex;align-items:center;margin-bottom:10px;gap:8px">';
22
22
  h+='<span style="font-weight:700;font-size:13px">'+detail.label+'</span>';
23
23
  h+='<span style="color:#9ca3af;font-size:11px">'+detail.summary+'</span>';
24
- h+='<span style="margin-left:auto;cursor:pointer;color:#6b7280;font-size:16px" onclick="document.getElementById(\''+C+'-panel\').style.display=\'none\';lastActive=null">\u00d7</span>';
24
+ h+='<span style="margin-left:auto;cursor:pointer;color:#6b7280;font-size:16px" onclick="document.getElementById('+C+'-panel).style.display=\\'none\\';lastActive=null">\u00d7</span>';
25
25
  h+='</div>';
26
26
  h+='<table style="width:100%;border-collapse:collapse">';
27
27
  for (var k in detail.details) {
@@ -75,8 +75,7 @@ const TOOLBAR_TEMPLATE = () => {
75
75
  if(d.routes) panels.push(d.routes);
76
76
  if(d.logs) panels.push(d.logs);
77
77
  for(var k in d){if(panels.indexOf(d[k])===-1&&d[k]&&d[k].label)panels.push(d[k]);}
78
- var colors=['#a6e3a1','#f9e2af','#89b4fa','#94e2d5','#fab387','#cba6f7','#f38ba8','#a6e3a1'];
79
- var icons={request:'\u{1F310}',performance:'\u26A1',database:'\u{1F5C4}\uFE0F',routes:'\u{1F4CB}',logs:'\u{1F4DD}','default':'\u{1F527}'};
78
+ var icons={request:'🌐',performance:'',database:'🗄️',routes:'📋',logs:'📝','default':'🔧'};
80
79
  panels.forEach(function(p,i){
81
80
  var ic=icons[p.label.toLowerCase()]||icons['default'];
82
81
  var btn=D.createElement('span');
@@ -84,13 +83,16 @@ const TOOLBAR_TEMPLATE = () => {
84
83
  btn.innerHTML=ic+' '+escapeHtml(p.summary);
85
84
  btn.onmouseenter=function(){this.style.background='#4b5563'};
86
85
  btn.onmouseleave=function(){this.style.background='#374151'};
87
- btn.onclick=function(n){return function(){renderPanel(n,d[n]||d[Object.keys(d).filter(function(k){return d[k]===p})[0]])}}(Object.keys(d).filter(function(k){return d[k]===p})[0]);
86
+ btn.onclick=function(n){return function(){
87
+ var key=Object.keys(d).filter(function(k){return d[k]===d[n]})[0];
88
+ renderPanel(key,d[key]);
89
+ }}(i);
88
90
  bar.appendChild(btn);
89
91
  });
90
92
  D.getElementById(C+'-toggle').onclick=function(){
91
- var p=D.getElementById(C+'-panel');
92
- p.style.display=p.style.display==='none'?'block':'none';
93
- this.innerHTML=p.style.display==='block'?'\u203A':'\u2039';
93
+ var pnl=D.getElementById(C+'-panel');
94
+ pnl.style.display=pnl.style.display==='none'?'block':'none';
95
+ this.innerHTML=pnl.style.display==='block'?'\u203A':'\u2039';
94
96
  };
95
97
  }).catch(function(){});
96
98
  })();
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../toolbar/template.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,GAAG,gBAAgB,CAAC;IAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnD,OAAO,eAAe,EAAE;;4CAEkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAwFrC,CAAC;AACX,CAAC,CAAC;AA/FW,QAAA,gBAAgB,oBA+F3B"}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../toolbar/template.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,GAAG,gBAAgB,CAAC;IAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnD,OAAO,eAAe,EAAE;;4CAEkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA0FrC,CAAC;AACX,CAAC,CAAC;AAjGW,QAAA,gBAAgB,oBAiG3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestjs-devtools",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Symfony-style debug toolbar for NestJS applications",
5
5
  "keywords": [
6
6
  "nestjs",