@poe-platform/safe-js 0.1.297 → 0.1.299
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-MQRGC4JQ.js → chunk-3QW2X67U.js} +91 -31
- package/dist/safe-js/chunks/chunk-3QW2X67U.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-TMRE5H76.js → chunk-FTBN4WF3.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/package.json +2 -2
- package/dist/safe-js/chunks/chunk-MQRGC4JQ.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-TMRE5H76.js.map → chunk-FTBN4WF3.js.map} +0 -0
|
@@ -6839,8 +6839,9 @@ function float32DataProperties(value) {
|
|
|
6839
6839
|
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
6840
6840
|
throw new TypeError("Float32Array symbol properties are not supported.");
|
|
6841
6841
|
const properties = [];
|
|
6842
|
-
for (const
|
|
6842
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
6843
6843
|
if (isFloat32Index(key)) continue;
|
|
6844
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
6844
6845
|
if (!("value" in descriptor))
|
|
6845
6846
|
throw new TypeError(`Float32Array accessor property '${key}' is not supported.`);
|
|
6846
6847
|
properties.push([key, descriptor]);
|
|
@@ -7012,6 +7013,17 @@ function serializedDateTime(value) {
|
|
|
7012
7013
|
// packages/safe-js/src/interp/internal-symbols.ts
|
|
7013
7014
|
var internalSymbols = /* @__PURE__ */ new Set();
|
|
7014
7015
|
|
|
7016
|
+
// packages/safe-js/src/interp/generator-properties.ts
|
|
7017
|
+
var generatorGuestProperties = /* @__PURE__ */ new WeakMap();
|
|
7018
|
+
function getGeneratorProperties(value) {
|
|
7019
|
+
let properties = generatorGuestProperties.get(value);
|
|
7020
|
+
if (properties === void 0) {
|
|
7021
|
+
properties = /* @__PURE__ */ Object.create(null);
|
|
7022
|
+
generatorGuestProperties.set(value, properties);
|
|
7023
|
+
}
|
|
7024
|
+
return properties;
|
|
7025
|
+
}
|
|
7026
|
+
|
|
7015
7027
|
// packages/safe-js/src/interp/regexp-properties.ts
|
|
7016
7028
|
var regexGuestProperties = /* @__PURE__ */ new WeakMap();
|
|
7017
7029
|
function getRegexProperties(value) {
|
|
@@ -7354,7 +7366,7 @@ function walkGraphDepth(root, rootPath, assertDepth) {
|
|
|
7354
7366
|
}
|
|
7355
7367
|
}
|
|
7356
7368
|
function graphEntries(value) {
|
|
7357
|
-
const properties = regexGuestProperties.get(value);
|
|
7369
|
+
const properties = regexGuestProperties.get(value) ?? generatorGuestProperties.get(value);
|
|
7358
7370
|
if (properties !== void 0) return Reflect.ownKeys(properties).flatMap((key) => {
|
|
7359
7371
|
const descriptor = Object.getOwnPropertyDescriptor(properties, key);
|
|
7360
7372
|
return "value" in descriptor ? [[`.${String(key)}`, descriptor.value]] : [];
|
|
@@ -8017,8 +8029,8 @@ function getSandboxPropertyDescriptor(value, key, budget) {
|
|
|
8017
8029
|
return hostProperties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(hostProperties, key);
|
|
8018
8030
|
let current = value;
|
|
8019
8031
|
let depth = 0;
|
|
8020
|
-
while (typeof current === "object" && current !== null && (Array.isArray(current) || isSandboxDate(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxMap(current) || isSandboxSet(current) || isPrototypeRecord(current))) {
|
|
8021
|
-
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
8032
|
+
while (typeof current === "object" && current !== null && (Array.isArray(current) || isSandboxGenerator(current) || isSandboxDate(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxMap(current) || isSandboxSet(current) || isPrototypeRecord(current))) {
|
|
8033
|
+
const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
8022
8034
|
const descriptor = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, key);
|
|
8023
8035
|
if (descriptor !== void 0) return descriptor;
|
|
8024
8036
|
current = getSandboxPrototype(current, budget);
|
|
@@ -8036,6 +8048,10 @@ function getSandboxDataProperty(value, key, budget) {
|
|
|
8036
8048
|
if (isGuestHostObject(current)) return typeof key === "symbol" ? void 0 : getHostObjectMember(current, String(key));
|
|
8037
8049
|
if (isSandboxRegex(current)) return Object.getOwnPropertyDescriptor(getRegexProperties(current), key)?.value;
|
|
8038
8050
|
if (isSandboxPromise(current)) return Object.getOwnPropertyDescriptor(getPromiseProperties(current), key)?.value;
|
|
8051
|
+
if (isSandboxGenerator(current)) {
|
|
8052
|
+
const descriptor = Object.getOwnPropertyDescriptor(getGeneratorProperties(current), key);
|
|
8053
|
+
if (descriptor !== void 0) return descriptor.value;
|
|
8054
|
+
}
|
|
8039
8055
|
if (isSandboxMap(current) || isSandboxSet(current)) return Object.getOwnPropertyDescriptor(getCollectionProperties(current), key)?.value;
|
|
8040
8056
|
if (isGuestClosure(current)) {
|
|
8041
8057
|
const entry = getGuestFunctionProperty(current, key);
|
|
@@ -8044,9 +8060,9 @@ function getSandboxDataProperty(value, key, budget) {
|
|
|
8044
8060
|
const properties = current.properties;
|
|
8045
8061
|
return properties !== void 0 && Object.hasOwn(properties, key) ? properties[key] : void 0;
|
|
8046
8062
|
}
|
|
8047
|
-
if (isSandboxMap(current) || isSandboxSet(current) || isSandboxPromise(current) || isSandboxRegex(current)
|
|
8063
|
+
if (isSandboxMap(current) || isSandboxSet(current) || isSandboxPromise(current) || isSandboxRegex(current))
|
|
8048
8064
|
return void 0;
|
|
8049
|
-
if (!isSandboxClosure(current) && Object.hasOwn(current, key)) return current[key];
|
|
8065
|
+
if (!isSandboxClosure(current) && !isSandboxGenerator(current) && Object.hasOwn(current, key)) return current[key];
|
|
8050
8066
|
current = getSandboxPrototype(current, budget);
|
|
8051
8067
|
if (current !== null) {
|
|
8052
8068
|
budget?.visitNode();
|
|
@@ -8059,7 +8075,7 @@ function setSandboxPrototype(value, prototype, budget) {
|
|
|
8059
8075
|
if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
|
|
8060
8076
|
throw new TypeError("Object.prototype has an immutable null prototype.");
|
|
8061
8077
|
}
|
|
8062
|
-
if (!Array.isArray(value) && !isSandboxDate(value) && !isSandboxPromise(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxDate(prototype) && !isSandboxPromise(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
|
|
8078
|
+
if (!Array.isArray(value) && !isSandboxGenerator(value) && !isSandboxDate(value) && !isSandboxPromise(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxGenerator(prototype) && !isSandboxDate(prototype) && !isSandboxPromise(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
|
|
8063
8079
|
throw new TypeError(
|
|
8064
8080
|
"Prototype links require supported sandbox objects."
|
|
8065
8081
|
);
|
|
@@ -8068,7 +8084,7 @@ function setSandboxPrototype(value, prototype, budget) {
|
|
|
8068
8084
|
if (prototype === null) prototypes.set(value, null);
|
|
8069
8085
|
return;
|
|
8070
8086
|
}
|
|
8071
|
-
if (!Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
|
|
8087
|
+
if (!Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
|
|
8072
8088
|
throw new TypeError("Cannot change the prototype of a non-extensible object.");
|
|
8073
8089
|
}
|
|
8074
8090
|
let depth = 0;
|
|
@@ -9383,7 +9399,10 @@ async function restoreSandboxIterator(snapshot, budget, context, signal) {
|
|
|
9383
9399
|
if (snapshot.kind === "guest") return guestIterator(snapshot.value, snapshot.next, snapshot.async, budget, context, signal);
|
|
9384
9400
|
if (snapshot.kind === "async-from-sync") return asyncFromSyncIterator(await restoreSandboxIterator(snapshot.inner, budget, context, signal), budget, signal, context);
|
|
9385
9401
|
if (Array.isArray(snapshot.value)) return arrayIterator(snapshot.value, context, budget, snapshot.index);
|
|
9386
|
-
const iterator = isSandboxGenerator(snapshot.value)
|
|
9402
|
+
const iterator = isSandboxGenerator(snapshot.value) ? {
|
|
9403
|
+
...generatorObjectIterator(snapshot.value, budget, context),
|
|
9404
|
+
...snapshot.value.async ? { asyncProtocol: true } : {}
|
|
9405
|
+
} : getSandboxIterator(snapshot.value, budget, context);
|
|
9387
9406
|
if (iterator === void 0) throw new TypeError("Invalid builtin iterator snapshot.");
|
|
9388
9407
|
for (let index = 0; index < snapshot.index; index++) await iterator.next();
|
|
9389
9408
|
return iterator;
|
|
@@ -9393,6 +9412,11 @@ async function acquireSandboxIterator(value, budget, context, asyncProtocol = fa
|
|
|
9393
9412
|
if (context.getProperty === void 0 || isGuestHostObject(value))
|
|
9394
9413
|
return asyncProtocol ? getSandboxAsyncIterator(value, budget, context, signal) : getSandboxIterator(value, budget, context);
|
|
9395
9414
|
if (getSandboxPropertyDescriptor(value, key, budget) === void 0 && !(isSandboxRegExpIterator(value) && !asyncProtocol && getSandboxPropertyDescriptor(value, "next", budget) !== void 0)) {
|
|
9415
|
+
if (isSandboxGenerator(value)) {
|
|
9416
|
+
if (hasExplicitSandboxPrototype(value)) return void 0;
|
|
9417
|
+
if (value.async === true === asyncProtocol && getSandboxPropertyDescriptor(value, "next", budget) !== void 0)
|
|
9418
|
+
return guestIterator(value, await context.getProperty(value, "next"), asyncProtocol, budget, context, signal);
|
|
9419
|
+
}
|
|
9396
9420
|
if (!asyncProtocol && Array.isArray(value) && getSandboxPrototype(value, budget) !== null) return void 0;
|
|
9397
9421
|
if (!asyncProtocol) return getSandboxIterator(value, budget, context);
|
|
9398
9422
|
if (isSandboxGenerator(value) && value.async)
|
|
@@ -9457,7 +9481,7 @@ async function readIteratorResult(iterator, result, property) {
|
|
|
9457
9481
|
}
|
|
9458
9482
|
function getSandboxAsyncIterator(value, budget, context, signal) {
|
|
9459
9483
|
if (isSandboxGenerator(value) && value.async) {
|
|
9460
|
-
return { ...
|
|
9484
|
+
return hasExplicitSandboxPrototype(value) ? void 0 : { ...generatorObjectIterator(value, budget, context), asyncProtocol: true };
|
|
9461
9485
|
}
|
|
9462
9486
|
if (value !== null && (typeof value === "object" || typeof value === "function") && !isGuestHostObject(value)) {
|
|
9463
9487
|
const method = value[Symbol.asyncIterator];
|
|
@@ -9607,7 +9631,7 @@ function getSandboxIterator(value, budget, context) {
|
|
|
9607
9631
|
return syncIterator(Float32Array.prototype.values.call(value));
|
|
9608
9632
|
}
|
|
9609
9633
|
if (isSandboxGenerator(value)) {
|
|
9610
|
-
return value.async ? void 0 :
|
|
9634
|
+
return value.async || hasExplicitSandboxPrototype(value) ? void 0 : generatorObjectIterator(value, budget, context);
|
|
9611
9635
|
}
|
|
9612
9636
|
if (typeof value === "string") {
|
|
9613
9637
|
const iterator2 = value[Symbol.iterator]();
|
|
@@ -9684,6 +9708,26 @@ function collectionIterator(collection, value) {
|
|
|
9684
9708
|
return adapter;
|
|
9685
9709
|
}
|
|
9686
9710
|
var asyncGeneratorRequests = /* @__PURE__ */ new WeakMap();
|
|
9711
|
+
function generatorObjectIterator(generator, budget, context) {
|
|
9712
|
+
const iterator = generatorIterator(generator, budget, context);
|
|
9713
|
+
if (context?.getProperty === void 0) return iterator;
|
|
9714
|
+
return {
|
|
9715
|
+
...iterator,
|
|
9716
|
+
getOperation: async (method) => {
|
|
9717
|
+
if (method === "next" || !hasExplicitSandboxPrototype(generator) && getSandboxPropertyDescriptor(generator, method, budget) === void 0) return iterator[method];
|
|
9718
|
+
const operation = await context.getProperty(generator, method);
|
|
9719
|
+
if (operation === void 0 || operation === null) return void 0;
|
|
9720
|
+
if (!isSandboxClosure(operation)) throw new TypeError("Iterator operation must be callable.");
|
|
9721
|
+
return async (...args) => {
|
|
9722
|
+
const result = await invokeBuiltinClosure(operation, args, budget ?? new Budget(), context, generator);
|
|
9723
|
+
return generator.async ? await awaitSandboxValue(result, void 0, budget, context) : result;
|
|
9724
|
+
};
|
|
9725
|
+
},
|
|
9726
|
+
readResultProperty: async (result, property) => ({
|
|
9727
|
+
value: await context.getProperty(result, property)
|
|
9728
|
+
})
|
|
9729
|
+
};
|
|
9730
|
+
}
|
|
9687
9731
|
function generatorIterator(generator, budget, context) {
|
|
9688
9732
|
const invoke = async (method, value) => {
|
|
9689
9733
|
const leaveRunning = enterRunningState(generator);
|
|
@@ -13005,14 +13049,14 @@ function createObjectArrayGlobals(options) {
|
|
|
13005
13049
|
call: ([value]) => {
|
|
13006
13050
|
if (isGuestHostObject(value))
|
|
13007
13051
|
throw new TypeError("Live host objects cannot be made non-extensible.");
|
|
13008
|
-
Object.preventExtensions(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13052
|
+
Object.preventExtensions(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13009
13053
|
return value;
|
|
13010
13054
|
},
|
|
13011
13055
|
name: "preventExtensions"
|
|
13012
13056
|
}),
|
|
13013
13057
|
isExtensible: createSandboxClosure({
|
|
13014
13058
|
sandbox: true,
|
|
13015
|
-
call: ([value]) => Object.isExtensible(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13059
|
+
call: ([value]) => Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13016
13060
|
name: "isExtensible"
|
|
13017
13061
|
}),
|
|
13018
13062
|
seal: createSandboxClosure({
|
|
@@ -13020,14 +13064,14 @@ function createObjectArrayGlobals(options) {
|
|
|
13020
13064
|
call: ([value]) => {
|
|
13021
13065
|
if (isGuestHostObject(value))
|
|
13022
13066
|
throw new TypeError("Live host objects cannot be sealed.");
|
|
13023
|
-
Object.seal(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13067
|
+
Object.seal(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13024
13068
|
return value;
|
|
13025
13069
|
},
|
|
13026
13070
|
name: "seal"
|
|
13027
13071
|
}),
|
|
13028
13072
|
isSealed: createSandboxClosure({
|
|
13029
13073
|
sandbox: true,
|
|
13030
|
-
call: ([value]) => Object.isSealed(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13074
|
+
call: ([value]) => Object.isSealed(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13031
13075
|
name: "isSealed"
|
|
13032
13076
|
}),
|
|
13033
13077
|
freeze: createSandboxClosure({
|
|
@@ -13036,7 +13080,7 @@ function createObjectArrayGlobals(options) {
|
|
|
13036
13080
|
if (isGuestHostObject(value))
|
|
13037
13081
|
throw new TypeError("Live host objects cannot be frozen.");
|
|
13038
13082
|
if (typeof value === "object" && value !== null) {
|
|
13039
|
-
Object.freeze(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13083
|
+
Object.freeze(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13040
13084
|
}
|
|
13041
13085
|
return value;
|
|
13042
13086
|
},
|
|
@@ -13044,7 +13088,7 @@ function createObjectArrayGlobals(options) {
|
|
|
13044
13088
|
}),
|
|
13045
13089
|
isFrozen: createSandboxClosure({
|
|
13046
13090
|
sandbox: true,
|
|
13047
|
-
call: ([value]) => Object.isFrozen(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13091
|
+
call: ([value]) => Object.isFrozen(isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13048
13092
|
name: "isFrozen"
|
|
13049
13093
|
}),
|
|
13050
13094
|
assign: createSandboxClosure({
|
|
@@ -13387,6 +13431,7 @@ function reflectionProperties(value) {
|
|
|
13387
13431
|
return objectProperties(value);
|
|
13388
13432
|
}
|
|
13389
13433
|
function objectProperties(value, mutable = false) {
|
|
13434
|
+
if (isSandboxGenerator(value)) return getGeneratorProperties(value);
|
|
13390
13435
|
if (isSandboxPromise(value)) return getPromiseProperties(value);
|
|
13391
13436
|
if (isSandboxMap(value) || isSandboxSet(value)) return getCollectionProperties(value);
|
|
13392
13437
|
if (isSandboxRegex(value)) return getRegexProperties(value);
|
|
@@ -16191,7 +16236,7 @@ function forInKeys(object, budget) {
|
|
|
16191
16236
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
16192
16237
|
if (depth > 0) budget.visitNode();
|
|
16193
16238
|
assertSandboxDataDepth(depth++);
|
|
16194
|
-
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
16239
|
+
const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
16195
16240
|
for (const key of Object.getOwnPropertyNames(properties)) {
|
|
16196
16241
|
if (seen.has(key)) continue;
|
|
16197
16242
|
seen.add(key);
|
|
@@ -16207,7 +16252,7 @@ function hasForInProperty(object, key, budget) {
|
|
|
16207
16252
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
16208
16253
|
if (depth > 0) budget.visitNode();
|
|
16209
16254
|
assertSandboxDataDepth(depth++);
|
|
16210
|
-
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
16255
|
+
const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
16211
16256
|
if (Object.hasOwn(properties, key)) return true;
|
|
16212
16257
|
}
|
|
16213
16258
|
return false;
|
|
@@ -16763,7 +16808,7 @@ function getPropertyValue(target, property, context, receiver = target) {
|
|
|
16763
16808
|
if (isSandboxSet(target)) return getSandboxPrototype(target, context.budget) === null ? getSetMember(target, property, createSetMethodOptions(context)) : void 0;
|
|
16764
16809
|
if (isSandboxCollectionIterator(target))
|
|
16765
16810
|
return getCollectionIteratorMember(target, property, context.budget);
|
|
16766
|
-
if (isSandboxGenerator(target)) return getGeneratorMember(target, property, context.budget);
|
|
16811
|
+
if (isSandboxGenerator(target)) return hasExplicitSandboxPrototype(target) ? void 0 : getGeneratorMember(target, property, context.budget);
|
|
16767
16812
|
if (isSandboxClosure(target)) return getClosureMemberValue(target, property, context);
|
|
16768
16813
|
if (isSandboxPromise(target)) return hasExplicitSandboxPrototype(target) ? void 0 : getPromiseMember(property, context.budget);
|
|
16769
16814
|
if (isSandboxRegex(target)) return hasExplicitSandboxPrototype(target) || getSandboxPrototype(target, context.budget) !== null ? void 0 : getRegexMember(target, property, context.budget, createCoercionContext(context));
|
|
@@ -17079,7 +17124,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
17079
17124
|
);
|
|
17080
17125
|
}
|
|
17081
17126
|
if (isSandboxGenerator(member.object)) {
|
|
17082
|
-
const memberValue =
|
|
17127
|
+
const memberValue = await getPropertyValue(member.object, member.property, context);
|
|
17083
17128
|
if (memberValue === void 0) {
|
|
17084
17129
|
throw new TypeError(`Generator#${String(member.property)} is not a supported method.`);
|
|
17085
17130
|
}
|
|
@@ -17383,7 +17428,7 @@ function hasSandboxProperty(value, key, context) {
|
|
|
17383
17428
|
while (typeof current === "object" && current !== null) {
|
|
17384
17429
|
if (isGuestHostObject(current)) return typeof key === "symbol" ? false : hasHostObjectMember(current, String(key));
|
|
17385
17430
|
if (hasOwnSandboxProperty(current, key, false)) return true;
|
|
17386
|
-
if (!isSandboxDate(current) && !isSandboxRegex(current) && !isSandboxMap(current) && !isSandboxSet(current) && !((isGuestClosure(current) || Array.isArray(current)) && hasExplicitSandboxPrototype(current)) && (Array.isArray(current) || !isPlainSandboxObject(current) || isSandboxDate(current) || isFloat32Array(current) || isSandboxGenerator(current) || isSandboxCollectionIterator(current) || isSandboxRegExpIterator(current))) {
|
|
17431
|
+
if (!isSandboxDate(current) && !isSandboxRegex(current) && !isSandboxMap(current) && !isSandboxSet(current) && !((isGuestClosure(current) || isSandboxGenerator(current) || Array.isArray(current)) && hasExplicitSandboxPrototype(current)) && (Array.isArray(current) || !isPlainSandboxObject(current) || isSandboxDate(current) || isFloat32Array(current) || isSandboxGenerator(current) || isSandboxCollectionIterator(current) || isSandboxRegExpIterator(current))) {
|
|
17387
17432
|
return getPropertyValue(current, key, context) !== void 0;
|
|
17388
17433
|
}
|
|
17389
17434
|
current = getSandboxPrototype(current, context.budget);
|
|
@@ -17629,6 +17674,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
|
|
|
17629
17674
|
}
|
|
17630
17675
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
17631
17676
|
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
17677
|
+
if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
|
|
17632
17678
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
17633
17679
|
if (isFloat32Array(target)) {
|
|
17634
17680
|
if (typeof property === "symbol") throw new TypeError("Typed array symbol properties are not yet supported.");
|
|
@@ -17662,7 +17708,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
|
|
|
17662
17708
|
for (let prototype = getSandboxPrototype(prototypeOwner, budget); prototype !== null; prototype = getSandboxPrototype(prototype, budget)) {
|
|
17663
17709
|
budget.visitNode();
|
|
17664
17710
|
assertSandboxDataDepth(depth++);
|
|
17665
|
-
const properties = isSandboxClosure(prototype) ? prototype.properties : prototype;
|
|
17711
|
+
const properties = isSandboxGenerator(prototype) ? getGeneratorProperties(prototype) : isSandboxClosure(prototype) ? prototype.properties : prototype;
|
|
17666
17712
|
const inherited = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, key);
|
|
17667
17713
|
if (inherited === void 0) continue;
|
|
17668
17714
|
if (inherited.writable !== true)
|
|
@@ -17681,7 +17727,7 @@ function setSuperProperty(base, receiver, key, value, context) {
|
|
|
17681
17727
|
for (let current = base; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
17682
17728
|
budget.visitNode();
|
|
17683
17729
|
assertSandboxDataDepth(depth++);
|
|
17684
|
-
const properties = isSandboxClosure(current) ? current.properties : current;
|
|
17730
|
+
const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxClosure(current) ? current.properties : current;
|
|
17685
17731
|
const descriptor = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, key);
|
|
17686
17732
|
if (descriptor === void 0) continue;
|
|
17687
17733
|
if (!("value" in descriptor))
|
|
@@ -17699,6 +17745,7 @@ function deleteSandboxProperty(target, property) {
|
|
|
17699
17745
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
17700
17746
|
if (isSandboxRegex(target)) target = getRegexProperties(target);
|
|
17701
17747
|
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
17748
|
+
if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
|
|
17702
17749
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
17703
17750
|
if (Array.isArray(target)) {
|
|
17704
17751
|
assertCollectionMutable(target);
|
|
@@ -18269,7 +18316,7 @@ function conversionHook(value, name, budget, context) {
|
|
|
18269
18316
|
let current = value;
|
|
18270
18317
|
let depth = 0;
|
|
18271
18318
|
while (current !== null) {
|
|
18272
|
-
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
18319
|
+
const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
18273
18320
|
const descriptor = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, name);
|
|
18274
18321
|
if (descriptor !== void 0) {
|
|
18275
18322
|
return readPropertyDescriptor(descriptor, value, context);
|
|
@@ -18482,8 +18529,7 @@ function hasOwnSandboxProperty(value, key, enumerable) {
|
|
|
18482
18529
|
properties = value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
18483
18530
|
} else if (isSandboxMap(value) || isSandboxSet(value)) properties = getCollectionProperties(value);
|
|
18484
18531
|
else if (isSandboxPromise(value)) properties = getPromiseProperties(value);
|
|
18485
|
-
else if (isSandboxGenerator(value))
|
|
18486
|
-
return false;
|
|
18532
|
+
else if (isSandboxGenerator(value)) properties = getGeneratorProperties(value);
|
|
18487
18533
|
else if (isSandboxRegex(value)) properties = getRegexProperties(value);
|
|
18488
18534
|
else properties = Object(value);
|
|
18489
18535
|
const descriptor = Object.getOwnPropertyDescriptor(properties, key);
|
|
@@ -20152,6 +20198,7 @@ function captureGuestHeapNode(value, encode) {
|
|
|
20152
20198
|
state: value.state,
|
|
20153
20199
|
astNodeId: origin2.node.nodeId,
|
|
20154
20200
|
async: value.async === true,
|
|
20201
|
+
objectState: captureObjectState(value, encode),
|
|
20155
20202
|
scope: encode(origin2.scope),
|
|
20156
20203
|
closureScope: encode(origin2.closureScope),
|
|
20157
20204
|
...value.state !== "suspended" || origin2.suspendedScope === void 0 ? {} : { suspendedScope: encode(origin2.suspendedScope) },
|
|
@@ -20267,6 +20314,7 @@ function captureGuestHeapNode(value, encode) {
|
|
|
20267
20314
|
}
|
|
20268
20315
|
function captureObjectState(value, encode) {
|
|
20269
20316
|
let properties = value;
|
|
20317
|
+
if (isSandboxGenerator(value)) properties = getGeneratorProperties(value);
|
|
20270
20318
|
if (isSandboxClosure(value)) {
|
|
20271
20319
|
properties = value.properties;
|
|
20272
20320
|
if (isGuestClosure(value)) properties = materializeFunctionProperties(value);
|
|
@@ -24253,7 +24301,8 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
24253
24301
|
}
|
|
24254
24302
|
state(node.state);
|
|
24255
24303
|
} else if (node.kind === "guest-generator") {
|
|
24256
|
-
fields(node, ["kind", "state", "astNodeId", "async", "scope", "closureScope", "sent"], ["suspendedScope", "yieldNodeId", "environment", "blockScopes", "finallyCompletions", "expressionStates"]);
|
|
24304
|
+
fields(node, ["kind", "state", "astNodeId", "async", "scope", "closureScope", "sent"], ["suspendedScope", "yieldNodeId", "environment", "blockScopes", "finallyCompletions", "expressionStates", "objectState"]);
|
|
24305
|
+
if (Object.hasOwn(node, "objectState")) state(node.objectState);
|
|
24257
24306
|
if (!["start", "running", "suspended", "done"].includes(String(node.state)) || typeof node.async !== "boolean" || integer(node.astNodeId) < 1)
|
|
24258
24307
|
throw new TypeError("Invalid generator state.");
|
|
24259
24308
|
reference(node.scope, ["scope-frame"]);
|
|
@@ -25766,6 +25815,7 @@ function ownEnumerableSandboxEntries(value, excludedKeys) {
|
|
|
25766
25815
|
if (isGuestClosure(value)) entries = Object.entries(value.properties ?? {});
|
|
25767
25816
|
else if (isSandboxRegex(value)) entries = Object.entries(getRegexProperties(value));
|
|
25768
25817
|
else if (isSandboxPromise(value)) entries = Object.entries(getPromiseProperties(value));
|
|
25818
|
+
else if (isSandboxGenerator(value)) entries = Object.entries(getGeneratorProperties(value));
|
|
25769
25819
|
else if (isSandboxMap(value) || isSandboxSet(value)) entries = Object.entries(getCollectionProperties(value));
|
|
25770
25820
|
else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
25771
25821
|
else entries = Object.entries(Object(value));
|
|
@@ -25777,19 +25827,20 @@ function ownSandboxSymbolKeys(value) {
|
|
|
25777
25827
|
if (isSandboxClosure(value)) value = value.properties ?? {};
|
|
25778
25828
|
else if (isSandboxRegex(value)) value = getRegexProperties(value);
|
|
25779
25829
|
else if (isSandboxPromise(value)) value = getPromiseProperties(value);
|
|
25830
|
+
else if (isSandboxGenerator(value)) value = getGeneratorProperties(value);
|
|
25780
25831
|
else if (isSandboxMap(value) || isSandboxSet(value)) value = getCollectionProperties(value);
|
|
25781
|
-
else if (isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
25782
25832
|
return Object.getOwnPropertySymbols(Object(value)).filter((key) => !internalSymbols.has(key));
|
|
25783
25833
|
}
|
|
25784
25834
|
function ownEnumerableSandboxKeys(value, includeSymbols = false) {
|
|
25785
25835
|
if (includeSymbols) {
|
|
25786
|
-
const properties = isSandboxClosure(value) ? value.properties ?? {} : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : Object(value);
|
|
25836
|
+
const properties = isSandboxClosure(value) ? value.properties ?? {} : isSandboxGenerator(value) ? getGeneratorProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : Object(value);
|
|
25787
25837
|
return [...ownEnumerableSandboxKeys(value), ...ownSandboxSymbolKeys(value).filter((key) => Object.getOwnPropertyDescriptor(properties, key)?.enumerable === true)];
|
|
25788
25838
|
}
|
|
25789
25839
|
if (isGuestHostObject(value)) return getHostObjectKeys(value);
|
|
25790
25840
|
if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
|
|
25791
25841
|
if (isGuestClosure(value)) return Object.keys(value.properties ?? {});
|
|
25792
25842
|
if (isSandboxPromise(value)) return Object.keys(getPromiseProperties(value));
|
|
25843
|
+
if (isSandboxGenerator(value)) return Object.keys(getGeneratorProperties(value));
|
|
25793
25844
|
if (isSandboxRegex(value)) return Object.keys(getRegexProperties(value));
|
|
25794
25845
|
if (isSandboxMap(value) || isSandboxSet(value)) return Object.keys(getCollectionProperties(value));
|
|
25795
25846
|
if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
@@ -25841,6 +25892,7 @@ function createSandboxGenerator(channel, metadata = void 0) {
|
|
|
25841
25892
|
enumerable: false,
|
|
25842
25893
|
value: true
|
|
25843
25894
|
});
|
|
25895
|
+
getGeneratorProperties(generator);
|
|
25844
25896
|
return generator;
|
|
25845
25897
|
}
|
|
25846
25898
|
function createSandboxMap(entries = []) {
|
|
@@ -26095,6 +26147,14 @@ function measureSandboxData(values, options = {}) {
|
|
|
26095
26147
|
return;
|
|
26096
26148
|
}
|
|
26097
26149
|
if (isSandboxGenerator(value)) {
|
|
26150
|
+
const descriptors3 = Object.getOwnPropertyDescriptors(getGeneratorProperties(value));
|
|
26151
|
+
for (const key of Reflect.ownKeys(descriptors3)) {
|
|
26152
|
+
const descriptor = descriptors3[key];
|
|
26153
|
+
usage += typeof key === "string" ? key.length + 1 : 1;
|
|
26154
|
+
if (typeof key === "symbol") visit(key, depth + 1);
|
|
26155
|
+
if ("value" in descriptor) visit(descriptor.value, depth + 1);
|
|
26156
|
+
else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
|
|
26157
|
+
}
|
|
26098
26158
|
const snapshot = value.channel.snapshot();
|
|
26099
26159
|
usage += snapshot.sent.length;
|
|
26100
26160
|
for (const completion of snapshot.sent) visit(completion.value, depth + 1);
|
|
@@ -40921,4 +40981,4 @@ export {
|
|
|
40921
40981
|
FileSnapshotBackend,
|
|
40922
40982
|
run
|
|
40923
40983
|
};
|
|
40924
|
-
//# sourceMappingURL=chunk-
|
|
40984
|
+
//# sourceMappingURL=chunk-3QW2X67U.js.map
|