poe-code 14.0.43 → 14.0.44
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/index.js +7 -4
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-js/dist/chunks/{chunk-RE6OPFUY.js → chunk-2GJ635AB.js} +2 -2
- package/packages/safe-js/dist/chunks/{chunk-774EXZKX.js → chunk-JZXAWFPL.js} +8 -5
- package/packages/safe-js/dist/chunks/{chunk-774EXZKX.js.map → chunk-JZXAWFPL.js.map} +2 -2
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/interp/interpreter.js +2 -2
- package/packages/safe-js/dist/interp/methods/number.d.ts +2 -2
- package/packages/safe-js/dist/interp/methods/number.js +5 -2
- /package/packages/safe-js/dist/chunks/{chunk-RE6OPFUY.js.map → chunk-2GJ635AB.js.map} +0 -0
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveFsConfig,
|
|
23
23
|
splitFrontmatter,
|
|
24
24
|
withBrokenPipeGuard
|
|
25
|
-
} from "./chunks/chunk-
|
|
25
|
+
} from "./chunks/chunk-2GJ635AB.js";
|
|
26
26
|
import {
|
|
27
27
|
Budget,
|
|
28
28
|
SandboxError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
replaceErrorStack,
|
|
35
35
|
restore,
|
|
36
36
|
run
|
|
37
|
-
} from "./chunks/chunk-
|
|
37
|
+
} from "./chunks/chunk-JZXAWFPL.js";
|
|
38
38
|
import "./chunks/chunk-UXMKEUH3.js";
|
|
39
39
|
import "./chunks/chunk-5DYEOCT5.js";
|
|
40
40
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runWithSpawnUsageAccumulator,
|
|
27
27
|
splitFrontmatter,
|
|
28
28
|
supportsSpawnMode
|
|
29
|
-
} from "./chunks/chunk-
|
|
29
|
+
} from "./chunks/chunk-2GJ635AB.js";
|
|
30
30
|
import {
|
|
31
31
|
Budget,
|
|
32
32
|
FileSnapshotBackend,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
registerPendingHostCallPolicy,
|
|
51
51
|
restore,
|
|
52
52
|
run
|
|
53
|
-
} from "./chunks/chunk-
|
|
53
|
+
} from "./chunks/chunk-JZXAWFPL.js";
|
|
54
54
|
import "./chunks/chunk-UXMKEUH3.js";
|
|
55
55
|
import "./chunks/chunk-5DYEOCT5.js";
|
|
56
56
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -1675,7 +1675,7 @@ function getPropertyValue(target, property, context) {
|
|
|
1675
1675
|
if (typeof target === "string")
|
|
1676
1676
|
return getStringMember(target, property, context.budget);
|
|
1677
1677
|
if (typeof target === "number")
|
|
1678
|
-
return getNumberMember(
|
|
1678
|
+
return getNumberMember(property, context.budget);
|
|
1679
1679
|
if (typeof target === "boolean")
|
|
1680
1680
|
return undefined;
|
|
1681
1681
|
if (isFloat32Array(target))
|
|
@@ -1878,7 +1878,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
1878
1878
|
return evaluatePrimitiveMemberCall(node, "String", member.property, getStringMember(member.object, member.property, context.budget), context);
|
|
1879
1879
|
}
|
|
1880
1880
|
if (typeof member.object === "number") {
|
|
1881
|
-
return evaluatePrimitiveMemberCall(node, "Number", member.property, getNumberMember(member.
|
|
1881
|
+
return evaluatePrimitiveMemberCall(node, "Number", member.property, getNumberMember(member.property, context.budget), context);
|
|
1882
1882
|
}
|
|
1883
1883
|
if (Array.isArray(member.object) && !Object.hasOwn(member.object, member.property)) {
|
|
1884
1884
|
return evaluatePrimitiveMemberCall(node, "Array", member.property, getArrayMemberValue(member.object, member.property, context), context);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Budget } from "../budget.js";
|
|
2
2
|
import { type SandboxValue } from "../values.js";
|
|
3
3
|
export type NumberMethodName = "toExponential" | "toFixed" | "toPrecision" | "toString";
|
|
4
|
-
export declare function getNumberMember(
|
|
4
|
+
export declare function getNumberMember(property: string | number, budget: Budget): SandboxValue | undefined;
|
|
5
5
|
export declare function isNumberMethodName(property: string | number): property is NumberMethodName;
|
|
6
|
-
export declare function callNumberMethod(value:
|
|
6
|
+
export declare function callNumberMethod(value: SandboxValue, methodName: NumberMethodName, args: readonly SandboxValue[], budget: Budget): string;
|
|
@@ -5,20 +5,23 @@ const numberMethodNames = new Set([
|
|
|
5
5
|
"toPrecision",
|
|
6
6
|
"toString"
|
|
7
7
|
]);
|
|
8
|
-
export function getNumberMember(
|
|
8
|
+
export function getNumberMember(property, budget) {
|
|
9
9
|
if (!isNumberMethodName(property)) {
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
12
|
return createSandboxClosure({
|
|
13
13
|
sandbox: true,
|
|
14
14
|
name: `Number#${property}`,
|
|
15
|
-
call: (args) => callNumberMethod(
|
|
15
|
+
call: (args, context) => callNumberMethod(context?.thisValue, property, args, budget)
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
export function isNumberMethodName(property) {
|
|
19
19
|
return typeof property === "string" && numberMethodNames.has(property);
|
|
20
20
|
}
|
|
21
21
|
export function callNumberMethod(value, methodName, args, budget) {
|
|
22
|
+
if (typeof value !== "number") {
|
|
23
|
+
throw new TypeError(`Number#${methodName} requires a number receiver.`);
|
|
24
|
+
}
|
|
22
25
|
return budget.allocateString(callNativeNumberMethod(value, methodName, args));
|
|
23
26
|
}
|
|
24
27
|
function callNativeNumberMethod(value, methodName, args) {
|
|
File without changes
|