claude-code-inspector 0.1.3 → 0.1.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/bin/cli.js +46 -1
- package/next.config.js +58 -0
- package/package.json +6 -4
- package/postcss.config.mjs +7 -0
- package/tsconfig.json +34 -0
package/bin/cli.js
CHANGED
|
@@ -1,13 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
const { createServer } = require('http');
|
|
5
6
|
const next = require('next');
|
|
6
7
|
const { WebSocketServer } = require('ws');
|
|
7
8
|
const { parse } = require('url');
|
|
8
9
|
|
|
9
10
|
// 切换到包的安装目录,确保 Next.js 能正确找到文件
|
|
10
|
-
|
|
11
|
+
const installDir = path.resolve(__dirname, '..');
|
|
12
|
+
process.chdir(installDir);
|
|
13
|
+
|
|
14
|
+
// 临时重命名 tsconfig.json,防止 Next.js 尝试安装 TypeScript 依赖
|
|
15
|
+
// 但创建一个包含路径别名的简化版本,确保模块解析正确
|
|
16
|
+
const tsconfigPath = path.join(installDir, 'tsconfig.json');
|
|
17
|
+
const tsconfigBackupPath = path.join(installDir, 'tsconfig.json.bak');
|
|
18
|
+
let tsconfigMoved = false;
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(tsconfigPath)) {
|
|
21
|
+
fs.renameSync(tsconfigPath, tsconfigBackupPath);
|
|
22
|
+
tsconfigMoved = true;
|
|
23
|
+
// 创建一个简化的 tsconfig.json,只包含路径别名配置
|
|
24
|
+
const minimalTsconfig = {
|
|
25
|
+
compilerOptions: {
|
|
26
|
+
baseUrl: '.',
|
|
27
|
+
paths: {
|
|
28
|
+
'@/*': ['./*']
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
fs.writeFileSync(tsconfigPath, JSON.stringify(minimalTsconfig, null, 2));
|
|
33
|
+
|
|
34
|
+
// 进程退出时恢复原始文件
|
|
35
|
+
process.on('exit', () => {
|
|
36
|
+
if (tsconfigMoved && fs.existsSync(tsconfigBackupPath)) {
|
|
37
|
+
fs.renameSync(tsconfigBackupPath, tsconfigPath);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// 捕获信号,确保恢复文件
|
|
42
|
+
process.on('SIGINT', () => {
|
|
43
|
+
if (tsconfigMoved && fs.existsSync(tsconfigBackupPath)) {
|
|
44
|
+
fs.renameSync(tsconfigBackupPath, tsconfigPath);
|
|
45
|
+
}
|
|
46
|
+
process.exit();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
process.on('SIGTERM', () => {
|
|
50
|
+
if (tsconfigMoved && fs.existsSync(tsconfigBackupPath)) {
|
|
51
|
+
fs.renameSync(tsconfigBackupPath, tsconfigPath);
|
|
52
|
+
}
|
|
53
|
+
process.exit();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
11
56
|
|
|
12
57
|
const port = parseInt(process.env.PORT || '3000', 10);
|
|
13
58
|
const dev = process.env.NODE_ENV !== 'production';
|
package/next.config.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** @type {import('next').NextConfig} */
|
|
2
|
+
const nextConfig = {
|
|
3
|
+
// 禁用 HMR 的自动刷新,防止 WebSocket 错误时页面重新加载
|
|
4
|
+
reactStrictMode: false,
|
|
5
|
+
// 开发服务器配置 - 防止页面被 unloaded
|
|
6
|
+
onDemandEntries: {
|
|
7
|
+
// 页面在不活动后保持活跃的毫秒数(设置为最大值)
|
|
8
|
+
maxInactiveAge: 24 * 60 * 60 * 1000, // 24 小时
|
|
9
|
+
// 保持多少个页面活跃
|
|
10
|
+
pagesBufferLength: 10,
|
|
11
|
+
},
|
|
12
|
+
// 完全禁用 Fast Refresh
|
|
13
|
+
compiler: {
|
|
14
|
+
reactRemoveProperties: true,
|
|
15
|
+
},
|
|
16
|
+
// 空的 turbopack 配置,避免警告
|
|
17
|
+
turbopack: {},
|
|
18
|
+
// webpack 配置
|
|
19
|
+
webpack: (config, { dev, isServer }) => {
|
|
20
|
+
if (dev) {
|
|
21
|
+
// 禁用 HMR 的自动刷新
|
|
22
|
+
config.plugins = config.plugins.filter(
|
|
23
|
+
(plugin) => plugin?.constructor?.name !== 'HotModuleReplacementPlugin'
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// 禁用所有文件监听
|
|
27
|
+
config.watchOptions = {
|
|
28
|
+
// 超长聚合延迟,等效于禁用
|
|
29
|
+
aggregateTimeout: 300000, // 5 分钟
|
|
30
|
+
// 忽略所有非源代码文件
|
|
31
|
+
ignored: [
|
|
32
|
+
'**/db/**',
|
|
33
|
+
'**/*.sqlite',
|
|
34
|
+
'**/*.sqlite-wal',
|
|
35
|
+
'**/*.sqlite-shm',
|
|
36
|
+
'**/node_modules/**',
|
|
37
|
+
'**/.git/**',
|
|
38
|
+
'**/*.log',
|
|
39
|
+
'**/dist/**',
|
|
40
|
+
'**/build/**',
|
|
41
|
+
'**/*.json',
|
|
42
|
+
],
|
|
43
|
+
// 禁用轮询
|
|
44
|
+
poll: false,
|
|
45
|
+
// 完全禁用跟随符号链接
|
|
46
|
+
followSymlinks: false,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// 禁用性能监听
|
|
50
|
+
config.performance = {
|
|
51
|
+
hints: false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return config;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
module.exports = nextConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-inspector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"cc-inspector": "./bin/cli.js"
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"components",
|
|
15
15
|
"bin",
|
|
16
16
|
"public",
|
|
17
|
-
"next.config.
|
|
17
|
+
"next.config.js",
|
|
18
|
+
"tsconfig.json",
|
|
19
|
+
"postcss.config.mjs",
|
|
18
20
|
"server.ts"
|
|
19
21
|
],
|
|
20
22
|
"scripts": {
|
|
@@ -27,17 +29,18 @@
|
|
|
27
29
|
"test:watch": "vitest"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
32
|
+
"@tailwindcss/postcss": "^4",
|
|
30
33
|
"axios": "^1.13.6",
|
|
31
34
|
"better-sqlite3": "^12.8.0",
|
|
32
35
|
"next": "16.1.6",
|
|
33
36
|
"react": "19.2.3",
|
|
34
37
|
"react-dom": "19.2.3",
|
|
38
|
+
"tailwindcss": "^4",
|
|
35
39
|
"typescript": "^5",
|
|
36
40
|
"uuid": "^13.0.0",
|
|
37
41
|
"ws": "^8.19.0"
|
|
38
42
|
},
|
|
39
43
|
"devDependencies": {
|
|
40
|
-
"@tailwindcss/postcss": "^4",
|
|
41
44
|
"@types/better-sqlite3": "^7.6.13",
|
|
42
45
|
"@types/node": "^20",
|
|
43
46
|
"@types/react": "^19",
|
|
@@ -46,7 +49,6 @@
|
|
|
46
49
|
"@types/ws": "^8.18.1",
|
|
47
50
|
"eslint": "^9",
|
|
48
51
|
"eslint-config-next": "16.1.6",
|
|
49
|
-
"tailwindcss": "^4",
|
|
50
52
|
"ts-node": "^10.9.2",
|
|
51
53
|
"tsx": "^4.21.0",
|
|
52
54
|
"vitest": "^4.0.18"
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./*"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"next-env.d.ts",
|
|
27
|
+
"**/*.ts",
|
|
28
|
+
"**/*.tsx",
|
|
29
|
+
".next/types/**/*.ts",
|
|
30
|
+
".next/dev/types/**/*.ts",
|
|
31
|
+
"**/*.mts"
|
|
32
|
+
],
|
|
33
|
+
"exclude": ["node_modules"]
|
|
34
|
+
}
|