@poe-platform/safe-js 0.1.188 → 0.1.189
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-23I25RFY.js → chunk-LX5FI3OX.js} +34 -11
- package/dist/safe-js/chunks/chunk-LX5FI3OX.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-6DIV4OFN.js → chunk-MIZBGOGS.js} +2 -2
- 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-23I25RFY.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-6DIV4OFN.js.map → chunk-MIZBGOGS.js.map} +0 -0
|
@@ -9896,7 +9896,7 @@ function callStringMethodBody(value, methodName, args, budget, parent, context)
|
|
|
9896
9896
|
if (methodName === "search" && isSandboxRegex(regex) && hasRegexPropertyOverride(regex, ["exec"], budget))
|
|
9897
9897
|
return regexSearch(regex, value, budget, context);
|
|
9898
9898
|
if (methodName === "match" && isSandboxRegex(regex) && hasRegexPropertyOverride(regex, ["exec", "flags", ...Object.keys(regexFlagProperties)], budget))
|
|
9899
|
-
return
|
|
9899
|
+
return regexMatch(value, regex, budget, context);
|
|
9900
9900
|
if (isSandboxRegex(regex) && (methodName === "matchAll" || methodName === "match" && !regex.flags.includes("g") && regex.lastIndex !== null && typeof regex.lastIndex === "object")) {
|
|
9901
9901
|
return callStringRegexCursor(value, methodName, regex, budget, parent, context);
|
|
9902
9902
|
}
|
|
@@ -10363,38 +10363,50 @@ async function callStringPattern(value, methodName, pattern, budget, parent, con
|
|
|
10363
10363
|
operation.release();
|
|
10364
10364
|
}
|
|
10365
10365
|
}
|
|
10366
|
-
async function
|
|
10366
|
+
async function regexMatch(input, regex, budget, context) {
|
|
10367
|
+
if (regex === null || typeof regex !== "object") throw new TypeError("RegExp match requires an object receiver.");
|
|
10368
|
+
let value;
|
|
10367
10369
|
const matches = [];
|
|
10368
10370
|
let result;
|
|
10369
10371
|
let matched;
|
|
10370
10372
|
let cursor;
|
|
10371
10373
|
let flagsValue;
|
|
10372
10374
|
let flags;
|
|
10373
|
-
const release = retainValues(budget, () => [value, regex, matches, result, matched, cursor, flagsValue, flags]);
|
|
10375
|
+
const release = retainValues(budget, () => [input, value, regex, matches, result, matched, cursor, flagsValue, flags]);
|
|
10376
|
+
const read = (target, key) => {
|
|
10377
|
+
if (context?.getProperty !== void 0) return context.getProperty(target, key);
|
|
10378
|
+
const descriptor = getSandboxPropertyDescriptor(target, key, budget);
|
|
10379
|
+
return descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, target, context);
|
|
10380
|
+
};
|
|
10374
10381
|
try {
|
|
10375
|
-
|
|
10376
|
-
|
|
10382
|
+
value = await sandboxString(input, budget, context);
|
|
10383
|
+
input = void 0;
|
|
10384
|
+
if (isSandboxRegex(regex) && !hasRegexPropertyOverride(regex, ["exec", "flags", ...Object.keys(regexFlagProperties)], budget)) {
|
|
10385
|
+
release();
|
|
10386
|
+
return await callStringMethodBody(value, "match", [regex], budget, context?.compilation, context);
|
|
10387
|
+
}
|
|
10388
|
+
flagsValue = await read(regex, "flags");
|
|
10377
10389
|
flags = await sandboxString(flagsValue, budget, context);
|
|
10378
10390
|
flagsValue = void 0;
|
|
10379
10391
|
if (!flags.includes("g")) return await regexExec(regex, value, budget, context);
|
|
10380
10392
|
const fullUnicode = flags.includes("u") || flags.includes("v");
|
|
10381
10393
|
flags = void 0;
|
|
10382
|
-
regex
|
|
10394
|
+
await setSandboxProperty(regex, "lastIndex", 0, budget, true, context);
|
|
10383
10395
|
while (true) {
|
|
10384
10396
|
budget.visitNode();
|
|
10385
10397
|
result = await regexExec(regex, value, budget, context);
|
|
10386
10398
|
if (result === null) return matches.length === 0 ? null : matches;
|
|
10387
|
-
const
|
|
10388
|
-
matched = await (context?.getProperty !== void 0 ? context.getProperty(result, "0") :
|
|
10399
|
+
const descriptor = context?.getProperty === void 0 ? getSandboxPropertyDescriptor(result, "0", budget) : void 0;
|
|
10400
|
+
matched = await (context?.getProperty !== void 0 ? context.getProperty(result, "0") : descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, result, context));
|
|
10389
10401
|
const text = await sandboxString(matched, budget, context);
|
|
10390
10402
|
matched = void 0;
|
|
10391
10403
|
budget.allocateArrayLength(matches.length + 1);
|
|
10392
10404
|
matches.push(text);
|
|
10393
10405
|
if (text.length === 0) {
|
|
10394
|
-
cursor = regex
|
|
10406
|
+
cursor = await read(regex, "lastIndex");
|
|
10395
10407
|
const index = normalizeLastIndex(await sandboxNumber(cursor, budget, context));
|
|
10396
10408
|
const point = fullUnicode ? value.codePointAt(index) : void 0;
|
|
10397
|
-
regex
|
|
10409
|
+
await setSandboxProperty(regex, "lastIndex", index + (point !== void 0 && point > 65535 ? 2 : 1), budget, true, context);
|
|
10398
10410
|
cursor = void 0;
|
|
10399
10411
|
}
|
|
10400
10412
|
result = void 0;
|
|
@@ -34443,6 +34455,17 @@ function createRegexGlobals(options) {
|
|
|
34443
34455
|
writable: true,
|
|
34444
34456
|
configurable: true
|
|
34445
34457
|
});
|
|
34458
|
+
Object.defineProperty(prototype, Symbol.match, {
|
|
34459
|
+
value: createSandboxClosure({
|
|
34460
|
+
guest: true,
|
|
34461
|
+
sandbox: true,
|
|
34462
|
+
name: "[Symbol.match]",
|
|
34463
|
+
length: 1,
|
|
34464
|
+
call: (args, context) => regexMatch(args[0], context?.thisValue, options.budget, context)
|
|
34465
|
+
}),
|
|
34466
|
+
writable: true,
|
|
34467
|
+
configurable: true
|
|
34468
|
+
});
|
|
34446
34469
|
for (const name of ["exec", "test", "toString"]) {
|
|
34447
34470
|
Object.defineProperty(prototype, name, {
|
|
34448
34471
|
value: createSandboxClosure({
|
|
@@ -36787,4 +36810,4 @@ export {
|
|
|
36787
36810
|
FileSnapshotBackend,
|
|
36788
36811
|
run
|
|
36789
36812
|
};
|
|
36790
|
-
//# sourceMappingURL=chunk-
|
|
36813
|
+
//# sourceMappingURL=chunk-LX5FI3OX.js.map
|