poe-code 14.0.15 → 14.0.17
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 +61 -11
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-bash/dist/commands/network/output.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/network/output.js +20 -7
- package/packages/safe-bash/dist/commands/network/output.js.map +1 -1
- package/packages/safe-js/dist/chunks/{chunk-LBJGHXII.js → chunk-BW4SYRDC.js} +61 -11
- package/packages/safe-js/dist/chunks/chunk-BW4SYRDC.js.map +7 -0
- package/packages/safe-js/dist/chunks/{chunk-6ET7ZJGT.js → chunk-W6AHPZCN.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/host-capabilities.d.ts +4 -0
- package/packages/safe-js/dist/interp/host-capabilities.js +62 -5
- package/packages/safe-js/dist/interp/interpreter.js +5 -5
- package/packages/safe-js/dist/realm.js +2 -1
- package/packages/safe-js/dist/chunks/chunk-LBJGHXII.js.map +0 -7
- /package/packages/safe-js/dist/chunks/{chunk-6ET7ZJGT.js.map → chunk-W6AHPZCN.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -125635,11 +125635,15 @@ function createLiveHostObject(definition, controller) {
|
|
|
125635
125635
|
if (input.named !== void 0) {
|
|
125636
125636
|
const data = readDataRecord(input.named, "Named host capability");
|
|
125637
125637
|
if (Object.keys(data).some(
|
|
125638
|
-
(key3) => !["keys", "get", "maxKeys", "maxKeyCodeUnits", "enumerable"].includes(key3)
|
|
125638
|
+
(key3) => !["keys", "get", "set", "delete", "maxKeys", "maxKeyCodeUnits", "enumerable"].includes(key3)
|
|
125639
125639
|
))
|
|
125640
125640
|
throw new TypeError("Unknown named host capability field.");
|
|
125641
|
-
|
|
125642
|
-
|
|
125641
|
+
for (const name of ["keys", "get", "set", "delete"]) {
|
|
125642
|
+
const operation = data[name];
|
|
125643
|
+
if (operation === void 0 && (name === "set" || name === "delete")) continue;
|
|
125644
|
+
if (typeof operation !== "function" || types2.isProxy(operation) || types2.isAsyncFunction(operation) || types2.isGeneratorFunction(operation))
|
|
125645
|
+
throw new TypeError(`Named ${name} must be a synchronous non-generator function, not a proxy.`);
|
|
125646
|
+
}
|
|
125643
125647
|
if (typeof data.maxKeys !== "number" || !Number.isInteger(data.maxKeys) || data.maxKeys < 1 || data.maxKeys > MAX_NAMED_KEYS)
|
|
125644
125648
|
throw new RangeError(`Named maxKeys must be an integer from 1 to ${MAX_NAMED_KEYS}.`);
|
|
125645
125649
|
if (typeof data.maxKeyCodeUnits !== "number" || !Number.isInteger(data.maxKeyCodeUnits) || data.maxKeyCodeUnits < 1 || data.maxKeyCodeUnits > MAX_NAMED_KEY_CODE_UNITS)
|
|
@@ -125651,6 +125655,8 @@ function createLiveHostObject(definition, controller) {
|
|
|
125651
125655
|
named = {
|
|
125652
125656
|
keys: data.keys,
|
|
125653
125657
|
get: data.get,
|
|
125658
|
+
set: data.set,
|
|
125659
|
+
delete: data.delete,
|
|
125654
125660
|
maxKeys: data.maxKeys,
|
|
125655
125661
|
maxKeyCodeUnits: data.maxKeyCodeUnits,
|
|
125656
125662
|
enumerable: data.enumerable
|
|
@@ -125774,8 +125780,28 @@ function setHostObjectMember(value, key3, entry) {
|
|
|
125774
125780
|
state.controller.assertActive();
|
|
125775
125781
|
state.controller.chargeWork();
|
|
125776
125782
|
const property = state.properties.get(key3);
|
|
125777
|
-
if (property
|
|
125778
|
-
|
|
125783
|
+
if (property !== void 0) {
|
|
125784
|
+
if (property.set === void 0) throw new TypeError(`Host property '${key3}' is not writable.`);
|
|
125785
|
+
state.controller.write(property.set, entry);
|
|
125786
|
+
return;
|
|
125787
|
+
}
|
|
125788
|
+
if (state.named?.set === void 0) throw new TypeError(`Host property '${key3}' is not writable.`);
|
|
125789
|
+
namedMutationKeys(state, key3, true);
|
|
125790
|
+
state.controller.write((value2) => state.named.set(key3, value2), entry);
|
|
125791
|
+
namedKeys2(state);
|
|
125792
|
+
}
|
|
125793
|
+
function deleteHostObjectMember(value, key3) {
|
|
125794
|
+
const state = guestObjects.get(value);
|
|
125795
|
+
state.controller.assertActive();
|
|
125796
|
+
state.controller.chargeWork();
|
|
125797
|
+
if (state.named?.delete === void 0) throw new TypeError("Live host properties cannot be deleted.");
|
|
125798
|
+
if (!namedMutationKeys(state, key3, false).includes(key3)) return true;
|
|
125799
|
+
const deleted = state.controller.read(() => state.named.delete(key3), (result) => {
|
|
125800
|
+
if (typeof result !== "boolean") throw new TypeError("Named delete must return a boolean.");
|
|
125801
|
+
return result;
|
|
125802
|
+
});
|
|
125803
|
+
namedKeys2(state);
|
|
125804
|
+
return deleted;
|
|
125779
125805
|
}
|
|
125780
125806
|
function getHostObjectKeys(value) {
|
|
125781
125807
|
const state = guestObjects.get(value);
|
|
@@ -125846,6 +125872,27 @@ function canonicalIndex(key3) {
|
|
|
125846
125872
|
const index = Number(key3);
|
|
125847
125873
|
return Number.isInteger(index) && index >= 0 && index < 4294967295 && String(index) === key3 ? index : void 0;
|
|
125848
125874
|
}
|
|
125875
|
+
function namedMutationKeys(state, key3, create) {
|
|
125876
|
+
state.controller.chargeWork(key3.length);
|
|
125877
|
+
state.controller.checkString(key3);
|
|
125878
|
+
if (["constructor", "prototype", "__proto__"].includes(key3) || state.properties.has(key3) || state.methods.has(key3) || state.indexed !== void 0 && (key3 === "length" || canonicalIndex(key3) !== void 0))
|
|
125879
|
+
throw new TypeError(`Host member '${key3}' is protected from named mutation.`);
|
|
125880
|
+
const named = state.named;
|
|
125881
|
+
if (key3.length > named.maxKeyCodeUnits)
|
|
125882
|
+
throw new RangeError("Named key exceeds maximum UTF-16 code units.");
|
|
125883
|
+
const keys = namedKeys2(state);
|
|
125884
|
+
if (create && !keys.includes(key3)) {
|
|
125885
|
+
const length = keys.length + 1;
|
|
125886
|
+
if (length > named.maxKeys) throw new RangeError("Named keys exceed maxKeys.");
|
|
125887
|
+
state.controller.checkLength(length);
|
|
125888
|
+
let units = key3.length;
|
|
125889
|
+
for (const existing of keys) units += existing.length;
|
|
125890
|
+
if (units > named.maxKeyCodeUnits)
|
|
125891
|
+
throw new RangeError("Named keys exceed maximum UTF-16 code units.");
|
|
125892
|
+
state.controller.checkTemporaryDataSize(1 + length + units);
|
|
125893
|
+
}
|
|
125894
|
+
return keys;
|
|
125895
|
+
}
|
|
125849
125896
|
function namedKeys2(state) {
|
|
125850
125897
|
const named = state.named;
|
|
125851
125898
|
return state.controller.read(named.keys, (value) => {
|
|
@@ -147054,11 +147101,11 @@ async function evaluateDeleteExpression(node, context) {
|
|
|
147054
147101
|
if (!isIndexableSandboxValue(member.object)) {
|
|
147055
147102
|
throw new TypeError("Unary operator 'delete' requires a sandbox object property.");
|
|
147056
147103
|
}
|
|
147057
|
-
deleteSandboxProperty(member.object, member.property);
|
|
147104
|
+
const deleted = deleteSandboxProperty(member.object, member.property);
|
|
147058
147105
|
return {
|
|
147059
147106
|
kind: "normal",
|
|
147060
147107
|
hasValue: true,
|
|
147061
|
-
value:
|
|
147108
|
+
value: deleted
|
|
147062
147109
|
};
|
|
147063
147110
|
}
|
|
147064
147111
|
async function evaluateUpdateExpression(node, context) {
|
|
@@ -147920,12 +147967,12 @@ function setSandboxProperty(target, property, value, budget) {
|
|
|
147920
147967
|
}
|
|
147921
147968
|
}
|
|
147922
147969
|
function deleteSandboxProperty(target, property) {
|
|
147923
|
-
if (isGuestHostObject(target))
|
|
147970
|
+
if (isGuestHostObject(target)) return deleteHostObjectMember(target, String(property));
|
|
147924
147971
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
147925
147972
|
if (Array.isArray(target)) {
|
|
147926
147973
|
assertCollectionMutable(target);
|
|
147927
147974
|
}
|
|
147928
|
-
delete target[String(property)];
|
|
147975
|
+
return delete target[String(property)];
|
|
147929
147976
|
}
|
|
147930
147977
|
function getClosureMemberValue(target, property, context) {
|
|
147931
147978
|
return getFunctionMember(target, property, createFunctionMethodOptions(context));
|
|
@@ -151284,6 +151331,9 @@ var init_realm = __esm({
|
|
|
151284
151331
|
assertActive: this.assertOpen,
|
|
151285
151332
|
chargeWork: this.chargeWork,
|
|
151286
151333
|
checkLength: (length) => this.budget.allocateArrayLength(length),
|
|
151334
|
+
checkString: (value) => {
|
|
151335
|
+
this.budget.allocateString(value);
|
|
151336
|
+
},
|
|
151287
151337
|
checkTemporaryDataSize: (size) => {
|
|
151288
151338
|
const temporary = {};
|
|
151289
151339
|
try {
|
|
@@ -151296,7 +151346,7 @@ var init_realm = __esm({
|
|
|
151296
151346
|
const value = this.invokeHost(operation, operation);
|
|
151297
151347
|
if (types5.isPromise(value)) {
|
|
151298
151348
|
void Promise.resolve(value).catch(() => void 0);
|
|
151299
|
-
throw new TypeError("Live property
|
|
151349
|
+
throw new TypeError("Live property operations must be synchronous.");
|
|
151300
151350
|
}
|
|
151301
151351
|
return this.importValue(validate2 === void 0 ? value : validate2(value));
|
|
151302
151352
|
},
|
|
@@ -159695,7 +159745,7 @@ var init_package2 = __esm({
|
|
|
159695
159745
|
"package.json"() {
|
|
159696
159746
|
package_default2 = {
|
|
159697
159747
|
name: "poe-code",
|
|
159698
|
-
version: "14.0.
|
|
159748
|
+
version: "14.0.17",
|
|
159699
159749
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
159700
159750
|
license: "MIT",
|
|
159701
159751
|
type: "module",
|