@tezx/devtools 1.0.14 → 4.0.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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/cjs/html/index.js +0 -7
- package/cjs/index.js +2 -6
- package/html/index.js +0 -7
- package/index.d.ts +1 -1
- package/index.js +2 -6
- package/package.json +1 -1
- package/cjs/html/env.js +0 -135
- package/html/env.d.ts +0 -2
- package/html/env.js +0 -132
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/cjs/html/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.html = html;
|
|
4
4
|
const cookies_js_1 = require("./cookies.js");
|
|
5
|
-
const env_js_1 = require("./env.js");
|
|
6
5
|
const routes_js_1 = require("./routes.js");
|
|
7
6
|
const StaticFile_js_1 = require("./StaticFile.js");
|
|
8
7
|
function html(ctx, app) {
|
|
@@ -25,12 +24,6 @@ function html(ctx, app) {
|
|
|
25
24
|
doc_title: "DevTools - Cookie Inspector",
|
|
26
25
|
content: (0, cookies_js_1.CookiesInspector)(ctx),
|
|
27
26
|
},
|
|
28
|
-
{
|
|
29
|
-
tab: ".env",
|
|
30
|
-
label: "Environment",
|
|
31
|
-
doc_title: "DevTools - Environment",
|
|
32
|
-
content: (0, env_js_1.EnvInspector)(ctx),
|
|
33
|
-
},
|
|
34
27
|
];
|
|
35
28
|
return tabDb;
|
|
36
29
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DevTools = DevTools;
|
|
4
|
-
const helper_1 = require("tezx/helper");
|
|
5
4
|
const index_js_1 = require("./html/index.js");
|
|
6
5
|
function DevTools(app, options = {
|
|
7
6
|
disableTabs: [],
|
|
@@ -34,14 +33,11 @@ function DevTools(app, options = {
|
|
|
34
33
|
</div>
|
|
35
34
|
<div class="tabs">
|
|
36
35
|
<a class="toggle-dark" onclick="toggleTheme()">🌙 Toggle Dark</a>
|
|
37
|
-
<a class="active">
|
|
38
|
-
${helper_1.GlobalConfig.adapter}
|
|
39
|
-
</a>
|
|
40
36
|
</div>
|
|
41
37
|
</header>
|
|
42
38
|
`;
|
|
43
39
|
let find = html.find((r) => r?.tab == tab);
|
|
44
|
-
return ctx.html
|
|
40
|
+
return ctx.html(`
|
|
45
41
|
<!DOCTYPE html>
|
|
46
42
|
<html lang="en">
|
|
47
43
|
<head>
|
|
@@ -400,7 +396,7 @@ function DevTools(app, options = {
|
|
|
400
396
|
</script>
|
|
401
397
|
</body>
|
|
402
398
|
</html>
|
|
403
|
-
|
|
399
|
+
`);
|
|
404
400
|
};
|
|
405
401
|
}
|
|
406
402
|
exports.default = DevTools;
|
package/html/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CookiesInspector } from "./cookies.js";
|
|
2
|
-
import { EnvInspector } from "./env.js";
|
|
3
2
|
import { Routes } from "./routes.js";
|
|
4
3
|
import { StaticFile } from "./StaticFile.js";
|
|
5
4
|
export function html(ctx, app) {
|
|
@@ -22,12 +21,6 @@ export function html(ctx, app) {
|
|
|
22
21
|
doc_title: "DevTools - Cookie Inspector",
|
|
23
22
|
content: CookiesInspector(ctx),
|
|
24
23
|
},
|
|
25
|
-
{
|
|
26
|
-
tab: ".env",
|
|
27
|
-
label: "Environment",
|
|
28
|
-
doc_title: "DevTools - Environment",
|
|
29
|
-
content: EnvInspector(ctx),
|
|
30
|
-
},
|
|
31
24
|
];
|
|
32
25
|
return tabDb;
|
|
33
26
|
}
|
package/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { Tab, TabType } from "./html/index.js";
|
|
|
10
10
|
export type Options = {
|
|
11
11
|
extraTabs?: (ctx: Context) => Promise<TabType> | TabType;
|
|
12
12
|
disableTabs?: Tab[];
|
|
13
|
-
enable
|
|
13
|
+
enable?: boolean;
|
|
14
14
|
};
|
|
15
15
|
export declare function DevTools(app: TezX<any>, options?: Options): Callback;
|
|
16
16
|
export default DevTools;
|
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GlobalConfig } from "tezx/helper";
|
|
2
1
|
import { html as htmlTab } from "./html/index.js";
|
|
3
2
|
export function DevTools(app, options = {
|
|
4
3
|
disableTabs: [],
|
|
@@ -31,14 +30,11 @@ export function DevTools(app, options = {
|
|
|
31
30
|
</div>
|
|
32
31
|
<div class="tabs">
|
|
33
32
|
<a class="toggle-dark" onclick="toggleTheme()">🌙 Toggle Dark</a>
|
|
34
|
-
<a class="active">
|
|
35
|
-
${GlobalConfig.adapter}
|
|
36
|
-
</a>
|
|
37
33
|
</div>
|
|
38
34
|
</header>
|
|
39
35
|
`;
|
|
40
36
|
let find = html.find((r) => r?.tab == tab);
|
|
41
|
-
return ctx.html
|
|
37
|
+
return ctx.html(`
|
|
42
38
|
<!DOCTYPE html>
|
|
43
39
|
<html lang="en">
|
|
44
40
|
<head>
|
|
@@ -397,7 +393,7 @@ export function DevTools(app, options = {
|
|
|
397
393
|
</script>
|
|
398
394
|
</body>
|
|
399
395
|
</html>
|
|
400
|
-
|
|
396
|
+
`);
|
|
401
397
|
};
|
|
402
398
|
}
|
|
403
399
|
export default DevTools;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tezx/devtools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Developer tools for the TezX framework, including route inspector, cookie manager, and real-time diagnostics. Lightweight and plug-and-play compatible with Node.js, Bun, and Deno.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "cjs/index.cjs",
|
package/cjs/html/env.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
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><code>${safeKey}</code></td>
|
|
16
|
-
<td><code>${value}</code></td>
|
|
17
|
-
<td>
|
|
18
|
-
<button class="copy-btn" onclick="copyRowEnv('${safeKey}', \`${safeValue}\`)" title="Copy">
|
|
19
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
20
|
-
<path d="M10 1.5A1.5 1.5 0 0 1 11.5 3v1h-1V3a.5.5 0 0 0-.5-.5H4A1.5 1.5 0 0 0 2.5 4v8A1.5 1.5 0 0 0 4 13.5H5v1H4A2.5 2.5 0 0 1 1.5 12V4A2.5 2.5 0 0 1 4 1.5h6z"/>
|
|
21
|
-
<path d="M5.5 5A1.5 1.5 0 0 0 4 6.5v7A1.5 1.5 0 0 0 5.5 15h6A1.5 1.5 0 0 0 13 13.5v-7A1.5 1.5 0 0 0 11.5 5h-6zM5 6.5A.5.5 0 0 1 5.5 6h6a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5v-7z"/>
|
|
22
|
-
</svg>
|
|
23
|
-
</button>
|
|
24
|
-
</td>
|
|
25
|
-
</tr>`;
|
|
26
|
-
})
|
|
27
|
-
.join("")
|
|
28
|
-
: `
|
|
29
|
-
<tr>
|
|
30
|
-
<td colspan="4">
|
|
31
|
-
<p>⚠️ <strong>No environment variables found.</strong></p>
|
|
32
|
-
<pre class="code-block">
|
|
33
|
-
const env = loadEnv();
|
|
34
|
-
|
|
35
|
-
export const app = new TezX({
|
|
36
|
-
env: env,
|
|
37
|
-
debugMode: true,
|
|
38
|
-
allowDuplicateMw: true,
|
|
39
|
-
});
|
|
40
|
-
</pre>
|
|
41
|
-
</td>
|
|
42
|
-
</tr>`;
|
|
43
|
-
return `
|
|
44
|
-
<style>
|
|
45
|
-
.search-container {
|
|
46
|
-
margin-bottom: 1rem;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.search-container input {
|
|
50
|
-
padding: 0.5rem;
|
|
51
|
-
width: 100%;
|
|
52
|
-
max-width: 400px;
|
|
53
|
-
border: 1px solid #cbd5e1;
|
|
54
|
-
border-radius: 0.375rem;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.code-block {
|
|
58
|
-
background: #f1f5f9;
|
|
59
|
-
padding: 1rem;
|
|
60
|
-
border-radius: 0.5rem;
|
|
61
|
-
font-size: 0.875rem;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
</style>
|
|
65
|
-
|
|
66
|
-
<div class="tabs">
|
|
67
|
-
<a onclick="exportEnv()">📤 Export JSON</a>
|
|
68
|
-
<a onclick="copyAllEnv()">📋 Copy All</a>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<div class="search-container">
|
|
72
|
-
<input type="text" id="env-search" placeholder="🔍 Search environment variables..." oninput="filterEnvTable()" />
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="table-container">
|
|
76
|
-
<table>
|
|
77
|
-
<thead>
|
|
78
|
-
<tr>
|
|
79
|
-
<th>#</th>
|
|
80
|
-
<th>Key</th>
|
|
81
|
-
<th>Value</th>
|
|
82
|
-
<th>Copy</th>
|
|
83
|
-
</tr>
|
|
84
|
-
</thead>
|
|
85
|
-
<tbody id="env-body">
|
|
86
|
-
${tableRows}
|
|
87
|
-
</tbody>
|
|
88
|
-
</table>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<pre id="json-output">${JSON.stringify(env, null, 2)}</pre>
|
|
92
|
-
|
|
93
|
-
<script>
|
|
94
|
-
function exportEnv() {
|
|
95
|
-
const output = document.getElementById('json-output');
|
|
96
|
-
const blob = new Blob([output.textContent], { type: 'application/json' });
|
|
97
|
-
const url = URL.createObjectURL(blob);
|
|
98
|
-
const a = document.createElement('a');
|
|
99
|
-
a.href = url;
|
|
100
|
-
a.download = 'env.json';
|
|
101
|
-
a.click();
|
|
102
|
-
URL.revokeObjectURL(url);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function copyAllEnv() {
|
|
106
|
-
const output = document.getElementById('json-output');
|
|
107
|
-
navigator.clipboard.writeText(output.textContent).then(() => {
|
|
108
|
-
showToast('✅ All environment variables copied!');
|
|
109
|
-
}).catch(err => {
|
|
110
|
-
alert('❌ Failed to copy: ' + err);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function copyRowEnv(key, value) {
|
|
115
|
-
const text = \`\${key}=\${value}\`;
|
|
116
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
117
|
-
showToast(\`✅ Copied: \${key}\`);
|
|
118
|
-
}).catch(err => {
|
|
119
|
-
alert('❌ Failed to copy: ' + err);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function filterEnvTable() {
|
|
124
|
-
const input = document.getElementById('env-search').value.toLowerCase();
|
|
125
|
-
const rows = document.querySelectorAll('#env-body tr');
|
|
126
|
-
|
|
127
|
-
rows.forEach(row => {
|
|
128
|
-
const key = row.getAttribute('data-key') || '';
|
|
129
|
-
const value = row.getAttribute('data-value') || '';
|
|
130
|
-
row.style.display = (key.includes(input) || value.includes(input)) ? '' : 'none';
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
</script>
|
|
134
|
-
`;
|
|
135
|
-
}
|
package/html/env.d.ts
DELETED
package/html/env.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
export function EnvInspector(ctx) {
|
|
2
|
-
const env = ctx.env;
|
|
3
|
-
const entries = Object.entries(env);
|
|
4
|
-
const tableRows = entries.length
|
|
5
|
-
? entries
|
|
6
|
-
.map(([key, value], i) => {
|
|
7
|
-
const safeKey = key.replace(/"/g, """);
|
|
8
|
-
const safeValue = value.replace(/`/g, "\\`").replace(/"/g, """);
|
|
9
|
-
return `
|
|
10
|
-
<tr data-key="${safeKey.toLowerCase()}" data-value="${value.toLowerCase()}">
|
|
11
|
-
<td>${i + 1}</td>
|
|
12
|
-
<td><code>${safeKey}</code></td>
|
|
13
|
-
<td><code>${value}</code></td>
|
|
14
|
-
<td>
|
|
15
|
-
<button class="copy-btn" onclick="copyRowEnv('${safeKey}', \`${safeValue}\`)" title="Copy">
|
|
16
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
17
|
-
<path d="M10 1.5A1.5 1.5 0 0 1 11.5 3v1h-1V3a.5.5 0 0 0-.5-.5H4A1.5 1.5 0 0 0 2.5 4v8A1.5 1.5 0 0 0 4 13.5H5v1H4A2.5 2.5 0 0 1 1.5 12V4A2.5 2.5 0 0 1 4 1.5h6z"/>
|
|
18
|
-
<path d="M5.5 5A1.5 1.5 0 0 0 4 6.5v7A1.5 1.5 0 0 0 5.5 15h6A1.5 1.5 0 0 0 13 13.5v-7A1.5 1.5 0 0 0 11.5 5h-6zM5 6.5A.5.5 0 0 1 5.5 6h6a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5v-7z"/>
|
|
19
|
-
</svg>
|
|
20
|
-
</button>
|
|
21
|
-
</td>
|
|
22
|
-
</tr>`;
|
|
23
|
-
})
|
|
24
|
-
.join("")
|
|
25
|
-
: `
|
|
26
|
-
<tr>
|
|
27
|
-
<td colspan="4">
|
|
28
|
-
<p>⚠️ <strong>No environment variables found.</strong></p>
|
|
29
|
-
<pre class="code-block">
|
|
30
|
-
const env = loadEnv();
|
|
31
|
-
|
|
32
|
-
export const app = new TezX({
|
|
33
|
-
env: env,
|
|
34
|
-
debugMode: true,
|
|
35
|
-
allowDuplicateMw: true,
|
|
36
|
-
});
|
|
37
|
-
</pre>
|
|
38
|
-
</td>
|
|
39
|
-
</tr>`;
|
|
40
|
-
return `
|
|
41
|
-
<style>
|
|
42
|
-
.search-container {
|
|
43
|
-
margin-bottom: 1rem;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.search-container input {
|
|
47
|
-
padding: 0.5rem;
|
|
48
|
-
width: 100%;
|
|
49
|
-
max-width: 400px;
|
|
50
|
-
border: 1px solid #cbd5e1;
|
|
51
|
-
border-radius: 0.375rem;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.code-block {
|
|
55
|
-
background: #f1f5f9;
|
|
56
|
-
padding: 1rem;
|
|
57
|
-
border-radius: 0.5rem;
|
|
58
|
-
font-size: 0.875rem;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
</style>
|
|
62
|
-
|
|
63
|
-
<div class="tabs">
|
|
64
|
-
<a onclick="exportEnv()">📤 Export JSON</a>
|
|
65
|
-
<a onclick="copyAllEnv()">📋 Copy All</a>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div class="search-container">
|
|
69
|
-
<input type="text" id="env-search" placeholder="🔍 Search environment variables..." oninput="filterEnvTable()" />
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<div class="table-container">
|
|
73
|
-
<table>
|
|
74
|
-
<thead>
|
|
75
|
-
<tr>
|
|
76
|
-
<th>#</th>
|
|
77
|
-
<th>Key</th>
|
|
78
|
-
<th>Value</th>
|
|
79
|
-
<th>Copy</th>
|
|
80
|
-
</tr>
|
|
81
|
-
</thead>
|
|
82
|
-
<tbody id="env-body">
|
|
83
|
-
${tableRows}
|
|
84
|
-
</tbody>
|
|
85
|
-
</table>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<pre id="json-output">${JSON.stringify(env, null, 2)}</pre>
|
|
89
|
-
|
|
90
|
-
<script>
|
|
91
|
-
function exportEnv() {
|
|
92
|
-
const output = document.getElementById('json-output');
|
|
93
|
-
const blob = new Blob([output.textContent], { type: 'application/json' });
|
|
94
|
-
const url = URL.createObjectURL(blob);
|
|
95
|
-
const a = document.createElement('a');
|
|
96
|
-
a.href = url;
|
|
97
|
-
a.download = 'env.json';
|
|
98
|
-
a.click();
|
|
99
|
-
URL.revokeObjectURL(url);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function copyAllEnv() {
|
|
103
|
-
const output = document.getElementById('json-output');
|
|
104
|
-
navigator.clipboard.writeText(output.textContent).then(() => {
|
|
105
|
-
showToast('✅ All environment variables copied!');
|
|
106
|
-
}).catch(err => {
|
|
107
|
-
alert('❌ Failed to copy: ' + err);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function copyRowEnv(key, value) {
|
|
112
|
-
const text = \`\${key}=\${value}\`;
|
|
113
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
114
|
-
showToast(\`✅ Copied: \${key}\`);
|
|
115
|
-
}).catch(err => {
|
|
116
|
-
alert('❌ Failed to copy: ' + err);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function filterEnvTable() {
|
|
121
|
-
const input = document.getElementById('env-search').value.toLowerCase();
|
|
122
|
-
const rows = document.querySelectorAll('#env-body tr');
|
|
123
|
-
|
|
124
|
-
rows.forEach(row => {
|
|
125
|
-
const key = row.getAttribute('data-key') || '';
|
|
126
|
-
const value = row.getAttribute('data-value') || '';
|
|
127
|
-
row.style.display = (key.includes(input) || value.includes(input)) ? '' : 'none';
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
</script>
|
|
131
|
-
`;
|
|
132
|
-
}
|