@mcpc-tech/unplugin-dev-inspector-mcp 0.0.34 → 0.0.36

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/dist/index.cjs CHANGED
@@ -40,13 +40,10 @@ async function launchBrowserWithDevTools(options) {
40
40
  chrome_navigate_page: { url }
41
41
  }
42
42
  });
43
- await new Promise((resolve) => setTimeout(resolve, 500));
44
43
  return true;
45
44
  } catch (error) {
46
45
  console.error(`[dev-inspector] ⚠️ Failed to auto-open browser:`, error instanceof Error ? error.message : String(error));
47
46
  return false;
48
- } finally {
49
- if (client) await client.close().catch(() => {});
50
47
  }
51
48
  }
52
49
  var init_browser_launcher = require_chunk.__esmMin((() => {}));
@@ -91,28 +88,35 @@ export function registerInspectorTool(tool) {
91
88
  }
92
89
 
93
90
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
94
- // Create inspector element
95
- const inspector = document.createElement('dev-inspector-mcp');
96
- document.body.appendChild(inspector);
91
+ // Skip if already loaded (e.g., by HTML injection)
92
+ if (window.__DEV_INSPECTOR_LOADED__) {
93
+ // Already initialized, skip
94
+ } else {
95
+ window.__DEV_INSPECTOR_LOADED__ = true;
96
+
97
+ // Create inspector element
98
+ const inspector = document.createElement('dev-inspector-mcp');
99
+ document.body.appendChild(inspector);
97
100
 
98
- // Store dev server config globally
99
- window.__DEV_INSPECTOR_CONFIG__ = {
100
- host: '${resolvedHost}',
101
- port: '${resolvedPort}',
102
- base: '/',
103
- showInspectorBar: ${options.showInspectorBar ?? true}
104
- };
101
+ // Store dev server config globally
102
+ window.__DEV_INSPECTOR_CONFIG__ = {
103
+ host: '${resolvedHost}',
104
+ port: '${resolvedPort}',
105
+ base: '/',
106
+ showInspectorBar: ${options.showInspectorBar ?? true}
107
+ };
105
108
 
106
- // Dynamically load inspector script
107
- const script = document.createElement('script');
108
- const config = window.__DEV_INSPECTOR_CONFIG__;
109
- let baseUrl = 'http://' + config.host + ':' + config.port + config.base;
110
- if (baseUrl.endsWith('/')) {
111
- baseUrl = baseUrl.slice(0, -1);
109
+ // Dynamically load inspector script
110
+ const script = document.createElement('script');
111
+ const config = window.__DEV_INSPECTOR_CONFIG__;
112
+ let baseUrl = 'http://' + config.host + ':' + config.port + config.base;
113
+ if (baseUrl.endsWith('/')) {
114
+ baseUrl = baseUrl.slice(0, -1);
115
+ }
116
+ script.src = baseUrl + '/__inspector__/inspector.iife.js';
117
+ script.type = 'module';
118
+ document.head.appendChild(script);
112
119
  }
113
- script.src = baseUrl + '/__inspector__/inspector.iife.js';
114
- script.type = 'module';
115
- document.head.appendChild(script);
116
120
  }
117
121
  `;
118
122
  },
package/dist/index.js CHANGED
@@ -36,13 +36,10 @@ async function launchBrowserWithDevTools(options) {
36
36
  chrome_navigate_page: { url }
37
37
  }
38
38
  });
39
- await new Promise((resolve) => setTimeout(resolve, 500));
40
39
  return true;
41
40
  } catch (error) {
42
41
  console.error(`[dev-inspector] ⚠️ Failed to auto-open browser:`, error instanceof Error ? error.message : String(error));
43
42
  return false;
44
- } finally {
45
- if (client) await client.close().catch(() => {});
46
43
  }
47
44
  }
48
45
  var init_browser_launcher = __esmMin((() => {}));
@@ -87,28 +84,35 @@ export function registerInspectorTool(tool) {
87
84
  }
88
85
 
89
86
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
90
- // Create inspector element
91
- const inspector = document.createElement('dev-inspector-mcp');
92
- document.body.appendChild(inspector);
87
+ // Skip if already loaded (e.g., by HTML injection)
88
+ if (window.__DEV_INSPECTOR_LOADED__) {
89
+ // Already initialized, skip
90
+ } else {
91
+ window.__DEV_INSPECTOR_LOADED__ = true;
92
+
93
+ // Create inspector element
94
+ const inspector = document.createElement('dev-inspector-mcp');
95
+ document.body.appendChild(inspector);
93
96
 
94
- // Store dev server config globally
95
- window.__DEV_INSPECTOR_CONFIG__ = {
96
- host: '${resolvedHost}',
97
- port: '${resolvedPort}',
98
- base: '/',
99
- showInspectorBar: ${options.showInspectorBar ?? true}
100
- };
97
+ // Store dev server config globally
98
+ window.__DEV_INSPECTOR_CONFIG__ = {
99
+ host: '${resolvedHost}',
100
+ port: '${resolvedPort}',
101
+ base: '/',
102
+ showInspectorBar: ${options.showInspectorBar ?? true}
103
+ };
101
104
 
102
- // Dynamically load inspector script
103
- const script = document.createElement('script');
104
- const config = window.__DEV_INSPECTOR_CONFIG__;
105
- let baseUrl = 'http://' + config.host + ':' + config.port + config.base;
106
- if (baseUrl.endsWith('/')) {
107
- baseUrl = baseUrl.slice(0, -1);
105
+ // Dynamically load inspector script
106
+ const script = document.createElement('script');
107
+ const config = window.__DEV_INSPECTOR_CONFIG__;
108
+ let baseUrl = 'http://' + config.host + ':' + config.port + config.base;
109
+ if (baseUrl.endsWith('/')) {
110
+ baseUrl = baseUrl.slice(0, -1);
111
+ }
112
+ script.src = baseUrl + '/__inspector__/inspector.iife.js';
113
+ script.type = 'module';
114
+ document.head.appendChild(script);
108
115
  }
109
- script.src = baseUrl + '/__inspector__/inspector.iife.js';
110
- script.type = 'module';
111
- document.head.appendChild(script);
112
116
  }
113
117
  `;
114
118
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/unplugin-dev-inspector-mcp",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "Universal dev inspector plugin for React/Vue - inspect component sources and API calls in any bundler",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -145,7 +145,7 @@
145
145
  "@xyflow/react": "^12.9.3",
146
146
  "ai": "^5.0.95",
147
147
  "aria-hidden": "^1.2.6",
148
- "chrome-devtools-mcp": "^0.10.1",
148
+ "chrome-devtools-mcp": "^0.12.1",
149
149
  "class-variance-authority": "^0.7.1",
150
150
  "clsx": "^2.1.1",
151
151
  "cmdk": "^1.1.1",