@poe-platform/safe-js 0.1.447 → 0.1.449
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-RN5KVZJA.js → chunk-264RHYEA.js} +229 -25
- package/dist/safe-js/chunks/chunk-264RHYEA.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-CABKDQ4L.js → chunk-FOE6VBOD.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/intl-collator.d.ts +20 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +6 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-RN5KVZJA.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-CABKDQ4L.js.map → chunk-FOE6VBOD.js.map} +0 -0
|
@@ -8525,6 +8525,8 @@ var functionPrototypes = /* @__PURE__ */ new WeakMap();
|
|
|
8525
8525
|
var initialArrayMethods = /* @__PURE__ */ new WeakMap();
|
|
8526
8526
|
var initialRegexDescriptors = /* @__PURE__ */ new WeakMap();
|
|
8527
8527
|
var intrinsicPrototypeRoots = /* @__PURE__ */ new WeakMap();
|
|
8528
|
+
var intrinsicRetentionTargets = /* @__PURE__ */ new WeakMap();
|
|
8529
|
+
var intrinsicRetentionGroups = /* @__PURE__ */ new WeakMap();
|
|
8528
8530
|
var intrinsicConstructors = /* @__PURE__ */ new WeakMap();
|
|
8529
8531
|
var intrinsicFunctions = /* @__PURE__ */ new WeakSet();
|
|
8530
8532
|
var initialBoxedMethods = /* @__PURE__ */ new WeakMap();
|
|
@@ -8701,11 +8703,16 @@ function registerIntrinsicObject(budget, value, trackMethods = true) {
|
|
|
8701
8703
|
const methods2 = trackMethods ? Object.values(Object.getOwnPropertyDescriptors(value)).map((descriptor) => descriptor.value).filter(isGuestClosure) : [];
|
|
8702
8704
|
trackIntrinsicState(budget, value, value, [value, ...methods2]);
|
|
8703
8705
|
}
|
|
8704
|
-
function
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8706
|
+
function completeIntrinsicObjectInitialization(budget, value) {
|
|
8707
|
+
for (const records of intrinsicRetentionGroups.get(budget)?.values() ?? []) {
|
|
8708
|
+
const record4 = records.find((record5) => record5.target === value);
|
|
8709
|
+
if (record4 === void 0) continue;
|
|
8710
|
+
Object.assign(record4, captureIntrinsicRecords([value])[0]);
|
|
8711
|
+
return;
|
|
8712
|
+
}
|
|
8713
|
+
}
|
|
8714
|
+
function captureIntrinsicRecords(targets) {
|
|
8715
|
+
return [...new Set(targets)].map((target) => {
|
|
8709
8716
|
let tracked = trackedPrototypes.get(target);
|
|
8710
8717
|
if (tracked === void 0) {
|
|
8711
8718
|
tracked = { current: getSandboxPrototype(target) };
|
|
@@ -8726,6 +8733,12 @@ function trackIntrinsicState(budget, root, owner, targets) {
|
|
|
8726
8733
|
extensible: Object.isExtensible(record4.value),
|
|
8727
8734
|
descriptors: new Map(Reflect.ownKeys(record4.value).map((key) => [key, Object.getOwnPropertyDescriptor(record4.value, key)]))
|
|
8728
8735
|
}));
|
|
8736
|
+
}
|
|
8737
|
+
function trackIntrinsicState(budget, root, owner, targets) {
|
|
8738
|
+
let roots = intrinsicPrototypeRoots.get(budget);
|
|
8739
|
+
if (roots === void 0) intrinsicPrototypeRoots.set(budget, roots = /* @__PURE__ */ new Set());
|
|
8740
|
+
roots.add(root);
|
|
8741
|
+
const records = captureIntrinsicRecords(targets);
|
|
8729
8742
|
for (const { target } of records)
|
|
8730
8743
|
if (isGuestClosure(target)) intrinsicFunctions.add(target);
|
|
8731
8744
|
const unchanged = (before, after) => before !== void 0 && after !== void 0 && Object.is(before.value, after.value) && before.get === after.get && before.set === after.set && before.writable === after.writable && before.configurable === after.configurable && before.enumerable === after.enumerable;
|
|
@@ -8736,9 +8749,21 @@ function trackIntrinsicState(budget, root, owner, targets) {
|
|
|
8736
8749
|
return getSandboxPrototype(target) === parent && Object.isExtensible(value) === extensible && hasExplicitSandboxPrototype(target) === explicit && Reflect.ownKeys(current).length === descriptors2.size && Reflect.ownKeys(value).every((key) => unchanged(descriptors2.get(key), Object.getOwnPropertyDescriptor(value, key)));
|
|
8737
8750
|
})
|
|
8738
8751
|
);
|
|
8752
|
+
let retainedTargets = intrinsicRetentionTargets.get(budget);
|
|
8753
|
+
if (retainedTargets === void 0) intrinsicRetentionTargets.set(budget, retainedTargets = /* @__PURE__ */ new WeakSet());
|
|
8754
|
+
let groups = intrinsicRetentionGroups.get(budget);
|
|
8755
|
+
if (groups === void 0) intrinsicRetentionGroups.set(budget, groups = /* @__PURE__ */ new Map());
|
|
8756
|
+
let retainedRecords = groups.get(root);
|
|
8757
|
+
if (retainedRecords === void 0) groups.set(root, retainedRecords = []);
|
|
8758
|
+
for (const record4 of records) {
|
|
8759
|
+
if (retainedTargets.has(record4.target)) continue;
|
|
8760
|
+
retainedTargets.add(record4.target);
|
|
8761
|
+
retainedRecords.push(record4);
|
|
8762
|
+
}
|
|
8763
|
+
if (retainedRecords.length === 0) return;
|
|
8739
8764
|
budget.setRetainedValues(root, () => {
|
|
8740
8765
|
const retained = [];
|
|
8741
|
-
for (const record4 of
|
|
8766
|
+
for (const record4 of retainedRecords) {
|
|
8742
8767
|
const { value, descriptors: descriptors2, prototype: parent, revision } = record4;
|
|
8743
8768
|
const currentPrototype = record4.tracked.current;
|
|
8744
8769
|
if (currentPrototype !== parent) retained.push(currentPrototype);
|
|
@@ -8762,6 +8787,8 @@ function releaseObjectPrototype(budget) {
|
|
|
8762
8787
|
releaseIntrinsicIdentities(budget);
|
|
8763
8788
|
for (const prototype of intrinsicPrototypeRoots.get(budget) ?? []) budget.setRetainedValues(prototype, void 0);
|
|
8764
8789
|
intrinsicPrototypeRoots.delete(budget);
|
|
8790
|
+
intrinsicRetentionTargets.delete(budget);
|
|
8791
|
+
intrinsicRetentionGroups.delete(budget);
|
|
8765
8792
|
boxedPrototypes.delete(budget);
|
|
8766
8793
|
regexPrototypes.delete(budget);
|
|
8767
8794
|
collectionPrototypes.delete(budget);
|
|
@@ -12349,8 +12376,12 @@ function formatNumber(value, methodName, argument, budget) {
|
|
|
12349
12376
|
// packages/safe-js/src/interp/methods/string.ts
|
|
12350
12377
|
import { types as types7 } from "node:util";
|
|
12351
12378
|
|
|
12352
|
-
// packages/safe-js/src/interp/
|
|
12353
|
-
var
|
|
12379
|
+
// packages/safe-js/src/interp/intl-collator.ts
|
|
12380
|
+
var NativeCollator = Intl.Collator;
|
|
12381
|
+
var nativeResolvedOptions = NativeCollator.prototype.resolvedOptions;
|
|
12382
|
+
var nativeCompare = Object.getOwnPropertyDescriptor(NativeCollator.prototype, "compare").get;
|
|
12383
|
+
var states5 = /* @__PURE__ */ new WeakMap();
|
|
12384
|
+
var optionTypes = [
|
|
12354
12385
|
["usage", ["sort", "search"]],
|
|
12355
12386
|
["localeMatcher", ["lookup", "best fit"]],
|
|
12356
12387
|
["collation", "unicodeType"],
|
|
@@ -12359,6 +12390,50 @@ var collatorOptions = [
|
|
|
12359
12390
|
["sensitivity", ["base", "accent", "case", "variant"]],
|
|
12360
12391
|
["ignorePunctuation", "boolean"]
|
|
12361
12392
|
];
|
|
12393
|
+
async function readCollatorOptions(input, budget, context, invalid) {
|
|
12394
|
+
const source = intlOptionsObject(input, budget);
|
|
12395
|
+
const options = /* @__PURE__ */ Object.create(null);
|
|
12396
|
+
const release = retainValues(budget, () => [source, options]);
|
|
12397
|
+
try {
|
|
12398
|
+
for (const [key, type] of optionTypes) {
|
|
12399
|
+
const value = await readIntlProperty(source, key, budget, context);
|
|
12400
|
+
if (value !== void 0) options[key] = await convertIntlOption(
|
|
12401
|
+
value,
|
|
12402
|
+
key,
|
|
12403
|
+
type,
|
|
12404
|
+
budget,
|
|
12405
|
+
context,
|
|
12406
|
+
(text) => {
|
|
12407
|
+
invalid?.(key, text);
|
|
12408
|
+
new NativeCollator([], { [key]: text });
|
|
12409
|
+
}
|
|
12410
|
+
);
|
|
12411
|
+
}
|
|
12412
|
+
return options;
|
|
12413
|
+
} finally {
|
|
12414
|
+
release();
|
|
12415
|
+
}
|
|
12416
|
+
}
|
|
12417
|
+
function createSandboxCollator(locales2, options) {
|
|
12418
|
+
const native = new NativeCollator(locales2, options);
|
|
12419
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
12420
|
+
states5.set(value, { native, options: Reflect.apply(nativeResolvedOptions, native, []) });
|
|
12421
|
+
return value;
|
|
12422
|
+
}
|
|
12423
|
+
function isSandboxCollator(value) {
|
|
12424
|
+
return typeof value === "object" && value !== null && states5.has(value);
|
|
12425
|
+
}
|
|
12426
|
+
function collatorState(value) {
|
|
12427
|
+
if (!isSandboxCollator(value)) throw new TypeError("Intl.Collator requires a Collator receiver.");
|
|
12428
|
+
return states5.get(value);
|
|
12429
|
+
}
|
|
12430
|
+
function compareCollatorStrings(value, first, second) {
|
|
12431
|
+
const state = collatorState(value);
|
|
12432
|
+
const compare = Reflect.apply(nativeCompare, state.native, []);
|
|
12433
|
+
return Reflect.apply(compare, void 0, [first, second]);
|
|
12434
|
+
}
|
|
12435
|
+
|
|
12436
|
+
// packages/safe-js/src/interp/methods/string-locale.ts
|
|
12362
12437
|
async function changeStringLocaleCase(value, method, args, budget, context) {
|
|
12363
12438
|
let locales2 = [];
|
|
12364
12439
|
const release = retainValues(budget, () => [value, locales2]);
|
|
@@ -12373,19 +12448,15 @@ async function changeStringLocaleCase(value, method, args, budget, context) {
|
|
|
12373
12448
|
async function compareStringLocale(value, args, budget, context) {
|
|
12374
12449
|
let comparison = "";
|
|
12375
12450
|
let locales2 = [];
|
|
12376
|
-
|
|
12451
|
+
let options = /* @__PURE__ */ Object.create(null);
|
|
12377
12452
|
const release = retainValues(budget, () => [value, comparison, locales2, options]);
|
|
12378
12453
|
try {
|
|
12379
12454
|
comparison = await sandboxString(args[0], budget, context);
|
|
12380
12455
|
locales2 = await canonicalizeGuestLocales(args[1], budget, context);
|
|
12381
12456
|
if (args[2] === null) return Reflect.apply(String.prototype.localeCompare, value, [comparison, locales2, null]);
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
if (option !== void 0) options[key] = await convertIntlOption(option, key, type, budget, context, (text) => {
|
|
12386
|
-
Reflect.apply(String.prototype.localeCompare, "", ["", [], { [key]: text }]);
|
|
12387
|
-
});
|
|
12388
|
-
}
|
|
12457
|
+
options = await readCollatorOptions(args[2], budget, context, (key, text) => {
|
|
12458
|
+
Reflect.apply(String.prototype.localeCompare, "", ["", [], { [key]: text }]);
|
|
12459
|
+
});
|
|
12389
12460
|
budget.visitNode(value.length + comparison.length);
|
|
12390
12461
|
return Reflect.apply(String.prototype.localeCompare, value, [comparison, locales2, options]);
|
|
12391
12462
|
} finally {
|
|
@@ -21145,7 +21216,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
21145
21216
|
}
|
|
21146
21217
|
const updated = Object.values(base).filter((value) => value !== void 0).join("-") + canonical.slice(native.baseName.length);
|
|
21147
21218
|
const extension = unicodeKeywords(updated);
|
|
21148
|
-
const
|
|
21219
|
+
const optionTypes2 = [
|
|
21149
21220
|
["calendar", "ca", "unicodeType"],
|
|
21150
21221
|
["collation", "co", "unicodeType"],
|
|
21151
21222
|
["firstDayOfWeek", "fw", "unicodeType"],
|
|
@@ -21154,7 +21225,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
21154
21225
|
["numeric", "kn", "boolean"],
|
|
21155
21226
|
["numberingSystem", "nu", "unicodeType"]
|
|
21156
21227
|
];
|
|
21157
|
-
for (const [key, extensionKey, type] of
|
|
21228
|
+
for (const [key, extensionKey, type] of optionTypes2) {
|
|
21158
21229
|
let value = await readIntlProperty(options, key, budget, context);
|
|
21159
21230
|
if (value === void 0) continue;
|
|
21160
21231
|
if (key === "firstDayOfWeek") {
|
|
@@ -21513,6 +21584,10 @@ function captureGuestHeapNode(value, encode) {
|
|
|
21513
21584
|
return void 0;
|
|
21514
21585
|
}
|
|
21515
21586
|
if (isSandboxLocale(value)) return { kind: "guest-locale", tag: localeTag(value), state: captureObjectState(value, encode) };
|
|
21587
|
+
if (isSandboxCollator(value)) {
|
|
21588
|
+
const { options, compare } = collatorState(value);
|
|
21589
|
+
return { kind: "guest-collator", options: { ...options }, ...compare === void 0 ? {} : { compare: encode(compare) }, state: captureObjectState(value, encode) };
|
|
21590
|
+
}
|
|
21516
21591
|
if (hasGuestObjectState(value) || privateElements.has(value)) {
|
|
21517
21592
|
if (isSandboxRegex(value)) return { kind: "guest-regex", source: value.source, flags: value.flags, state: captureObjectState(value, encode) };
|
|
21518
21593
|
if (isSandboxBox(value)) return { kind: "guest-boxed", value: encode(boxedValue(value)), state: captureObjectState(value, encode) };
|
|
@@ -24791,6 +24866,7 @@ function createIteratorGlobal(budget) {
|
|
|
24791
24866
|
installIteratorConsumers(prototype, budget);
|
|
24792
24867
|
installLazyIteratorHelpers(prototype, budget);
|
|
24793
24868
|
registerIntrinsicFunction(budget, constructor);
|
|
24869
|
+
completeIntrinsicObjectInitialization(budget, prototype);
|
|
24794
24870
|
registerIntrinsicObject(budget, prototype);
|
|
24795
24871
|
return constructor;
|
|
24796
24872
|
}
|
|
@@ -25714,6 +25790,107 @@ function createLocaleConstructor(budget) {
|
|
|
25714
25790
|
return constructor;
|
|
25715
25791
|
}
|
|
25716
25792
|
|
|
25793
|
+
// packages/safe-js/src/interp/globals/intl-collator.ts
|
|
25794
|
+
var supportedLocalesOf = Intl.Collator.supportedLocalesOf;
|
|
25795
|
+
function createCollatorConstructor(budget) {
|
|
25796
|
+
const prototype = createIntrinsicObject();
|
|
25797
|
+
const compareTarget = createSandboxClosure({
|
|
25798
|
+
guest: true,
|
|
25799
|
+
sandbox: true,
|
|
25800
|
+
name: "",
|
|
25801
|
+
length: 2,
|
|
25802
|
+
call: async ([first, second], context) => {
|
|
25803
|
+
let left = "";
|
|
25804
|
+
const release = retainValues(budget, () => [context?.thisValue, left]);
|
|
25805
|
+
try {
|
|
25806
|
+
left = await sandboxString(first, budget, context);
|
|
25807
|
+
const right = await sandboxString(second, budget, context);
|
|
25808
|
+
budget.visitNode(left.length + right.length);
|
|
25809
|
+
return compareCollatorStrings(context?.thisValue, left, right);
|
|
25810
|
+
} finally {
|
|
25811
|
+
release();
|
|
25812
|
+
}
|
|
25813
|
+
}
|
|
25814
|
+
});
|
|
25815
|
+
registerBuiltinIdentities(budget, { "%CollatorCompare%": compareTarget });
|
|
25816
|
+
registerIntrinsicFunction(budget, compareTarget);
|
|
25817
|
+
const initialize = async ([input, options], context) => {
|
|
25818
|
+
const target = context?.newTarget;
|
|
25819
|
+
const selected = target === void 0 || target === constructor ? prototype : context?.getProperty !== void 0 ? await context.getProperty(target, "prototype") : await readPropertyDescriptor(getSandboxPropertyDescriptor(target, "prototype", budget) ?? { value: void 0 }, target, context);
|
|
25820
|
+
let locales2 = [];
|
|
25821
|
+
const release = retainValues(budget, () => [selected, locales2]);
|
|
25822
|
+
try {
|
|
25823
|
+
locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
25824
|
+
const converted = await readCollatorOptions(options, budget, context);
|
|
25825
|
+
const value = createSandboxCollator(locales2, converted);
|
|
25826
|
+
setSandboxPrototype(value, typeof selected === "object" && selected !== null ? selected : prototype, budget);
|
|
25827
|
+
return allocateProducedSandboxValue(value, budget);
|
|
25828
|
+
} finally {
|
|
25829
|
+
release();
|
|
25830
|
+
}
|
|
25831
|
+
};
|
|
25832
|
+
const constructor = createSandboxClosure({
|
|
25833
|
+
guest: true,
|
|
25834
|
+
sandbox: true,
|
|
25835
|
+
name: "Collator",
|
|
25836
|
+
length: 0,
|
|
25837
|
+
construct: initialize,
|
|
25838
|
+
call: (args, context) => initialize(args, { ...context, stack: context?.stack ?? [], thisValue: context?.thisValue, newTarget: void 0 })
|
|
25839
|
+
});
|
|
25840
|
+
const properties = materializeFunctionProperties(constructor);
|
|
25841
|
+
Object.defineProperty(properties, "prototype", { value: prototype, writable: false, configurable: false });
|
|
25842
|
+
Object.defineProperty(properties, "supportedLocalesOf", { value: createSandboxClosure({
|
|
25843
|
+
guest: true,
|
|
25844
|
+
sandbox: true,
|
|
25845
|
+
name: "supportedLocalesOf",
|
|
25846
|
+
length: 1,
|
|
25847
|
+
call: async ([input, options], context) => {
|
|
25848
|
+
const locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
25849
|
+
const release = retainValues(budget, () => [locales2]);
|
|
25850
|
+
try {
|
|
25851
|
+
const source = intlOptionsObject(options, budget);
|
|
25852
|
+
const option = await readIntlProperty(source, "localeMatcher", budget, context);
|
|
25853
|
+
const matcher = option === void 0 ? void 0 : await convertIntlOption(option, "localeMatcher", ["lookup", "best fit"], budget, context);
|
|
25854
|
+
return allocateProducedSandboxValue(supportedLocalesOf(locales2, { localeMatcher: matcher }), budget);
|
|
25855
|
+
} finally {
|
|
25856
|
+
release();
|
|
25857
|
+
}
|
|
25858
|
+
}
|
|
25859
|
+
}), writable: true, configurable: true });
|
|
25860
|
+
Object.defineProperties(prototype, {
|
|
25861
|
+
constructor: { value: constructor, writable: true, configurable: true },
|
|
25862
|
+
[Symbol.toStringTag]: { value: "Intl.Collator", configurable: true },
|
|
25863
|
+
resolvedOptions: { value: createSandboxClosure({
|
|
25864
|
+
guest: true,
|
|
25865
|
+
sandbox: true,
|
|
25866
|
+
name: "resolvedOptions",
|
|
25867
|
+
length: 0,
|
|
25868
|
+
call: (_args, context) => allocateProducedSandboxValue({ ...collatorState(context?.thisValue).options }, budget)
|
|
25869
|
+
}), writable: true, configurable: true },
|
|
25870
|
+
compare: { get: accessorAdapter(createSandboxClosure({
|
|
25871
|
+
guest: true,
|
|
25872
|
+
sandbox: true,
|
|
25873
|
+
name: "get compare",
|
|
25874
|
+
length: 0,
|
|
25875
|
+
call: (_args, context) => {
|
|
25876
|
+
const receiver = context?.thisValue;
|
|
25877
|
+
const state = collatorState(receiver);
|
|
25878
|
+
if (state.compare === void 0) {
|
|
25879
|
+
state.compare = createBoundFunction(
|
|
25880
|
+
{ target: compareTarget, thisValue: receiver, args: [] },
|
|
25881
|
+
"",
|
|
25882
|
+
2,
|
|
25883
|
+
(target, args, stack, thisValue) => invokeBuiltinClosure(target, args, budget, { stack, thisValue }, thisValue)
|
|
25884
|
+
);
|
|
25885
|
+
allocateProducedSandboxValue(state.compare, budget);
|
|
25886
|
+
}
|
|
25887
|
+
return state.compare;
|
|
25888
|
+
}
|
|
25889
|
+
}), "get"), configurable: true }
|
|
25890
|
+
});
|
|
25891
|
+
return constructor;
|
|
25892
|
+
}
|
|
25893
|
+
|
|
25717
25894
|
// packages/safe-js/src/interp/globals/intl.ts
|
|
25718
25895
|
var supportedValuesOf = Intl.supportedValuesOf;
|
|
25719
25896
|
function createIntlGlobal(budget) {
|
|
@@ -25727,18 +25904,23 @@ function createIntlGlobal(budget) {
|
|
|
25727
25904
|
};
|
|
25728
25905
|
const intl = createIntrinsicObject();
|
|
25729
25906
|
const locale = createLocaleConstructor(budget);
|
|
25907
|
+
const collator = createCollatorConstructor(budget);
|
|
25730
25908
|
Object.defineProperty(intl, "Locale", { value: locale, writable: true, configurable: true });
|
|
25909
|
+
Object.defineProperty(intl, "Collator", { value: collator, writable: true, configurable: true });
|
|
25731
25910
|
for (const [name, call] of Object.entries(methods2)) {
|
|
25732
25911
|
const closure = createSandboxClosure({ guest: true, sandbox: true, name, length: 1, call });
|
|
25733
25912
|
Object.defineProperty(intl, name, { value: closure, writable: true, configurable: true });
|
|
25734
25913
|
}
|
|
25735
25914
|
Object.defineProperty(intl, Symbol.toStringTag, { value: "Intl", configurable: true });
|
|
25736
25915
|
registerBuiltinIdentities(budget, { Intl: intl });
|
|
25737
|
-
const
|
|
25738
|
-
|
|
25739
|
-
for (const
|
|
25740
|
-
|
|
25741
|
-
|
|
25916
|
+
for (const constructor of [locale, collator]) {
|
|
25917
|
+
const prototype = constructor.properties.prototype;
|
|
25918
|
+
for (const owner of [prototype, constructor.properties])
|
|
25919
|
+
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(owner)))
|
|
25920
|
+
for (const closure of [descriptor.value, ...retainedAccessorClosures(descriptor)])
|
|
25921
|
+
if (isSandboxClosure(closure)) registerIntrinsicFunction(budget, closure);
|
|
25922
|
+
registerIntrinsicObject(budget, prototype);
|
|
25923
|
+
}
|
|
25742
25924
|
for (const name of Object.keys(methods2)) registerIntrinsicFunction(budget, intl[name]);
|
|
25743
25925
|
registerIntrinsicObject(budget, intl);
|
|
25744
25926
|
return intl;
|
|
@@ -25848,7 +26030,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
25848
26030
|
createRawJson(node.text);
|
|
25849
26031
|
return true;
|
|
25850
26032
|
}
|
|
25851
|
-
if (!["module-function", "async-generator-driver", "async-generator-handler", "async-function-driver", "async-function-handler", "thenable-state", "thenable-resolver", "construction-environment", "capability-executor", "promise-aggregate", "aggregate-entry", "aggregate-handler", "intrinsic", "bound-function", "promise-resolver", "pending-promise", "promise-reaction", "promise-adoption", "adoption-resolver", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-locale", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "async-disposable-stack", "async-cleanup", "async-cleanup-handler", "disposable-stack", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
26033
|
+
if (!["module-function", "async-generator-driver", "async-generator-handler", "async-function-driver", "async-function-handler", "thenable-state", "thenable-resolver", "construction-environment", "capability-executor", "promise-aggregate", "aggregate-entry", "aggregate-handler", "intrinsic", "bound-function", "promise-resolver", "pending-promise", "promise-reaction", "promise-adoption", "adoption-resolver", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-locale", "guest-collator", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "async-disposable-stack", "async-cleanup", "async-cleanup-handler", "disposable-stack", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
25852
26034
|
const reference = (value, kinds) => {
|
|
25853
26035
|
const ref = record2(value);
|
|
25854
26036
|
fields(ref, ["kind", "id"]);
|
|
@@ -26117,6 +26299,23 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
26117
26299
|
fields(node, ["kind", "source", "flags", "state"]);
|
|
26118
26300
|
if (typeof node.source !== "string" || typeof node.flags !== "string") throw new TypeError("Invalid guest RegExp payload.");
|
|
26119
26301
|
state(node.state);
|
|
26302
|
+
} else if (node.kind === "guest-collator") {
|
|
26303
|
+
fields(node, ["kind", "options", "state"], ["compare"]);
|
|
26304
|
+
const options = record2(node.options);
|
|
26305
|
+
const names = ["locale", "usage", "sensitivity", "ignorePunctuation", "collation", "numeric", "caseFirst"];
|
|
26306
|
+
fields(options, names);
|
|
26307
|
+
for (const key of names)
|
|
26308
|
+
if (typeof options[key] !== (key === "numeric" || key === "ignorePunctuation" ? "boolean" : "string"))
|
|
26309
|
+
throw new TypeError("Invalid Collator option type.");
|
|
26310
|
+
const restored = collatorState(createSandboxCollator(options.locale, options)).options;
|
|
26311
|
+
for (const key of names)
|
|
26312
|
+
if (options[key] !== restored[key]) throw new TypeError("Invalid resolved Collator options.");
|
|
26313
|
+
if (node.compare !== void 0) {
|
|
26314
|
+
const compare = reference(node.compare, ["bound-function"]);
|
|
26315
|
+
if (reference(compare.thisValue) !== node || array(compare.args).length !== 0 || compare.name !== "" || compare.length !== 2 || reference(compare.target, ["intrinsic"]).id !== '["%CollatorCompare%"]')
|
|
26316
|
+
throw new TypeError("Invalid cached Collator comparison.");
|
|
26317
|
+
}
|
|
26318
|
+
state(node.state);
|
|
26120
26319
|
} else if (node.kind === "guest-locale") {
|
|
26121
26320
|
fields(node, ["kind", "tag", "state"]);
|
|
26122
26321
|
if (typeof node.tag !== "string" || localeTag(createSandboxLocale(node.tag)) !== node.tag)
|
|
@@ -29855,6 +30054,11 @@ function measureSandboxData(values, options = {}) {
|
|
|
29855
30054
|
}
|
|
29856
30055
|
if (isSandboxDate(value)) usage += 8;
|
|
29857
30056
|
if (isSandboxLocale(value)) usage += localeTag(value).length;
|
|
30057
|
+
if (isSandboxCollator(value)) {
|
|
30058
|
+
const state = collatorState(value);
|
|
30059
|
+
visit(state.options, depth + 1);
|
|
30060
|
+
visit(state.compare, depth + 1);
|
|
30061
|
+
}
|
|
29858
30062
|
if (isGuestHostObject(value)) {
|
|
29859
30063
|
usage += measureHostObjectData(value);
|
|
29860
30064
|
return;
|
|
@@ -47818,4 +48022,4 @@ export {
|
|
|
47818
48022
|
FileSnapshotBackend,
|
|
47819
48023
|
run
|
|
47820
48024
|
};
|
|
47821
|
-
//# sourceMappingURL=chunk-
|
|
48025
|
+
//# sourceMappingURL=chunk-264RHYEA.js.map
|