@poe-platform/safe-js 0.1.179 → 0.1.181
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/safe-js/chunks/{chunk-AQQ5HET5.js → chunk-27CDLBE5.js} +2 -2
- package/dist/safe-js/chunks/{chunk-GF7KHTVI.js → chunk-IJRSYEH5.js} +82 -11
- package/dist/safe-js/chunks/chunk-IJRSYEH5.js.map +7 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-GF7KHTVI.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-AQQ5HET5.js.map → chunk-27CDLBE5.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-IJRSYEH5.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-27CDLBE5.js.map
|
|
@@ -9590,25 +9590,36 @@ async function callRegexMethod(target, methodName, args, budget, context) {
|
|
|
9590
9590
|
try {
|
|
9591
9591
|
const input = await sandboxString(args[0], budget, context);
|
|
9592
9592
|
if (methodName === "test") {
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
const result = await invokeBuiltinClosure(exec, [input], budget, context, target);
|
|
9596
|
-
if (result !== null && typeof result !== "object") {
|
|
9597
|
-
throw new TypeError("RegExp#test exec must return an object or null.");
|
|
9598
|
-
}
|
|
9599
|
-
return result !== null;
|
|
9600
|
-
}
|
|
9593
|
+
budget.setRetainedValues(retained, void 0);
|
|
9594
|
+
return await regexExec(target, input, budget, context) !== null;
|
|
9601
9595
|
}
|
|
9602
|
-
if (!isSandboxRegex(target)) throw new TypeError("RegExp execution requires a regex receiver.");
|
|
9603
9596
|
if (typeof args[0] !== "string") convertedInput = input;
|
|
9597
|
+
if (!isSandboxRegex(target)) throw new TypeError("RegExp execution requires a regex receiver.");
|
|
9604
9598
|
cursor = target.lastIndex;
|
|
9605
9599
|
const lastIndex = await sandboxNumber(cursor, budget, context);
|
|
9606
9600
|
const match = executeRegex(target, input, lastIndex);
|
|
9607
|
-
return
|
|
9601
|
+
return toMatchArray(match, input);
|
|
9608
9602
|
} finally {
|
|
9609
9603
|
budget.setRetainedValues(retained, void 0);
|
|
9610
9604
|
}
|
|
9611
9605
|
}
|
|
9606
|
+
async function regexExec(target, input, budget, context) {
|
|
9607
|
+
let exec;
|
|
9608
|
+
const release = retainValues(budget, () => [target, input, exec]);
|
|
9609
|
+
try {
|
|
9610
|
+
const descriptor = context?.getProperty === void 0 ? getSandboxPropertyDescriptor(target, "exec", budget) : void 0;
|
|
9611
|
+
exec = await (context?.getProperty !== void 0 ? context.getProperty(target, "exec") : descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, target, context));
|
|
9612
|
+
if (isSandboxClosure(exec)) {
|
|
9613
|
+
const result = await invokeBuiltinClosure(exec, [input], budget, context, target);
|
|
9614
|
+
if (result !== null && typeof result !== "object")
|
|
9615
|
+
throw new TypeError("RegExp exec must return an object or null.");
|
|
9616
|
+
return result;
|
|
9617
|
+
}
|
|
9618
|
+
return await callRegexMethod(target, "exec", [input], budget, context);
|
|
9619
|
+
} finally {
|
|
9620
|
+
release();
|
|
9621
|
+
}
|
|
9622
|
+
}
|
|
9612
9623
|
async function regexToString(target, budget, context) {
|
|
9613
9624
|
if (target === null || typeof target !== "object")
|
|
9614
9625
|
throw new TypeError("RegExp#toString requires an object receiver.");
|
|
@@ -10647,6 +10658,10 @@ function callStringMethodBody(value, methodName, args, budget, parent, context)
|
|
|
10647
10658
|
return budget.allocateString(result + value.slice(spanStart));
|
|
10648
10659
|
}
|
|
10649
10660
|
const regex = args[0];
|
|
10661
|
+
if (methodName === "search" && isSandboxRegex(regex) && getSandboxPropertyDescriptor(regex, "exec", budget) !== void 0)
|
|
10662
|
+
return callCustomRegexSearch(value, regex, budget, context);
|
|
10663
|
+
if (methodName === "match" && isSandboxRegex(regex) && getSandboxPropertyDescriptor(regex, "exec", budget) !== void 0)
|
|
10664
|
+
return callCustomRegexMatch(value, regex, budget, context);
|
|
10650
10665
|
if (isSandboxRegex(regex) && (methodName === "matchAll" || methodName === "match" && !regex.flags.includes("g") && regex.lastIndex !== null && typeof regex.lastIndex === "object")) {
|
|
10651
10666
|
return callStringRegexCursor(value, methodName, regex, budget, parent, context);
|
|
10652
10667
|
}
|
|
@@ -10994,6 +11009,62 @@ async function callStringPattern(value, methodName, pattern, budget, parent, con
|
|
|
10994
11009
|
operation.release();
|
|
10995
11010
|
}
|
|
10996
11011
|
}
|
|
11012
|
+
async function callCustomRegexSearch(value, regex, budget, context) {
|
|
11013
|
+
const previousIndex = regex.lastIndex;
|
|
11014
|
+
let result;
|
|
11015
|
+
const release = retainValues(budget, () => [value, regex, previousIndex, result]);
|
|
11016
|
+
try {
|
|
11017
|
+
if (!Object.is(previousIndex, 0)) regex.lastIndex = 0;
|
|
11018
|
+
result = await regexExec(regex, value, budget, context);
|
|
11019
|
+
if (!Object.is(regex.lastIndex, previousIndex)) regex.lastIndex = previousIndex;
|
|
11020
|
+
if (result === null) return -1;
|
|
11021
|
+
if (context?.getProperty !== void 0) return await context.getProperty(result, "index");
|
|
11022
|
+
const descriptor = getSandboxPropertyDescriptor(result, "index", budget);
|
|
11023
|
+
return descriptor === void 0 ? void 0 : await readPropertyDescriptor(descriptor, result, context);
|
|
11024
|
+
} finally {
|
|
11025
|
+
release();
|
|
11026
|
+
}
|
|
11027
|
+
}
|
|
11028
|
+
async function callCustomRegexMatch(value, regex, budget, context) {
|
|
11029
|
+
const matches = [];
|
|
11030
|
+
let result;
|
|
11031
|
+
let matched;
|
|
11032
|
+
let cursor;
|
|
11033
|
+
let flagsValue;
|
|
11034
|
+
let flags;
|
|
11035
|
+
const release = retainValues(budget, () => [value, regex, matches, result, matched, cursor, flagsValue, flags]);
|
|
11036
|
+
try {
|
|
11037
|
+
const descriptor = context?.getProperty === void 0 ? getSandboxPropertyDescriptor(regex, "flags", budget) : void 0;
|
|
11038
|
+
flagsValue = await (context?.getProperty !== void 0 ? context.getProperty(regex, "flags") : descriptor === void 0 ? getRegexMember(regex, "flags", budget, context) : readPropertyDescriptor(descriptor, regex, context));
|
|
11039
|
+
flags = await sandboxString(flagsValue, budget, context);
|
|
11040
|
+
flagsValue = void 0;
|
|
11041
|
+
if (!flags.includes("g")) return await regexExec(regex, value, budget, context);
|
|
11042
|
+
const fullUnicode = flags.includes("u") || flags.includes("v");
|
|
11043
|
+
flags = void 0;
|
|
11044
|
+
regex.lastIndex = 0;
|
|
11045
|
+
while (true) {
|
|
11046
|
+
budget.visitNode();
|
|
11047
|
+
result = await regexExec(regex, value, budget, context);
|
|
11048
|
+
if (result === null) return matches.length === 0 ? null : matches;
|
|
11049
|
+
const descriptor2 = context?.getProperty === void 0 ? getSandboxPropertyDescriptor(result, "0", budget) : void 0;
|
|
11050
|
+
matched = await (context?.getProperty !== void 0 ? context.getProperty(result, "0") : descriptor2 === void 0 ? void 0 : readPropertyDescriptor(descriptor2, result, context));
|
|
11051
|
+
const text = await sandboxString(matched, budget, context);
|
|
11052
|
+
matched = void 0;
|
|
11053
|
+
budget.allocateArrayLength(matches.length + 1);
|
|
11054
|
+
matches.push(text);
|
|
11055
|
+
if (text.length === 0) {
|
|
11056
|
+
cursor = regex.lastIndex;
|
|
11057
|
+
const index = normalizeLastIndex(await sandboxNumber(cursor, budget, context));
|
|
11058
|
+
const point = fullUnicode ? value.codePointAt(index) : void 0;
|
|
11059
|
+
regex.lastIndex = index + (point !== void 0 && point > 65535 ? 2 : 1);
|
|
11060
|
+
cursor = void 0;
|
|
11061
|
+
}
|
|
11062
|
+
result = void 0;
|
|
11063
|
+
}
|
|
11064
|
+
} finally {
|
|
11065
|
+
release();
|
|
11066
|
+
}
|
|
11067
|
+
}
|
|
10997
11068
|
function callStringRegexCursor(value, methodName, regex, budget, parent, context) {
|
|
10998
11069
|
const operation = budget.acquireCompileOwner(false, parent?.owner);
|
|
10999
11070
|
const compilation = new CompileScope(operation.owner);
|
|
@@ -36496,4 +36567,4 @@ export {
|
|
|
36496
36567
|
FileSnapshotBackend,
|
|
36497
36568
|
run
|
|
36498
36569
|
};
|
|
36499
|
-
//# sourceMappingURL=chunk-
|
|
36570
|
+
//# sourceMappingURL=chunk-IJRSYEH5.js.map
|