nestjs-devtools 1.1.0 → 1.2.1

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,6 +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
8
  getToolbarData(): Record<string, unknown>;
8
9
  getHistory(): {
9
10
  id: string;
@@ -16,11 +16,15 @@ exports.DevtoolsController = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
17
  const devtools_service_1 = require("./devtools.service");
18
18
  const devtools_module_1 = require("./devtools.module");
19
+ const profiler_1 = require("./toolbar/profiler");
19
20
  let DevtoolsController = class DevtoolsController {
20
21
  constructor(devtoolsService, collectors = []) {
21
22
  this.devtoolsService = devtoolsService;
22
23
  this.collectors = collectors;
23
24
  }
25
+ getProfiler() {
26
+ return (0, profiler_1.PROFILER_PAGE)();
27
+ }
24
28
  getToolbarData() {
25
29
  const panels = {};
26
30
  for (const collector of this.collectors) {
@@ -42,6 +46,13 @@ let DevtoolsController = class DevtoolsController {
42
46
  }
43
47
  };
44
48
  exports.DevtoolsController = DevtoolsController;
49
+ __decorate([
50
+ (0, common_1.Get)(),
51
+ (0, common_1.Header)('content-type', 'text/html'),
52
+ __metadata("design:type", Function),
53
+ __metadata("design:paramtypes", []),
54
+ __metadata("design:returntype", void 0)
55
+ ], DevtoolsController.prototype, "getProfiler", null);
45
56
  __decorate([
46
57
  (0, common_1.Get)('data'),
47
58
  __metadata("design:type", Function),
@@ -1 +1 @@
1
- {"version":3,"file":"devtools.controller.js","sourceRoot":"","sources":["../devtools.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmE;AACnE,yDAAqD;AAErD,uDAA6D;AAGtD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YACmB,eAAgC,EAGhC,aAAkC,EAAE;QAHpC,o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C;;;;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"}
@@ -23,7 +23,7 @@ let DevtoolsFilter = class DevtoolsFilter {
23
23
  const response = context.switchToHttp().getResponse();
24
24
  const contentType = response.getHeader('content-type') ?? '';
25
25
  if (typeof data === 'string' && contentType.includes('text/html')) {
26
- return data.replace('</body>', (0, template_1.TOOLBAR_TEMPLATE)('/__devtools/data') + '</body>');
26
+ return data.replace('</body>', (0, template_1.TOOLBAR_TEMPLATE)() + '</body>');
27
27
  }
28
28
  return data;
29
29
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"devtools.filter.js","sourceRoot":"","sources":["../devtools.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AACxB,+BAAuC;AACvC,yDAAqD;AACrD,iDAAsD;AAG/C,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,UAAG,EAAC,CAAC,IAAI,EAAE,EAAE;YACX,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,CAAC;YACtD,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;YAE7D,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAA,2BAAgB,EAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC,CAAC;YACnF,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AAjBY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAEmC,kCAAe;GADlD,cAAc,CAiB1B"}
1
+ {"version":3,"file":"devtools.filter.js","sourceRoot":"","sources":["../devtools.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AACxB,+BAAuC;AACvC,yDAAqD;AACrD,iDAAsD;AAG/C,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,UAAG,EAAC,CAAC,IAAI,EAAE,EAAE;YACX,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,CAAC;YACtD,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;YAE7D,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClE,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAA,2BAAgB,GAAE,GAAG,SAAS,CAAC,CAAC;YACjE,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AAjBY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAEmC,kCAAe;GADlD,cAAc,CAiB1B"}
@@ -0,0 +1 @@
1
+ export declare const PROFILER_PAGE: () => string;
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROFILER_PAGE = void 0;
4
+ const PROFILER_PAGE = () => `<!DOCTYPE html>
5
+ <html lang="en">
6
+ <head>
7
+ <meta charset="UTF-8">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
+ <title>NestJS Devtools Profiler</title>
10
+ <style>
11
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
12
+ body {
13
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
14
+ background: #111827; color: #f3f4f6; font-size: 13px; line-height: 1.5;
15
+ min-height: 100vh;
16
+ }
17
+ .header {
18
+ background: #1f2937; border-bottom: 2px solid #3b82f6;
19
+ padding: 16px 24px; display: flex; align-items: center; gap: 12px;
20
+ }
21
+ .header h1 { font-size: 18px; font-weight: 700; color: #60a5fa; }
22
+ .header span { color: #9ca3af; font-size: 13px; }
23
+ .container { max-width: 1200px; margin: 0 auto; padding: 24px; }
24
+ .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
25
+ .card {
26
+ background: #1f2937; border-radius: 8px; border: 1px solid #374151;
27
+ overflow: hidden; cursor: pointer; transition: border-color .15s;
28
+ }
29
+ .card:hover { border-color: #3b82f6; }
30
+ .card-header {
31
+ padding: 12px 16px; display: flex; align-items: center; gap: 10px;
32
+ border-bottom: 1px solid #374151;
33
+ }
34
+ .card-header .icon { font-size: 18px; }
35
+ .card-header .label { font-weight: 600; font-size: 13px; }
36
+ .card-header .summary { color: #9ca3af; font-size: 11px; margin-left: auto; }
37
+ .card-body { padding: 0; max-height: 0; overflow: hidden; transition: max-height .2s, padding .2s; }
38
+ .card-body.open { max-height: 2000px; padding: 12px 16px; overflow-y: auto; }
39
+ .card-body table { width: 100%; border-collapse: collapse; font-size: 12px; }
40
+ .card-body td, .card-body th {
41
+ padding: 6px 8px; border-bottom: 1px solid #1f2937; text-align: left;
42
+ vertical-align: top; word-break: break-word;
43
+ }
44
+ .card-body th { color: #9ca3af; font-weight: 600; width: 120px; }
45
+ .badge {
46
+ display: inline-block; padding: 2px 8px; border-radius: 4px;
47
+ font-size: 11px; font-weight: 600;
48
+ }
49
+ .badge-get { background: #065f46; color: #6ee7b7; }
50
+ .badge-post { background: #1e3a5f; color: #93c5fd; }
51
+ .badge-put { background: #713f12; color: #fcd34d; }
52
+ .badge-delete { background: #7f1d1d; color: #fca5a5; }
53
+ .badge-patch { background: #581c87; color: #d8b4fe; }
54
+ .empty { padding: 24px; text-align: center; color: #6b7280; }
55
+ .mono { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; font-size: 11px; }
56
+ .history-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
57
+ .history-table th { padding: 8px 12px; text-align: left; color: #9ca3af; font-weight: 600; border-bottom: 2px solid #374151; }
58
+ .history-table td { padding: 8px 12px; border-bottom: 1px solid #1f2937; }
59
+ .history-table tr:hover td { background: #1f2937; }
60
+ .error-text { color: #ef4444; }
61
+ .warn-text { color: #f59e0b; }
62
+ .ok-text { color: #10b981; }
63
+ .nav { display: flex; gap: 8px; margin-bottom: 24px; }
64
+ .nav button {
65
+ padding: 8px 16px; border-radius: 6px; border: 1px solid #374151;
66
+ background: #1f2937; color: #d1d5db; cursor: pointer; font-size: 13px;
67
+ }
68
+ .nav button.active { border-color: #3b82f6; color: #60a5fa; background: #1e3a5f; }
69
+ .nav button:hover { background: #374151; }
70
+ .section { display: none; }
71
+ .section.active { display: block; }
72
+ .qlabel { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; margin-right: 4px; }
73
+ .qlabel-1 { background: #3b82f6; color: #fff; }
74
+ .qlabel-2 { background: #8b5cf6; color: #fff; }
75
+ .qlabel-3 { background: #10b981; color: #fff; }
76
+ </style>
77
+ </head>
78
+ <body>
79
+ <div class="header">
80
+ <h1>NDev</h1>
81
+ <span>NestJS Devtools Profiler</span>
82
+ </div>
83
+ <div class="container">
84
+ <div class="nav">
85
+ <button class="active" data-tab="dashboard">Dashboard</button>
86
+ <button data-tab="history">History</button>
87
+ </div>
88
+ <div id="tab-dashboard" class="section active">
89
+ <div class="grid" id="panel-grid"></div>
90
+ </div>
91
+ <div id="tab-history" class="section">
92
+ <table class="history-table">
93
+ <thead><tr><th>Time</th><th>Method</th><th>Path</th><th>Status</th><th>Duration</th></tr></thead>
94
+ <tbody id="history-body"></tbody>
95
+ </table>
96
+ </div>
97
+ </div>
98
+ <script>
99
+ (function() {
100
+ var BASE = window.location.pathname.replace(/\/__devtools\/?$/, '');
101
+ function escape(s) { return s==null?'':String(s).replace(/[&<>"]/g,function(m){return {'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[m]}); }
102
+
103
+ document.querySelectorAll('[data-tab]').forEach(function(btn){
104
+ btn.addEventListener('click', function(){
105
+ document.querySelectorAll('[data-tab]').forEach(function(b){b.classList.remove('active')});
106
+ document.querySelectorAll('.section').forEach(function(s){s.classList.remove('active')});
107
+ btn.classList.add('active');
108
+ document.getElementById('tab-'+btn.getAttribute('data-tab')).classList.add('active');
109
+ if (btn.getAttribute('data-tab')==='history') loadHistory();
110
+ });
111
+ });
112
+
113
+ function renderDetails(detail) {
114
+ if (!detail || !detail.details) return '<div class="empty">No data</div>';
115
+ var d = detail.details;
116
+ var h = '<table>';
117
+ for (var k in d) {
118
+ var v = d[k];
119
+ if (k === 'queries' && Array.isArray(v)) {
120
+ h += '<tr><th>Queries</th><td>';
121
+ v.forEach(function(q,i){
122
+ var cls = 'qlabel-'+((i%3)+1);
123
+ h += '<div style="padding:4px 0;border-bottom:1px solid #1f2937">';
124
+ h += '<span class="qlabel '+cls+'">#'+(i+1)+'</span>';
125
+ h += '<span class="mono">'+escape(q.sql||'')+'</span>';
126
+ h += '<span style="float:right;color:#fbbf24">'+escape(q.duration||'')+'</span>';
127
+ h += '</div>';
128
+ });
129
+ h += '</td></tr>';
130
+ continue;
131
+ }
132
+ if (k === 'entries' && Array.isArray(v)) {
133
+ h += '<tr><th>Logs</th><td>';
134
+ v.forEach(function(e){
135
+ var lc = e.level==='error' ? 'error-text' : e.level==='warn' ? 'warn-text' : '';
136
+ h += '<div style="padding:3px 0;border-bottom:1px solid #1f2937">';
137
+ h += '<span class="badge '+lc+'" style="background:#1f2937;text-transform:uppercase;font-size:10px;margin-right:6px">'+escape(e.level||'')+'</span>';
138
+ h += '<span>'+escape(e.message||'')+'</span>';
139
+ h += '</div>';
140
+ });
141
+ h += '</td></tr>';
142
+ continue;
143
+ }
144
+ if (k === 'grouped' && Array.isArray(v)) {
145
+ h += '<tr><th>Routes</th><td>';
146
+ v.forEach(function(g){
147
+ h += '<div style="font-weight:600;color:#60a5fa;padding:4px 0">'+escape(g.method||'')+' ('+(g.count||0)+')</div>';
148
+ if (g.routes) g.routes.forEach(function(r){
149
+ h += '<div style="padding:2px 0 2px 16px;font-family:monospace;font-size:11px">';
150
+ h += escape(r.path||'')+' <span style="color:#6b7280">('+escape(r.controller||'')+')</span></div>';
151
+ });
152
+ });
153
+ h += '</td></tr>';
154
+ continue;
155
+ }
156
+ if (k === 'exception' && v && typeof v === 'object') {
157
+ h += '<tr><th>Exception</th><td>';
158
+ h += '<div class="error-text" style="font-weight:600">'+escape(v.message||'')+'</div>';
159
+ h += '<pre class="mono" style="margin-top:6px;color:#9ca3af;white-space:pre-wrap">'+escape(v.stack||'')+'</pre>';
160
+ h += '</td></tr>';
161
+ continue;
162
+ }
163
+ if (k === 'stack') continue;
164
+ h += '<tr><th>'+escape(k)+'</th><td>'+escape(typeof v==='object'?JSON.stringify(v):v)+'</td></tr>';
165
+ }
166
+ h += '</table>';
167
+ return h;
168
+ }
169
+
170
+ function loadDashboard() {
171
+ fetch(BASE + '/__devtools/data').then(function(r){return r.json()}).then(function(d){
172
+ var grid = document.getElementById('panel-grid');
173
+ grid.innerHTML = '';
174
+ var icons = {request:'🌐',performance:'⚡',database:'🗄️',routes:'📋',logs:'📝'};
175
+ Object.keys(d).forEach(function(key){
176
+ var p = d[key];
177
+ if (!p || !p.label) return;
178
+ var card = document.createElement('div');
179
+ card.className = 'card';
180
+ card.innerHTML =
181
+ '<div class="card-header"><span class="icon">'+(icons[key]||'🔧')+'</span>'+
182
+ '<span class="label">'+escape(p.label)+'</span>'+
183
+ '<span class="summary">'+escape(p.summary||'')+'</span></div>'+
184
+ '<div class="card-body">'+renderDetails(p)+'</div>';
185
+ card.querySelector('.card-header').addEventListener('click', function(){
186
+ var body = card.querySelector('.card-body');
187
+ body.classList.toggle('open');
188
+ });
189
+ grid.appendChild(card);
190
+ });
191
+ }).catch(function(){
192
+ document.getElementById('panel-grid').innerHTML = '<div class="empty">Failed to load profiler data. Make sure the server is running.</div>';
193
+ });
194
+ }
195
+
196
+ function loadHistory() {
197
+ fetch(BASE + '/__devtools/history').then(function(r){return r.json()}).then(function(rows){
198
+ var tbody = document.getElementById('history-body');
199
+ tbody.innerHTML = '';
200
+ if (!rows || rows.length === 0) {
201
+ tbody.innerHTML = '<tr><td colspan="5" class="empty">No requests recorded yet</td></tr>';
202
+ return;
203
+ }
204
+ rows.forEach(function(r){
205
+ var statusClass = r.statusCode >= 400 ? 'error-text' : r.statusCode >= 300 ? 'warn-text' : 'ok-text';
206
+ var methodBadge = 'badge-'+r.method.toLowerCase();
207
+ tbody.innerHTML += '<tr>'+
208
+ '<td>'+escape(new Date(r.timestamp).toLocaleTimeString())+'</td>'+
209
+ '<td><span class="badge '+methodBadge+'">'+escape(r.method)+'</span></td>'+
210
+ '<td class="mono">'+escape(r.path)+'</td>'+
211
+ '<td><span class="'+statusClass+'">'+r.statusCode+'</span></td>'+
212
+ '<td>'+r.duration.toFixed(1)+' ms</td>'+
213
+ '</tr>';
214
+ });
215
+ }).catch(function(){
216
+ document.getElementById('history-body').innerHTML = '<tr><td colspan="5" class="empty">Failed to load history</td></tr>';
217
+ });
218
+ }
219
+
220
+ loadDashboard();
221
+ })();
222
+ </script>
223
+ </body>
224
+ </html>`;
225
+ exports.PROFILER_PAGE = PROFILER_PAGE;
226
+ //# sourceMappingURL=profiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiler.js","sourceRoot":"","sources":["../../toolbar/profiler.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4N3B,CAAC;AA5NI,QAAA,aAAa,iBA4NjB"}
@@ -1 +1 @@
1
- export declare const TOOLBAR_TEMPLATE: (dataUrl: string) => string;
1
+ export declare const TOOLBAR_TEMPLATE: () => string;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TOOLBAR_TEMPLATE = void 0;
4
- const TOOLBAR_TEMPLATE = (dataUrl) => {
4
+ const TOOLBAR_TEMPLATE = () => {
5
5
  const id = '__nestDevtools';
6
6
  const uid = Math.random().toString(36).slice(2, 8);
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
11
  var c=D.createElement('div'); c.id=C;
11
- 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><span id="'+C+'-toggle" style="margin-left:auto;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:-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
13
  B.appendChild(c);
13
14
 
14
15
  var lastActive=null;
@@ -64,7 +65,8 @@ const TOOLBAR_TEMPLATE = (dataUrl) => {
64
65
  return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
65
66
  }
66
67
 
67
- fetch('${dataUrl}').then(function(r){return r.json()}).then(function(d){
68
+ var furl = p + '/data';
69
+ fetch(furl).then(function(r){return r.json()}).then(function(d){
68
70
  var bar=D.getElementById(C+'-bar');
69
71
  var panels=[];
70
72
  if(d.request) panels.push(d.request);
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../toolbar/template.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE;IAClD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA0DpC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA4BR,CAAC;AACX,CAAC,CAAC;AA7FW,QAAA,gBAAgB,oBA6F3B"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestjs-devtools",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Symfony-style debug toolbar for NestJS applications",
5
5
  "keywords": [
6
6
  "nestjs",