@poe-platform/safe-js 0.1.427 → 0.1.429

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-GZSWJFFP.js";
30
+ } from "./chunk-OTAJ3S3N.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-74YCEXKO.js.map
8252
+ //# sourceMappingURL=chunk-AE2AANZZ.js.map
@@ -7824,6 +7824,7 @@ var wellKnownSymbols = Object.freeze({
7824
7824
  // packages/safe-js/src/interp/intrinsics.ts
7825
7825
  var identities = /* @__PURE__ */ new WeakMap();
7826
7826
  var realms2 = /* @__PURE__ */ new WeakMap();
7827
+ var mutableBuiltinBindings = /* @__PURE__ */ new WeakMap();
7827
7828
  function registerBuiltinIdentities(budget, bindings) {
7828
7829
  let realm = realms2.get(budget);
7829
7830
  if (realm === void 0) realms2.set(budget, realm = /* @__PURE__ */ new Map());
@@ -11793,9 +11794,10 @@ var Scope = class _Scope {
11793
11794
  this.importMeta = importMeta;
11794
11795
  this.options = options;
11795
11796
  this.#restoredBindings = parent === void 0 ? new Map(Object.entries(restoredBindings ?? {})) : parent.#restoredBindings;
11797
+ const mutable = mutableBuiltinBindings.get(bindings);
11796
11798
  for (const [name, value] of Object.entries(bindings)) {
11797
11799
  this.#bindings.set(name, {
11798
- kind: "const",
11800
+ kind: mutable?.has(name) ? "var" : "const",
11799
11801
  value
11800
11802
  });
11801
11803
  }
@@ -11806,6 +11808,7 @@ var Scope = class _Scope {
11806
11808
  resourceState;
11807
11809
  privateNames;
11808
11810
  #bindings = /* @__PURE__ */ new Map();
11811
+ #replacedBindings = /* @__PURE__ */ new Set();
11809
11812
  #restoredBindings;
11810
11813
  #frameHydrated = false;
11811
11814
  child(bindings = {}, options = {}) {
@@ -11879,6 +11882,10 @@ var Scope = class _Scope {
11879
11882
  for (const binding of this.#bindings.values()) {
11880
11883
  if (binding.value !== uninitialized) values.push(binding.value);
11881
11884
  }
11885
+ } else {
11886
+ for (const binding of this.#replacedBindings) {
11887
+ if (binding.value !== uninitialized) values.push(binding.value);
11888
+ }
11882
11889
  }
11883
11890
  return values;
11884
11891
  }
@@ -11945,6 +11952,7 @@ var Scope = class _Scope {
11945
11952
  throw new TypeError(`Cannot assign to const binding '${name}'.`);
11946
11953
  }
11947
11954
  binding.value = value;
11955
+ scope.trackReplacement(name, binding);
11948
11956
  }
11949
11957
  lookup(name) {
11950
11958
  const binding = this.#bindings.get(name);
@@ -12033,7 +12041,10 @@ var Scope = class _Scope {
12033
12041
  this.importMeta = frame.importMeta;
12034
12042
  this.resourceState = frame.resourceState;
12035
12043
  if (frame.privateNames !== void 0) this.privateNames = new Map(frame.privateNames);
12036
- for (const [name, binding] of bindings) this.#bindings.set(name, binding);
12044
+ for (const [name, binding] of bindings) {
12045
+ this.#bindings.set(name, binding);
12046
+ this.trackReplacement(name, binding);
12047
+ }
12037
12048
  if (this.parent === void 0)
12038
12049
  for (const [name, value] of restored) this.#restoredBindings.set(name, value);
12039
12050
  this.#frameHydrated = true;
@@ -12057,6 +12068,13 @@ var Scope = class _Scope {
12057
12068
  }
12058
12069
  return this.parent?.resolveScope(name);
12059
12070
  }
12071
+ trackReplacement(name, binding) {
12072
+ if (this.options.chargeData !== false || binding.kind === "const") return;
12073
+ const value = binding.value;
12074
+ if (typeof value === "object" && value !== null && getIntrinsicIdentity(value) === JSON.stringify([name]))
12075
+ this.#replacedBindings.delete(binding);
12076
+ else this.#replacedBindings.add(binding);
12077
+ }
12060
12078
  requireInitializedBinding(name) {
12061
12079
  const scope = this.resolveScope(name);
12062
12080
  const binding = scope === void 0 ? void 0 : scope.#bindings.get(name);
@@ -18814,7 +18832,7 @@ function requiresPromiseReplay(promise) {
18814
18832
  if (seen.has(current)) continue;
18815
18833
  seen.add(current);
18816
18834
  const continuation = promiseContinuations.get(current);
18817
- if (promiseStates.get(current)?.status === "pending" && (unrepresentedPromiseContinuations.has(current) || continuation === void 0)) return true;
18835
+ if (promiseStates.get(current)?.status === "pending" && (unrepresentedPromiseContinuations.has(current) || continuation === void 0 || continuation.kind === "reaction" && continuation.phase === "running")) return true;
18818
18836
  pending.push(...promiseProducers.get(current) ?? [], ...promiseReactionResults.get(current) ?? []);
18819
18837
  if (continuation?.kind === "reaction") {
18820
18838
  pending.push(continuation.source);
@@ -24626,6 +24644,7 @@ function createBuiltinBindings(options) {
24626
24644
  if (options.errorPrototypes !== false) createErrorPrototypes(options.budget, bindings);
24627
24645
  createGeneratorPrototypes(options.budget);
24628
24646
  registerBuiltinIdentities(options.budget, bindings);
24647
+ mutableBuiltinBindings.set(bindings, new Set(Object.keys(bindings).filter((name) => name !== "Infinity" && name !== "NaN" && name !== "undefined")));
24629
24648
  return bindings;
24630
24649
  }
24631
24650
 
@@ -47166,4 +47185,4 @@ export {
47166
47185
  FileSnapshotBackend,
47167
47186
  run
47168
47187
  };
47169
- //# sourceMappingURL=chunk-GZSWJFFP.js.map
47188
+ //# sourceMappingURL=chunk-OTAJ3S3N.js.map