style(editor-app): 移除log信息

This commit is contained in:
yhh
2025-11-20 09:51:29 +08:00
parent 0d2948e60c
commit 8b9616837d
15 changed files with 4 additions and 164 deletions

View File

@@ -5,8 +5,6 @@ import { EditorAppearancePlugin } from '../../plugins/EditorAppearancePlugin';
export class PluginInstaller { export class PluginInstaller {
async installBuiltinPlugins(pluginManager: EditorPluginManager): Promise<void> { async installBuiltinPlugins(pluginManager: EditorPluginManager): Promise<void> {
console.log('[PluginInstaller] Installing builtin plugins...');
const plugins = [ const plugins = [
new SceneInspectorPlugin(), new SceneInspectorPlugin(),
new ProfilerPlugin(), new ProfilerPlugin(),
@@ -16,12 +14,9 @@ export class PluginInstaller {
for (const plugin of plugins) { for (const plugin of plugins) {
try { try {
await pluginManager.installEditor(plugin); await pluginManager.installEditor(plugin);
console.log(`[PluginInstaller] Installed plugin: ${plugin.name}`);
} catch (error) { } catch (error) {
console.error(`[PluginInstaller] Failed to install plugin ${plugin.name}:`, error); console.error(`[PluginInstaller] Failed to install plugin ${plugin.name}:`, error);
} }
} }
console.log('[PluginInstaller] All builtin plugins installed');
} }
} }

View File

@@ -23,24 +23,14 @@ export class EditorBootstrap {
throw new Error('EditorBootstrap has already been initialized'); throw new Error('EditorBootstrap has already been initialized');
} }
console.log('[EditorBootstrap] Starting editor initialization...');
const scene = await this.createScene(); const scene = await this.createScene();
console.log('[EditorBootstrap] Scene created');
const container = globalContainer; const container = globalContainer;
const eventBus = container.resolve(EditorEventBus); const eventBus = container.resolve(EditorEventBus);
console.log('[EditorBootstrap] EventBus initialized');
const commands = container.resolve(CommandRegistry); const commands = container.resolve(CommandRegistry);
console.log('[EditorBootstrap] CommandRegistry initialized');
const panels = container.resolve(PanelRegistry); const panels = container.resolve(PanelRegistry);
console.log('[EditorBootstrap] PanelRegistry initialized');
this.initialized = true; this.initialized = true;
console.log('[EditorBootstrap] Editor initialized successfully');
return { return {
container, container,

View File

@@ -16,11 +16,9 @@ export class SceneInspectorPlugin implements IEditorPlugin {
readonly icon = '🔍'; readonly icon = '🔍';
async install(_core: Core, _services: ServiceContainer): Promise<void> { async install(_core: Core, _services: ServiceContainer): Promise<void> {
console.log('[SceneInspectorPlugin] Installed');
} }
async uninstall(): Promise<void> { async uninstall(): Promise<void> {
console.log('[SceneInspectorPlugin] Uninstalled');
} }
registerMenuItems(): MenuItem[] { registerMenuItems(): MenuItem[] {
@@ -30,7 +28,6 @@ export class SceneInspectorPlugin implements IEditorPlugin {
label: 'Scene Inspector', label: 'Scene Inspector',
parentId: 'view', parentId: 'view',
onClick: () => { onClick: () => {
console.log('Toggle Scene Inspector');
}, },
shortcut: 'Ctrl+Shift+I', shortcut: 'Ctrl+Shift+I',
order: 100 order: 100
@@ -40,7 +37,6 @@ export class SceneInspectorPlugin implements IEditorPlugin {
label: 'Create Entity', label: 'Create Entity',
parentId: 'scene', parentId: 'scene',
onClick: () => { onClick: () => {
console.log('Create new entity');
}, },
shortcut: 'Ctrl+N', shortcut: 'Ctrl+N',
order: 10 order: 10
@@ -56,7 +52,6 @@ export class SceneInspectorPlugin implements IEditorPlugin {
groupId: 'entity-tools', groupId: 'entity-tools',
icon: '', icon: '',
onClick: () => { onClick: () => {
console.log('Create entity from toolbar');
}, },
order: 10 order: 10
}, },
@@ -66,7 +61,6 @@ export class SceneInspectorPlugin implements IEditorPlugin {
groupId: 'entity-tools', groupId: 'entity-tools',
icon: '🗑️', icon: '🗑️',
onClick: () => { onClick: () => {
console.log('Delete entity from toolbar');
}, },
order: 20 order: 20
} }
@@ -117,14 +111,11 @@ export class SceneInspectorPlugin implements IEditorPlugin {
} }
async onEditorReady(): Promise<void> { async onEditorReady(): Promise<void> {
console.log('[SceneInspectorPlugin] Editor is ready');
} }
async onProjectOpen(projectPath: string): Promise<void> { async onProjectOpen(projectPath: string): Promise<void> {
console.log(`[SceneInspectorPlugin] Project opened: ${projectPath}`);
} }
async onProjectClose(): Promise<void> { async onProjectClose(): Promise<void> {
console.log('[SceneInspectorPlugin] Project closed');
} }
} }

View File

@@ -280,9 +280,6 @@ export class GitHubService {
* 返回设备代码信息,包含用户需要访问的 URL 和输入的代码 * 返回设备代码信息,包含用户需要访问的 URL 和输入的代码
*/ */
async requestDeviceCode(): Promise<DeviceCodeResponse> { async requestDeviceCode(): Promise<DeviceCodeResponse> {
console.log('[GitHubService] Requesting device code...');
console.log('[GitHubService] Client ID:', this.CLIENT_ID);
try { try {
const response = await fetch('https://github.com/login/device/code', { const response = await fetch('https://github.com/login/device/code', {
method: 'POST', method: 'POST',
@@ -296,9 +293,6 @@ export class GitHubService {
}) })
}); });
console.log('[GitHubService] Response status:', response.status);
console.log('[GitHubService] Response ok:', response.ok);
if (!response.ok) { if (!response.ok) {
const error = await response.text(); const error = await response.text();
console.error('[GitHubService] Request device code failed:', error); console.error('[GitHubService] Request device code failed:', error);
@@ -306,11 +300,6 @@ export class GitHubService {
} }
const data = (await response.json()) as DeviceCodeResponse; const data = (await response.json()) as DeviceCodeResponse;
console.log('[GitHubService] Device code received:', {
user_code: data.user_code,
verification_uri: data.verification_uri
});
return data; return data;
} catch (error) { } catch (error) {
console.error('[GitHubService] Error requesting device code:', error); console.error('[GitHubService] Error requesting device code:', error);
@@ -518,14 +507,12 @@ export class GitHubService {
} }
async deleteFile(owner: string, repo: string, path: string, message: string, branch: string): Promise<void> { async deleteFile(owner: string, repo: string, path: string, message: string, branch: string): Promise<void> {
console.log(`[GitHubService] Getting file SHA for: ${owner}/${repo}/${path}?ref=${branch}`);
const existing = await this.request<GitHubFileContent>(`GET /repos/${owner}/${repo}/contents/${path}?ref=${branch}`); const existing = await this.request<GitHubFileContent>(`GET /repos/${owner}/${repo}/contents/${path}?ref=${branch}`);
if (!existing || !existing.sha) { if (!existing || !existing.sha) {
throw new Error(`Failed to get file SHA for ${path}`); throw new Error(`Failed to get file SHA for ${path}`);
} }
console.log(`[GitHubService] Deleting file with SHA: ${existing.sha}`);
await this.request<void>(`DELETE /repos/${owner}/${repo}/contents/${path}`, { await this.request<void>(`DELETE /repos/${owner}/${repo}/contents/${path}`, {
message: message, message: message,
sha: existing.sha, sha: existing.sha,
@@ -631,7 +618,6 @@ export class GitHubService {
if (deletedDate && pr.merged_at) { if (deletedDate && pr.merged_at) {
const addedDate = new Date(pr.merged_at); const addedDate = new Date(pr.merged_at);
if (deletedDate > addedDate) { if (deletedDate > addedDate) {
console.log(`[GitHubService] Plugin ${pluginName} was deleted after being added, skipping`);
continue; continue;
} }
} }
@@ -922,12 +908,10 @@ export class GitHubService {
try { try {
const stored = localStorage.getItem(this.STORAGE_KEY); const stored = localStorage.getItem(this.STORAGE_KEY);
if (stored) { if (stored) {
console.log('[GitHubService] Loading stored token...');
this.accessToken = stored; this.accessToken = stored;
this.notifyUserLoadStateChange(true); this.notifyUserLoadStateChange(true);
this.fetchUser() this.fetchUser()
.then((user) => { .then((user) => {
console.log('[GitHubService] User loaded from stored token:', user.login);
this.user = user; this.user = user;
if (this.retryTimer) { if (this.retryTimer) {
clearTimeout(this.retryTimer); clearTimeout(this.retryTimer);
@@ -940,18 +924,14 @@ export class GitHubService {
const errorMessage = error instanceof Error ? error.message : String(error); const errorMessage = error instanceof Error ? error.message : String(error);
if (errorMessage.includes('401') || errorMessage.includes('Unauthorized')) { if (errorMessage.includes('401') || errorMessage.includes('Unauthorized')) {
console.log('[GitHubService] Token is invalid or expired, removing it');
this.accessToken = null; this.accessToken = null;
this.user = null; this.user = null;
localStorage.removeItem(this.STORAGE_KEY); localStorage.removeItem(this.STORAGE_KEY);
this.notifyUserLoadStateChange(false); this.notifyUserLoadStateChange(false);
} else { } else {
console.log('[GitHubService] Temporary error fetching user, will retry in 5 seconds');
this.scheduleRetryLoadUser(); this.scheduleRetryLoadUser();
} }
}); });
} else {
console.log('[GitHubService] No stored token found');
} }
} catch (error) { } catch (error) {
console.error('[GitHubService] Failed to load token:', error); console.error('[GitHubService] Failed to load token:', error);
@@ -965,11 +945,9 @@ export class GitHubService {
} }
this.retryTimer = window.setTimeout(() => { this.retryTimer = window.setTimeout(() => {
console.log('[GitHubService] Retrying to load user...');
if (this.accessToken && !this.user) { if (this.accessToken && !this.user) {
this.fetchUser() this.fetchUser()
.then((user) => { .then((user) => {
console.log('[GitHubService] User loaded successfully on retry:', user.login);
this.user = user; this.user = user;
this.retryTimer = null; this.retryTimer = null;
this.notifyUserLoadStateChange(false); this.notifyUserLoadStateChange(false);
@@ -978,13 +956,11 @@ export class GitHubService {
console.error('[GitHubService] Retry failed:', error); console.error('[GitHubService] Retry failed:', error);
const errorMessage = error instanceof Error ? error.message : String(error); const errorMessage = error instanceof Error ? error.message : String(error);
if (errorMessage.includes('401') || errorMessage.includes('Unauthorized')) { if (errorMessage.includes('401') || errorMessage.includes('Unauthorized')) {
console.log('[GitHubService] Token is invalid, removing it');
this.accessToken = null; this.accessToken = null;
this.user = null; this.user = null;
localStorage.removeItem(this.STORAGE_KEY); localStorage.removeItem(this.STORAGE_KEY);
this.notifyUserLoadStateChange(false); this.notifyUserLoadStateChange(false);
} else { } else {
console.log('[GitHubService] Will retry again in 10 seconds');
this.retryTimer = window.setTimeout(() => this.scheduleRetryLoadUser(), 10000); this.retryTimer = window.setTimeout(() => this.scheduleRetryLoadUser(), 10000);
} }
}); });

View File

@@ -56,7 +56,6 @@ export class PluginBuildService {
pluginFolder pluginFolder
}); });
console.log('[PluginBuildService] Build completed, zip path:', zipPath);
return zipPath; return zipPath;
} catch (error) { } catch (error) {
console.error('[PluginBuildService] Build failed:', error); console.error('[PluginBuildService] Build failed:', error);

View File

@@ -31,13 +31,11 @@ export class PluginLoader {
try { try {
const exists = await TauriAPI.pathExists(pluginsPath); const exists = await TauriAPI.pathExists(pluginsPath);
if (!exists) { if (!exists) {
console.log('[PluginLoader] No plugins directory found');
return; return;
} }
const entries = await TauriAPI.listDirectory(pluginsPath); const entries = await TauriAPI.listDirectory(pluginsPath);
const pluginDirs = entries.filter((entry) => entry.is_dir && !entry.name.startsWith('.')); const pluginDirs = entries.filter((entry) => entry.is_dir && !entry.name.startsWith('.'));
console.log('[PluginLoader] Found plugin directories:', pluginDirs.map((d) => d.name));
for (const entry of pluginDirs) { for (const entry of pluginDirs) {
const pluginPath = `${pluginsPath}/${entry.name}`; const pluginPath = `${pluginsPath}/${entry.name}`;
@@ -102,13 +100,10 @@ export class PluginLoader {
const timestamp = Date.now(); const timestamp = Date.now();
const moduleUrl = `/@user-project/plugins/${pluginDirName}/${entryPoint}?v=${currentVersion}&t=${timestamp}`; const moduleUrl = `/@user-project/plugins/${pluginDirName}/${entryPoint}?v=${currentVersion}&t=${timestamp}`;
console.log(`[PluginLoader] Loading plugin from: ${moduleUrl} (version: ${currentVersion})`);
// 清除可能存在的旧模块缓存 // 清除可能存在的旧模块缓存
this.loadedModuleUrls.add(moduleUrl); this.loadedModuleUrls.add(moduleUrl);
const module = await import(/* @vite-ignore */ moduleUrl); const module = await import(/* @vite-ignore */ moduleUrl);
console.log('[PluginLoader] Module loaded successfully');
let pluginInstance: IEditorPlugin | null = null; let pluginInstance: IEditorPlugin | null = null;
try { try {
@@ -133,7 +128,6 @@ export class PluginLoader {
const currentLocale = localeService.getCurrentLocale(); const currentLocale = localeService.getCurrentLocale();
if (pluginInstance.setLocale) { if (pluginInstance.setLocale) {
pluginInstance.setLocale(currentLocale); pluginInstance.setLocale(currentLocale);
console.log(`[PluginLoader] Set locale for plugin ${packageJson.name}: ${currentLocale}`);
} }
} catch (error) { } catch (error) {
console.warn(`[PluginLoader] Failed to set locale for plugin ${packageJson.name}:`, error); console.warn(`[PluginLoader] Failed to set locale for plugin ${packageJson.name}:`, error);
@@ -144,12 +138,9 @@ export class PluginLoader {
const messageHub = Core.services.resolve(MessageHub); const messageHub = Core.services.resolve(MessageHub);
const localeService = Core.services.resolve(LocaleService); const localeService = Core.services.resolve(LocaleService);
messageHub.publish('locale:changed', { locale: localeService.getCurrentLocale() }); messageHub.publish('locale:changed', { locale: localeService.getCurrentLocale() });
console.log(`[PluginLoader] Published locale:changed event for plugin ${packageJson.name}`);
} catch (error) { } catch (error) {
console.warn('[PluginLoader] Failed to publish locale:changed event:', error); console.warn('[PluginLoader] Failed to publish locale:changed event:', error);
} }
console.log(`[PluginLoader] Successfully loaded plugin: ${packageJson.name}`);
} catch (error) { } catch (error) {
console.error(`[PluginLoader] Failed to load plugin from ${pluginPath}:`, error); console.error(`[PluginLoader] Failed to load plugin from ${pluginPath}:`, error);
if (error instanceof Error) { if (error instanceof Error) {
@@ -159,17 +150,13 @@ export class PluginLoader {
} }
private findPluginInstance(module: any): IEditorPlugin | null { private findPluginInstance(module: any): IEditorPlugin | null {
console.log('[PluginLoader] Module exports:', Object.keys(module));
if (module.default && this.isPluginInstance(module.default)) { if (module.default && this.isPluginInstance(module.default)) {
console.log('[PluginLoader] Found plugin in default export');
return module.default; return module.default;
} }
for (const key of Object.keys(module)) { for (const key of Object.keys(module)) {
const value = module[key]; const value = module[key];
if (value && this.isPluginInstance(value)) { if (value && this.isPluginInstance(value)) {
console.log(`[PluginLoader] Found plugin in export: ${key}`);
return value; return value;
} }
} }
@@ -192,19 +179,6 @@ export class PluginLoader {
typeof obj.install === 'function' && typeof obj.install === 'function' &&
typeof obj.uninstall === 'function'; typeof obj.uninstall === 'function';
if (!hasRequiredProperties) {
console.log('[PluginLoader] Object is not a valid plugin:', {
hasName: typeof obj.name === 'string',
hasVersion: typeof obj.version === 'string',
hasDisplayName: typeof obj.displayName === 'string',
hasCategory: typeof obj.category === 'string',
hasInstall: typeof obj.install === 'function',
hasUninstall: typeof obj.uninstall === 'function',
objectType: typeof obj,
objectConstructor: obj?.constructor?.name
});
}
return hasRequiredProperties; return hasRequiredProperties;
} catch (error) { } catch (error) {
console.error('[PluginLoader] Error in isPluginInstance:', error); console.error('[PluginLoader] Error in isPluginInstance:', error);
@@ -213,11 +187,8 @@ export class PluginLoader {
} }
async unloadProjectPlugins(pluginManager: EditorPluginManager): Promise<void> { async unloadProjectPlugins(pluginManager: EditorPluginManager): Promise<void> {
console.log('[PluginLoader] Unloading all project plugins...');
for (const pluginName of this.loadedPluginNames) { for (const pluginName of this.loadedPluginNames) {
try { try {
console.log(`[PluginLoader] Uninstalling plugin: ${pluginName}`);
await pluginManager.uninstallEditor(pluginName); await pluginManager.uninstallEditor(pluginName);
} catch (error) { } catch (error) {
console.error(`[PluginLoader] Failed to unload plugin ${pluginName}:`, error); console.error(`[PluginLoader] Failed to unload plugin ${pluginName}:`, error);
@@ -229,22 +200,14 @@ export class PluginLoader {
this.loadedPluginNames.clear(); this.loadedPluginNames.clear();
this.loadedModuleUrls.clear(); this.loadedModuleUrls.clear();
console.log('[PluginLoader] All project plugins unloaded');
} }
private invalidateModuleCache(): void { private invalidateModuleCache(): void {
try { try {
// 尝试使用Vite HMR API无效化模块 // 尝试使用Vite HMR API无效化模块
if (import.meta.hot) { if (import.meta.hot) {
console.log('[PluginLoader] Attempting to invalidate module cache via HMR');
import.meta.hot.invalidate(); import.meta.hot.invalidate();
} }
// 清除已加载的模块URL记录
for (const url of this.loadedModuleUrls) {
console.log(`[PluginLoader] Marking module for reload: ${url}`);
}
} catch (error) { } catch (error) {
console.warn('[PluginLoader] Failed to invalidate module cache:', error); console.warn('[PluginLoader] Failed to invalidate module cache:', error);
} }

View File

@@ -1,6 +1,6 @@
import type { EditorPluginManager, IEditorPlugin } from '@esengine/editor-core'; import type { EditorPluginManager } from '@esengine/editor-core';
import JSZip from 'jszip';
import { fetch } from '@tauri-apps/plugin-http'; import { fetch } from '@tauri-apps/plugin-http';
import { invoke } from '@tauri-apps/api/core';
export interface PluginAuthor { export interface PluginAuthor {
name: string; name: string;
@@ -80,7 +80,6 @@ export class PluginMarketService {
setProjectPath(path: string | null): void { setProjectPath(path: string | null): void {
this.projectPath = path; this.projectPath = path;
console.log(`[PluginMarketService] Project path set to: ${path}`);
} }
isUsingDirectSource(): boolean { isUsingDirectSource(): boolean {
@@ -89,14 +88,12 @@ export class PluginMarketService {
setUseDirectSource(useDirect: boolean): void { setUseDirectSource(useDirect: boolean): void {
localStorage.setItem(this.USE_DIRECT_SOURCE_KEY, String(useDirect)); localStorage.setItem(this.USE_DIRECT_SOURCE_KEY, String(useDirect));
console.log(`[PluginMarketService] Direct source ${useDirect ? 'enabled' : 'disabled'}`);
} }
async fetchPluginList(bypassCache: boolean = false): Promise<PluginMarketMetadata[]> { async fetchPluginList(bypassCache: boolean = false): Promise<PluginMarketMetadata[]> {
const useDirectSource = this.isUsingDirectSource(); const useDirectSource = this.isUsingDirectSource();
if (useDirectSource) { if (useDirectSource) {
console.log('[PluginMarketService] Using direct GitHub source (bypass CDN)');
return await this.fetchFromUrl(this.GITHUB_DIRECT_URL, bypassCache); return await this.fetchFromUrl(this.GITHUB_DIRECT_URL, bypassCache);
} }
@@ -131,16 +128,9 @@ export class PluginMarketService {
if (bypassCache) { if (bypassCache) {
url += `?t=${Date.now()}`; url += `?t=${Date.now()}`;
if (urlIndex && totalUrls) { if (urlIndex && totalUrls) {
console.log(`[PluginMarketService] Bypassing cache with timestamp (URL ${urlIndex}/${totalUrls})`);
} }
} }
if (urlIndex && totalUrls) {
console.log(`[PluginMarketService] Trying URL ${urlIndex}/${totalUrls}: ${url}`);
} else {
console.log(`[PluginMarketService] Fetching from: ${url}`);
}
const response = await fetch(url, { const response = await fetch(url, {
cache: 'no-cache', cache: 'no-cache',
headers: { headers: {
@@ -154,22 +144,11 @@ export class PluginMarketService {
} }
const registry: PluginRegistry = await response.json(); const registry: PluginRegistry = await response.json();
if (urlIndex) {
console.log(`[PluginMarketService] Successfully loaded from URL ${urlIndex}`);
} else {
console.log(`[PluginMarketService] Successfully loaded`);
}
console.log(`[PluginMarketService] Loaded ${registry.plugins.length} plugins from registry`);
console.log(`[PluginMarketService] Registry generated at: ${registry.generatedAt}`);
return registry.plugins; return registry.plugins;
} }
async installPlugin(plugin: PluginMarketMetadata, version?: string, onReload?: () => Promise<void>): Promise<void> { async installPlugin(plugin: PluginMarketMetadata, version?: string, onReload?: () => Promise<void>): Promise<void> {
const targetVersion = version || plugin.latestVersion; const targetVersion = version || plugin.latestVersion;
console.log(`[PluginMarketService] Installing plugin: ${plugin.name} v${targetVersion}`);
if (!this.projectPath) { if (!this.projectPath) {
throw new Error('No project opened. Please open a project first.'); throw new Error('No project opened. Please open a project first.');
} }
@@ -182,11 +161,9 @@ export class PluginMarketService {
} }
// 下载 ZIP 文件 // 下载 ZIP 文件
console.log(`[PluginMarketService] Downloading ZIP: ${versionInfo.zipUrl}`);
const zipBlob = await this.downloadZip(versionInfo.zipUrl); const zipBlob = await this.downloadZip(versionInfo.zipUrl);
// 解压到项目 plugins 目录 // 解压到项目 plugins 目录
console.log(`[PluginMarketService] Extracting plugin to project...`);
await this.extractZipToProject(zipBlob, plugin.id); await this.extractZipToProject(zipBlob, plugin.id);
// 标记为已安装 // 标记为已安装
@@ -194,11 +171,8 @@ export class PluginMarketService {
// 重新加载项目插件 // 重新加载项目插件
if (onReload) { if (onReload) {
console.log(`[PluginMarketService] Reloading project plugins...`);
await onReload(); await onReload();
} }
console.log(`[PluginMarketService] Successfully installed: ${plugin.name} v${targetVersion}`);
} catch (error) { } catch (error) {
console.error(`[PluginMarketService] Failed to install plugin ${plugin.name}:`, error); console.error(`[PluginMarketService] Failed to install plugin ${plugin.name}:`, error);
throw error; throw error;
@@ -206,8 +180,6 @@ export class PluginMarketService {
} }
async uninstallPlugin(pluginId: string, onReload?: () => Promise<void>): Promise<void> { async uninstallPlugin(pluginId: string, onReload?: () => Promise<void>): Promise<void> {
console.log(`[PluginMarketService] Uninstalling plugin: ${pluginId}`);
if (!this.projectPath) { if (!this.projectPath) {
throw new Error('No project opened'); throw new Error('No project opened');
} }
@@ -223,19 +195,14 @@ export class PluginMarketService {
pluginId: pluginId pluginId: pluginId
}); });
console.log(`[PluginMarketService] Successfully removed plugin directory`);
// 从已安装列表移除 // 从已安装列表移除
this.installedPlugins.delete(pluginId); this.installedPlugins.delete(pluginId);
this.saveInstalledPlugins(); this.saveInstalledPlugins();
// 重新加载项目插件 // 重新加载项目插件
if (onReload) { if (onReload) {
console.log(`[PluginMarketService] Reloading project plugins...`);
await onReload(); await onReload();
} }
console.log(`[PluginMarketService] Successfully uninstalled: ${pluginId}`);
} catch (error) { } catch (error) {
console.error(`[PluginMarketService] Failed to uninstall plugin ${pluginId}:`, error); console.error(`[PluginMarketService] Failed to uninstall plugin ${pluginId}:`, error);
throw error; throw error;
@@ -286,14 +253,11 @@ export class PluginMarketService {
const base64Data = btoa(binary); const base64Data = btoa(binary);
// 调用 Tauri 后端命令进行安装 // 调用 Tauri 后端命令进行安装
const { invoke } = await import('@tauri-apps/api/core'); await invoke<string>('install_marketplace_plugin', {
const pluginDir = await invoke<string>('install_marketplace_plugin', {
projectPath: this.projectPath, projectPath: this.projectPath,
pluginId: pluginId, pluginId: pluginId,
zipDataBase64: base64Data zipDataBase64: base64Data
}); });
console.log(`[PluginMarketService] Successfully extracted plugin to ${pluginDir}`);
} catch (error) { } catch (error) {
console.error('[PluginMarketService] Failed to extract ZIP:', error); console.error('[PluginMarketService] Failed to extract ZIP:', error);
throw new Error(`Failed to extract plugin: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`Failed to extract plugin: ${error instanceof Error ? error.message : String(error)}`);

View File

@@ -48,7 +48,6 @@ export class PluginPublishService {
} }
private notifyProgress(step: PublishStep, message: string, progress: number): void { private notifyProgress(step: PublishStep, message: string, progress: number): void {
console.log(`[PluginPublishService] ${message} (${progress}%)`);
this.progressCallback?.({ step, message, progress }); this.progressCallback?.({ step, message, progress });
} }
@@ -59,9 +58,6 @@ export class PluginPublishService {
* @returns Pull Request URL * @returns Pull Request URL
*/ */
async publishPlugin(publishInfo: PluginPublishInfo, zipPath: string): Promise<string> { async publishPlugin(publishInfo: PluginPublishInfo, zipPath: string): Promise<string> {
console.log('[PluginPublishService] Publishing plugin with ZIP:', zipPath);
console.log('[PluginPublishService] Plugin info:', publishInfo);
if (!this.githubService.isAuthenticated()) { if (!this.githubService.isAuthenticated()) {
throw new Error('Please login to GitHub first'); throw new Error('Please login to GitHub first');
} }
@@ -214,7 +210,6 @@ export class PluginPublishService {
); );
return JSON.parse(content); return JSON.parse(content);
} catch (error) { } catch (error) {
console.log(`[PluginPublishService] No existing manifest found, will create new one`);
return null; return null;
} }
} }
@@ -543,7 +538,6 @@ ${releaseNotes}
throw new Error(`No files found to delete in ${pluginPath}`); throw new Error(`No files found to delete in ${pluginPath}`);
} }
console.log(`[PluginPublishService] Files to delete:`, filesToDelete.map(f => f.path));
this.notifyProgress('uploading-files', `Deleting ${filesToDelete.length} files...`, 40); this.notifyProgress('uploading-files', `Deleting ${filesToDelete.length} files...`, 40);
let deletedCount = 0; let deletedCount = 0;
@@ -551,7 +545,6 @@ ${releaseNotes}
for (const file of filesToDelete) { for (const file of filesToDelete) {
try { try {
console.log(`[PluginPublishService] Deleting file: ${file.path} (SHA: ${file.sha}) from ${user.login}/${this.REGISTRY_REPO}:${branchName}`);
await this.githubService.deleteFileWithSha( await this.githubService.deleteFileWithSha(
user.login, user.login,
this.REGISTRY_REPO, this.REGISTRY_REPO,
@@ -561,7 +554,6 @@ ${releaseNotes}
branchName branchName
); );
deletedCount++; deletedCount++;
console.log(`[PluginPublishService] Successfully deleted: ${file.path}`);
const progress = 40 + Math.floor((deletedCount / filesToDelete.length) * 40); const progress = 40 + Math.floor((deletedCount / filesToDelete.length) * 40);
this.notifyProgress('uploading-files', `Deleted ${deletedCount}/${filesToDelete.length} files`, progress); this.notifyProgress('uploading-files', `Deleted ${deletedCount}/${filesToDelete.length} files`, progress);
} catch (error) { } catch (error) {

View File

@@ -47,8 +47,6 @@ export class PluginSourceParser {
const packageJsonContent = await readTextFile(packageJsonPath); const packageJsonContent = await readTextFile(packageJsonPath);
const packageJson = JSON.parse(packageJsonContent) as PluginPackageJson; const packageJson = JSON.parse(packageJsonContent) as PluginPackageJson;
console.log('[PluginSourceParser] Parsed package.json from folder:', packageJson);
return { return {
packageJson, packageJson,
sourceType: 'folder', sourceType: 'folder',
@@ -87,8 +85,6 @@ export class PluginSourceParser {
const packageJsonContent = await packageJsonFile.async('text'); const packageJsonContent = await packageJsonFile.async('text');
const packageJson = JSON.parse(packageJsonContent) as PluginPackageJson; const packageJson = JSON.parse(packageJsonContent) as PluginPackageJson;
console.log('[PluginSourceParser] Parsed package.json from ZIP:', packageJson);
// 验证 ZIP 中必须包含 dist 目录 // 验证 ZIP 中必须包含 dist 目录
const distFiles = Object.keys(zip.files).filter(f => f.startsWith('dist/')); const distFiles = Object.keys(zip.files).filter(f => f.startsWith('dist/'));
if (distFiles.length === 0) { if (distFiles.length === 0) {

View File

@@ -18,11 +18,6 @@ export async function checkForUpdates(silent: boolean = false): Promise<UpdateCh
const update = await check(); const update = await check();
if (update?.available) { if (update?.available) {
console.log(`发现新版本: ${update.version}`);
console.log(`当前版本: ${update.currentVersion}`);
console.log(`更新日期: ${update.date}`);
console.log(`更新说明:\n${update.body}`);
if (!silent) { if (!silent) {
// Tauri 会自动显示更新对话框(因为配置了 dialog: true // Tauri 会自动显示更新对话框(因为配置了 dialog: true
// 用户点击确认后会自动下载并安装,安装完成后会自动重启 // 用户点击确认后会自动下载并安装,安装完成后会自动重启
@@ -35,9 +30,6 @@ export async function checkForUpdates(silent: boolean = false): Promise<UpdateCh
currentVersion: update.currentVersion currentVersion: update.currentVersion
}; };
} else { } else {
if (!silent) {
console.log('当前已是最新版本');
}
return { available: false }; return { available: false };
} }
} catch (error) { } catch (error) {

View File

@@ -111,8 +111,6 @@ const userProjectPlugin = () => ({
} }
const filePath = path.join(projectPath, relativePath); const filePath = path.join(projectPath, relativePath);
console.log('[Vite] Loading file:', id);
console.log('[Vite] Resolved path:', filePath);
if (!fs.existsSync(filePath)) { if (!fs.existsSync(filePath)) {
throw new Error(`File not found: ${filePath}`); throw new Error(`File not found: ${filePath}`);

View File

@@ -66,12 +66,9 @@ export class EditorPluginManager extends PluginManager {
this.pluginMetadata.set(plugin.name, metadata); this.pluginMetadata.set(plugin.name, metadata);
try { try {
console.log('[EditorPluginManager] Checking registerMenuItems:', !!plugin.registerMenuItems);
if (plugin.registerMenuItems) { if (plugin.registerMenuItems) {
const menuItems = plugin.registerMenuItems(); const menuItems = plugin.registerMenuItems();
console.log('[EditorPluginManager] Got menu items:', menuItems);
this.uiRegistry.registerMenus(menuItems); this.uiRegistry.registerMenus(menuItems);
console.log('[EditorPluginManager] Registered menu items to UIRegistry');
logger.debug(`Registered ${menuItems.length} menu items for ${plugin.name}`); logger.debug(`Registered ${menuItems.length} menu items for ${plugin.name}`);
} }

View File

@@ -9,12 +9,10 @@ export class CompilerRegistry implements IService {
console.warn(`Compiler with id "${compiler.id}" is already registered. Overwriting.`); console.warn(`Compiler with id "${compiler.id}" is already registered. Overwriting.`);
} }
this.compilers.set(compiler.id, compiler); this.compilers.set(compiler.id, compiler);
console.log(`[CompilerRegistry] Registered compiler: ${compiler.name} (${compiler.id})`);
} }
unregister(compilerId: string): void { unregister(compilerId: string): void {
this.compilers.delete(compilerId); this.compilers.delete(compilerId);
console.log(`[CompilerRegistry] Unregistered compiler: ${compilerId}`);
} }
get(compilerId: string): ICompiler | undefined { get(compilerId: string): ICompiler | undefined {

View File

@@ -82,18 +82,10 @@ export class FileActionRegistry implements IService {
* 处理文件双击 * 处理文件双击
*/ */
async handleDoubleClick(filePath: string): Promise<boolean> { async handleDoubleClick(filePath: string): Promise<boolean> {
const extension = this.getFileExtension(filePath);
console.log('[FileActionRegistry] handleDoubleClick:', filePath);
console.log('[FileActionRegistry] Extension:', extension);
console.log('[FileActionRegistry] Total handlers:', this.actionHandlers.size);
console.log('[FileActionRegistry] Registered extensions:', Array.from(this.actionHandlers.keys()));
const handlers = this.getHandlersForFile(filePath); const handlers = this.getHandlersForFile(filePath);
console.log('[FileActionRegistry] Found handlers:', handlers.length);
for (const handler of handlers) { for (const handler of handlers) {
if (handler.onDoubleClick) { if (handler.onDoubleClick) {
console.log('[FileActionRegistry] Calling handler for extensions:', handler.extensions);
await handler.onDoubleClick(filePath); await handler.onDoubleClick(filePath);
return true; return true;
} }

View File

@@ -70,7 +70,6 @@ export class WindowRegistry implements IService {
return; return;
} }
this.windows.set(descriptor.id, descriptor); this.windows.set(descriptor.id, descriptor);
console.log(`[WindowRegistry] Registered window: ${descriptor.id}`);
} }
/** /**
@@ -106,7 +105,6 @@ export class WindowRegistry implements IService {
return; return;
} }
console.log(`[WindowRegistry] Opening window: ${windowId}`, params);
this.openWindows.set(windowId, { this.openWindows.set(windowId, {
descriptor, descriptor,
isOpen: true, isOpen: true,
@@ -119,7 +117,6 @@ export class WindowRegistry implements IService {
* 关闭窗口 * 关闭窗口
*/ */
closeWindow(windowId: string): void { closeWindow(windowId: string): void {
console.log(`[WindowRegistry] Closing window: ${windowId}`);
this.openWindows.delete(windowId); this.openWindows.delete(windowId);
this.notifyListeners(); this.notifyListeners();
} }