@poe-platform/safe-js 0.1.395 → 0.1.397
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-7V4MG4KI.js → chunk-6HQSVAXP.js} +34 -6
- package/dist/safe-js/chunks/{chunk-7V4MG4KI.js.map → chunk-6HQSVAXP.js.map} +3 -3
- package/dist/safe-js/chunks/{chunk-LQ2HXAJ6.js → chunk-HGDPHBJA.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/snapshot/guest-heap.d.ts +1 -0
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-LQ2HXAJ6.js.map → chunk-HGDPHBJA.js.map} +0 -0
|
@@ -22159,6 +22159,9 @@ function isPromiseLike2(value) {
|
|
|
22159
22159
|
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function" && !isSandboxClosure(value) && !isSandboxPromise(value);
|
|
22160
22160
|
}
|
|
22161
22161
|
|
|
22162
|
+
// packages/safe-js/src/interp/symbol-registry.ts
|
|
22163
|
+
var symbolRegistryOrigins = /* @__PURE__ */ new WeakMap();
|
|
22164
|
+
|
|
22162
22165
|
// packages/safe-js/src/snapshot/property-descriptors.ts
|
|
22163
22166
|
function serializePropertyDescriptors(target, encode) {
|
|
22164
22167
|
return {
|
|
@@ -22326,7 +22329,13 @@ function captureGuestHeapNode(value, encode) {
|
|
|
22326
22329
|
const intrinsic = getIntrinsicIdentity(value);
|
|
22327
22330
|
if (intrinsic !== void 0) {
|
|
22328
22331
|
const state2 = captureObjectState(value, encode);
|
|
22329
|
-
|
|
22332
|
+
const registry = isSandboxClosure(value) ? symbolRegistryOrigins.get(value) : void 0;
|
|
22333
|
+
return {
|
|
22334
|
+
kind: "intrinsic",
|
|
22335
|
+
id: intrinsic,
|
|
22336
|
+
...state2 === void 0 ? {} : { state: state2 },
|
|
22337
|
+
...registry === void 0 ? {} : { symbolRegistry: [...registry].map(([key, symbol]) => [key, encode(symbol)]) }
|
|
22338
|
+
};
|
|
22330
22339
|
}
|
|
22331
22340
|
const bound = boundFunctionStates.get(value);
|
|
22332
22341
|
if (bound !== void 0 && isSandboxClosure(value)) {
|
|
@@ -27018,10 +27027,10 @@ var registries = /* @__PURE__ */ new WeakMap();
|
|
|
27018
27027
|
function createSymbolGlobal(budget) {
|
|
27019
27028
|
let registry = registries.get(budget);
|
|
27020
27029
|
if (registry === void 0) {
|
|
27021
|
-
registry =
|
|
27030
|
+
registry = createSandboxMap();
|
|
27022
27031
|
registries.set(budget, registry);
|
|
27023
27032
|
}
|
|
27024
|
-
const entries = registry;
|
|
27033
|
+
const entries = registry.entries;
|
|
27025
27034
|
const prototype = /* @__PURE__ */ Object.create(null);
|
|
27026
27035
|
const valueOf = createSandboxClosure({
|
|
27027
27036
|
sandbox: true,
|
|
@@ -27073,7 +27082,7 @@ function createSymbolGlobal(budget) {
|
|
|
27073
27082
|
sandbox: true,
|
|
27074
27083
|
name: "Symbol",
|
|
27075
27084
|
length: 0,
|
|
27076
|
-
retainedValues: () => [
|
|
27085
|
+
retainedValues: () => [registry],
|
|
27077
27086
|
call: async ([description], context) => Symbol(
|
|
27078
27087
|
description === void 0 ? void 0 : await sandboxString(description, budget, context)
|
|
27079
27088
|
)
|
|
@@ -27085,6 +27094,7 @@ function createSymbolGlobal(budget) {
|
|
|
27085
27094
|
sandbox: true,
|
|
27086
27095
|
name: "for",
|
|
27087
27096
|
length: 1,
|
|
27097
|
+
retainedValues: () => [registry],
|
|
27088
27098
|
call: async ([key], context) => {
|
|
27089
27099
|
const text = await sandboxString(key, budget, context);
|
|
27090
27100
|
let value = entries.get(text);
|
|
@@ -27099,6 +27109,7 @@ function createSymbolGlobal(budget) {
|
|
|
27099
27109
|
sandbox: true,
|
|
27100
27110
|
name: "keyFor",
|
|
27101
27111
|
length: 1,
|
|
27112
|
+
retainedValues: () => [registry],
|
|
27102
27113
|
call: ([value]) => {
|
|
27103
27114
|
if (typeof value !== "symbol") throw new TypeError("Symbol.keyFor requires a symbol.");
|
|
27104
27115
|
for (const [key, registered] of entries) if (registered === value) return key;
|
|
@@ -27107,8 +27118,10 @@ function createSymbolGlobal(budget) {
|
|
|
27107
27118
|
})
|
|
27108
27119
|
};
|
|
27109
27120
|
for (const [name, method] of Object.entries(methods2)) {
|
|
27121
|
+
symbolRegistryOrigins.set(method, entries);
|
|
27110
27122
|
Object.defineProperty(properties, name, { value: method, writable: true, configurable: true });
|
|
27111
27123
|
}
|
|
27124
|
+
symbolRegistryOrigins.set(constructor, entries);
|
|
27112
27125
|
for (const [name, value] of Object.entries(wellKnownSymbols)) {
|
|
27113
27126
|
Object.defineProperty(properties, name, { value });
|
|
27114
27127
|
}
|
|
@@ -27846,8 +27859,23 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
27846
27859
|
if (iterator.kind === "symbol" || iterator.kind === "scope-frame") throw new TypeError("Invalid wrapped iterator.");
|
|
27847
27860
|
state(node.state);
|
|
27848
27861
|
} else if (node.kind === "intrinsic") {
|
|
27849
|
-
fields(node, ["kind", "id"], ["state"]);
|
|
27862
|
+
fields(node, ["kind", "id"], ["state", "symbolRegistry"]);
|
|
27850
27863
|
if (typeof node.id !== "string" || !intrinsicCatalogue().has(node.id)) throw new TypeError("Unknown intrinsic identity.");
|
|
27864
|
+
if (Object.hasOwn(node, "symbolRegistry")) {
|
|
27865
|
+
if (![JSON.stringify(["Symbol"]), JSON.stringify(["Symbol", "for"]), JSON.stringify(["Symbol", "keyFor"])].includes(node.id) || !Array.isArray(node.symbolRegistry))
|
|
27866
|
+
throw new TypeError("Invalid symbol registry owner.");
|
|
27867
|
+
const keys = /* @__PURE__ */ new Set();
|
|
27868
|
+
const symbols = /* @__PURE__ */ new Set();
|
|
27869
|
+
for (const entry of node.symbolRegistry) {
|
|
27870
|
+
if (!Array.isArray(entry) || entry.length !== 2 || typeof entry[0] !== "string" || keys.has(entry[0]))
|
|
27871
|
+
throw new TypeError("Invalid symbol registry entry.");
|
|
27872
|
+
const symbol = reference(entry[1], ["symbol"]);
|
|
27873
|
+
if (symbol.wellKnown !== void 0 || symbol.description !== entry[0] || symbols.has(symbol))
|
|
27874
|
+
throw new TypeError("Invalid registered symbol identity.");
|
|
27875
|
+
keys.add(entry[0]);
|
|
27876
|
+
symbols.add(symbol);
|
|
27877
|
+
}
|
|
27878
|
+
}
|
|
27851
27879
|
if (Object.hasOwn(node, "state")) state(node.state);
|
|
27852
27880
|
} else if (node.kind === "guest-regexp-iterator") {
|
|
27853
27881
|
fields(node, ["kind", "matcher", "input", "exhausted", "state"], ["global", "unicode"]);
|
|
@@ -45015,4 +45043,4 @@ export {
|
|
|
45015
45043
|
FileSnapshotBackend,
|
|
45016
45044
|
run
|
|
45017
45045
|
};
|
|
45018
|
-
//# sourceMappingURL=chunk-
|
|
45046
|
+
//# sourceMappingURL=chunk-6HQSVAXP.js.map
|