@frontmcp/uipack 1.10.8 → 1.10.9-rc.2
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/adapters/index.js +29 -2040
- package/bridge-runtime/index.js +11 -217
- package/component/index.js +24 -1469
- package/esm/adapters/index.mjs +29 -2006
- package/esm/bridge-runtime/index.mjs +11 -185
- package/esm/component/index.mjs +24 -1439
- package/esm/index.mjs +150 -3483
- package/esm/package.json +2 -2
- package/esm/resolver/index.mjs +2 -660
- package/esm/shell/index.mjs +16 -750
- package/esm/types/index.mjs +1 -75
- package/esm/typings/index.mjs +3 -971
- package/esm/utils/index.mjs +1 -66
- package/index.js +150 -3605
- package/package.json +2 -2
- package/resolver/index.js +2 -707
- package/shell/index.js +16 -803
- package/types/index.js +1 -108
- package/typings/index.js +3 -1032
- package/utils/index.js +1 -96
package/esm/utils/index.mjs
CHANGED
|
@@ -1,66 +1 @@
|
|
|
1
|
-
|
|
2
|
-
function safeStringify(value, space) {
|
|
3
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
4
|
-
try {
|
|
5
|
-
return JSON.stringify(
|
|
6
|
-
value,
|
|
7
|
-
(_key, val) => {
|
|
8
|
-
if (typeof val === "object" && val !== null) {
|
|
9
|
-
if (seen.has(val)) return "[Circular]";
|
|
10
|
-
seen.add(val);
|
|
11
|
-
}
|
|
12
|
-
return val;
|
|
13
|
-
},
|
|
14
|
-
space
|
|
15
|
-
);
|
|
16
|
-
} catch {
|
|
17
|
-
return JSON.stringify({ error: "Output could not be serialized" });
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function escapeHtml(str) {
|
|
21
|
-
if (str === null || str === void 0) {
|
|
22
|
-
return "";
|
|
23
|
-
}
|
|
24
|
-
const s = String(str);
|
|
25
|
-
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
26
|
-
}
|
|
27
|
-
function escapeHtmlAttr(str) {
|
|
28
|
-
return str.replace(/&/g, "&").replace(/"/g, """);
|
|
29
|
-
}
|
|
30
|
-
function escapeJsString(str) {
|
|
31
|
-
return str.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
32
|
-
}
|
|
33
|
-
function escapeScriptClose(jsonString) {
|
|
34
|
-
return jsonString.replace(/<\//g, "<\\/");
|
|
35
|
-
}
|
|
36
|
-
var SCRIPT_UNSAFE_CHARACTERS = /[<>&\u2028\u2029]/g;
|
|
37
|
-
function toUnicodeEscape(character) {
|
|
38
|
-
return `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
|
39
|
-
}
|
|
40
|
-
function safeJsonForScript(value) {
|
|
41
|
-
if (value === void 0) {
|
|
42
|
-
return "null";
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
const jsonString = JSON.stringify(value, (_key, val) => {
|
|
46
|
-
if (typeof val === "bigint") {
|
|
47
|
-
return val.toString();
|
|
48
|
-
}
|
|
49
|
-
return val;
|
|
50
|
-
});
|
|
51
|
-
if (jsonString === void 0) {
|
|
52
|
-
return "null";
|
|
53
|
-
}
|
|
54
|
-
return jsonString.replace(SCRIPT_UNSAFE_CHARACTERS, toUnicodeEscape);
|
|
55
|
-
} catch {
|
|
56
|
-
return '{"error":"Value could not be serialized"}';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
escapeHtml,
|
|
61
|
-
escapeHtmlAttr,
|
|
62
|
-
escapeJsString,
|
|
63
|
-
escapeScriptClose,
|
|
64
|
-
safeJsonForScript,
|
|
65
|
-
safeStringify
|
|
66
|
-
};
|
|
1
|
+
function safeStringify(value,space){const seen=new WeakSet;try{return JSON.stringify(value,(_key,val)=>{if(typeof val==="object"&&val!==null){if(seen.has(val))return"[Circular]";seen.add(val)}return val},space)}catch{return JSON.stringify({error:"Output could not be serialized"})}}function escapeHtml(str){if(str===null||str===void 0){return""}const s=String(str);return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function escapeHtmlAttr(str){return str.replace(/&/g,"&").replace(/"/g,""")}function escapeJsString(str){return str.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function escapeScriptClose(jsonString){return jsonString.replace(/<\//g,"<\\/")}var SCRIPT_UNSAFE_CHARACTERS=/[<>&\u2028\u2029]/g;function toUnicodeEscape(character){return`\\u${character.charCodeAt(0).toString(16).padStart(4,"0")}`}function safeJsonForScript(value){if(value===void 0){return"null"}try{const jsonString=JSON.stringify(value,(_key,val)=>{if(typeof val==="bigint"){return val.toString()}return val});if(jsonString===void 0){return"null"}return jsonString.replace(SCRIPT_UNSAFE_CHARACTERS,toUnicodeEscape)}catch{return'{"error":"Value could not be serialized"}'}}export{escapeHtml,escapeHtmlAttr,escapeJsString,escapeScriptClose,safeJsonForScript,safeStringify};
|