@poe-platform/safe-js 0.1.302 → 0.1.303

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-T2TQBEDG.js";
30
+ } from "./chunk-S5C5SAU4.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-RPUBUYIO.js.map
8252
+ //# sourceMappingURL=chunk-5WFKY3Y3.js.map
@@ -14131,6 +14131,8 @@ function callFunctionMethod(target, methodName, args, options, stack, context) {
14131
14131
  const thisValue = args[0];
14132
14132
  if (methodName === "bind") {
14133
14133
  const boundArgs = args.slice(1);
14134
+ const explicitPrototype = hasExplicitSandboxPrototype(target);
14135
+ const prototype = getSandboxPrototype(target, options.budget);
14134
14136
  const bind = (length, name) => {
14135
14137
  const bound = createSandboxClosure({
14136
14138
  guest: true,
@@ -14151,8 +14153,7 @@ function callFunctionMethod(target, methodName, args, options, stack, context) {
14151
14153
  )
14152
14154
  }
14153
14155
  });
14154
- if (hasExplicitSandboxPrototype(target))
14155
- setSandboxPrototype(bound, getSandboxPrototype(target, options.budget), options.budget);
14156
+ if (explicitPrototype) setSandboxPrototype(bound, prototype, options.budget);
14156
14157
  return bound;
14157
14158
  };
14158
14159
  if (context?.getProperty === void 0)
@@ -14161,15 +14162,20 @@ function callFunctionMethod(target, methodName, args, options, stack, context) {
14161
14162
  target.name ?? ""
14162
14163
  );
14163
14164
  return (async () => {
14164
- const properties = target.properties;
14165
- const defaultName = target.name;
14166
- const hasLength = !isGuestClosure(target) || target.properties === void 0 || Object.hasOwn(target.properties, "length");
14167
- const length = hasLength ? await context.getProperty(target, "length") : void 0;
14168
- const name = !isGuestClosure(target) && !Object.hasOwn(properties ?? {}, "name") ? defaultName : await context.getProperty(target, "name");
14169
- return bind(
14170
- typeof length === "number" && !Number.isNaN(length) ? Math.max(0, Math.trunc(length) - boundArgs.length) : 0,
14171
- typeof name === "string" ? name : ""
14172
- );
14165
+ const release = options.budget !== void 0 && explicitPrototype && prototype !== null ? retainValues(options.budget, () => [prototype]) : void 0;
14166
+ try {
14167
+ const properties = target.properties;
14168
+ const defaultName = target.name;
14169
+ const hasLength = !isGuestClosure(target) || target.properties === void 0 || Object.hasOwn(target.properties, "length");
14170
+ const length = hasLength ? await context.getProperty(target, "length") : void 0;
14171
+ const name = !isGuestClosure(target) && !Object.hasOwn(properties ?? {}, "name") ? defaultName : await context.getProperty(target, "name");
14172
+ return bind(
14173
+ typeof length === "number" && !Number.isNaN(length) ? Math.max(0, Math.trunc(length) - boundArgs.length) : 0,
14174
+ typeof name === "string" ? name : ""
14175
+ );
14176
+ } finally {
14177
+ release?.();
14178
+ }
14173
14179
  })();
14174
14180
  }
14175
14181
  if (methodName === "call") {
@@ -41195,4 +41201,4 @@ export {
41195
41201
  FileSnapshotBackend,
41196
41202
  run
41197
41203
  };
41198
- //# sourceMappingURL=chunk-T2TQBEDG.js.map
41204
+ //# sourceMappingURL=chunk-S5C5SAU4.js.map