@tezx/devtools 1.0.4 → 1.0.5
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/cjs/devtools/dumpRoutes.js +3 -4
- package/cjs/devtools/index.js +4 -8
- package/cjs/devtools/middlewares.js +29 -19
- package/cjs/html/cookies.js +146 -127
- package/cjs/html/env.js +145 -0
- package/cjs/html/index.js +22 -8
- package/cjs/html/middlewares.js +184 -0
- package/cjs/html/routes.js +112 -83
- package/cjs/index.js +27 -10
- package/devtools/dumpRoutes.d.ts +2 -3
- package/devtools/dumpRoutes.js +3 -4
- package/devtools/index.d.ts +1 -5
- package/devtools/index.js +2 -7
- package/devtools/middlewares.d.ts +6 -6
- package/devtools/middlewares.js +28 -18
- package/html/cookies.js +146 -127
- package/html/env.d.ts +2 -0
- package/html/env.js +142 -0
- package/html/index.d.ts +2 -2
- package/html/index.js +22 -8
- package/html/middlewares.d.ts +7 -0
- package/html/middlewares.js +181 -0
- package/html/routes.js +112 -83
- package/index.d.ts +2 -2
- package/index.js +27 -10
- package/package.json +1 -1
|
@@ -4,13 +4,13 @@ exports.sanitizePathSplit = sanitizePathSplit;
|
|
|
4
4
|
exports.dumpRoutes = dumpRoutes;
|
|
5
5
|
function sanitizePathSplit(basePath, path) {
|
|
6
6
|
const parts = `${basePath}/${path}`
|
|
7
|
-
.replace(/\\/g,
|
|
8
|
-
.replace(/\/+/g,
|
|
7
|
+
.replace(/\\/g, "")
|
|
8
|
+
.replace(/\/+/g, "/")
|
|
9
9
|
?.split("/")
|
|
10
10
|
.filter(Boolean);
|
|
11
11
|
return parts;
|
|
12
12
|
}
|
|
13
|
-
function collectRoutes(node, basePath =
|
|
13
|
+
function collectRoutes(node, basePath = "/") {
|
|
14
14
|
const routes = [];
|
|
15
15
|
let fullPath = basePath;
|
|
16
16
|
if (node.isParam && node.paramName) {
|
|
@@ -38,7 +38,6 @@ function dumpRoutes(TezX) {
|
|
|
38
38
|
for (const [path, handlers] of app.routers) {
|
|
39
39
|
for (const [method, handler] of handlers) {
|
|
40
40
|
staticRoutes.push({
|
|
41
|
-
match: true,
|
|
42
41
|
endpoint: `/${path}`,
|
|
43
42
|
pattern: `/${path}`,
|
|
44
43
|
method,
|
package/cjs/devtools/index.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dumpRoutes = void 0;
|
|
4
|
-
const middlewares_1 = require("./middlewares");
|
|
3
|
+
exports.dumpMiddlewares = exports.dumpRoutes = void 0;
|
|
5
4
|
var dumpRoutes_1 = require("./dumpRoutes");
|
|
6
5
|
Object.defineProperty(exports, "dumpRoutes", { enumerable: true, get: function () { return dumpRoutes_1.dumpRoutes; } });
|
|
6
|
+
var middlewares_1 = require("./middlewares");
|
|
7
|
+
Object.defineProperty(exports, "dumpMiddlewares", { enumerable: true, get: function () { return middlewares_1.dumpMiddlewares; } });
|
|
7
8
|
class devtools {
|
|
8
9
|
static get runtime() {
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
static dumpMiddlewares(TezX) {
|
|
12
|
-
let app = TezX;
|
|
13
|
-
let middlewares = app?.triMiddlewares;
|
|
14
|
-
return (0, middlewares_1.inspectMiddlewares)(middlewares);
|
|
10
|
+
return "";
|
|
15
11
|
}
|
|
16
12
|
}
|
|
17
13
|
exports.default = devtools;
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
exports.dumpMiddlewares = dumpMiddlewares;
|
|
4
|
+
const dumpRoutes_1 = require("./dumpRoutes");
|
|
5
|
+
function detectRouteType(pathname, isOptional) {
|
|
6
|
+
if (pathname.includes("*"))
|
|
7
|
+
return "wildcard";
|
|
8
|
+
if (pathname.includes(":"))
|
|
9
|
+
return "dynamic params";
|
|
10
|
+
if (isOptional)
|
|
11
|
+
return "optional params";
|
|
12
|
+
return "static";
|
|
13
|
+
}
|
|
14
|
+
function collectMiddlewares(node, basePath = "/") {
|
|
15
|
+
const routes = [];
|
|
16
|
+
const fullPath = (0, dumpRoutes_1.sanitizePathSplit)("/", basePath).join("/");
|
|
17
|
+
const routeType = detectRouteType(fullPath, node.isOptional);
|
|
18
|
+
routes.push({
|
|
19
|
+
type: routeType,
|
|
20
|
+
pattern: `/${fullPath}`,
|
|
21
|
+
appliedMiddlewares: Array.isArray(node.middlewares)
|
|
22
|
+
? node.middlewares.map((mw) => mw?.name || "anonymous")
|
|
23
|
+
: Array.from(node.middlewares).map((mw) => mw?.name || "anonymous"),
|
|
24
|
+
});
|
|
25
|
+
for (const [childPath, childNode] of node.children.entries()) {
|
|
26
|
+
const newPath = (0, dumpRoutes_1.sanitizePathSplit)(basePath, childPath).join("/");
|
|
27
|
+
routes.push(...collectMiddlewares(childNode, newPath));
|
|
21
28
|
}
|
|
22
|
-
return
|
|
29
|
+
return routes;
|
|
30
|
+
}
|
|
31
|
+
function dumpMiddlewares(TezX) {
|
|
32
|
+
return collectMiddlewares(TezX.triMiddlewares);
|
|
23
33
|
}
|
package/cjs/html/cookies.js
CHANGED
|
@@ -3,143 +3,162 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CookiesInspector = CookiesInspector;
|
|
4
4
|
function CookiesInspector(ctx) {
|
|
5
5
|
const cookies = ctx.cookies.all();
|
|
6
|
-
const rawJSON = JSON.stringify(cookies, null, 2);
|
|
7
|
-
const tableRows = Object.entries(cookies)
|
|
8
|
-
.map(([key, value], i) => `
|
|
9
|
-
<tr>
|
|
10
|
-
<td>${i + 1}</td>
|
|
11
|
-
<td contenteditable="true" class="cookie-key">${key}</td>
|
|
12
|
-
<td contenteditable="true" class="cookie-value">${value}</td>
|
|
13
|
-
<td><button class="delete-btn">🗑️</button></td>
|
|
14
|
-
</tr>
|
|
15
|
-
`).join("");
|
|
16
6
|
const html = `
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
<style>
|
|
8
|
+
td[contenteditable="true"] {
|
|
9
|
+
outline: 0px;
|
|
10
|
+
}
|
|
11
|
+
td[contenteditable="true"]:focus {
|
|
12
|
+
outline: 1px solid var(--accent);
|
|
13
|
+
}
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
function addCookieRow() {
|
|
100
|
-
const tbody = document.getElementById('cookie-body');
|
|
15
|
+
.delete-btn,
|
|
16
|
+
.copy-btn {
|
|
17
|
+
background: #dc2626;
|
|
18
|
+
color: white;
|
|
19
|
+
border: none;
|
|
20
|
+
border-radius: 0.375rem;
|
|
21
|
+
padding: 0.3rem 0.6rem;
|
|
22
|
+
font-size: 0.8rem;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
margin-left: 4px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.copy-btn {
|
|
28
|
+
background: #2563eb;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.delete-btn:hover {
|
|
32
|
+
background: #b91c1c;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.copy-btn:hover {
|
|
36
|
+
background: #1e40af;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pre#json-output {
|
|
40
|
+
margin-top: 1rem;
|
|
41
|
+
padding: 1rem;
|
|
42
|
+
border-radius: 0.5rem;
|
|
43
|
+
font-size: 0.875rem;
|
|
44
|
+
overflow-x: auto;
|
|
45
|
+
display: none;
|
|
46
|
+
background: #f3f4f6;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
49
|
+
|
|
50
|
+
<div class="tabs">
|
|
51
|
+
<a onclick="addCookieRow()">➕ Add Cookie</a>
|
|
52
|
+
<a onclick="saveCookies()">💾 Save All</a>
|
|
53
|
+
<a onclick="exportCookies()">📤 Export JSON</a>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="table-container">
|
|
57
|
+
<table>
|
|
58
|
+
<thead>
|
|
59
|
+
<tr>
|
|
60
|
+
<th>#</th>
|
|
61
|
+
<th>Key</th>
|
|
62
|
+
<th>Value</th>
|
|
63
|
+
<th>Actions</th>
|
|
64
|
+
</tr>
|
|
65
|
+
</thead>
|
|
66
|
+
<tbody id="cookie-body"></tbody>
|
|
67
|
+
</table>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<pre class="json-view" id="json-output"></pre>
|
|
71
|
+
|
|
72
|
+
<script>
|
|
73
|
+
function getCookies() {
|
|
74
|
+
const cookies = {};
|
|
75
|
+
document.cookie.split(';').forEach(c => {
|
|
76
|
+
const [k, ...v] = c.trim().split('=');
|
|
77
|
+
cookies[k] = decodeURIComponent(v.join('='));
|
|
78
|
+
});
|
|
79
|
+
return cookies;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function renderCookies() {
|
|
83
|
+
const tbody = document.getElementById('cookie-body');
|
|
84
|
+
tbody.innerHTML = '';
|
|
85
|
+
const cookies = getCookies();
|
|
86
|
+
let index = 1;
|
|
87
|
+
for (const [key, val] of Object.entries(cookies)) {
|
|
101
88
|
const row = document.createElement('tr');
|
|
102
89
|
row.innerHTML = \`
|
|
103
|
-
<td>\${
|
|
104
|
-
<td contenteditable="true" class="cookie-key"
|
|
105
|
-
<td contenteditable="true" class="cookie-value"
|
|
106
|
-
<td
|
|
90
|
+
<td>\${index++}</td>
|
|
91
|
+
<td contenteditable="true" class="cookie-key" style="white-space: nowrap">\${key}</td>
|
|
92
|
+
<td contenteditable="true" class="cookie-value">\${val}</td>
|
|
93
|
+
<td class="action">
|
|
94
|
+
<button class="copy-btn" onclick="copyRow(this)">📋</button>
|
|
95
|
+
<button class="delete-btn" onclick="deleteRow(this)">Delete</button>
|
|
96
|
+
</td>
|
|
107
97
|
\`;
|
|
108
98
|
tbody.appendChild(row);
|
|
109
99
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function addCookieRow() {
|
|
103
|
+
const tbody = document.getElementById('cookie-body');
|
|
104
|
+
const row = document.createElement('tr');
|
|
105
|
+
row.innerHTML = \`
|
|
106
|
+
<td>\${tbody.children.length + 1}</td>
|
|
107
|
+
<td contenteditable="true" class="cookie-key" style="white-space: nowrap"></td>
|
|
108
|
+
<td contenteditable="true" class="cookie-value"></td>
|
|
109
|
+
<td class="action">
|
|
110
|
+
<button class="copy-btn" onclick="copyRow(this)">📋</button>
|
|
111
|
+
<button class="delete-btn" onclick="deleteRow(this)">Delete</button>
|
|
112
|
+
</td>
|
|
113
|
+
\`;
|
|
114
|
+
tbody.appendChild(row);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function deleteRow(button) {
|
|
118
|
+
const row = button.closest('tr');
|
|
119
|
+
const key = row.querySelector('.cookie-key')?.innerText.trim();
|
|
120
|
+
if (key) {
|
|
121
|
+
document.cookie = key + '=; Max-Age=0; path=/';
|
|
122
|
+
}
|
|
123
|
+
row.remove();
|
|
124
|
+
renderCookies();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function saveCookies() {
|
|
128
|
+
const rows = document.querySelectorAll('#cookie-body tr');
|
|
129
|
+
rows.forEach(row => {
|
|
113
130
|
const key = row.querySelector('.cookie-key')?.innerText.trim();
|
|
131
|
+
const value = row.querySelector('.cookie-value')?.innerText.trim();
|
|
114
132
|
if (key) {
|
|
115
|
-
document.cookie = key + '
|
|
133
|
+
document.cookie = key + '=' + encodeURIComponent(value) + '; path=/';
|
|
116
134
|
}
|
|
117
|
-
|
|
118
|
-
renderCookies();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function saveCookies() {
|
|
122
|
-
const rows = document.querySelectorAll('#cookie-body tr');
|
|
123
|
-
rows.forEach(row => {
|
|
124
|
-
const key = row.querySelector('.cookie-key')?.innerText.trim();
|
|
125
|
-
const value = row.querySelector('.cookie-value')?.innerText.trim();
|
|
126
|
-
if (key) {
|
|
127
|
-
document.cookie = key + '=' + encodeURIComponent(value) + '; path=/';
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
renderCookies();
|
|
131
|
-
alert('✅ Cookies saved!');
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function exportCookies() {
|
|
135
|
-
const cookies = getCookies();
|
|
136
|
-
const output = document.getElementById('json-output');
|
|
137
|
-
output.textContent = JSON.stringify(cookies, null, 2);
|
|
138
|
-
output.style.display = 'block';
|
|
139
|
-
}
|
|
140
|
-
|
|
135
|
+
});
|
|
141
136
|
renderCookies();
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
alert('✅ Cookies saved!');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function exportCookies() {
|
|
141
|
+
const cookies = getCookies();
|
|
142
|
+
const output = document.getElementById('json-output');
|
|
143
|
+
output.textContent = JSON.stringify(cookies, null, 2);
|
|
144
|
+
output.style.display = 'block';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function copyRow(button) {
|
|
148
|
+
const row = button.closest('tr');
|
|
149
|
+
const key = row.querySelector('.cookie-key')?.innerText.trim();
|
|
150
|
+
const value = row.querySelector('.cookie-value')?.innerText.trim();
|
|
151
|
+
if (key) {
|
|
152
|
+
navigator.clipboard.writeText(\`\${key}: \${value}\`)
|
|
153
|
+
.then(() => {
|
|
154
|
+
button.innerText = '✅';
|
|
155
|
+
setTimeout(() => button.innerText = '📋', 1000);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
renderCookies();
|
|
161
|
+
</script>
|
|
162
|
+
`;
|
|
144
163
|
return html;
|
|
145
164
|
}
|
package/cjs/html/env.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnvInspector = EnvInspector;
|
|
4
|
+
function EnvInspector(ctx) {
|
|
5
|
+
const env = ctx.env;
|
|
6
|
+
const entries = Object.entries(env);
|
|
7
|
+
const tableRows = entries.length
|
|
8
|
+
? entries
|
|
9
|
+
.map(([key, value], i) => {
|
|
10
|
+
const safeKey = key.replace(/"/g, """);
|
|
11
|
+
const safeValue = value.replace(/`/g, "\\`").replace(/"/g, """);
|
|
12
|
+
return `
|
|
13
|
+
<tr data-key="${safeKey.toLowerCase()}" data-value="${value.toLowerCase()}">
|
|
14
|
+
<td>${i + 1}</td>
|
|
15
|
+
<td>${safeKey}</td>
|
|
16
|
+
<td>${value}</td>
|
|
17
|
+
<td><button onclick="copyRowEnv('${safeKey}', \`${safeValue}\`)">📋</button></td>
|
|
18
|
+
</tr>
|
|
19
|
+
`;
|
|
20
|
+
})
|
|
21
|
+
.join("")
|
|
22
|
+
: `
|
|
23
|
+
<tr>
|
|
24
|
+
<td colspan="4">
|
|
25
|
+
<p>⚠️ <strong>No environment variables found.</strong></p>
|
|
26
|
+
<pre style="margin-top: 1rem; background: #f1f5f9; padding: 1rem; border-radius: 0.5rem;">
|
|
27
|
+
const env = loadEnv();
|
|
28
|
+
|
|
29
|
+
export const app = new TezX({
|
|
30
|
+
env: env,
|
|
31
|
+
debugMode: true,
|
|
32
|
+
// basePath: 'v1',
|
|
33
|
+
allowDuplicateMw: true,
|
|
34
|
+
});
|
|
35
|
+
</pre>
|
|
36
|
+
</td>
|
|
37
|
+
</tr>`;
|
|
38
|
+
return `
|
|
39
|
+
<style>
|
|
40
|
+
table td button {
|
|
41
|
+
background: #e2e8f0;
|
|
42
|
+
border: none;
|
|
43
|
+
padding: 0.3rem 0.6rem;
|
|
44
|
+
border-radius: 0.375rem;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
}
|
|
47
|
+
table td button:hover {
|
|
48
|
+
background: #cbd5e1;
|
|
49
|
+
}
|
|
50
|
+
pre#json-output {
|
|
51
|
+
margin-top: 1rem;
|
|
52
|
+
padding: 1rem;
|
|
53
|
+
border-radius: 0.5rem;
|
|
54
|
+
background: #f9fafb;
|
|
55
|
+
border: 1px solid #e5e7eb;
|
|
56
|
+
font-size: 0.875rem;
|
|
57
|
+
overflow-x: auto;
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
.search-container {
|
|
61
|
+
margin-bottom: 1rem;
|
|
62
|
+
}
|
|
63
|
+
.search-container input {
|
|
64
|
+
padding: 0.5rem;
|
|
65
|
+
width: 100%;
|
|
66
|
+
max-width: 400px;
|
|
67
|
+
border: 1px solid #e5e7eb;
|
|
68
|
+
border-radius: 0.375rem;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
71
|
+
|
|
72
|
+
<div class="tabs">
|
|
73
|
+
<a onclick="exportEnv()">📤 Export JSON</a>
|
|
74
|
+
<a onclick="copyAllEnv()">📋 Copy All</a>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div class="search-container">
|
|
78
|
+
<input type="text" id="env-search" placeholder="🔍 Search environment variables..." oninput="filterEnvTable()" />
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="table-container">
|
|
82
|
+
<table>
|
|
83
|
+
<thead>
|
|
84
|
+
<tr>
|
|
85
|
+
<th>#</th>
|
|
86
|
+
<th>Key</th>
|
|
87
|
+
<th>Value</th>
|
|
88
|
+
<th>Copy</th>
|
|
89
|
+
</tr>
|
|
90
|
+
</thead>
|
|
91
|
+
<tbody id="env-body">
|
|
92
|
+
${tableRows}
|
|
93
|
+
</tbody>
|
|
94
|
+
</table>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<pre id="json-output">${JSON.stringify(env, null, 2)}</pre>
|
|
98
|
+
|
|
99
|
+
<script>
|
|
100
|
+
function exportEnv() {
|
|
101
|
+
const output = document.getElementById('json-output');
|
|
102
|
+
const blob = new Blob([output.textContent], { type: 'application/json' });
|
|
103
|
+
const url = URL.createObjectURL(blob);
|
|
104
|
+
const a = document.createElement('a');
|
|
105
|
+
a.href = url;
|
|
106
|
+
a.download = 'env.json';
|
|
107
|
+
a.click();
|
|
108
|
+
URL.revokeObjectURL(url);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function copyAllEnv() {
|
|
112
|
+
const output = document.getElementById('json-output');
|
|
113
|
+
navigator.clipboard.writeText(output.textContent).then(() => {
|
|
114
|
+
alert('✅ All environment variables copied!');
|
|
115
|
+
}).catch(err => {
|
|
116
|
+
alert('❌ Failed to copy: ' + err);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function copyRowEnv(key, value) {
|
|
121
|
+
const text = \`\${key}=\${value}\`;
|
|
122
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
123
|
+
alert(\`✅ Copied: \${text}\`);
|
|
124
|
+
}).catch(err => {
|
|
125
|
+
alert('❌ Failed to copy: ' + err);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function filterEnvTable() {
|
|
130
|
+
const input = document.getElementById('env-search').value.toLowerCase();
|
|
131
|
+
const rows = document.querySelectorAll('#env-body tr');
|
|
132
|
+
|
|
133
|
+
rows.forEach(row => {
|
|
134
|
+
const key = row.getAttribute('data-key') || '';
|
|
135
|
+
const value = row.getAttribute('data-value') || '';
|
|
136
|
+
if (key.includes(input) || value.includes(input)) {
|
|
137
|
+
row.style.display = '';
|
|
138
|
+
} else {
|
|
139
|
+
row.style.display = 'none';
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
</script>
|
|
144
|
+
`;
|
|
145
|
+
}
|
package/cjs/html/index.js
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.html = html;
|
|
4
|
-
const routes_js_1 = require("./routes.js");
|
|
5
4
|
const cookies_js_1 = require("./cookies.js");
|
|
5
|
+
const env_js_1 = require("./env.js");
|
|
6
|
+
const middlewares_js_1 = require("./middlewares.js");
|
|
7
|
+
const routes_js_1 = require("./routes.js");
|
|
6
8
|
function html(ctx, app) {
|
|
7
9
|
let tabDb = [
|
|
8
10
|
{
|
|
9
11
|
doc_title: "DevTools - Route Inspector",
|
|
10
12
|
label: "Routes",
|
|
11
|
-
tab:
|
|
12
|
-
content: (0, routes_js_1.Routes)(ctx, app)
|
|
13
|
+
tab: "routes",
|
|
14
|
+
content: (0, routes_js_1.Routes)(ctx, app),
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
doc_title: "DevTools - Middleware Inspector",
|
|
18
|
+
label: "Middlewares",
|
|
19
|
+
tab: "middleware",
|
|
20
|
+
content: (0, middlewares_js_1.Middlewares)(ctx, app),
|
|
13
21
|
},
|
|
14
22
|
{
|
|
15
|
-
tab:
|
|
16
|
-
label:
|
|
17
|
-
doc_title:
|
|
18
|
-
content: (0, cookies_js_1.CookiesInspector)(ctx)
|
|
19
|
-
}
|
|
23
|
+
tab: "cookies",
|
|
24
|
+
label: "Cookies",
|
|
25
|
+
doc_title: "DevTools - Cookie Inspector",
|
|
26
|
+
content: (0, cookies_js_1.CookiesInspector)(ctx),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
tab: ".env",
|
|
30
|
+
label: "Environment",
|
|
31
|
+
doc_title: "DevTools - Environment",
|
|
32
|
+
content: (0, env_js_1.EnvInspector)(ctx),
|
|
33
|
+
},
|
|
20
34
|
];
|
|
21
35
|
return tabDb;
|
|
22
36
|
}
|