@mcpc-tech/unplugin-dev-inspector-mcp 0.0.28 → 0.0.29
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/client/dist/inspector.iife.js +3 -3
- package/dist/cli.cjs +7 -7
- package/dist/config-updater.cjs +9962 -9954
- package/dist/config-updater.js +9924 -9916
- package/dist/index.cjs +12 -30
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -20
- package/dist/loader.cjs +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4,16 +4,16 @@ const require_config_updater = require('./config-updater.cjs');
|
|
|
4
4
|
let node_module = require("node:module");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_chunk.__toESM(node_path);
|
|
7
|
-
let
|
|
8
|
-
let
|
|
7
|
+
let _modelcontextprotocol_sdk_client_index_js = require("@modelcontextprotocol/sdk/client/index.js");
|
|
8
|
+
let _modelcontextprotocol_sdk_client_sse_js = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
9
9
|
let node_url = require("node:url");
|
|
10
|
-
let
|
|
10
|
+
let _babel_parser = require("@babel/parser");
|
|
11
11
|
let magic_string = require("magic-string");
|
|
12
12
|
magic_string = require_chunk.__toESM(magic_string);
|
|
13
13
|
let unplugin = require("unplugin");
|
|
14
|
-
let
|
|
14
|
+
let _vue_compiler_sfc = require("@vue/compiler-sfc");
|
|
15
15
|
let svelte_compiler = require("svelte/compiler");
|
|
16
|
-
let
|
|
16
|
+
let _code_inspector_core = require("@code-inspector/core");
|
|
17
17
|
|
|
18
18
|
//#region src/utils/browser-launcher.ts
|
|
19
19
|
var browser_launcher_exports = /* @__PURE__ */ require_chunk.__export({ launchBrowserWithDevTools: () => launchBrowserWithDevTools });
|
|
@@ -26,11 +26,11 @@ async function launchBrowserWithDevTools(options) {
|
|
|
26
26
|
const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host || "localhost"}:${serverContext.port || 5173}/__mcp__/sse?clientId=auto-browser`;
|
|
27
27
|
let client = null;
|
|
28
28
|
try {
|
|
29
|
-
client = new
|
|
29
|
+
client = new _modelcontextprotocol_sdk_client_index_js.Client({
|
|
30
30
|
name: "dev-inspector-auto-browser",
|
|
31
31
|
version: "1.0.0"
|
|
32
32
|
});
|
|
33
|
-
const transport = new
|
|
33
|
+
const transport = new _modelcontextprotocol_sdk_client_sse_js.SSEClientTransport(new URL(sseUrl));
|
|
34
34
|
await client.connect(transport);
|
|
35
35
|
await client.callTool({
|
|
36
36
|
name: "chrome_devtools",
|
|
@@ -70,22 +70,7 @@ const createDevInspectorPlugin = (name, transformFactory) => {
|
|
|
70
70
|
},
|
|
71
71
|
load(id) {
|
|
72
72
|
if (id === "\0" + virtualModuleName) return `
|
|
73
|
-
//
|
|
74
|
-
const __toolRegistry = new Map();
|
|
75
|
-
|
|
76
|
-
export function registerInspectorTool(tool) {
|
|
77
|
-
if (__toolRegistry.has(tool.name)) {
|
|
78
|
-
console.warn('[dev-inspector] Tool "' + tool.name + '" already registered, overwriting...');
|
|
79
|
-
}
|
|
80
|
-
__toolRegistry.set(tool.name, tool);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Internal: used by the inspector's useMcp hook
|
|
84
|
-
export function __getRegisteredTools() {
|
|
85
|
-
return Array.from(__toolRegistry.values());
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// ===== Inspector Setup =====
|
|
73
|
+
// Development-only code - removed in production builds
|
|
89
74
|
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
90
75
|
// Create inspector element
|
|
91
76
|
const inspector = document.createElement('dev-inspector-mcp');
|
|
@@ -99,10 +84,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
99
84
|
showInspectorBar: ${options.showInspectorBar ?? true}
|
|
100
85
|
};
|
|
101
86
|
|
|
102
|
-
//
|
|
103
|
-
window.__getInspectorTools = __getRegisteredTools;
|
|
104
|
-
|
|
105
|
-
// Load inspector script
|
|
87
|
+
// Dynamically load inspector script
|
|
106
88
|
const script = document.createElement('script');
|
|
107
89
|
const config = window.__DEV_INSPECTOR_CONFIG__;
|
|
108
90
|
let baseUrl = 'http://' + config.host + ':' + config.port + config.base;
|
|
@@ -325,7 +307,7 @@ function transformJSX({ code, id }) {
|
|
|
325
307
|
if (!code.includes("<")) return null;
|
|
326
308
|
let ast;
|
|
327
309
|
try {
|
|
328
|
-
ast = (0,
|
|
310
|
+
ast = (0, _babel_parser.parse)(code, {
|
|
329
311
|
sourceType: "module",
|
|
330
312
|
plugins: [
|
|
331
313
|
"jsx",
|
|
@@ -379,7 +361,7 @@ function normalizePath$1(id) {
|
|
|
379
361
|
const DATA_SOURCE_ATTR$1 = "data-source";
|
|
380
362
|
function compileVue({ code, id }) {
|
|
381
363
|
const relativePath = normalizePath$1(node_path.default.relative(process.cwd(), id));
|
|
382
|
-
const { descriptor } = (0,
|
|
364
|
+
const { descriptor } = (0, _vue_compiler_sfc.parse)(code, {
|
|
383
365
|
filename: id,
|
|
384
366
|
sourceMap: true
|
|
385
367
|
});
|
|
@@ -517,7 +499,7 @@ const unpluginExternal = createDevInspectorPlugin("unplugin-dev-inspector-extern
|
|
|
517
499
|
const fileType = detectFileType(id);
|
|
518
500
|
if (!fileType) return null;
|
|
519
501
|
try {
|
|
520
|
-
return (0,
|
|
502
|
+
return (0, _code_inspector_core.transformCode)({
|
|
521
503
|
content: code,
|
|
522
504
|
filePath: id,
|
|
523
505
|
fileType,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as unplugin1 from "unplugin";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/config-updater.d.ts
|
|
4
4
|
type EditorId = "cursor" | "vscode" | "windsurf" | "claude-code" | "antigravity";
|
|
@@ -32,7 +32,6 @@ interface McpConfigOptions {
|
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region client/constants/types.d.ts
|
|
35
|
-
|
|
36
35
|
/**
|
|
37
36
|
* ACP (Agent Client Protocol) options for configuring agent behavior
|
|
38
37
|
*/
|
|
@@ -135,10 +134,10 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
|
|
|
135
134
|
}
|
|
136
135
|
//#endregion
|
|
137
136
|
//#region src/core.d.ts
|
|
138
|
-
declare const unplugin:
|
|
137
|
+
declare const unplugin: unplugin1.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
|
|
139
138
|
//#endregion
|
|
140
139
|
//#region src/core-external.d.ts
|
|
141
|
-
declare const unpluginExternal:
|
|
140
|
+
declare const unpluginExternal: unplugin1.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
|
|
142
141
|
//#endregion
|
|
143
142
|
//#region src/turbopack.d.ts
|
|
144
143
|
interface TurbopackDevInspectorOptions extends DevInspectorOptions {
|
|
@@ -163,7 +162,7 @@ interface TurbopackDevInspectorOptions extends DevInspectorOptions {
|
|
|
163
162
|
declare function turbopackDevInspector(options?: TurbopackDevInspectorOptions): any;
|
|
164
163
|
//#endregion
|
|
165
164
|
//#region src/index.d.ts
|
|
166
|
-
declare const external:
|
|
165
|
+
declare const external: unplugin1.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
|
|
167
166
|
declare module "virtual:dev-inspector-mcp" {}
|
|
168
167
|
//#endregion
|
|
169
168
|
export { type CustomEditorConfig, type DevInspectorOptions, type EditorId, type McpConfigOptions, type TurbopackDevInspectorOptions, unplugin as default, unplugin, external, turbopackDevInspector, unpluginExternal };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -66,22 +66,7 @@ const createDevInspectorPlugin = (name, transformFactory) => {
|
|
|
66
66
|
},
|
|
67
67
|
load(id) {
|
|
68
68
|
if (id === "\0" + virtualModuleName) return `
|
|
69
|
-
//
|
|
70
|
-
const __toolRegistry = new Map();
|
|
71
|
-
|
|
72
|
-
export function registerInspectorTool(tool) {
|
|
73
|
-
if (__toolRegistry.has(tool.name)) {
|
|
74
|
-
console.warn('[dev-inspector] Tool "' + tool.name + '" already registered, overwriting...');
|
|
75
|
-
}
|
|
76
|
-
__toolRegistry.set(tool.name, tool);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Internal: used by the inspector's useMcp hook
|
|
80
|
-
export function __getRegisteredTools() {
|
|
81
|
-
return Array.from(__toolRegistry.values());
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// ===== Inspector Setup =====
|
|
69
|
+
// Development-only code - removed in production builds
|
|
85
70
|
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
86
71
|
// Create inspector element
|
|
87
72
|
const inspector = document.createElement('dev-inspector-mcp');
|
|
@@ -95,10 +80,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
95
80
|
showInspectorBar: ${options.showInspectorBar ?? true}
|
|
96
81
|
};
|
|
97
82
|
|
|
98
|
-
//
|
|
99
|
-
window.__getInspectorTools = __getRegisteredTools;
|
|
100
|
-
|
|
101
|
-
// Load inspector script
|
|
83
|
+
// Dynamically load inspector script
|
|
102
84
|
const script = document.createElement('script');
|
|
103
85
|
const config = window.__DEV_INSPECTOR_CONFIG__;
|
|
104
86
|
let baseUrl = 'http://' + config.host + ':' + config.port + config.base;
|
package/dist/loader.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk.cjs');
|
|
3
|
-
let
|
|
3
|
+
let _code_inspector_core = require("@code-inspector/core");
|
|
4
4
|
|
|
5
5
|
//#region src/loader.ts
|
|
6
6
|
function devInspectorLoader(source) {
|
|
@@ -10,7 +10,7 @@ function devInspectorLoader(source) {
|
|
|
10
10
|
const isVue = resourcePath.match(/\.vue$/);
|
|
11
11
|
const isSvelte = resourcePath.match(/\.svelte$/);
|
|
12
12
|
if (isJsx || isVue || isSvelte) try {
|
|
13
|
-
return (0,
|
|
13
|
+
return (0, _code_inspector_core.transformCode)({
|
|
14
14
|
content: source,
|
|
15
15
|
filePath: resourcePath,
|
|
16
16
|
fileType: isJsx ? "jsx" : isVue ? "vue" : "svelte",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcpc-tech/unplugin-dev-inspector-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
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",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"@babel/parser": "^7.28.5",
|
|
114
114
|
"@babel/traverse": "^7.28.5",
|
|
115
115
|
"@code-inspector/core": "^1.3.0",
|
|
116
|
-
"@mcpc-tech/acp-ai-provider": "^0.1.
|
|
116
|
+
"@mcpc-tech/acp-ai-provider": "^0.1.35",
|
|
117
117
|
"@mcpc-tech/cmcp": "^0.0.15",
|
|
118
118
|
"@mcpc-tech/core": "^0.3.8",
|
|
119
119
|
"@modelcontextprotocol/sdk": "^1.20.1",
|