mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-18 20:30:08 +08:00
Enable source maps and improve debugging support
This commit enables source maps in napcat-shell's Vite config for better debugging, adds source map path overrides to VSCode settings, and updates nodeTest.ps1 to launch with the Node.js inspector. The autoIncludeTSPlugin transform now returns a source map for improved breakpoint support in VSCode. Also adds a sources.txt file listing project and dependency sources.
This commit is contained in:
parent
b99c0ca437
commit
66d02eeb6a
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@ -1,2 +1,9 @@
|
||||
{
|
||||
"debug.node.sourceMapPathOverrides": {
|
||||
"../../napcat-onebot/*": "${workspaceFolder}/packages/napcat-onebot/*",
|
||||
"../../napcat-core/*": "${workspaceFolder}/packages/napcat-core/*",
|
||||
"../../napcat-common/*": "${workspaceFolder}/packages/napcat-common/*",
|
||||
"../../napcat-webui-backend/*": "${workspaceFolder}/packages/napcat-webui-backend/*",
|
||||
"../../napcat-pty/*": "${workspaceFolder}/packages/napcat-pty/*"
|
||||
}
|
||||
}
|
||||
@ -5,4 +5,4 @@ $uninstall = $uninstall.Trim('"')
|
||||
$qqPath = Split-Path $uninstall -Parent
|
||||
|
||||
Write-Host "QQPath: $qqPath"
|
||||
node.exe "./loadNapCat.cjs" "$qqPath"
|
||||
node.exe --inspect "./loadNapCat.cjs" "$qqPath"
|
||||
|
||||
@ -48,7 +48,7 @@ const ShellBaseConfig = () =>
|
||||
},
|
||||
},
|
||||
build: {
|
||||
sourcemap: false,
|
||||
sourcemap: true,
|
||||
target: 'esnext',
|
||||
minify: false,
|
||||
lib: {
|
||||
@ -61,7 +61,7 @@ const ShellBaseConfig = () =>
|
||||
fileName: (_, entryName) => `${entryName}.mjs`,
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...nodeModules, ...external],
|
||||
external: [...nodeModules, ...external]
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -35,7 +35,6 @@ export function autoIncludeTSPlugin(options) {
|
||||
|
||||
transform(code, id) {
|
||||
for (const [entry, tsFiles] of Object.entries(tsFilesMap)) {
|
||||
// 检查id是否匹配entry(支持完整路径或相对路径)
|
||||
const isMatch = id.endsWith(entry) || id.includes(entry);
|
||||
if (isMatch && tsFiles.length > 0) {
|
||||
const imports = tsFiles.map(filePath => {
|
||||
@ -43,11 +42,18 @@ export function autoIncludeTSPlugin(options) {
|
||||
return `import './${relativePath}';`;
|
||||
}).join('\n');
|
||||
|
||||
return imports + '\n' + code;
|
||||
const transformedCode = imports + '\n' + code;
|
||||
|
||||
return {
|
||||
code: transformedCode,
|
||||
map: { mappings: '' } // 空映射即可,VSCode 可以在 TS 上断点
|
||||
};
|
||||
}
|
||||
}
|
||||
return code;
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user