@midscene/shared 0.19.0 → 0.19.1-beta-20250613042051.0
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/es/utils.d.ts +3 -3
- package/dist/es/utils.js +4 -4
- package/dist/lib/utils.d.ts +3 -3
- package/dist/lib/utils.js +6 -6
- package/dist/types/utils.d.ts +3 -3
- package/package.json +1 -1
- package/src/utils.ts +2 -2
package/dist/es/utils.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare function getGlobalScope(): GlobalScope;
|
|
|
14
14
|
declare function setIsMcp(value: boolean): void;
|
|
15
15
|
declare function logMsg(...message: Parameters<typeof console.log>): void;
|
|
16
16
|
declare function repeat(times: number, fn: (index: number) => Promise<void>): Promise<void>;
|
|
17
|
-
declare const
|
|
18
|
-
declare const
|
|
17
|
+
declare const escapeScriptTag: (html: string) => string;
|
|
18
|
+
declare const antiEscapeScriptTag: (html: string) => string;
|
|
19
19
|
|
|
20
|
-
export {
|
|
20
|
+
export { antiEscapeScriptTag, assert, escapeScriptTag, generateHashId, getGlobalScope, ifInBrowser, logMsg, repeat, setIsMcp, uuid };
|
package/dist/es/utils.js
CHANGED
|
@@ -66,18 +66,18 @@ var REGEXP_LT = /</g;
|
|
|
66
66
|
var REGEXP_GT = />/g;
|
|
67
67
|
var REGEXP_LT_ESCAPE = "__midscene_lt__";
|
|
68
68
|
var REGEXP_GT_ESCAPE = "__midscene_gt__";
|
|
69
|
-
var
|
|
69
|
+
var escapeScriptTag = (html) => {
|
|
70
70
|
return html.replace(REGEXP_LT, REGEXP_LT_ESCAPE).replace(REGEXP_GT, REGEXP_GT_ESCAPE);
|
|
71
71
|
};
|
|
72
|
-
var
|
|
72
|
+
var antiEscapeScriptTag = (html) => {
|
|
73
73
|
const REGEXP_LT2 = new RegExp(REGEXP_LT_ESCAPE, "g");
|
|
74
74
|
const REGEXP_GT2 = new RegExp(REGEXP_GT_ESCAPE, "g");
|
|
75
75
|
return html.replace(REGEXP_LT2, "<").replace(REGEXP_GT2, ">");
|
|
76
76
|
};
|
|
77
77
|
export {
|
|
78
|
-
|
|
78
|
+
antiEscapeScriptTag,
|
|
79
79
|
assert,
|
|
80
|
-
|
|
80
|
+
escapeScriptTag,
|
|
81
81
|
generateHashId,
|
|
82
82
|
getGlobalScope,
|
|
83
83
|
ifInBrowser,
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare function getGlobalScope(): GlobalScope;
|
|
|
14
14
|
declare function setIsMcp(value: boolean): void;
|
|
15
15
|
declare function logMsg(...message: Parameters<typeof console.log>): void;
|
|
16
16
|
declare function repeat(times: number, fn: (index: number) => Promise<void>): Promise<void>;
|
|
17
|
-
declare const
|
|
18
|
-
declare const
|
|
17
|
+
declare const escapeScriptTag: (html: string) => string;
|
|
18
|
+
declare const antiEscapeScriptTag: (html: string) => string;
|
|
19
19
|
|
|
20
|
-
export {
|
|
20
|
+
export { antiEscapeScriptTag, assert, escapeScriptTag, generateHashId, getGlobalScope, ifInBrowser, logMsg, repeat, setIsMcp, uuid };
|
package/dist/lib/utils.js
CHANGED
|
@@ -20,9 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/utils.ts
|
|
21
21
|
var utils_exports = {};
|
|
22
22
|
__export(utils_exports, {
|
|
23
|
-
|
|
23
|
+
antiEscapeScriptTag: () => antiEscapeScriptTag,
|
|
24
24
|
assert: () => assert,
|
|
25
|
-
|
|
25
|
+
escapeScriptTag: () => escapeScriptTag,
|
|
26
26
|
generateHashId: () => generateHashId,
|
|
27
27
|
getGlobalScope: () => getGlobalScope,
|
|
28
28
|
ifInBrowser: () => ifInBrowser,
|
|
@@ -99,19 +99,19 @@ var REGEXP_LT = /</g;
|
|
|
99
99
|
var REGEXP_GT = />/g;
|
|
100
100
|
var REGEXP_LT_ESCAPE = "__midscene_lt__";
|
|
101
101
|
var REGEXP_GT_ESCAPE = "__midscene_gt__";
|
|
102
|
-
var
|
|
102
|
+
var escapeScriptTag = (html) => {
|
|
103
103
|
return html.replace(REGEXP_LT, REGEXP_LT_ESCAPE).replace(REGEXP_GT, REGEXP_GT_ESCAPE);
|
|
104
104
|
};
|
|
105
|
-
var
|
|
105
|
+
var antiEscapeScriptTag = (html) => {
|
|
106
106
|
const REGEXP_LT2 = new RegExp(REGEXP_LT_ESCAPE, "g");
|
|
107
107
|
const REGEXP_GT2 = new RegExp(REGEXP_GT_ESCAPE, "g");
|
|
108
108
|
return html.replace(REGEXP_LT2, "<").replace(REGEXP_GT2, ">");
|
|
109
109
|
};
|
|
110
110
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
111
|
0 && (module.exports = {
|
|
112
|
-
|
|
112
|
+
antiEscapeScriptTag,
|
|
113
113
|
assert,
|
|
114
|
-
|
|
114
|
+
escapeScriptTag,
|
|
115
115
|
generateHashId,
|
|
116
116
|
getGlobalScope,
|
|
117
117
|
ifInBrowser,
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare function getGlobalScope(): GlobalScope;
|
|
|
14
14
|
declare function setIsMcp(value: boolean): void;
|
|
15
15
|
declare function logMsg(...message: Parameters<typeof console.log>): void;
|
|
16
16
|
declare function repeat(times: number, fn: (index: number) => Promise<void>): Promise<void>;
|
|
17
|
-
declare const
|
|
18
|
-
declare const
|
|
17
|
+
declare const escapeScriptTag: (html: string) => string;
|
|
18
|
+
declare const antiEscapeScriptTag: (html: string) => string;
|
|
19
19
|
|
|
20
|
-
export {
|
|
20
|
+
export { antiEscapeScriptTag, assert, escapeScriptTag, generateHashId, getGlobalScope, ifInBrowser, logMsg, repeat, setIsMcp, uuid };
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -102,13 +102,13 @@ const REGEXP_GT = />/g;
|
|
|
102
102
|
const REGEXP_LT_ESCAPE = '__midscene_lt__';
|
|
103
103
|
const REGEXP_GT_ESCAPE = '__midscene_gt__';
|
|
104
104
|
|
|
105
|
-
export const
|
|
105
|
+
export const escapeScriptTag = (html: string) => {
|
|
106
106
|
return html
|
|
107
107
|
.replace(REGEXP_LT, REGEXP_LT_ESCAPE)
|
|
108
108
|
.replace(REGEXP_GT, REGEXP_GT_ESCAPE);
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
export const
|
|
111
|
+
export const antiEscapeScriptTag = (html: string) => {
|
|
112
112
|
const REGEXP_LT = new RegExp(REGEXP_LT_ESCAPE, 'g');
|
|
113
113
|
const REGEXP_GT = new RegExp(REGEXP_GT_ESCAPE, 'g');
|
|
114
114
|
|