@geekmidas/telescope 0.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/README.md +521 -0
- package/dist/Telescope-B3Wd82yk.cjs +602 -0
- package/dist/Telescope-B3Wd82yk.cjs.map +1 -0
- package/dist/Telescope-C5dyDYYB.d.cts +133 -0
- package/dist/Telescope-D-uoZB6b.mjs +596 -0
- package/dist/Telescope-D-uoZB6b.mjs.map +1 -0
- package/dist/Telescope-DyIWgh9-.d.mts +133 -0
- package/dist/Telescope.cjs +3 -0
- package/dist/Telescope.d.cts +3 -0
- package/dist/Telescope.d.mts +3 -0
- package/dist/Telescope.mjs +3 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +4 -0
- package/dist/logger/console.cjs +161 -0
- package/dist/logger/console.cjs.map +1 -0
- package/dist/logger/console.d.cts +109 -0
- package/dist/logger/console.d.mts +109 -0
- package/dist/logger/console.mjs +159 -0
- package/dist/logger/console.mjs.map +1 -0
- package/dist/logger/pino.cjs +118 -0
- package/dist/logger/pino.cjs.map +1 -0
- package/dist/logger/pino.d.cts +89 -0
- package/dist/logger/pino.d.mts +89 -0
- package/dist/logger/pino.mjs +116 -0
- package/dist/logger/pino.mjs.map +1 -0
- package/dist/memory-9-B9WACq.cjs +110 -0
- package/dist/memory-9-B9WACq.cjs.map +1 -0
- package/dist/memory-Cm0eevCS.d.mts +38 -0
- package/dist/memory-DiP1a-pp.d.cts +38 -0
- package/dist/memory-SdN5vtG9.mjs +104 -0
- package/dist/memory-SdN5vtG9.mjs.map +1 -0
- package/dist/server/hono.cjs +180 -0
- package/dist/server/hono.cjs.map +1 -0
- package/dist/server/hono.d.cts +26 -0
- package/dist/server/hono.d.mts +26 -0
- package/dist/server/hono.mjs +176 -0
- package/dist/server/hono.mjs.map +1 -0
- package/dist/storage/kysely.cjs +336 -0
- package/dist/storage/kysely.cjs.map +1 -0
- package/dist/storage/kysely.d.cts +161 -0
- package/dist/storage/kysely.d.mts +161 -0
- package/dist/storage/kysely.mjs +334 -0
- package/dist/storage/kysely.mjs.map +1 -0
- package/dist/storage/memory.cjs +3 -0
- package/dist/storage/memory.d.cts +3 -0
- package/dist/storage/memory.d.mts +3 -0
- package/dist/storage/memory.mjs +3 -0
- package/dist/types-BGDhFv4R.d.cts +170 -0
- package/dist/types-CZbzz8kx.d.mts +170 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +0 -0
- package/dist/ui-assets-D6-8TAr_.mjs +30 -0
- package/dist/ui-assets-D6-8TAr_.mjs.map +1 -0
- package/dist/ui-assets-ulevVble.cjs +48 -0
- package/dist/ui-assets-ulevVble.cjs.map +1 -0
- package/dist/ui-assets.cjs +5 -0
- package/dist/ui-assets.d.cts +12 -0
- package/dist/ui-assets.d.mts +12 -0
- package/dist/ui-assets.mjs +3 -0
- package/package.json +83 -0
- package/scripts/embed-ui.ts +90 -0
- package/src/Telescope.ts +714 -0
- package/src/__tests__/Telescope.spec.ts +356 -0
- package/src/index.ts +23 -0
- package/src/logger/__tests__/console.spec.ts +266 -0
- package/src/logger/__tests__/pino.spec.ts +217 -0
- package/src/logger/console.ts +230 -0
- package/src/logger/pino.ts +191 -0
- package/src/server/__tests__/hono.spec.ts +340 -0
- package/src/server/hono.ts +247 -0
- package/src/storage/__tests__/kysely.spec.ts +715 -0
- package/src/storage/__tests__/memory.spec.ts +411 -0
- package/src/storage/kysely.ts +572 -0
- package/src/storage/memory.ts +168 -0
- package/src/types.ts +188 -0
- package/src/ui-assets.ts +40 -0
- package/ui/index.html +12 -0
- package/ui/node_modules/.bin/browserslist +21 -0
- package/ui/node_modules/.bin/jiti +21 -0
- package/ui/node_modules/.bin/terser +21 -0
- package/ui/node_modules/.bin/tsc +21 -0
- package/ui/node_modules/.bin/tsserver +21 -0
- package/ui/node_modules/.bin/tsx +21 -0
- package/ui/node_modules/.bin/vite +21 -0
- package/ui/package.json +24 -0
- package/ui/src/App.tsx +342 -0
- package/ui/src/api.ts +75 -0
- package/ui/src/components/ExceptionDetail.tsx +100 -0
- package/ui/src/components/LogDetail.tsx +91 -0
- package/ui/src/components/RequestDetail.tsx +143 -0
- package/ui/src/main.tsx +10 -0
- package/ui/src/styles.css +10 -0
- package/ui/src/types.ts +63 -0
- package/ui/src/vite-env.d.ts +1 -0
- package/ui/src/vite-plugin-gkm-config.ts +54 -0
- package/ui/tsconfig.json +20 -0
- package/ui/tsconfig.tsbuildinfo +14 -0
- package/ui/vite.config.ts +13 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/ui-assets.d.ts
|
|
2
|
+
interface UIAsset {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
contentType: string;
|
|
6
|
+
}
|
|
7
|
+
declare const UI_ASSETS: UIAsset[];
|
|
8
|
+
declare function getAsset(path: string): UIAsset | undefined;
|
|
9
|
+
declare function getIndexHtml(): string;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { UIAsset, UI_ASSETS, getAsset, getIndexHtml };
|
|
12
|
+
//# sourceMappingURL=ui-assets.d.cts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/ui-assets.d.ts
|
|
2
|
+
interface UIAsset {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
contentType: string;
|
|
6
|
+
}
|
|
7
|
+
declare const UI_ASSETS: UIAsset[];
|
|
8
|
+
declare function getAsset(path: string): UIAsset | undefined;
|
|
9
|
+
declare function getIndexHtml(): string;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { UIAsset, UI_ASSETS, getAsset, getIndexHtml };
|
|
12
|
+
//# sourceMappingURL=ui-assets.d.mts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geekmidas/telescope",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Laravel Telescope-style debugging and monitoring for web applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
|
+
},
|
|
12
|
+
"./storage/memory": {
|
|
13
|
+
"types": "./dist/storage/memory.d.ts",
|
|
14
|
+
"import": "./dist/storage/memory.mjs",
|
|
15
|
+
"require": "./dist/storage/memory.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./storage/kysely": {
|
|
18
|
+
"types": "./dist/storage/kysely.d.ts",
|
|
19
|
+
"import": "./dist/storage/kysely.mjs",
|
|
20
|
+
"require": "./dist/storage/kysely.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./server/hono": {
|
|
23
|
+
"types": "./dist/server/hono.d.ts",
|
|
24
|
+
"import": "./dist/server/hono.mjs",
|
|
25
|
+
"require": "./dist/server/hono.cjs"
|
|
26
|
+
},
|
|
27
|
+
"./hono": {
|
|
28
|
+
"types": "./dist/server/hono.d.ts",
|
|
29
|
+
"import": "./dist/server/hono.mjs",
|
|
30
|
+
"require": "./dist/server/hono.cjs"
|
|
31
|
+
},
|
|
32
|
+
"./logger/pino": {
|
|
33
|
+
"types": "./dist/logger/pino.d.ts",
|
|
34
|
+
"import": "./dist/logger/pino.mjs",
|
|
35
|
+
"require": "./dist/logger/pino.cjs"
|
|
36
|
+
},
|
|
37
|
+
"./logger/console": {
|
|
38
|
+
"types": "./dist/logger/console.d.ts",
|
|
39
|
+
"import": "./dist/logger/console.mjs",
|
|
40
|
+
"require": "./dist/logger/console.cjs"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/geekmidas/toolbox"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"registry": "https://registry.npmjs.org/",
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"nanoid": "~5.1.5"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"hono": "^4.0.0",
|
|
56
|
+
"kysely": "^0.28.0",
|
|
57
|
+
"pino": "^9.0.0",
|
|
58
|
+
"pino-abstract-transport": "^2.0.0 || ^3.0.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependenciesMeta": {
|
|
61
|
+
"hono": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"kysely": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"pino": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"pino-abstract-transport": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"hono": "^4.7.0",
|
|
76
|
+
"kysely": "~0.28.2",
|
|
77
|
+
"pino": "^9.6.0",
|
|
78
|
+
"pino-abstract-transport": "~3.0.0"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"build:ui": "pnpm --filter @geekmidas/telescope-ui build && tsx scripts/embed-ui.ts"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Script to embed the built UI assets into a TypeScript file.
|
|
4
|
+
* This allows the telescope package to serve the UI without external files.
|
|
5
|
+
*/
|
|
6
|
+
import { readFileSync, readdirSync, writeFileSync } from 'fs';
|
|
7
|
+
import { dirname, join } from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const uiDistPath = join(__dirname, '../dist/ui');
|
|
12
|
+
const outputPath = join(__dirname, '../src/ui-assets.ts');
|
|
13
|
+
|
|
14
|
+
interface Asset {
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
contentType: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getContentType(filename: string): string {
|
|
21
|
+
if (filename.endsWith('.html')) return 'text/html';
|
|
22
|
+
if (filename.endsWith('.css')) return 'text/css';
|
|
23
|
+
if (filename.endsWith('.js')) return 'application/javascript';
|
|
24
|
+
if (filename.endsWith('.map')) return 'application/json';
|
|
25
|
+
return 'application/octet-stream';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function collectAssets(dir: string, basePath: string = ''): Asset[] {
|
|
29
|
+
const assets: Asset[] = [];
|
|
30
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
31
|
+
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
const fullPath = join(dir, entry.name);
|
|
34
|
+
const assetPath = basePath ? `${basePath}/${entry.name}` : entry.name;
|
|
35
|
+
|
|
36
|
+
if (entry.isDirectory()) {
|
|
37
|
+
assets.push(...collectAssets(fullPath, assetPath));
|
|
38
|
+
} else if (!entry.name.endsWith('.map')) {
|
|
39
|
+
// Skip source maps
|
|
40
|
+
const content = readFileSync(fullPath, 'utf-8');
|
|
41
|
+
assets.push({
|
|
42
|
+
path: assetPath,
|
|
43
|
+
content,
|
|
44
|
+
contentType: getContentType(entry.name),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return assets;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
const assets = collectAssets(uiDistPath);
|
|
54
|
+
|
|
55
|
+
// Find the index.html to extract references
|
|
56
|
+
const indexHtml = assets.find((a) => a.path === 'index.html');
|
|
57
|
+
if (!indexHtml) {
|
|
58
|
+
console.error('index.html not found in build output');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Generate TypeScript file
|
|
63
|
+
const output = `// Auto-generated file - do not edit directly
|
|
64
|
+
// Generated by scripts/embed-ui.ts
|
|
65
|
+
|
|
66
|
+
export interface UIAsset {
|
|
67
|
+
path: string;
|
|
68
|
+
content: string;
|
|
69
|
+
contentType: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const UI_ASSETS: UIAsset[] = ${JSON.stringify(assets, null, 2)};
|
|
73
|
+
|
|
74
|
+
export function getAsset(path: string): UIAsset | undefined {
|
|
75
|
+
// Normalize path
|
|
76
|
+
const normalized = path.replace(/^\\//, '');
|
|
77
|
+
return UI_ASSETS.find((a) => a.path === normalized);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function getIndexHtml(): string {
|
|
81
|
+
const asset = UI_ASSETS.find((a) => a.path === 'index.html');
|
|
82
|
+
return asset?.content ?? '';
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
writeFileSync(outputPath, output);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('Error embedding UI assets:', error);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|