poe-code 14.0.43 → 14.0.45
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 +50 -26
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-bash/dist/browser.js +72 -25
- package/packages/safe-bash/dist/browser.js.map +3 -3
- package/packages/safe-bash/dist/shell/parser.d.ts +3 -2
- package/packages/safe-bash/dist/shell/parser.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/parser.js +18 -21
- package/packages/safe-bash/dist/shell/parser.js.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/runtime.js +14 -6
- package/packages/safe-bash/dist/shell/runtime.js.map +1 -1
- package/packages/safe-bash/dist/shell/shell.d.ts.map +1 -1
- package/packages/safe-bash/dist/shell/shell.js +4 -2
- package/packages/safe-bash/dist/shell/shell.js.map +1 -1
- package/packages/safe-bash/dist/shell/source-line-index.d.ts +10 -0
- package/packages/safe-bash/dist/shell/source-line-index.d.ts.map +1 -0
- package/packages/safe-bash/dist/shell/source-line-index.js +41 -0
- package/packages/safe-bash/dist/shell/source-line-index.js.map +1 -0
- package/packages/safe-js/dist/chunks/{chunk-774EXZKX.js → chunk-T3NC5O24.js} +50 -27
- package/packages/safe-js/dist/chunks/chunk-T3NC5O24.js.map +7 -0
- package/packages/safe-js/dist/chunks/{chunk-RE6OPFUY.js → chunk-WQQANSWB.js} +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/exceptions.d.ts +1 -0
- package/packages/safe-js/dist/interp/exceptions.js +11 -11
- package/packages/safe-js/dist/interp/interpreter.js +4 -3
- 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/interp/patterns.js +2 -4
- package/packages/safe-js/dist/interp/values.d.ts +1 -1
- package/packages/safe-js/dist/interp/values.js +9 -4
- package/packages/safe-js/dist/chunks/chunk-774EXZKX.js.map +0 -7
- /package/packages/safe-js/dist/chunks/{chunk-RE6OPFUY.js.map → chunk-WQQANSWB.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -128747,6 +128747,9 @@ async function evaluateCatchClause(node, thrownValue, context, evaluateNode3) {
|
|
|
128747
128747
|
scope
|
|
128748
128748
|
};
|
|
128749
128749
|
if (node.param !== void 0) {
|
|
128750
|
+
for (const name of getPatternBindingNames(node.param)) {
|
|
128751
|
+
scope.predeclare(name, "let");
|
|
128752
|
+
}
|
|
128750
128753
|
const binding = await bindPattern(node.param, thrownValue, catchContext, evaluateNode3);
|
|
128751
128754
|
if (!binding.ok) {
|
|
128752
128755
|
return binding.result;
|
|
@@ -128860,8 +128863,8 @@ async function bindArrayPattern(pattern, value, context, evaluateNode3) {
|
|
|
128860
128863
|
return { ok: true };
|
|
128861
128864
|
}
|
|
128862
128865
|
async function bindObjectPattern(pattern, value, context, evaluateNode3) {
|
|
128863
|
-
if (
|
|
128864
|
-
throw new TypeError("Object catch bindings require a non-
|
|
128866
|
+
if (value === null || value === void 0) {
|
|
128867
|
+
throw new TypeError("Object catch bindings require a non-nullish value.");
|
|
128865
128868
|
}
|
|
128866
128869
|
const excludedKeys = /* @__PURE__ */ new Set();
|
|
128867
128870
|
for (const property of pattern.properties) {
|
|
@@ -128880,7 +128883,7 @@ async function bindObjectPattern(pattern, value, context, evaluateNode3) {
|
|
|
128880
128883
|
excludedKeys.add(String(key3.value));
|
|
128881
128884
|
const binding = await bindPattern(
|
|
128882
128885
|
property.value,
|
|
128883
|
-
|
|
128886
|
+
context.getProperty === void 0 ? getSandboxDataProperty(value, key3.value, context.budget) : context.getProperty(value, key3.value),
|
|
128884
128887
|
context,
|
|
128885
128888
|
evaluateNode3
|
|
128886
128889
|
);
|
|
@@ -128924,15 +128927,9 @@ function getStaticPropertyKey(property) {
|
|
|
128924
128927
|
throw new TypeError(`Unsupported catch binding property key '${property.type}'.`);
|
|
128925
128928
|
}
|
|
128926
128929
|
}
|
|
128927
|
-
function getObjectPatternValue(value, key3) {
|
|
128928
|
-
return value[key3];
|
|
128929
|
-
}
|
|
128930
128930
|
function copyObjectRest(value, excludedKeys) {
|
|
128931
128931
|
const rest = /* @__PURE__ */ Object.create(null);
|
|
128932
|
-
for (const [key3, entryValue] of
|
|
128933
|
-
if (excludedKeys.has(key3)) {
|
|
128934
|
-
continue;
|
|
128935
|
-
}
|
|
128932
|
+
for (const [key3, entryValue] of ownEnumerableSandboxEntries(value, excludedKeys)) {
|
|
128936
128933
|
rest[key3] = entryValue;
|
|
128937
128934
|
}
|
|
128938
128935
|
return rest;
|
|
@@ -128946,6 +128943,7 @@ var init_exceptions = __esm({
|
|
|
128946
128943
|
init_host_call();
|
|
128947
128944
|
init_promise_tracker();
|
|
128948
128945
|
init_values();
|
|
128946
|
+
init_object_model();
|
|
128949
128947
|
init_property_key();
|
|
128950
128948
|
capturedExceptionBrand = /* @__PURE__ */ Symbol("CapturedException");
|
|
128951
128949
|
}
|
|
@@ -130189,18 +130187,21 @@ function createSandboxClosure(input) {
|
|
|
130189
130187
|
}
|
|
130190
130188
|
return Object.freeze(closure);
|
|
130191
130189
|
}
|
|
130192
|
-
function ownEnumerableSandboxEntries(value) {
|
|
130190
|
+
function ownEnumerableSandboxEntries(value, excludedKeys) {
|
|
130193
130191
|
if (isGuestHostObject(value)) {
|
|
130194
|
-
const
|
|
130192
|
+
const entries2 = [];
|
|
130195
130193
|
for (const key3 of getHostObjectKeys(value)) {
|
|
130196
|
-
if (
|
|
130194
|
+
if (excludedKeys?.has(key3)) continue;
|
|
130195
|
+
if (hasHostObjectMember(value, key3, true)) entries2.push([key3, getHostObjectMember(value, key3)]);
|
|
130197
130196
|
}
|
|
130198
|
-
return
|
|
130197
|
+
return entries2;
|
|
130199
130198
|
}
|
|
130200
130199
|
if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
|
|
130201
|
-
|
|
130202
|
-
if (
|
|
130203
|
-
|
|
130200
|
+
let entries;
|
|
130201
|
+
if (isGuestClosure(value)) entries = Object.entries(value.properties ?? {});
|
|
130202
|
+
else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
130203
|
+
else entries = Object.entries(Object(value));
|
|
130204
|
+
return excludedKeys === void 0 ? entries : entries.filter(([key3]) => !excludedKeys.has(key3));
|
|
130204
130205
|
}
|
|
130205
130206
|
function createSandboxPromise(promise, metadata = {}) {
|
|
130206
130207
|
const original = metadata.trackReplay === false ? promise : promiseReplayContext.getStore()?.track(promise) ?? promise;
|
|
@@ -131083,6 +131084,27 @@ function getSandboxPrototype(value, budget) {
|
|
|
131083
131084
|
function hasExplicitSandboxPrototype(value) {
|
|
131084
131085
|
return prototypes.has(value);
|
|
131085
131086
|
}
|
|
131087
|
+
function getSandboxDataProperty(value, key3, budget) {
|
|
131088
|
+
let current = value;
|
|
131089
|
+
let depth = 0;
|
|
131090
|
+
while (typeof current === "object" && current !== null) {
|
|
131091
|
+
if (isGuestHostObject(current)) return getHostObjectMember(current, String(key3));
|
|
131092
|
+
if (isGuestClosure(current)) return getGuestFunctionProperty(current, String(key3));
|
|
131093
|
+
if (isSandboxClosure(current)) {
|
|
131094
|
+
const properties = current.properties;
|
|
131095
|
+
return properties !== void 0 && Object.hasOwn(properties, String(key3)) ? properties[String(key3)] : void 0;
|
|
131096
|
+
}
|
|
131097
|
+
if (isSandboxMap(current) || isSandboxSet(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxGenerator(current))
|
|
131098
|
+
return void 0;
|
|
131099
|
+
if (Object.hasOwn(current, String(key3))) return current[String(key3)];
|
|
131100
|
+
current = getSandboxPrototype(current, budget);
|
|
131101
|
+
if (current !== null) {
|
|
131102
|
+
budget?.visitNode();
|
|
131103
|
+
assertSandboxDataDepth(++depth);
|
|
131104
|
+
}
|
|
131105
|
+
}
|
|
131106
|
+
return void 0;
|
|
131107
|
+
}
|
|
131086
131108
|
function setSandboxPrototype(value, prototype, budget) {
|
|
131087
131109
|
if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
|
|
131088
131110
|
throw new TypeError("Object.prototype has an immutable null prototype.");
|
|
@@ -143689,10 +143711,8 @@ function describeRuntimeValue(value) {
|
|
|
143689
143711
|
}
|
|
143690
143712
|
function copyObjectRestValue(value, excludedKeys) {
|
|
143691
143713
|
const rest = /* @__PURE__ */ Object.create(null);
|
|
143692
|
-
for (const [key3, entryValue] of ownEnumerableSandboxEntries(value)) {
|
|
143693
|
-
|
|
143694
|
-
defineProperty(rest, key3, entryValue);
|
|
143695
|
-
}
|
|
143714
|
+
for (const [key3, entryValue] of ownEnumerableSandboxEntries(value, excludedKeys)) {
|
|
143715
|
+
defineProperty(rest, key3, entryValue);
|
|
143696
143716
|
}
|
|
143697
143717
|
return rest;
|
|
143698
143718
|
}
|
|
@@ -144661,20 +144681,23 @@ var init_map = __esm({
|
|
|
144661
144681
|
});
|
|
144662
144682
|
|
|
144663
144683
|
// packages/safe-js/src/interp/methods/number.ts
|
|
144664
|
-
function getNumberMember(
|
|
144684
|
+
function getNumberMember(property, budget) {
|
|
144665
144685
|
if (!isNumberMethodName(property)) {
|
|
144666
144686
|
return void 0;
|
|
144667
144687
|
}
|
|
144668
144688
|
return createSandboxClosure({
|
|
144669
144689
|
sandbox: true,
|
|
144670
144690
|
name: `Number#${property}`,
|
|
144671
|
-
call: (args) => callNumberMethod(
|
|
144691
|
+
call: (args, context) => callNumberMethod(context?.thisValue, property, args, budget)
|
|
144672
144692
|
});
|
|
144673
144693
|
}
|
|
144674
144694
|
function isNumberMethodName(property) {
|
|
144675
144695
|
return typeof property === "string" && numberMethodNames.has(property);
|
|
144676
144696
|
}
|
|
144677
144697
|
function callNumberMethod(value, methodName, args, budget) {
|
|
144698
|
+
if (typeof value !== "number") {
|
|
144699
|
+
throw new TypeError(`Number#${methodName} requires a number receiver.`);
|
|
144700
|
+
}
|
|
144678
144701
|
return budget.allocateString(callNativeNumberMethod(value, methodName, args));
|
|
144679
144702
|
}
|
|
144680
144703
|
function callNativeNumberMethod(value, methodName, args) {
|
|
@@ -147546,7 +147569,8 @@ async function evaluateThrowStatement2(node, context) {
|
|
|
147546
147569
|
async function evaluateTryStatement2(node, context) {
|
|
147547
147570
|
return evaluateTryStatement(node, {
|
|
147548
147571
|
...context,
|
|
147549
|
-
toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context))
|
|
147572
|
+
toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context)),
|
|
147573
|
+
getProperty: (value, key3) => getPropertyValue(value, key3, context)
|
|
147550
147574
|
}, evaluateNode2);
|
|
147551
147575
|
}
|
|
147552
147576
|
async function evaluateUnaryExpression(node, context) {
|
|
@@ -147686,7 +147710,7 @@ async function evaluateMemberExpression(node, context) {
|
|
|
147686
147710
|
function getPropertyValue(target, property, context) {
|
|
147687
147711
|
if (isGuestHostObject(target)) return getHostObjectMember(target, String(property));
|
|
147688
147712
|
if (typeof target === "string") return getStringMember(target, property, context.budget);
|
|
147689
|
-
if (typeof target === "number") return getNumberMember(
|
|
147713
|
+
if (typeof target === "number") return getNumberMember(property, context.budget);
|
|
147690
147714
|
if (typeof target === "boolean") return void 0;
|
|
147691
147715
|
if (isFloat32Array(target)) return getFloat32Member(target, property, context.budget);
|
|
147692
147716
|
if (isSandboxDate(target)) return getDateMember(property, context.budget, context.compilation?.owner);
|
|
@@ -147893,7 +147917,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
147893
147917
|
node,
|
|
147894
147918
|
"Number",
|
|
147895
147919
|
member.property,
|
|
147896
|
-
getNumberMember(member.
|
|
147920
|
+
getNumberMember(member.property, context.budget),
|
|
147897
147921
|
context
|
|
147898
147922
|
);
|
|
147899
147923
|
}
|