@xiaou66/vite-plugin-vue-mcp-next 1.3.3 → 1.3.4
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/README.md +1 -1
- package/dist/index.cjs +17 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -145
- package/dist/index.js.map +1 -1
- package/dist/runtime/client.cjs +36 -189
- package/dist/runtime/client.cjs.map +1 -1
- package/dist/runtime/client.d.cts +1 -1
- package/dist/runtime/client.d.ts +1 -1
- package/dist/runtime/client.js +37 -189
- package/dist/runtime/client.js.map +1 -1
- package/dist/{types-DAx3jHdz.d.cts → types-BKXdHkwk.d.cts} +2 -2
- package/dist/{types-DAx3jHdz.d.ts → types-BKXdHkwk.d.ts} +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import { l as VueMcpNextOptions } from './types-
|
|
3
|
-
export { C as CdpOptions, a as ConsoleOptions, b as ConsoleRecord, c as CursorMcpConfig, D as DomOptions, E as ElementContextResult, d as ElementPickerOptions, e as ElementPickerShortcut, f as EvaluateOptions, M as McpClientConfigOptions, N as NetworkOptions, g as NetworkRecord, P as PageTarget, R as ResolvedVueMcpNextOptions, i as RuntimeElementContextRequest, j as RuntimeMode, k as RuntimeOptions, S as SkillConfigOptions, V as VueMcpNextContext } from './types-
|
|
2
|
+
import { l as VueMcpNextOptions } from './types-BKXdHkwk.cjs';
|
|
3
|
+
export { C as CdpOptions, a as ConsoleOptions, b as ConsoleRecord, c as CursorMcpConfig, D as DomOptions, E as ElementContextResult, d as ElementPickerOptions, e as ElementPickerShortcut, f as EvaluateOptions, M as McpClientConfigOptions, N as NetworkOptions, g as NetworkRecord, P as PageTarget, R as ResolvedVueMcpNextOptions, i as RuntimeElementContextRequest, j as RuntimeMode, k as RuntimeOptions, S as SkillConfigOptions, V as VueMcpNextContext } from './types-BKXdHkwk.cjs';
|
|
4
4
|
import 'hookable';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import { l as VueMcpNextOptions } from './types-
|
|
3
|
-
export { C as CdpOptions, a as ConsoleOptions, b as ConsoleRecord, c as CursorMcpConfig, D as DomOptions, E as ElementContextResult, d as ElementPickerOptions, e as ElementPickerShortcut, f as EvaluateOptions, M as McpClientConfigOptions, N as NetworkOptions, g as NetworkRecord, P as PageTarget, R as ResolvedVueMcpNextOptions, i as RuntimeElementContextRequest, j as RuntimeMode, k as RuntimeOptions, S as SkillConfigOptions, V as VueMcpNextContext } from './types-
|
|
2
|
+
import { l as VueMcpNextOptions } from './types-BKXdHkwk.js';
|
|
3
|
+
export { C as CdpOptions, a as ConsoleOptions, b as ConsoleRecord, c as CursorMcpConfig, D as DomOptions, E as ElementContextResult, d as ElementPickerOptions, e as ElementPickerShortcut, f as EvaluateOptions, M as McpClientConfigOptions, N as NetworkOptions, g as NetworkRecord, P as PageTarget, R as ResolvedVueMcpNextOptions, i as RuntimeElementContextRequest, j as RuntimeMode, k as RuntimeOptions, S as SkillConfigOptions, V as VueMcpNextContext } from './types-BKXdHkwk.js';
|
|
4
4
|
import 'hookable';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2662,153 +2662,25 @@ function createServerVueRuntimeRpc(ctx) {
|
|
|
2662
2662
|
import { nanoid as nanoid4 } from "nanoid";
|
|
2663
2663
|
|
|
2664
2664
|
// src/shared/serialization.ts
|
|
2665
|
-
var RPC_CIRCULAR_VALUE = "[Circular]";
|
|
2666
|
-
var RPC_UNREADABLE_VALUE = "[Unreadable]";
|
|
2667
|
-
function toRpcSafeValue(value) {
|
|
2668
|
-
return toRpcSafeChildValue(value, createRpcSafeContext(), false);
|
|
2669
|
-
}
|
|
2670
2665
|
function safeStringify(value) {
|
|
2671
2666
|
if (typeof value === "string") {
|
|
2672
2667
|
return value;
|
|
2673
2668
|
}
|
|
2674
|
-
const
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
}
|
|
2687
|
-
switch (typeof value) {
|
|
2688
|
-
case "string":
|
|
2689
|
-
case "boolean":
|
|
2690
|
-
return value;
|
|
2691
|
-
case "number":
|
|
2692
|
-
return Number.isFinite(value) ? value : String(value);
|
|
2693
|
-
case "bigint":
|
|
2694
|
-
return value.toString();
|
|
2695
|
-
case "symbol":
|
|
2696
|
-
return toSymbolPlaceholder(value);
|
|
2697
|
-
case "undefined":
|
|
2698
|
-
case "function":
|
|
2699
|
-
return arrayItem ? null : void 0;
|
|
2700
|
-
case "object":
|
|
2701
|
-
return toRpcSafeObject(value, context);
|
|
2702
|
-
default:
|
|
2703
|
-
return arrayItem ? null : void 0;
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
function toRpcSafeObject(value, context) {
|
|
2707
|
-
if (context.seen.has(value)) {
|
|
2708
|
-
return RPC_CIRCULAR_VALUE;
|
|
2709
|
-
}
|
|
2710
|
-
const cached = context.cache.get(value);
|
|
2711
|
-
if (cached) {
|
|
2712
|
-
return cached;
|
|
2713
|
-
}
|
|
2714
|
-
context.seen.add(value);
|
|
2715
|
-
try {
|
|
2716
|
-
let safeValue;
|
|
2717
|
-
if (value instanceof Date) {
|
|
2718
|
-
safeValue = toSafeDate(value);
|
|
2719
|
-
} else if (value instanceof Error) {
|
|
2720
|
-
safeValue = toSafeError(value, context);
|
|
2721
|
-
} else if (Array.isArray(value)) {
|
|
2722
|
-
safeValue = toSafeArray(value, context);
|
|
2723
|
-
} else {
|
|
2724
|
-
safeValue = toSafeRecord(value, context);
|
|
2725
|
-
}
|
|
2726
|
-
context.cache.set(value, safeValue);
|
|
2727
|
-
return safeValue;
|
|
2728
|
-
} finally {
|
|
2729
|
-
context.seen.delete(value);
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
function toSafeArray(values, context) {
|
|
2733
|
-
return values.map((item) => toRpcSafeChildValue(item, context, true) ?? null);
|
|
2734
|
-
}
|
|
2735
|
-
function toSafeRecord(value, context) {
|
|
2736
|
-
const keys = getEnumerableKeys(value);
|
|
2737
|
-
if (!keys) {
|
|
2738
|
-
return RPC_UNREADABLE_VALUE;
|
|
2739
|
-
}
|
|
2740
|
-
if (keys.length === 0 && !isPlainRecord3(value)) {
|
|
2741
|
-
return toObjectSummary(value);
|
|
2742
|
-
}
|
|
2743
|
-
const result = {};
|
|
2744
|
-
keys.forEach((key) => {
|
|
2745
|
-
if (key === "toJSON") {
|
|
2746
|
-
return;
|
|
2747
|
-
}
|
|
2748
|
-
const field = readObjectField(value, key);
|
|
2749
|
-
if (!field.ok) {
|
|
2750
|
-
result[key] = RPC_UNREADABLE_VALUE;
|
|
2751
|
-
return;
|
|
2752
|
-
}
|
|
2753
|
-
const safeValue = toRpcSafeChildValue(field.value, context, false);
|
|
2754
|
-
if (safeValue !== void 0) {
|
|
2755
|
-
result[key] = safeValue;
|
|
2669
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
2670
|
+
const serialized = JSON.stringify(
|
|
2671
|
+
value,
|
|
2672
|
+
(_key, current) => {
|
|
2673
|
+
if (typeof current !== "object" || current === null) {
|
|
2674
|
+
return current;
|
|
2675
|
+
}
|
|
2676
|
+
if (seen.has(current)) {
|
|
2677
|
+
return "[Circular]";
|
|
2678
|
+
}
|
|
2679
|
+
seen.add(current);
|
|
2680
|
+
return current;
|
|
2756
2681
|
}
|
|
2757
|
-
|
|
2758
|
-
return
|
|
2759
|
-
}
|
|
2760
|
-
function toSafeError(error, context) {
|
|
2761
|
-
const result = {
|
|
2762
|
-
name: error.name,
|
|
2763
|
-
message: error.message
|
|
2764
|
-
};
|
|
2765
|
-
const stack = readObjectField(error, "stack");
|
|
2766
|
-
if (stack.ok && typeof stack.value === "string") {
|
|
2767
|
-
result.stack = stack.value;
|
|
2768
|
-
}
|
|
2769
|
-
if ("cause" in error) {
|
|
2770
|
-
const cause = readObjectField(error, "cause");
|
|
2771
|
-
result.cause = cause.ok ? toRpcSafeChildValue(cause.value, context, false) ?? null : RPC_UNREADABLE_VALUE;
|
|
2772
|
-
}
|
|
2773
|
-
return result;
|
|
2774
|
-
}
|
|
2775
|
-
function toSafeDate(value) {
|
|
2776
|
-
return Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString();
|
|
2777
|
-
}
|
|
2778
|
-
function getEnumerableKeys(value) {
|
|
2779
|
-
try {
|
|
2780
|
-
return Object.keys(value);
|
|
2781
|
-
} catch {
|
|
2782
|
-
return void 0;
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
function readObjectField(value, key) {
|
|
2786
|
-
try {
|
|
2787
|
-
return {
|
|
2788
|
-
ok: true,
|
|
2789
|
-
value: value[key]
|
|
2790
|
-
};
|
|
2791
|
-
} catch {
|
|
2792
|
-
return { ok: false };
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
function isPlainRecord3(value) {
|
|
2796
|
-
try {
|
|
2797
|
-
const prototype = Object.getPrototypeOf(value);
|
|
2798
|
-
return prototype === Object.prototype || prototype === null;
|
|
2799
|
-
} catch {
|
|
2800
|
-
return false;
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
function toObjectSummary(value) {
|
|
2804
|
-
try {
|
|
2805
|
-
return Object.prototype.toString.call(value);
|
|
2806
|
-
} catch {
|
|
2807
|
-
return "[Object]";
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
function toSymbolPlaceholder(value) {
|
|
2811
|
-
return value.description ? `[Symbol(${value.description})]` : "[Symbol]";
|
|
2682
|
+
);
|
|
2683
|
+
return serialized;
|
|
2812
2684
|
}
|
|
2813
2685
|
|
|
2814
2686
|
// src/cdp/cdpConsole.ts
|
|
@@ -3363,11 +3235,11 @@ import path4 from "path";
|
|
|
3363
3235
|
async function updateJsonMcpClientConfig(options) {
|
|
3364
3236
|
try {
|
|
3365
3237
|
const config = await readJsonConfig(options.configPath);
|
|
3366
|
-
if (!
|
|
3238
|
+
if (!isPlainRecord3(config)) {
|
|
3367
3239
|
warnConfigFailure(options, "config root must be a JSON object");
|
|
3368
3240
|
return;
|
|
3369
3241
|
}
|
|
3370
|
-
const mcpServers =
|
|
3242
|
+
const mcpServers = isPlainRecord3(config.mcpServers) ? config.mcpServers : {};
|
|
3371
3243
|
if (Object.hasOwn(mcpServers, options.serverName)) {
|
|
3372
3244
|
return;
|
|
3373
3245
|
}
|
|
@@ -3420,7 +3292,7 @@ async function readOptionalTextFile2(filePath) {
|
|
|
3420
3292
|
throw error;
|
|
3421
3293
|
}
|
|
3422
3294
|
}
|
|
3423
|
-
function
|
|
3295
|
+
function isPlainRecord3(value) {
|
|
3424
3296
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3425
3297
|
}
|
|
3426
3298
|
function warnConfigFailure(options, reason) {
|