@poe-platform/safe-js 0.1.188 → 0.1.190
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-6DIV4OFN.js → chunk-JR2ZFJJM.js} +2 -2
- package/dist/safe-js/chunks/{chunk-23I25RFY.js → chunk-YEZOXLY4.js} +69 -17
- package/dist/safe-js/chunks/chunk-YEZOXLY4.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-23I25RFY.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-6DIV4OFN.js.map → chunk-JR2ZFJJM.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-YEZOXLY4.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-JR2ZFJJM.js.map
|
|
@@ -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
|
}
|
|
@@ -10068,7 +10068,7 @@ function callReplaceLikeMethod(value, methodName, args, budget, callClosure, use
|
|
|
10068
10068
|
}
|
|
10069
10069
|
async function replaceRegex(value, regex, replacement, budget, callClosure, context) {
|
|
10070
10070
|
if (hasRegexPropertyOverride(regex, ["exec", "flags", ...Object.keys(regexFlagProperties)], budget))
|
|
10071
|
-
return
|
|
10071
|
+
return regexReplace(value, regex, replacement, budget, callClosure, context);
|
|
10072
10072
|
if (regex.flags.includes("g")) regex.lastIndex = 0;
|
|
10073
10073
|
const cursor = regex.lastIndex;
|
|
10074
10074
|
let result = "";
|
|
@@ -10099,7 +10099,10 @@ function readReplacementProperty(target, key, budget, context) {
|
|
|
10099
10099
|
if (descriptor !== void 0) return readPropertyDescriptor(descriptor, target, context);
|
|
10100
10100
|
return isSandboxRegex(target) ? getRegexMember(target, key, budget, context) : void 0;
|
|
10101
10101
|
}
|
|
10102
|
-
async function
|
|
10102
|
+
async function regexReplace(input, regex, replacementInput, budget, callClosure, context) {
|
|
10103
|
+
if (regex === null || typeof regex !== "object") throw new TypeError("RegExp replace requires an object receiver.");
|
|
10104
|
+
let value;
|
|
10105
|
+
let replacement;
|
|
10103
10106
|
const matches = [];
|
|
10104
10107
|
let current;
|
|
10105
10108
|
let field;
|
|
@@ -10108,15 +10111,23 @@ async function replaceObservableRegex(value, regex, replacement, budget, callClo
|
|
|
10108
10111
|
let captures = [];
|
|
10109
10112
|
let result = "";
|
|
10110
10113
|
let flags;
|
|
10111
|
-
const release = retainValues(budget, () => [value, regex, replacement, matches, current, field, groups, matched, captures, result, flags]);
|
|
10114
|
+
const release = retainValues(budget, () => [input, value, regex, replacementInput, replacement, matches, current, field, groups, matched, captures, result, flags]);
|
|
10112
10115
|
try {
|
|
10116
|
+
value = await sandboxString(input, budget, context);
|
|
10117
|
+
input = void 0;
|
|
10118
|
+
replacement = isSandboxClosure(replacementInput) ? replacementInput : await sandboxString(replacementInput, budget, context);
|
|
10119
|
+
replacementInput = void 0;
|
|
10120
|
+
if (isSandboxRegex(regex) && !hasRegexPropertyOverride(regex, ["exec", "flags", ...Object.keys(regexFlagProperties)], budget)) {
|
|
10121
|
+
release();
|
|
10122
|
+
return await replaceRegex(value, regex, replacement, budget, callClosure, context);
|
|
10123
|
+
}
|
|
10113
10124
|
field = await readReplacementProperty(regex, "flags", budget, context);
|
|
10114
10125
|
flags = await sandboxString(field, budget, context);
|
|
10115
10126
|
field = void 0;
|
|
10116
10127
|
const global = flags.includes("g");
|
|
10117
10128
|
const fullUnicode = flags.includes("u") || flags.includes("v");
|
|
10118
10129
|
flags = void 0;
|
|
10119
|
-
if (global) regex
|
|
10130
|
+
if (global) await setSandboxProperty(regex, "lastIndex", 0, budget, true, context);
|
|
10120
10131
|
while (true) {
|
|
10121
10132
|
budget.visitNode();
|
|
10122
10133
|
current = await regexExec(regex, value, budget, context);
|
|
@@ -10128,10 +10139,10 @@ async function replaceObservableRegex(value, regex, replacement, budget, callClo
|
|
|
10128
10139
|
matched = await sandboxString(field, budget, context);
|
|
10129
10140
|
field = void 0;
|
|
10130
10141
|
if (matched.length === 0) {
|
|
10131
|
-
field = regex
|
|
10142
|
+
field = await readReplacementProperty(regex, "lastIndex", budget, context);
|
|
10132
10143
|
const index = normalizeLastIndex(await sandboxNumber(field, budget, context));
|
|
10133
10144
|
const point = fullUnicode ? value.codePointAt(index) : void 0;
|
|
10134
|
-
regex
|
|
10145
|
+
await setSandboxProperty(regex, "lastIndex", index + (point !== void 0 && point > 65535 ? 2 : 1), budget, true, context);
|
|
10135
10146
|
field = void 0;
|
|
10136
10147
|
}
|
|
10137
10148
|
matched = void 0;
|
|
@@ -10363,38 +10374,50 @@ async function callStringPattern(value, methodName, pattern, budget, parent, con
|
|
|
10363
10374
|
operation.release();
|
|
10364
10375
|
}
|
|
10365
10376
|
}
|
|
10366
|
-
async function
|
|
10377
|
+
async function regexMatch(input, regex, budget, context) {
|
|
10378
|
+
if (regex === null || typeof regex !== "object") throw new TypeError("RegExp match requires an object receiver.");
|
|
10379
|
+
let value;
|
|
10367
10380
|
const matches = [];
|
|
10368
10381
|
let result;
|
|
10369
10382
|
let matched;
|
|
10370
10383
|
let cursor;
|
|
10371
10384
|
let flagsValue;
|
|
10372
10385
|
let flags;
|
|
10373
|
-
const release = retainValues(budget, () => [value, regex, matches, result, matched, cursor, flagsValue, flags]);
|
|
10386
|
+
const release = retainValues(budget, () => [input, value, regex, matches, result, matched, cursor, flagsValue, flags]);
|
|
10387
|
+
const read = (target, key) => {
|
|
10388
|
+
if (context?.getProperty !== void 0) return context.getProperty(target, key);
|
|
10389
|
+
const descriptor = getSandboxPropertyDescriptor(target, key, budget);
|
|
10390
|
+
return descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, target, context);
|
|
10391
|
+
};
|
|
10374
10392
|
try {
|
|
10375
|
-
|
|
10376
|
-
|
|
10393
|
+
value = await sandboxString(input, budget, context);
|
|
10394
|
+
input = void 0;
|
|
10395
|
+
if (isSandboxRegex(regex) && !hasRegexPropertyOverride(regex, ["exec", "flags", ...Object.keys(regexFlagProperties)], budget)) {
|
|
10396
|
+
release();
|
|
10397
|
+
return await callStringMethodBody(value, "match", [regex], budget, context?.compilation, context);
|
|
10398
|
+
}
|
|
10399
|
+
flagsValue = await read(regex, "flags");
|
|
10377
10400
|
flags = await sandboxString(flagsValue, budget, context);
|
|
10378
10401
|
flagsValue = void 0;
|
|
10379
10402
|
if (!flags.includes("g")) return await regexExec(regex, value, budget, context);
|
|
10380
10403
|
const fullUnicode = flags.includes("u") || flags.includes("v");
|
|
10381
10404
|
flags = void 0;
|
|
10382
|
-
regex
|
|
10405
|
+
await setSandboxProperty(regex, "lastIndex", 0, budget, true, context);
|
|
10383
10406
|
while (true) {
|
|
10384
10407
|
budget.visitNode();
|
|
10385
10408
|
result = await regexExec(regex, value, budget, context);
|
|
10386
10409
|
if (result === null) return matches.length === 0 ? null : matches;
|
|
10387
|
-
const
|
|
10388
|
-
matched = await (context?.getProperty !== void 0 ? context.getProperty(result, "0") :
|
|
10410
|
+
const descriptor = context?.getProperty === void 0 ? getSandboxPropertyDescriptor(result, "0", budget) : void 0;
|
|
10411
|
+
matched = await (context?.getProperty !== void 0 ? context.getProperty(result, "0") : descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, result, context));
|
|
10389
10412
|
const text = await sandboxString(matched, budget, context);
|
|
10390
10413
|
matched = void 0;
|
|
10391
10414
|
budget.allocateArrayLength(matches.length + 1);
|
|
10392
10415
|
matches.push(text);
|
|
10393
10416
|
if (text.length === 0) {
|
|
10394
|
-
cursor = regex
|
|
10417
|
+
cursor = await read(regex, "lastIndex");
|
|
10395
10418
|
const index = normalizeLastIndex(await sandboxNumber(cursor, budget, context));
|
|
10396
10419
|
const point = fullUnicode ? value.codePointAt(index) : void 0;
|
|
10397
|
-
regex
|
|
10420
|
+
await setSandboxProperty(regex, "lastIndex", index + (point !== void 0 && point > 65535 ? 2 : 1), budget, true, context);
|
|
10398
10421
|
cursor = void 0;
|
|
10399
10422
|
}
|
|
10400
10423
|
result = void 0;
|
|
@@ -34443,6 +34466,35 @@ function createRegexGlobals(options) {
|
|
|
34443
34466
|
writable: true,
|
|
34444
34467
|
configurable: true
|
|
34445
34468
|
});
|
|
34469
|
+
Object.defineProperty(prototype, Symbol.match, {
|
|
34470
|
+
value: createSandboxClosure({
|
|
34471
|
+
guest: true,
|
|
34472
|
+
sandbox: true,
|
|
34473
|
+
name: "[Symbol.match]",
|
|
34474
|
+
length: 1,
|
|
34475
|
+
call: (args, context) => regexMatch(args[0], context?.thisValue, options.budget, context)
|
|
34476
|
+
}),
|
|
34477
|
+
writable: true,
|
|
34478
|
+
configurable: true
|
|
34479
|
+
});
|
|
34480
|
+
Object.defineProperty(prototype, Symbol.replace, {
|
|
34481
|
+
value: createSandboxClosure({
|
|
34482
|
+
guest: true,
|
|
34483
|
+
sandbox: true,
|
|
34484
|
+
name: "[Symbol.replace]",
|
|
34485
|
+
length: 2,
|
|
34486
|
+
call: (args, context) => regexReplace(
|
|
34487
|
+
args[0],
|
|
34488
|
+
context?.thisValue,
|
|
34489
|
+
args[1],
|
|
34490
|
+
options.budget,
|
|
34491
|
+
(closure, values) => invokeBuiltinClosure(closure, values, options.budget, context, void 0),
|
|
34492
|
+
context
|
|
34493
|
+
)
|
|
34494
|
+
}),
|
|
34495
|
+
writable: true,
|
|
34496
|
+
configurable: true
|
|
34497
|
+
});
|
|
34446
34498
|
for (const name of ["exec", "test", "toString"]) {
|
|
34447
34499
|
Object.defineProperty(prototype, name, {
|
|
34448
34500
|
value: createSandboxClosure({
|
|
@@ -36787,4 +36839,4 @@ export {
|
|
|
36787
36839
|
FileSnapshotBackend,
|
|
36788
36840
|
run
|
|
36789
36841
|
};
|
|
36790
|
-
//# sourceMappingURL=chunk-
|
|
36842
|
+
//# sourceMappingURL=chunk-YEZOXLY4.js.map
|