@poe-platform/safe-js 0.1.176 → 0.1.177
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-7CBZ6QP7.js → chunk-B5ZSXQUJ.js} +31 -8
- package/dist/safe-js/chunks/chunk-B5ZSXQUJ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-CBG2KJVU.js → chunk-OCQHXDRF.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-7CBZ6QP7.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-CBG2KJVU.js.map → chunk-OCQHXDRF.js.map} +0 -0
|
@@ -9497,7 +9497,7 @@ function isLineTerminator(character) {
|
|
|
9497
9497
|
}
|
|
9498
9498
|
|
|
9499
9499
|
// packages/safe-js/src/interp/methods/regex.ts
|
|
9500
|
-
var regexMethodNames = /* @__PURE__ */ new Set(["exec", "test"]);
|
|
9500
|
+
var regexMethodNames = /* @__PURE__ */ new Set(["exec", "test", "toString"]);
|
|
9501
9501
|
var regexFlagProperties = {
|
|
9502
9502
|
hasIndices: "d",
|
|
9503
9503
|
global: "g",
|
|
@@ -9524,7 +9524,7 @@ function getRegexMember(target, property, budget) {
|
|
|
9524
9524
|
}
|
|
9525
9525
|
return createSandboxClosure({
|
|
9526
9526
|
sandbox: true,
|
|
9527
|
-
name: `RegExp#${property}`,
|
|
9527
|
+
name: property === "toString" ? "toString" : `RegExp#${property}`,
|
|
9528
9528
|
call: (args, context) => callRegexMethod(context?.thisValue, property, args, budget, context)
|
|
9529
9529
|
});
|
|
9530
9530
|
}
|
|
@@ -9557,6 +9557,7 @@ function setRegexMember(target, property, value) {
|
|
|
9557
9557
|
if (!Reflect.set(properties, property, value)) throw new TypeError(`RegExp#${String(property)} is not writable.`);
|
|
9558
9558
|
}
|
|
9559
9559
|
async function callRegexMethod(target, methodName, args, budget, context) {
|
|
9560
|
+
if (methodName === "toString") return regexToString(target, budget, context);
|
|
9560
9561
|
if (target === null || typeof target !== "object" || methodName === "exec" && !isSandboxRegex(target)) {
|
|
9561
9562
|
throw new TypeError(`RegExp#${methodName} requires ${methodName === "exec" ? "a regex" : "an object"} receiver.`);
|
|
9562
9563
|
}
|
|
@@ -9586,6 +9587,32 @@ async function callRegexMethod(target, methodName, args, budget, context) {
|
|
|
9586
9587
|
budget.setRetainedValues(retained, void 0);
|
|
9587
9588
|
}
|
|
9588
9589
|
}
|
|
9590
|
+
async function regexToString(target, budget, context) {
|
|
9591
|
+
if (target === null || typeof target !== "object")
|
|
9592
|
+
throw new TypeError("RegExp#toString requires an object receiver.");
|
|
9593
|
+
const read = (key) => {
|
|
9594
|
+
if (context?.getProperty !== void 0) return context.getProperty(target, key);
|
|
9595
|
+
const descriptor = getSandboxPropertyDescriptor(target, key, budget);
|
|
9596
|
+
if (descriptor !== void 0) return readPropertyDescriptor(descriptor, target, context);
|
|
9597
|
+
return isSandboxRegex(target) ? getRegexMember(target, key, budget) : void 0;
|
|
9598
|
+
};
|
|
9599
|
+
let sourceValue;
|
|
9600
|
+
let flagsValue;
|
|
9601
|
+
let source;
|
|
9602
|
+
let flags;
|
|
9603
|
+
const release = retainValues(budget, () => [target, sourceValue, flagsValue, source, flags]);
|
|
9604
|
+
try {
|
|
9605
|
+
sourceValue = await read("source");
|
|
9606
|
+
source = await sandboxString(sourceValue, budget, context);
|
|
9607
|
+
sourceValue = void 0;
|
|
9608
|
+
flagsValue = await read("flags");
|
|
9609
|
+
flags = await sandboxString(flagsValue, budget, context);
|
|
9610
|
+
flagsValue = void 0;
|
|
9611
|
+
return budget.allocateString(`/${source}/${flags}`);
|
|
9612
|
+
} finally {
|
|
9613
|
+
release();
|
|
9614
|
+
}
|
|
9615
|
+
}
|
|
9589
9616
|
function executeRegex(target, input, lastIndex) {
|
|
9590
9617
|
const pattern = getSandboxRegexPattern(target);
|
|
9591
9618
|
const match = matchRegex(pattern, input, lastIndex);
|
|
@@ -18978,11 +19005,7 @@ async function defaultToString(value, budget, context, joining) {
|
|
|
18978
19005
|
if (isSandboxCollectionIterator(value))
|
|
18979
19006
|
return collectionIteratorState(value).collectionKind === "map" ? "[object Map Iterator]" : "[object Set Iterator]";
|
|
18980
19007
|
if (isSandboxGenerator(value)) return "[object Generator]";
|
|
18981
|
-
if (isSandboxRegex(value))
|
|
18982
|
-
return budget.allocateString(
|
|
18983
|
-
`/${String(getRegexMember(value, "source", budget))}/${String(getRegexMember(value, "flags", budget))}`
|
|
18984
|
-
);
|
|
18985
|
-
}
|
|
19008
|
+
if (isSandboxRegex(value)) return regexToString(value, budget, context);
|
|
18986
19009
|
if (isSandboxDate(value)) return budget.allocateString(dateString(value));
|
|
18987
19010
|
if (Array.isArray(value) || isFloat32Array(value)) {
|
|
18988
19011
|
if (Object.hasOwn(value, "join")) {
|
|
@@ -36413,4 +36436,4 @@ export {
|
|
|
36413
36436
|
FileSnapshotBackend,
|
|
36414
36437
|
run
|
|
36415
36438
|
};
|
|
36416
|
-
//# sourceMappingURL=chunk-
|
|
36439
|
+
//# sourceMappingURL=chunk-B5ZSXQUJ.js.map
|