@xiaou66/vite-plugin-vue-mcp-next 1.3.2 → 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 -133
- 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 -133
- package/dist/index.js.map +1 -1
- package/dist/runtime/client.cjs +36 -177
- 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 -177
- 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,141 +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, /* @__PURE__ */ new WeakSet(), 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
|
-
return Number.isFinite(value) ? value : String(value);
|
|
2687
|
-
case "bigint":
|
|
2688
|
-
return value.toString();
|
|
2689
|
-
case "symbol":
|
|
2690
|
-
return toSymbolPlaceholder(value);
|
|
2691
|
-
case "undefined":
|
|
2692
|
-
case "function":
|
|
2693
|
-
return arrayItem ? null : void 0;
|
|
2694
|
-
case "object":
|
|
2695
|
-
return toRpcSafeObject(value, seen);
|
|
2696
|
-
default:
|
|
2697
|
-
return arrayItem ? null : void 0;
|
|
2698
|
-
}
|
|
2699
|
-
}
|
|
2700
|
-
function toRpcSafeObject(value, seen) {
|
|
2701
|
-
if (seen.has(value)) {
|
|
2702
|
-
return RPC_CIRCULAR_VALUE;
|
|
2703
|
-
}
|
|
2704
|
-
seen.add(value);
|
|
2705
|
-
try {
|
|
2706
|
-
if (value instanceof Date) {
|
|
2707
|
-
return toSafeDate(value);
|
|
2708
|
-
}
|
|
2709
|
-
if (value instanceof Error) {
|
|
2710
|
-
return toSafeError(value, seen);
|
|
2711
|
-
}
|
|
2712
|
-
if (Array.isArray(value)) {
|
|
2713
|
-
return toSafeArray(value, seen);
|
|
2714
|
-
}
|
|
2715
|
-
return toSafeRecord(value, seen);
|
|
2716
|
-
} finally {
|
|
2717
|
-
seen.delete(value);
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
function toSafeArray(values, seen) {
|
|
2721
|
-
return values.map((item) => toRpcSafeChildValue(item, seen, true) ?? null);
|
|
2722
|
-
}
|
|
2723
|
-
function toSafeRecord(value, seen) {
|
|
2724
|
-
const keys = getEnumerableKeys(value);
|
|
2725
|
-
if (!keys) {
|
|
2726
|
-
return RPC_UNREADABLE_VALUE;
|
|
2727
|
-
}
|
|
2728
|
-
if (keys.length === 0 && !isPlainRecord3(value)) {
|
|
2729
|
-
return toObjectSummary(value);
|
|
2730
|
-
}
|
|
2731
|
-
const result = {};
|
|
2732
|
-
keys.forEach((key) => {
|
|
2733
|
-
if (key === "toJSON") {
|
|
2734
|
-
return;
|
|
2735
|
-
}
|
|
2736
|
-
const field = readObjectField(value, key);
|
|
2737
|
-
if (!field.ok) {
|
|
2738
|
-
result[key] = RPC_UNREADABLE_VALUE;
|
|
2739
|
-
return;
|
|
2740
|
-
}
|
|
2741
|
-
const safeValue = toRpcSafeChildValue(field.value, seen, false);
|
|
2742
|
-
if (safeValue !== void 0) {
|
|
2743
|
-
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;
|
|
2744
2681
|
}
|
|
2745
|
-
|
|
2746
|
-
return
|
|
2747
|
-
}
|
|
2748
|
-
function toSafeError(error, seen) {
|
|
2749
|
-
const result = {
|
|
2750
|
-
name: error.name,
|
|
2751
|
-
message: error.message
|
|
2752
|
-
};
|
|
2753
|
-
const stack = readObjectField(error, "stack");
|
|
2754
|
-
if (stack.ok && typeof stack.value === "string") {
|
|
2755
|
-
result.stack = stack.value;
|
|
2756
|
-
}
|
|
2757
|
-
if ("cause" in error) {
|
|
2758
|
-
const cause = readObjectField(error, "cause");
|
|
2759
|
-
result.cause = cause.ok ? toRpcSafeChildValue(cause.value, seen, false) ?? null : RPC_UNREADABLE_VALUE;
|
|
2760
|
-
}
|
|
2761
|
-
return result;
|
|
2762
|
-
}
|
|
2763
|
-
function toSafeDate(value) {
|
|
2764
|
-
return Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString();
|
|
2765
|
-
}
|
|
2766
|
-
function getEnumerableKeys(value) {
|
|
2767
|
-
try {
|
|
2768
|
-
return Object.keys(value);
|
|
2769
|
-
} catch {
|
|
2770
|
-
return void 0;
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
function readObjectField(value, key) {
|
|
2774
|
-
try {
|
|
2775
|
-
return {
|
|
2776
|
-
ok: true,
|
|
2777
|
-
value: value[key]
|
|
2778
|
-
};
|
|
2779
|
-
} catch {
|
|
2780
|
-
return { ok: false };
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
function isPlainRecord3(value) {
|
|
2784
|
-
try {
|
|
2785
|
-
const prototype = Object.getPrototypeOf(value);
|
|
2786
|
-
return prototype === Object.prototype || prototype === null;
|
|
2787
|
-
} catch {
|
|
2788
|
-
return false;
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
function toObjectSummary(value) {
|
|
2792
|
-
try {
|
|
2793
|
-
return Object.prototype.toString.call(value);
|
|
2794
|
-
} catch {
|
|
2795
|
-
return "[Object]";
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
function toSymbolPlaceholder(value) {
|
|
2799
|
-
return value.description ? `[Symbol(${value.description})]` : "[Symbol]";
|
|
2682
|
+
);
|
|
2683
|
+
return serialized;
|
|
2800
2684
|
}
|
|
2801
2685
|
|
|
2802
2686
|
// src/cdp/cdpConsole.ts
|
|
@@ -3351,11 +3235,11 @@ import path4 from "path";
|
|
|
3351
3235
|
async function updateJsonMcpClientConfig(options) {
|
|
3352
3236
|
try {
|
|
3353
3237
|
const config = await readJsonConfig(options.configPath);
|
|
3354
|
-
if (!
|
|
3238
|
+
if (!isPlainRecord3(config)) {
|
|
3355
3239
|
warnConfigFailure(options, "config root must be a JSON object");
|
|
3356
3240
|
return;
|
|
3357
3241
|
}
|
|
3358
|
-
const mcpServers =
|
|
3242
|
+
const mcpServers = isPlainRecord3(config.mcpServers) ? config.mcpServers : {};
|
|
3359
3243
|
if (Object.hasOwn(mcpServers, options.serverName)) {
|
|
3360
3244
|
return;
|
|
3361
3245
|
}
|
|
@@ -3408,7 +3292,7 @@ async function readOptionalTextFile2(filePath) {
|
|
|
3408
3292
|
throw error;
|
|
3409
3293
|
}
|
|
3410
3294
|
}
|
|
3411
|
-
function
|
|
3295
|
+
function isPlainRecord3(value) {
|
|
3412
3296
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3413
3297
|
}
|
|
3414
3298
|
function warnConfigFailure(options, reason) {
|