@poe-platform/safe-js 0.1.444 → 0.1.446
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-VSZJLQRZ.js → chunk-E6MWIIYR.js} +2 -2
- package/dist/safe-js/chunks/{chunk-27FJUX7D.js → chunk-F5KDPGJX.js} +71 -21
- package/dist/safe-js/chunks/chunk-F5KDPGJX.js.map +7 -0
- 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-E6MWIIYR.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-F5KDPGJX.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-
|
|
8252
|
+
//# sourceMappingURL=chunk-E6MWIIYR.js.map
|
|
@@ -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, {
|
|
@@ -25523,6 +25547,29 @@ function createReflectGlobal(budget) {
|
|
|
25523
25547
|
return reflect;
|
|
25524
25548
|
}
|
|
25525
25549
|
|
|
25550
|
+
// packages/safe-js/src/interp/globals/intl.ts
|
|
25551
|
+
var supportedValuesOf = Intl.supportedValuesOf;
|
|
25552
|
+
function createIntlGlobal(budget) {
|
|
25553
|
+
const methods2 = {
|
|
25554
|
+
getCanonicalLocales: async ([locales], context) => allocateProducedSandboxValue(await canonicalizeGuestLocales(locales, budget, context), budget),
|
|
25555
|
+
supportedValuesOf: async ([key], context) => {
|
|
25556
|
+
const text = await sandboxString(key, budget, context);
|
|
25557
|
+
budget.visitNode(text.length);
|
|
25558
|
+
return allocateProducedSandboxValue(supportedValuesOf(text), budget);
|
|
25559
|
+
}
|
|
25560
|
+
};
|
|
25561
|
+
const intl = createIntrinsicObject();
|
|
25562
|
+
for (const [name, call] of Object.entries(methods2)) {
|
|
25563
|
+
const closure = createSandboxClosure({ guest: true, sandbox: true, name, length: 1, call });
|
|
25564
|
+
Object.defineProperty(intl, name, { value: closure, writable: true, configurable: true });
|
|
25565
|
+
}
|
|
25566
|
+
Object.defineProperty(intl, Symbol.toStringTag, { value: "Intl", configurable: true });
|
|
25567
|
+
registerBuiltinIdentities(budget, { Intl: intl });
|
|
25568
|
+
for (const name of Object.keys(methods2)) registerIntrinsicFunction(budget, intl[name]);
|
|
25569
|
+
registerIntrinsicObject(budget, intl);
|
|
25570
|
+
return intl;
|
|
25571
|
+
}
|
|
25572
|
+
|
|
25526
25573
|
// packages/safe-js/src/interp/globals.ts
|
|
25527
25574
|
function createBuiltinBindings(options) {
|
|
25528
25575
|
const bindings = {
|
|
@@ -25539,6 +25586,7 @@ function createBuiltinBindings(options) {
|
|
|
25539
25586
|
DisposableStack: createDisposableStackGlobal(options.budget),
|
|
25540
25587
|
AsyncDisposableStack: createAsyncDisposableStackGlobal(options.budget),
|
|
25541
25588
|
Reflect: createReflectGlobal(options.budget),
|
|
25589
|
+
Intl: createIntlGlobal(options.budget),
|
|
25542
25590
|
ArrayBuffer: createArrayBufferGlobal(options.budget),
|
|
25543
25591
|
DataView: createDataViewGlobal(options.budget),
|
|
25544
25592
|
...createMiscGlobals(options),
|
|
@@ -29530,7 +29578,8 @@ function measureSandboxData(values, options = {}) {
|
|
|
29530
29578
|
const bindingRoot = scopeDataRoots.get(value);
|
|
29531
29579
|
if (bindingRoot !== void 0) {
|
|
29532
29580
|
seen.add(value);
|
|
29533
|
-
visit(bindingRoot.value, depth);
|
|
29581
|
+
if ("value" in bindingRoot) visit(bindingRoot.value, depth);
|
|
29582
|
+
else for (const entry of bindingRoot.values) visit(entry, depth);
|
|
29534
29583
|
return;
|
|
29535
29584
|
}
|
|
29536
29585
|
assertSandboxDataDepth(depth);
|
|
@@ -35036,6 +35085,7 @@ var KNOWN_RUNTIME_GLOBALS = [
|
|
|
35036
35085
|
"Error",
|
|
35037
35086
|
"EvalError",
|
|
35038
35087
|
"Infinity",
|
|
35088
|
+
"Intl",
|
|
35039
35089
|
"globalThis",
|
|
35040
35090
|
"isFinite",
|
|
35041
35091
|
"isNaN",
|
|
@@ -47588,4 +47638,4 @@ export {
|
|
|
47588
47638
|
FileSnapshotBackend,
|
|
47589
47639
|
run
|
|
47590
47640
|
};
|
|
47591
|
-
//# sourceMappingURL=chunk-
|
|
47641
|
+
//# sourceMappingURL=chunk-F5KDPGJX.js.map
|