@xiaou66/vite-plugin-vue-mcp-next 1.3.2 → 1.3.3
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 +34 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -22
- package/dist/index.js.map +1 -1
- package/dist/runtime/client.cjs +33 -21
- package/dist/runtime/client.cjs.map +1 -1
- package/dist/runtime/client.js +33 -21
- package/dist/runtime/client.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2702,7 +2702,7 @@ var import_nanoid4 = require("nanoid");
|
|
|
2702
2702
|
var RPC_CIRCULAR_VALUE = "[Circular]";
|
|
2703
2703
|
var RPC_UNREADABLE_VALUE = "[Unreadable]";
|
|
2704
2704
|
function toRpcSafeValue(value) {
|
|
2705
|
-
return toRpcSafeChildValue(value,
|
|
2705
|
+
return toRpcSafeChildValue(value, createRpcSafeContext(), false);
|
|
2706
2706
|
}
|
|
2707
2707
|
function safeStringify(value) {
|
|
2708
2708
|
if (typeof value === "string") {
|
|
@@ -2711,7 +2711,13 @@ function safeStringify(value) {
|
|
|
2711
2711
|
const safeValue = toRpcSafeValue(value);
|
|
2712
2712
|
return safeValue === void 0 ? "undefined" : JSON.stringify(safeValue);
|
|
2713
2713
|
}
|
|
2714
|
-
function
|
|
2714
|
+
function createRpcSafeContext() {
|
|
2715
|
+
return {
|
|
2716
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
|
2717
|
+
seen: /* @__PURE__ */ new WeakSet()
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
function toRpcSafeChildValue(value, context, arrayItem) {
|
|
2715
2721
|
if (value === null) {
|
|
2716
2722
|
return null;
|
|
2717
2723
|
}
|
|
@@ -2729,35 +2735,41 @@ function toRpcSafeChildValue(value, seen, arrayItem) {
|
|
|
2729
2735
|
case "function":
|
|
2730
2736
|
return arrayItem ? null : void 0;
|
|
2731
2737
|
case "object":
|
|
2732
|
-
return toRpcSafeObject(value,
|
|
2738
|
+
return toRpcSafeObject(value, context);
|
|
2733
2739
|
default:
|
|
2734
2740
|
return arrayItem ? null : void 0;
|
|
2735
2741
|
}
|
|
2736
2742
|
}
|
|
2737
|
-
function toRpcSafeObject(value,
|
|
2738
|
-
if (seen.has(value)) {
|
|
2743
|
+
function toRpcSafeObject(value, context) {
|
|
2744
|
+
if (context.seen.has(value)) {
|
|
2739
2745
|
return RPC_CIRCULAR_VALUE;
|
|
2740
2746
|
}
|
|
2741
|
-
|
|
2747
|
+
const cached = context.cache.get(value);
|
|
2748
|
+
if (cached) {
|
|
2749
|
+
return cached;
|
|
2750
|
+
}
|
|
2751
|
+
context.seen.add(value);
|
|
2742
2752
|
try {
|
|
2753
|
+
let safeValue;
|
|
2743
2754
|
if (value instanceof Date) {
|
|
2744
|
-
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2755
|
+
safeValue = toSafeDate(value);
|
|
2756
|
+
} else if (value instanceof Error) {
|
|
2757
|
+
safeValue = toSafeError(value, context);
|
|
2758
|
+
} else if (Array.isArray(value)) {
|
|
2759
|
+
safeValue = toSafeArray(value, context);
|
|
2760
|
+
} else {
|
|
2761
|
+
safeValue = toSafeRecord(value, context);
|
|
2762
|
+
}
|
|
2763
|
+
context.cache.set(value, safeValue);
|
|
2764
|
+
return safeValue;
|
|
2753
2765
|
} finally {
|
|
2754
|
-
seen.delete(value);
|
|
2766
|
+
context.seen.delete(value);
|
|
2755
2767
|
}
|
|
2756
2768
|
}
|
|
2757
|
-
function toSafeArray(values,
|
|
2758
|
-
return values.map((item) => toRpcSafeChildValue(item,
|
|
2769
|
+
function toSafeArray(values, context) {
|
|
2770
|
+
return values.map((item) => toRpcSafeChildValue(item, context, true) ?? null);
|
|
2759
2771
|
}
|
|
2760
|
-
function toSafeRecord(value,
|
|
2772
|
+
function toSafeRecord(value, context) {
|
|
2761
2773
|
const keys = getEnumerableKeys(value);
|
|
2762
2774
|
if (!keys) {
|
|
2763
2775
|
return RPC_UNREADABLE_VALUE;
|
|
@@ -2775,14 +2787,14 @@ function toSafeRecord(value, seen) {
|
|
|
2775
2787
|
result[key] = RPC_UNREADABLE_VALUE;
|
|
2776
2788
|
return;
|
|
2777
2789
|
}
|
|
2778
|
-
const safeValue = toRpcSafeChildValue(field.value,
|
|
2790
|
+
const safeValue = toRpcSafeChildValue(field.value, context, false);
|
|
2779
2791
|
if (safeValue !== void 0) {
|
|
2780
2792
|
result[key] = safeValue;
|
|
2781
2793
|
}
|
|
2782
2794
|
});
|
|
2783
2795
|
return result;
|
|
2784
2796
|
}
|
|
2785
|
-
function toSafeError(error,
|
|
2797
|
+
function toSafeError(error, context) {
|
|
2786
2798
|
const result = {
|
|
2787
2799
|
name: error.name,
|
|
2788
2800
|
message: error.message
|
|
@@ -2793,7 +2805,7 @@ function toSafeError(error, seen) {
|
|
|
2793
2805
|
}
|
|
2794
2806
|
if ("cause" in error) {
|
|
2795
2807
|
const cause = readObjectField(error, "cause");
|
|
2796
|
-
result.cause = cause.ok ? toRpcSafeChildValue(cause.value,
|
|
2808
|
+
result.cause = cause.ok ? toRpcSafeChildValue(cause.value, context, false) ?? null : RPC_UNREADABLE_VALUE;
|
|
2797
2809
|
}
|
|
2798
2810
|
return result;
|
|
2799
2811
|
}
|