poe-code 14.0.38 → 14.0.40
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/index.js +196 -157
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-js/dist/chunks/{chunk-CSC4EXIV.js → chunk-GO774BRE.js} +183 -145
- package/packages/safe-js/dist/chunks/chunk-GO774BRE.js.map +7 -0
- package/packages/safe-js/dist/chunks/{chunk-QXSG4XRW.js → chunk-LGJLTEI5.js} +2 -2
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/interp/interpreter.js +50 -8
- package/packages/safe-js/dist/parse/parser.js +13 -17
- package/packages/safe-js/dist/chunks/chunk-CSC4EXIV.js.map +0 -7
- /package/packages/safe-js/dist/chunks/{chunk-QXSG4XRW.js.map → chunk-LGJLTEI5.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -122866,10 +122866,7 @@ function rebasePosition(position, base) {
|
|
|
122866
122866
|
};
|
|
122867
122867
|
}
|
|
122868
122868
|
function isLiteralPropertyKey(token) {
|
|
122869
|
-
|
|
122870
|
-
return true;
|
|
122871
|
-
}
|
|
122872
|
-
return token.type === "keyword" && (token.value === "true" || token.value === "false" || token.value === "null" || token.value === "undefined");
|
|
122869
|
+
return token.type === "numeric" || token.type === "string";
|
|
122873
122870
|
}
|
|
122874
122871
|
function isIdentifierLikeToken(token) {
|
|
122875
122872
|
return token.type === "identifier" || token.type === "keyword" && token.value === "async";
|
|
@@ -123992,9 +123989,9 @@ var init_parser3 = __esm({
|
|
|
123992
123989
|
};
|
|
123993
123990
|
}
|
|
123994
123991
|
const token = this.currentToken();
|
|
123995
|
-
if (token.type === "identifier") {
|
|
123992
|
+
if (token.type === "identifier" || token.type === "keyword") {
|
|
123996
123993
|
this.index += 1;
|
|
123997
|
-
const key3 =
|
|
123994
|
+
const key3 = createIdentifierName(token);
|
|
123998
123995
|
if (this.consumePunctuator(":") !== void 0) {
|
|
123999
123996
|
const value2 = this.parseBindingElement();
|
|
124000
123997
|
if (value2.type === "RestElement") {
|
|
@@ -124009,6 +124006,7 @@ var init_parser3 = __esm({
|
|
|
124009
124006
|
span: createSpan2(key3.span.start, value2.span.end)
|
|
124010
124007
|
};
|
|
124011
124008
|
}
|
|
124009
|
+
if (!isIdentifierLikeToken(token)) throw unexpectedTokenError(token);
|
|
124012
124010
|
let value = key3;
|
|
124013
124011
|
if (this.consumePunctuator("=") !== void 0) {
|
|
124014
124012
|
const right = this.parseExpression().node;
|
|
@@ -124221,9 +124219,9 @@ var init_parser3 = __esm({
|
|
|
124221
124219
|
};
|
|
124222
124220
|
}
|
|
124223
124221
|
const token = this.currentToken();
|
|
124224
|
-
if (token.type === "identifier") {
|
|
124222
|
+
if (token.type === "identifier" || token.type === "keyword") {
|
|
124225
124223
|
this.index += 1;
|
|
124226
|
-
const key3 =
|
|
124224
|
+
const key3 = createIdentifierName(token);
|
|
124227
124225
|
if (this.consumePunctuator(":") !== void 0) {
|
|
124228
124226
|
const value2 = this.parseAssignmentPatternElement();
|
|
124229
124227
|
if (value2.type === "RestElement") {
|
|
@@ -124238,6 +124236,7 @@ var init_parser3 = __esm({
|
|
|
124238
124236
|
span: createSpan2(key3.span.start, value2.span.end)
|
|
124239
124237
|
};
|
|
124240
124238
|
}
|
|
124239
|
+
if (!isIdentifierLikeToken(token)) throw unexpectedTokenError(token);
|
|
124241
124240
|
let value = key3;
|
|
124242
124241
|
if (this.consumePunctuator("=") !== void 0) {
|
|
124243
124242
|
const right = this.parseAssignmentExpression().node;
|
|
@@ -124886,9 +124885,9 @@ var init_parser3 = __esm({
|
|
|
124886
124885
|
};
|
|
124887
124886
|
}
|
|
124888
124887
|
const token = this.currentToken();
|
|
124889
|
-
if (
|
|
124888
|
+
if (token.type === "identifier" || token.type === "keyword") {
|
|
124890
124889
|
this.index += 1;
|
|
124891
|
-
const key3 =
|
|
124890
|
+
const key3 = createIdentifierName(token);
|
|
124892
124891
|
if (this.currentToken().type === "punctuator" && this.currentToken().value === "(") {
|
|
124893
124892
|
const value2 = this.parseObjectMethod(asyncToken, key3.span.start);
|
|
124894
124893
|
return {
|
|
@@ -124901,6 +124900,7 @@ var init_parser3 = __esm({
|
|
|
124901
124900
|
};
|
|
124902
124901
|
}
|
|
124903
124902
|
if (this.consumePunctuator(":") === void 0) {
|
|
124903
|
+
if (!isIdentifierLikeToken(token)) throw unexpectedTokenError(token);
|
|
124904
124904
|
assertAllowedIdentifierReference(token);
|
|
124905
124905
|
return {
|
|
124906
124906
|
type: "Property",
|
|
@@ -145253,6 +145253,147 @@ var init_error = __esm({
|
|
|
145253
145253
|
}
|
|
145254
145254
|
});
|
|
145255
145255
|
|
|
145256
|
+
// packages/safe-js/src/interp/globals/object.ts
|
|
145257
|
+
function createObjectGlobal(methods, budget) {
|
|
145258
|
+
const construct = ([value]) => {
|
|
145259
|
+
if (value === null || value === void 0) {
|
|
145260
|
+
budget.chargeDataUsage(1);
|
|
145261
|
+
return /* @__PURE__ */ Object.create(null);
|
|
145262
|
+
}
|
|
145263
|
+
if (typeof value !== "object") throw new TypeError("Object primitive boxing is not supported.");
|
|
145264
|
+
return value;
|
|
145265
|
+
};
|
|
145266
|
+
const constructor = createSandboxClosure({
|
|
145267
|
+
guest: true,
|
|
145268
|
+
sandbox: true,
|
|
145269
|
+
name: "Object",
|
|
145270
|
+
length: 1,
|
|
145271
|
+
call: construct,
|
|
145272
|
+
construct
|
|
145273
|
+
});
|
|
145274
|
+
const properties = materializeFunctionProperties(constructor);
|
|
145275
|
+
const prototype = properties.prototype;
|
|
145276
|
+
Object.defineProperty(properties, "prototype", { writable: false });
|
|
145277
|
+
for (const [name, method] of Object.entries(methods)) {
|
|
145278
|
+
Object.defineProperty(properties, name, { value: method, writable: true, configurable: true });
|
|
145279
|
+
}
|
|
145280
|
+
const prototypeMethods = {
|
|
145281
|
+
toString: createSandboxClosure({
|
|
145282
|
+
sandbox: true,
|
|
145283
|
+
name: "toString",
|
|
145284
|
+
length: 0,
|
|
145285
|
+
call: (_args, context) => budget.allocateString(`[object ${typeTag(context?.thisValue)}]`)
|
|
145286
|
+
}),
|
|
145287
|
+
valueOf: createSandboxClosure({
|
|
145288
|
+
sandbox: true,
|
|
145289
|
+
name: "valueOf",
|
|
145290
|
+
length: 0,
|
|
145291
|
+
call: (_args, context) => {
|
|
145292
|
+
const value = requireReceiver(context?.thisValue);
|
|
145293
|
+
if (typeof value !== "object")
|
|
145294
|
+
throw new TypeError("Object primitive boxing is not supported.");
|
|
145295
|
+
return value;
|
|
145296
|
+
}
|
|
145297
|
+
}),
|
|
145298
|
+
hasOwnProperty: createSandboxClosure({
|
|
145299
|
+
sandbox: true,
|
|
145300
|
+
name: "hasOwnProperty",
|
|
145301
|
+
length: 1,
|
|
145302
|
+
call: async ([key3], context) => hasOwnSandboxProperty(
|
|
145303
|
+
requireReceiver(context?.thisValue),
|
|
145304
|
+
await sandboxString(key3, budget, context),
|
|
145305
|
+
false
|
|
145306
|
+
)
|
|
145307
|
+
}),
|
|
145308
|
+
propertyIsEnumerable: createSandboxClosure({
|
|
145309
|
+
sandbox: true,
|
|
145310
|
+
name: "propertyIsEnumerable",
|
|
145311
|
+
length: 1,
|
|
145312
|
+
call: async ([key3], context) => hasOwnSandboxProperty(
|
|
145313
|
+
requireReceiver(context?.thisValue),
|
|
145314
|
+
await sandboxString(key3, budget, context),
|
|
145315
|
+
true
|
|
145316
|
+
)
|
|
145317
|
+
}),
|
|
145318
|
+
isPrototypeOf: createSandboxClosure({
|
|
145319
|
+
sandbox: true,
|
|
145320
|
+
name: "isPrototypeOf",
|
|
145321
|
+
length: 1,
|
|
145322
|
+
call: ([value], context) => {
|
|
145323
|
+
if (typeof value !== "object" || value === null) return false;
|
|
145324
|
+
const receiver = requireReceiver(context?.thisValue);
|
|
145325
|
+
let depth = 0;
|
|
145326
|
+
for (let current = getSandboxPrototype(value, budget); current !== null; current = getSandboxPrototype(current, budget)) {
|
|
145327
|
+
budget.visitNode();
|
|
145328
|
+
assertSandboxDataDepth(depth++);
|
|
145329
|
+
if (current === receiver) return true;
|
|
145330
|
+
}
|
|
145331
|
+
return false;
|
|
145332
|
+
}
|
|
145333
|
+
})
|
|
145334
|
+
};
|
|
145335
|
+
for (const [name, method] of Object.entries(prototypeMethods)) {
|
|
145336
|
+
Object.defineProperty(prototype, name, { value: method, writable: true, configurable: true });
|
|
145337
|
+
}
|
|
145338
|
+
markDescriptorObject(prototype);
|
|
145339
|
+
installObjectPrototype(budget, prototype, constructor);
|
|
145340
|
+
return constructor;
|
|
145341
|
+
}
|
|
145342
|
+
function requireReceiver(value) {
|
|
145343
|
+
if (value === null || value === void 0)
|
|
145344
|
+
throw new TypeError("Object method requires a non-null receiver.");
|
|
145345
|
+
return value;
|
|
145346
|
+
}
|
|
145347
|
+
function hasOwnSandboxProperty(value, key3, enumerable) {
|
|
145348
|
+
requireReceiver(value);
|
|
145349
|
+
if (isGuestHostObject(value)) return hasHostObjectMember(value, key3, enumerable);
|
|
145350
|
+
let properties;
|
|
145351
|
+
if (isGuestClosure(value)) properties = materializeFunctionProperties(value);
|
|
145352
|
+
else if (isSandboxClosure(value)) {
|
|
145353
|
+
if (key3 === "length" || key3 === "name") return !enumerable;
|
|
145354
|
+
properties = value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
145355
|
+
} else if (isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxGenerator(value))
|
|
145356
|
+
return false;
|
|
145357
|
+
else if (isSandboxRegex(value)) return key3 === "lastIndex" && !enumerable;
|
|
145358
|
+
else properties = Object(value);
|
|
145359
|
+
const descriptor = Object.getOwnPropertyDescriptor(properties, key3);
|
|
145360
|
+
return descriptor !== void 0 && (!enumerable || descriptor.enumerable === true);
|
|
145361
|
+
}
|
|
145362
|
+
function typeTag(value) {
|
|
145363
|
+
if (value === void 0) return "Undefined";
|
|
145364
|
+
if (value === null) return "Null";
|
|
145365
|
+
if (typeof value === "string") return "String";
|
|
145366
|
+
if (typeof value === "number") return "Number";
|
|
145367
|
+
if (typeof value === "boolean") return "Boolean";
|
|
145368
|
+
if (isSandboxClosure(value)) {
|
|
145369
|
+
while (value.boundTarget !== void 0) value = value.boundTarget;
|
|
145370
|
+
return value.generator ? "GeneratorFunction" : value.async ? "AsyncFunction" : "Function";
|
|
145371
|
+
}
|
|
145372
|
+
if (Array.isArray(value)) return "Array";
|
|
145373
|
+
if (isSandboxDate(value)) return "Date";
|
|
145374
|
+
if (isSandboxErrorConstructorInstance(value, "Error")) return "Error";
|
|
145375
|
+
if (isSandboxRegex(value)) return "RegExp";
|
|
145376
|
+
if (isSandboxMap(value)) return "Map";
|
|
145377
|
+
if (isSandboxSet(value)) return "Set";
|
|
145378
|
+
if (isSandboxPromise(value)) return "Promise";
|
|
145379
|
+
if (isSandboxGenerator(value)) return "Generator";
|
|
145380
|
+
if (isFloat32Array(value)) return "Float32Array";
|
|
145381
|
+
return "Object";
|
|
145382
|
+
}
|
|
145383
|
+
var init_object2 = __esm({
|
|
145384
|
+
"packages/safe-js/src/interp/globals/object.ts"() {
|
|
145385
|
+
"use strict";
|
|
145386
|
+
init_graph_depth();
|
|
145387
|
+
init_date();
|
|
145388
|
+
init_exceptions();
|
|
145389
|
+
init_float32();
|
|
145390
|
+
init_host_capabilities();
|
|
145391
|
+
init_object_model();
|
|
145392
|
+
init_string_coercion();
|
|
145393
|
+
init_values();
|
|
145394
|
+
}
|
|
145395
|
+
});
|
|
145396
|
+
|
|
145256
145397
|
// packages/safe-js/src/interp/globals/collections.ts
|
|
145257
145398
|
function createCollectionGlobals(options) {
|
|
145258
145399
|
const mapConstructor = createSandboxClosure({
|
|
@@ -146237,11 +146378,14 @@ async function evaluateBinaryExpression(node, context) {
|
|
|
146237
146378
|
if (right.kind !== "normal") {
|
|
146238
146379
|
return right;
|
|
146239
146380
|
}
|
|
146240
|
-
|
|
146241
|
-
|
|
146242
|
-
|
|
146243
|
-
|
|
146244
|
-
|
|
146381
|
+
let leftValue = left.value;
|
|
146382
|
+
if (node.operator === "in") {
|
|
146383
|
+
if (typeof right.value !== "object" || right.value === null) {
|
|
146384
|
+
throw new TypeError("Right-hand side of 'in' must be an object.");
|
|
146385
|
+
}
|
|
146386
|
+
leftValue = await toPropertyKey(leftValue, context);
|
|
146387
|
+
}
|
|
146388
|
+
const value = applyBinaryOperator(node, leftValue, right.value, context);
|
|
146245
146389
|
return {
|
|
146246
146390
|
kind: "normal",
|
|
146247
146391
|
hasValue: true,
|
|
@@ -147949,9 +148093,44 @@ function applyBinaryOperator(node, left, right, context) {
|
|
|
147949
148093
|
}
|
|
147950
148094
|
return false;
|
|
147951
148095
|
case "in":
|
|
147952
|
-
|
|
148096
|
+
return hasSandboxProperty(right, left, context);
|
|
147953
148097
|
}
|
|
147954
148098
|
}
|
|
148099
|
+
async function toPropertyKey(value, context) {
|
|
148100
|
+
if (isPlainSandboxObject(value) && !isSandboxDate(value) && !isFloat32Array(value) && !isSandboxGenerator(value) && !isGuestHostObject(value)) {
|
|
148101
|
+
for (const name of ["toString", "valueOf"]) {
|
|
148102
|
+
const method = getMemberValue(value, name, context);
|
|
148103
|
+
if (!isSandboxClosure(method)) continue;
|
|
148104
|
+
const primitive = await invokeSandboxClosure(method, [], context, context.callStack, void 0, value);
|
|
148105
|
+
if (primitive === null || typeof primitive !== "object") {
|
|
148106
|
+
return context.budget.allocateString(String(primitive));
|
|
148107
|
+
}
|
|
148108
|
+
}
|
|
148109
|
+
throw new TypeError("Cannot convert object to primitive value.");
|
|
148110
|
+
}
|
|
148111
|
+
return sandboxString(value, context.budget, {
|
|
148112
|
+
stack: context.callStack,
|
|
148113
|
+
thisValue: void 0,
|
|
148114
|
+
invokeClosure: (closure, args, thisValue) => invokeSandboxClosure(closure, args, context, context.callStack, void 0, thisValue)
|
|
148115
|
+
});
|
|
148116
|
+
}
|
|
148117
|
+
function hasSandboxProperty(value, key3, context) {
|
|
148118
|
+
let current = value;
|
|
148119
|
+
let depth = 0;
|
|
148120
|
+
while (typeof current === "object" && current !== null) {
|
|
148121
|
+
if (isGuestHostObject(current)) return hasHostObjectMember(current, key3);
|
|
148122
|
+
if (hasOwnSandboxProperty(current, key3, false)) return true;
|
|
148123
|
+
if (Array.isArray(current) || !isPlainSandboxObject(current) || isSandboxDate(current) || isFloat32Array(current) || isSandboxGenerator(current)) {
|
|
148124
|
+
return getPropertyValue(current, key3, context) !== void 0;
|
|
148125
|
+
}
|
|
148126
|
+
current = getSandboxPrototype(current, context.budget);
|
|
148127
|
+
if (current !== null) {
|
|
148128
|
+
context.budget.visitNode();
|
|
148129
|
+
assertSandboxDataDepth(++depth);
|
|
148130
|
+
}
|
|
148131
|
+
}
|
|
148132
|
+
return false;
|
|
148133
|
+
}
|
|
147955
148134
|
async function applyCompoundAssignmentOperator(operator, left, right, context) {
|
|
147956
148135
|
left = await toNumericPrimitive(left, context);
|
|
147957
148136
|
right = await toNumericPrimitive(right, context);
|
|
@@ -148507,6 +148686,7 @@ var init_interpreter = __esm({
|
|
|
148507
148686
|
init_string();
|
|
148508
148687
|
init_set();
|
|
148509
148688
|
init_error();
|
|
148689
|
+
init_object2();
|
|
148510
148690
|
init_collections();
|
|
148511
148691
|
init_float32array2();
|
|
148512
148692
|
init_float32();
|
|
@@ -150388,147 +150568,6 @@ var init_misc = __esm({
|
|
|
150388
150568
|
}
|
|
150389
150569
|
});
|
|
150390
150570
|
|
|
150391
|
-
// packages/safe-js/src/interp/globals/object.ts
|
|
150392
|
-
function createObjectGlobal(methods, budget) {
|
|
150393
|
-
const construct = ([value]) => {
|
|
150394
|
-
if (value === null || value === void 0) {
|
|
150395
|
-
budget.chargeDataUsage(1);
|
|
150396
|
-
return /* @__PURE__ */ Object.create(null);
|
|
150397
|
-
}
|
|
150398
|
-
if (typeof value !== "object") throw new TypeError("Object primitive boxing is not supported.");
|
|
150399
|
-
return value;
|
|
150400
|
-
};
|
|
150401
|
-
const constructor = createSandboxClosure({
|
|
150402
|
-
guest: true,
|
|
150403
|
-
sandbox: true,
|
|
150404
|
-
name: "Object",
|
|
150405
|
-
length: 1,
|
|
150406
|
-
call: construct,
|
|
150407
|
-
construct
|
|
150408
|
-
});
|
|
150409
|
-
const properties = materializeFunctionProperties(constructor);
|
|
150410
|
-
const prototype = properties.prototype;
|
|
150411
|
-
Object.defineProperty(properties, "prototype", { writable: false });
|
|
150412
|
-
for (const [name, method] of Object.entries(methods)) {
|
|
150413
|
-
Object.defineProperty(properties, name, { value: method, writable: true, configurable: true });
|
|
150414
|
-
}
|
|
150415
|
-
const prototypeMethods = {
|
|
150416
|
-
toString: createSandboxClosure({
|
|
150417
|
-
sandbox: true,
|
|
150418
|
-
name: "toString",
|
|
150419
|
-
length: 0,
|
|
150420
|
-
call: (_args, context) => budget.allocateString(`[object ${typeTag(context?.thisValue)}]`)
|
|
150421
|
-
}),
|
|
150422
|
-
valueOf: createSandboxClosure({
|
|
150423
|
-
sandbox: true,
|
|
150424
|
-
name: "valueOf",
|
|
150425
|
-
length: 0,
|
|
150426
|
-
call: (_args, context) => {
|
|
150427
|
-
const value = requireReceiver(context?.thisValue);
|
|
150428
|
-
if (typeof value !== "object")
|
|
150429
|
-
throw new TypeError("Object primitive boxing is not supported.");
|
|
150430
|
-
return value;
|
|
150431
|
-
}
|
|
150432
|
-
}),
|
|
150433
|
-
hasOwnProperty: createSandboxClosure({
|
|
150434
|
-
sandbox: true,
|
|
150435
|
-
name: "hasOwnProperty",
|
|
150436
|
-
length: 1,
|
|
150437
|
-
call: async ([key3], context) => hasOwnSandboxProperty(
|
|
150438
|
-
requireReceiver(context?.thisValue),
|
|
150439
|
-
await sandboxString(key3, budget, context),
|
|
150440
|
-
false
|
|
150441
|
-
)
|
|
150442
|
-
}),
|
|
150443
|
-
propertyIsEnumerable: createSandboxClosure({
|
|
150444
|
-
sandbox: true,
|
|
150445
|
-
name: "propertyIsEnumerable",
|
|
150446
|
-
length: 1,
|
|
150447
|
-
call: async ([key3], context) => hasOwnSandboxProperty(
|
|
150448
|
-
requireReceiver(context?.thisValue),
|
|
150449
|
-
await sandboxString(key3, budget, context),
|
|
150450
|
-
true
|
|
150451
|
-
)
|
|
150452
|
-
}),
|
|
150453
|
-
isPrototypeOf: createSandboxClosure({
|
|
150454
|
-
sandbox: true,
|
|
150455
|
-
name: "isPrototypeOf",
|
|
150456
|
-
length: 1,
|
|
150457
|
-
call: ([value], context) => {
|
|
150458
|
-
if (typeof value !== "object" || value === null) return false;
|
|
150459
|
-
const receiver = requireReceiver(context?.thisValue);
|
|
150460
|
-
let depth = 0;
|
|
150461
|
-
for (let current = getSandboxPrototype(value, budget); current !== null; current = getSandboxPrototype(current, budget)) {
|
|
150462
|
-
budget.visitNode();
|
|
150463
|
-
assertSandboxDataDepth(depth++);
|
|
150464
|
-
if (current === receiver) return true;
|
|
150465
|
-
}
|
|
150466
|
-
return false;
|
|
150467
|
-
}
|
|
150468
|
-
})
|
|
150469
|
-
};
|
|
150470
|
-
for (const [name, method] of Object.entries(prototypeMethods)) {
|
|
150471
|
-
Object.defineProperty(prototype, name, { value: method, writable: true, configurable: true });
|
|
150472
|
-
}
|
|
150473
|
-
markDescriptorObject(prototype);
|
|
150474
|
-
installObjectPrototype(budget, prototype, constructor);
|
|
150475
|
-
return constructor;
|
|
150476
|
-
}
|
|
150477
|
-
function requireReceiver(value) {
|
|
150478
|
-
if (value === null || value === void 0)
|
|
150479
|
-
throw new TypeError("Object method requires a non-null receiver.");
|
|
150480
|
-
return value;
|
|
150481
|
-
}
|
|
150482
|
-
function hasOwnSandboxProperty(value, key3, enumerable) {
|
|
150483
|
-
requireReceiver(value);
|
|
150484
|
-
if (isGuestHostObject(value)) return hasHostObjectMember(value, key3, enumerable);
|
|
150485
|
-
let properties;
|
|
150486
|
-
if (isGuestClosure(value)) properties = materializeFunctionProperties(value);
|
|
150487
|
-
else if (isSandboxClosure(value)) {
|
|
150488
|
-
if (key3 === "length" || key3 === "name") return !enumerable;
|
|
150489
|
-
properties = value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
150490
|
-
} else if (isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxGenerator(value))
|
|
150491
|
-
return false;
|
|
150492
|
-
else if (isSandboxRegex(value)) return key3 === "lastIndex" && !enumerable;
|
|
150493
|
-
else properties = Object(value);
|
|
150494
|
-
const descriptor = Object.getOwnPropertyDescriptor(properties, key3);
|
|
150495
|
-
return descriptor !== void 0 && (!enumerable || descriptor.enumerable === true);
|
|
150496
|
-
}
|
|
150497
|
-
function typeTag(value) {
|
|
150498
|
-
if (value === void 0) return "Undefined";
|
|
150499
|
-
if (value === null) return "Null";
|
|
150500
|
-
if (typeof value === "string") return "String";
|
|
150501
|
-
if (typeof value === "number") return "Number";
|
|
150502
|
-
if (typeof value === "boolean") return "Boolean";
|
|
150503
|
-
if (isSandboxClosure(value)) {
|
|
150504
|
-
while (value.boundTarget !== void 0) value = value.boundTarget;
|
|
150505
|
-
return value.generator ? "GeneratorFunction" : value.async ? "AsyncFunction" : "Function";
|
|
150506
|
-
}
|
|
150507
|
-
if (Array.isArray(value)) return "Array";
|
|
150508
|
-
if (isSandboxDate(value)) return "Date";
|
|
150509
|
-
if (isSandboxErrorConstructorInstance(value, "Error")) return "Error";
|
|
150510
|
-
if (isSandboxRegex(value)) return "RegExp";
|
|
150511
|
-
if (isSandboxMap(value)) return "Map";
|
|
150512
|
-
if (isSandboxSet(value)) return "Set";
|
|
150513
|
-
if (isSandboxPromise(value)) return "Promise";
|
|
150514
|
-
if (isSandboxGenerator(value)) return "Generator";
|
|
150515
|
-
if (isFloat32Array(value)) return "Float32Array";
|
|
150516
|
-
return "Object";
|
|
150517
|
-
}
|
|
150518
|
-
var init_object2 = __esm({
|
|
150519
|
-
"packages/safe-js/src/interp/globals/object.ts"() {
|
|
150520
|
-
"use strict";
|
|
150521
|
-
init_graph_depth();
|
|
150522
|
-
init_date();
|
|
150523
|
-
init_exceptions();
|
|
150524
|
-
init_float32();
|
|
150525
|
-
init_host_capabilities();
|
|
150526
|
-
init_object_model();
|
|
150527
|
-
init_string_coercion();
|
|
150528
|
-
init_values();
|
|
150529
|
-
}
|
|
150530
|
-
});
|
|
150531
|
-
|
|
150532
150571
|
// packages/safe-js/src/interp/globals/object-array.ts
|
|
150533
150572
|
function createObjectArrayGlobals(options) {
|
|
150534
150573
|
return {
|