更新 vite 后调整 task-loop 的打包策略
This commit is contained in:
parent
3924ee0224
commit
c8451241f3
@ -7,13 +7,15 @@ export class WebviewController {
|
||||
@RegisterCommand('openmcp.showOpenMCP')
|
||||
async showOpenMCP(context: vscode.ExtensionContext, uri: vscode.Uri) {
|
||||
const connectionItem = getWorkspaceConnectionConfigItemByPath(uri.fsPath);
|
||||
|
||||
if (!connectionItem) {
|
||||
// 项目不存在连接信息
|
||||
const cwd = getLaunchCWD(context, uri);
|
||||
|
||||
const sigature = getDefaultLanunchSignature(uri.fsPath, cwd);
|
||||
const signature = getDefaultLanunchSignature(uri.fsPath, cwd);
|
||||
|
||||
if (!sigature) {
|
||||
if (!signature) {
|
||||
vscode.window.showInformationMessage('OpenMCP: 无法获取启动参数');
|
||||
vscode.window.showErrorMessage('OpenMCP: 无法获取启动参数');
|
||||
return;
|
||||
}
|
||||
@ -21,8 +23,8 @@ export class WebviewController {
|
||||
revealOpenMcpWebviewPanel(context, 'workspace', uri.fsPath, {
|
||||
type: 'stdio',
|
||||
name: 'OpenMCP',
|
||||
command: sigature.command,
|
||||
args: sigature.args,
|
||||
command: signature.command,
|
||||
args: signature.args,
|
||||
cwd
|
||||
});
|
||||
} else {
|
||||
|
@ -7,6 +7,7 @@ import { routeMessage } from '../../openmcp-sdk/service';
|
||||
export function getWebviewContent(context: vscode.ExtensionContext, panel: vscode.WebviewPanel): string | undefined {
|
||||
const viewRoot = fspath.join(context.extensionPath, 'openmcp-sdk', 'renderer');
|
||||
const htmlIndexPath = fspath.join(viewRoot, 'index.html');
|
||||
|
||||
const html = fs.readFileSync(htmlIndexPath, { encoding: 'utf-8' })?.replace(/(<link.+?href="|<script.+?src="|<img.+?src="|url\()(.+?)(\)|")/g, (m, $1, $2) => {
|
||||
const absLocalPath = fspath.resolve(viewRoot, $2);
|
||||
const webviewUri = panel.webview.asWebviewUri(vscode.Uri.file(absLocalPath));
|
||||
@ -14,6 +15,10 @@ export function getWebviewContent(context: vscode.ExtensionContext, panel: vscod
|
||||
const replaceHref = $1 + webviewUri?.toString() + '"';
|
||||
return replaceHref;
|
||||
});
|
||||
|
||||
console.log(html);
|
||||
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user