@poe-platform/safe-js 0.1.444 → 0.1.445
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/safe-js/chunks/{chunk-27FJUX7D.js → chunk-EMOUVQDE.js} +46 -21
- package/dist/safe-js/chunks/chunk-EMOUVQDE.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-VSZJLQRZ.js → chunk-UDJ5WEWH.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/scope.d.ts +1 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-27FJUX7D.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-VSZJLQRZ.js.map → chunk-UDJ5WEWH.js.map} +0 -0
|
@@ -9394,6 +9394,7 @@ var Scope = class _Scope {
|
|
|
9394
9394
|
#replacedBindings = /* @__PURE__ */ new Set();
|
|
9395
9395
|
#restoredBindings;
|
|
9396
9396
|
#frameHydrated = false;
|
|
9397
|
+
#bindingDataRoots;
|
|
9397
9398
|
child(bindings = {}, options = {}) {
|
|
9398
9399
|
return new _Scope(bindings, this, void 0, {
|
|
9399
9400
|
chargeData: true,
|
|
@@ -9492,17 +9493,27 @@ var Scope = class _Scope {
|
|
|
9492
9493
|
if (this.importMeta !== void 0) values.push(this.importMeta);
|
|
9493
9494
|
if (this.privateNames !== void 0) values.push(...this.privateNames.values());
|
|
9494
9495
|
}
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
const
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9496
|
+
if (this.#bindingDataRoots === void 0) {
|
|
9497
|
+
const roots = [];
|
|
9498
|
+
const bindings = this.options.chargeData === false ? this.#replacedBindings : this.#bindings.values();
|
|
9499
|
+
for (const binding of bindings) {
|
|
9500
|
+
const value = binding.value;
|
|
9501
|
+
if (!isChargedBindingValue(value)) continue;
|
|
9502
|
+
if (binding.accounting === void 0) {
|
|
9503
|
+
const root = Object.freeze({});
|
|
9504
|
+
scopeDataRoots.set(root, { value });
|
|
9505
|
+
binding.accounting = { value, root };
|
|
9506
|
+
}
|
|
9507
|
+
roots.push(binding.accounting.root);
|
|
9508
|
+
}
|
|
9509
|
+
this.#bindingDataRoots = [];
|
|
9510
|
+
if (roots.length > 0) {
|
|
9511
|
+
const group = Object.freeze({});
|
|
9512
|
+
scopeDataRoots.set(group, { values: roots });
|
|
9513
|
+
this.#bindingDataRoots.push(group);
|
|
9503
9514
|
}
|
|
9504
|
-
values.push(binding.accounting.root);
|
|
9505
9515
|
}
|
|
9516
|
+
values.push(...this.#bindingDataRoots);
|
|
9506
9517
|
return values;
|
|
9507
9518
|
}
|
|
9508
9519
|
declare(name, kind, value) {
|
|
@@ -9513,8 +9524,11 @@ var Scope = class _Scope {
|
|
|
9513
9524
|
if (existing !== void 0 && existing.kind !== kind) {
|
|
9514
9525
|
throw new Error(`Cannot redeclare binding '${name}' in the same scope.`);
|
|
9515
9526
|
}
|
|
9516
|
-
if (existing !== void 0) writeBindingValue(existing, value);
|
|
9517
|
-
else
|
|
9527
|
+
if (existing !== void 0) this.writeBindingValue(existing, value);
|
|
9528
|
+
else {
|
|
9529
|
+
this.#bindings.set(name, { kind, value });
|
|
9530
|
+
if (isChargedBindingValue(value)) this.#bindingDataRoots = void 0;
|
|
9531
|
+
}
|
|
9518
9532
|
}
|
|
9519
9533
|
declareAlias(name, target) {
|
|
9520
9534
|
if (this.#bindings.has(name)) throw new Error(`Cannot redeclare binding '${name}' in the same scope.`);
|
|
@@ -9576,7 +9590,7 @@ var Scope = class _Scope {
|
|
|
9576
9590
|
if (binding.kind === "const") {
|
|
9577
9591
|
throw new TypeError(`Cannot assign to const binding '${name}'.`);
|
|
9578
9592
|
}
|
|
9579
|
-
writeBindingValue(binding, value);
|
|
9593
|
+
scope.writeBindingValue(binding, value);
|
|
9580
9594
|
scope.trackReplacement(name, binding);
|
|
9581
9595
|
}
|
|
9582
9596
|
lookup(name) {
|
|
@@ -9688,6 +9702,7 @@ var Scope = class _Scope {
|
|
|
9688
9702
|
if (this.parent === void 0)
|
|
9689
9703
|
for (const [name, value] of restored) this.#restoredBindings.set(name, value);
|
|
9690
9704
|
this.#frameHydrated = true;
|
|
9705
|
+
this.#bindingDataRoots = void 0;
|
|
9691
9706
|
}
|
|
9692
9707
|
copyInitializedBindingsFrom(source, names) {
|
|
9693
9708
|
for (const name of names) {
|
|
@@ -9699,8 +9714,15 @@ var Scope = class _Scope {
|
|
|
9699
9714
|
}
|
|
9700
9715
|
const targetBinding = targetScope.#bindings.get(name);
|
|
9701
9716
|
targetBinding.kind = sourceBinding.kind;
|
|
9702
|
-
writeBindingValue(targetBinding, sourceBinding.value);
|
|
9717
|
+
targetScope.writeBindingValue(targetBinding, sourceBinding.value);
|
|
9718
|
+
}
|
|
9719
|
+
}
|
|
9720
|
+
writeBindingValue(binding, value) {
|
|
9721
|
+
if (!Object.is(binding.value, value)) {
|
|
9722
|
+
if (binding.accounting !== void 0 || isChargedBindingValue(value)) this.#bindingDataRoots = void 0;
|
|
9723
|
+
binding.accounting = void 0;
|
|
9703
9724
|
}
|
|
9725
|
+
binding.value = value;
|
|
9704
9726
|
}
|
|
9705
9727
|
resolveScope(name) {
|
|
9706
9728
|
if (this.#bindings.has(name) || this.objectEnvironment !== void 0 && getSandboxPropertyDescriptor(this.objectEnvironment, name) !== void 0) {
|
|
@@ -9711,9 +9733,12 @@ var Scope = class _Scope {
|
|
|
9711
9733
|
trackReplacement(name, binding) {
|
|
9712
9734
|
if (this.options.chargeData !== false || binding.kind === "const") return;
|
|
9713
9735
|
const value = binding.value;
|
|
9714
|
-
if (typeof value === "object" && value !== null && getIntrinsicIdentity(value) === JSON.stringify([name]))
|
|
9715
|
-
this.#replacedBindings.delete(binding);
|
|
9716
|
-
else this.#replacedBindings.
|
|
9736
|
+
if (typeof value === "object" && value !== null && getIntrinsicIdentity(value) === JSON.stringify([name])) {
|
|
9737
|
+
if (this.#replacedBindings.delete(binding)) this.#bindingDataRoots = void 0;
|
|
9738
|
+
} else if (!this.#replacedBindings.has(binding)) {
|
|
9739
|
+
this.#replacedBindings.add(binding);
|
|
9740
|
+
this.#bindingDataRoots = void 0;
|
|
9741
|
+
}
|
|
9717
9742
|
}
|
|
9718
9743
|
requireInitializedBinding(name) {
|
|
9719
9744
|
const scope = this.resolveScope(name);
|
|
@@ -9730,9 +9755,8 @@ var Scope = class _Scope {
|
|
|
9730
9755
|
};
|
|
9731
9756
|
}
|
|
9732
9757
|
};
|
|
9733
|
-
function
|
|
9734
|
-
|
|
9735
|
-
binding.value = value;
|
|
9758
|
+
function isChargedBindingValue(value) {
|
|
9759
|
+
return value !== uninitialized && value != null && typeof value !== "number" && typeof value !== "boolean";
|
|
9736
9760
|
}
|
|
9737
9761
|
function defineSnapshotBinding(target, name, value) {
|
|
9738
9762
|
Object.defineProperty(target, name, {
|
|
@@ -29530,7 +29554,8 @@ function measureSandboxData(values, options = {}) {
|
|
|
29530
29554
|
const bindingRoot = scopeDataRoots.get(value);
|
|
29531
29555
|
if (bindingRoot !== void 0) {
|
|
29532
29556
|
seen.add(value);
|
|
29533
|
-
visit(bindingRoot.value, depth);
|
|
29557
|
+
if ("value" in bindingRoot) visit(bindingRoot.value, depth);
|
|
29558
|
+
else for (const entry of bindingRoot.values) visit(entry, depth);
|
|
29534
29559
|
return;
|
|
29535
29560
|
}
|
|
29536
29561
|
assertSandboxDataDepth(depth);
|
|
@@ -47588,4 +47613,4 @@ export {
|
|
|
47588
47613
|
FileSnapshotBackend,
|
|
47589
47614
|
run
|
|
47590
47615
|
};
|
|
47591
|
-
//# sourceMappingURL=chunk-
|
|
47616
|
+
//# sourceMappingURL=chunk-EMOUVQDE.js.map
|