@poe-platform/safe-js 0.1.452 → 0.1.453
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-6WDZNRKU.js → chunk-CEBPHXBL.js} +2 -2
- package/dist/safe-js/chunks/{chunk-GJPSM3AB.js → chunk-E2VDSNJC.js} +142 -12
- package/dist/safe-js/chunks/{chunk-GJPSM3AB.js.map → chunk-E2VDSNJC.js.map} +4 -4
- 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-relativetimeformat.d.ts +18 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +5 -0
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-6WDZNRKU.js.map → chunk-CEBPHXBL.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-E2VDSNJC.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-CEBPHXBL.js.map
|
|
@@ -28545,7 +28545,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
28545
28545
|
}
|
|
28546
28546
|
const updated = Object.values(base).filter((value) => value !== void 0).join("-") + canonical.slice(native.baseName.length);
|
|
28547
28547
|
const extension = unicodeKeywords(updated);
|
|
28548
|
-
const
|
|
28548
|
+
const optionTypes4 = [
|
|
28549
28549
|
["calendar", "ca", "unicodeType"],
|
|
28550
28550
|
["collation", "co", "unicodeType"],
|
|
28551
28551
|
["firstDayOfWeek", "fw", "unicodeType"],
|
|
@@ -28554,7 +28554,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
28554
28554
|
["numeric", "kn", "boolean"],
|
|
28555
28555
|
["numberingSystem", "nu", "unicodeType"]
|
|
28556
28556
|
];
|
|
28557
|
-
for (const [key, extensionKey, type] of
|
|
28557
|
+
for (const [key, extensionKey, type] of optionTypes4) {
|
|
28558
28558
|
let value = await readIntlProperty(options, key, budget, context);
|
|
28559
28559
|
if (value === void 0) continue;
|
|
28560
28560
|
if (key === "firstDayOfWeek") {
|
|
@@ -28597,20 +28597,43 @@ function formatList(value, strings, parts) {
|
|
|
28597
28597
|
return Reflect.apply(parts ? formatToParts2 : format, listFormatState(value).native, [strings]);
|
|
28598
28598
|
}
|
|
28599
28599
|
|
|
28600
|
-
// packages/safe-js/src/interp/intl-
|
|
28600
|
+
// packages/safe-js/src/interp/intl-relativetimeformat.ts
|
|
28601
|
+
var NativeRelativeTimeFormat = Intl.RelativeTimeFormat;
|
|
28602
|
+
var resolvedOptions3 = NativeRelativeTimeFormat.prototype.resolvedOptions;
|
|
28603
|
+
var format2 = NativeRelativeTimeFormat.prototype.format;
|
|
28604
|
+
var formatToParts3 = NativeRelativeTimeFormat.prototype.formatToParts;
|
|
28601
28605
|
var states7 = /* @__PURE__ */ new WeakMap();
|
|
28606
|
+
function createSandboxRelativeTimeFormat(locales2, options) {
|
|
28607
|
+
const native = new NativeRelativeTimeFormat(locales2, options);
|
|
28608
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
28609
|
+
states7.set(value, { native, options: Reflect.apply(resolvedOptions3, native, []) });
|
|
28610
|
+
return value;
|
|
28611
|
+
}
|
|
28612
|
+
function isSandboxRelativeTimeFormat(value) {
|
|
28613
|
+
return typeof value === "object" && value !== null && states7.has(value);
|
|
28614
|
+
}
|
|
28615
|
+
function relativeTimeFormatState(value) {
|
|
28616
|
+
if (!isSandboxRelativeTimeFormat(value)) throw new TypeError("Intl.RelativeTimeFormat requires a RelativeTimeFormat receiver.");
|
|
28617
|
+
return states7.get(value);
|
|
28618
|
+
}
|
|
28619
|
+
function formatRelativeTime(value, amount, unit, parts) {
|
|
28620
|
+
return Reflect.apply(parts ? formatToParts3 : format2, relativeTimeFormatState(value).native, [amount, unit]);
|
|
28621
|
+
}
|
|
28622
|
+
|
|
28623
|
+
// packages/safe-js/src/interp/intl-numberformat.ts
|
|
28624
|
+
var states8 = /* @__PURE__ */ new WeakMap();
|
|
28602
28625
|
function createSandboxNumberFormat(locales2, options) {
|
|
28603
28626
|
const native = createNumberFormatter(locales2, options);
|
|
28604
28627
|
const value = /* @__PURE__ */ Object.create(null);
|
|
28605
|
-
|
|
28628
|
+
states8.set(value, { native, options: numberFormatterOptions2(native) });
|
|
28606
28629
|
return value;
|
|
28607
28630
|
}
|
|
28608
28631
|
function isSandboxNumberFormat(value) {
|
|
28609
|
-
return typeof value === "object" && value !== null &&
|
|
28632
|
+
return typeof value === "object" && value !== null && states8.has(value);
|
|
28610
28633
|
}
|
|
28611
28634
|
function numberFormatState(value) {
|
|
28612
28635
|
if (!isSandboxNumberFormat(value)) throw new TypeError("Intl.NumberFormat requires a NumberFormat receiver.");
|
|
28613
|
-
return
|
|
28636
|
+
return states8.get(value);
|
|
28614
28637
|
}
|
|
28615
28638
|
async function numberFormatValue(value, budget, context) {
|
|
28616
28639
|
const primitive = typeof value === "object" && value !== null ? await objectToPrimitive(value, budget, context, /* @__PURE__ */ new Set(), "number") : value;
|
|
@@ -28965,9 +28988,10 @@ function captureGuestHeapNode(value, encode) {
|
|
|
28965
28988
|
}
|
|
28966
28989
|
if (isSandboxLocale(value)) return { kind: "guest-locale", tag: localeTag(value), state: captureObjectState(value, encode) };
|
|
28967
28990
|
if (isSandboxListFormat(value)) return { kind: "guest-listformat", options: { ...listFormatState(value).options }, state: captureObjectState(value, encode) };
|
|
28991
|
+
if (isSandboxRelativeTimeFormat(value)) return { kind: "guest-relativetimeformat", options: { ...relativeTimeFormatState(value).options }, state: captureObjectState(value, encode) };
|
|
28968
28992
|
if (isSandboxNumberFormat(value)) {
|
|
28969
|
-
const { options, format:
|
|
28970
|
-
return { kind: "guest-numberformat", options: { ...options }, ...
|
|
28993
|
+
const { options, format: format3 } = numberFormatState(value);
|
|
28994
|
+
return { kind: "guest-numberformat", options: { ...options }, ...format3 === void 0 ? {} : { format: encode(format3) }, state: captureObjectState(value, encode) };
|
|
28971
28995
|
}
|
|
28972
28996
|
if (isSandboxCollator(value)) {
|
|
28973
28997
|
const { options, compare } = collatorState(value);
|
|
@@ -33509,6 +33533,100 @@ function createListFormatConstructor(budget) {
|
|
|
33509
33533
|
return constructor;
|
|
33510
33534
|
}
|
|
33511
33535
|
|
|
33536
|
+
// packages/safe-js/src/interp/globals/intl-relativetimeformat.ts
|
|
33537
|
+
var supportedLocalesOf5 = Intl.RelativeTimeFormat.supportedLocalesOf;
|
|
33538
|
+
var optionTypes3 = [
|
|
33539
|
+
["localeMatcher", ["lookup", "best fit"]],
|
|
33540
|
+
["numberingSystem", "unicodeType"],
|
|
33541
|
+
["style", ["long", "short", "narrow"]],
|
|
33542
|
+
["numeric", ["always", "auto"]]
|
|
33543
|
+
];
|
|
33544
|
+
function createRelativeTimeFormatConstructor(budget) {
|
|
33545
|
+
const prototype = createIntrinsicObject();
|
|
33546
|
+
const constructor = createSandboxClosure({
|
|
33547
|
+
guest: true,
|
|
33548
|
+
sandbox: true,
|
|
33549
|
+
name: "RelativeTimeFormat",
|
|
33550
|
+
length: 0,
|
|
33551
|
+
call: () => {
|
|
33552
|
+
throw new TypeError("Constructor RelativeTimeFormat requires 'new'.");
|
|
33553
|
+
},
|
|
33554
|
+
construct: async ([input, options], context) => {
|
|
33555
|
+
const target = context?.newTarget;
|
|
33556
|
+
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);
|
|
33557
|
+
let locales2 = [];
|
|
33558
|
+
const converted = /* @__PURE__ */ Object.create(null);
|
|
33559
|
+
const release = retainValues(budget, () => [selected, locales2, converted]);
|
|
33560
|
+
try {
|
|
33561
|
+
locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
33562
|
+
const source = intlOptionsObject(options, budget);
|
|
33563
|
+
for (const [key, type] of optionTypes3) {
|
|
33564
|
+
const raw = await readIntlProperty(source, key, budget, context);
|
|
33565
|
+
if (raw !== void 0) converted[key] = await convertIntlOption(raw, key, type, budget, context);
|
|
33566
|
+
}
|
|
33567
|
+
const value = createSandboxRelativeTimeFormat(locales2, converted);
|
|
33568
|
+
setSandboxPrototype(value, typeof selected === "object" && selected !== null ? selected : prototype, budget);
|
|
33569
|
+
return allocateProducedSandboxValue(value, budget);
|
|
33570
|
+
} finally {
|
|
33571
|
+
release();
|
|
33572
|
+
}
|
|
33573
|
+
}
|
|
33574
|
+
});
|
|
33575
|
+
const properties = materializeFunctionProperties(constructor);
|
|
33576
|
+
Object.defineProperty(properties, "prototype", { value: prototype, writable: false, configurable: false });
|
|
33577
|
+
Object.defineProperty(properties, "supportedLocalesOf", { value: createSandboxClosure({
|
|
33578
|
+
guest: true,
|
|
33579
|
+
sandbox: true,
|
|
33580
|
+
name: "supportedLocalesOf",
|
|
33581
|
+
length: 1,
|
|
33582
|
+
call: async ([input, options], context) => {
|
|
33583
|
+
const locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
33584
|
+
const release = retainValues(budget, () => [locales2]);
|
|
33585
|
+
try {
|
|
33586
|
+
const source = intlOptionsObject(options, budget);
|
|
33587
|
+
const raw = await readIntlProperty(source, "localeMatcher", budget, context);
|
|
33588
|
+
const matcher = raw === void 0 ? void 0 : await convertIntlOption(raw, "localeMatcher", ["lookup", "best fit"], budget, context);
|
|
33589
|
+
return allocateProducedSandboxValue(supportedLocalesOf5(locales2, { localeMatcher: matcher }), budget);
|
|
33590
|
+
} finally {
|
|
33591
|
+
release();
|
|
33592
|
+
}
|
|
33593
|
+
}
|
|
33594
|
+
}), writable: true, configurable: true });
|
|
33595
|
+
Object.defineProperties(prototype, {
|
|
33596
|
+
constructor: { value: constructor, writable: true, configurable: true },
|
|
33597
|
+
[Symbol.toStringTag]: { value: "Intl.RelativeTimeFormat", configurable: true },
|
|
33598
|
+
resolvedOptions: { value: createSandboxClosure({
|
|
33599
|
+
guest: true,
|
|
33600
|
+
sandbox: true,
|
|
33601
|
+
name: "resolvedOptions",
|
|
33602
|
+
length: 0,
|
|
33603
|
+
call: (_args, context) => allocateProducedSandboxValue({ ...relativeTimeFormatState(context?.thisValue).options }, budget)
|
|
33604
|
+
}), writable: true, configurable: true }
|
|
33605
|
+
});
|
|
33606
|
+
for (const method of ["format", "formatToParts"]) {
|
|
33607
|
+
Object.defineProperty(prototype, method, { value: createSandboxClosure({
|
|
33608
|
+
guest: true,
|
|
33609
|
+
sandbox: true,
|
|
33610
|
+
name: method,
|
|
33611
|
+
length: 2,
|
|
33612
|
+
call: async ([input, unit], context) => {
|
|
33613
|
+
const receiver = context?.thisValue;
|
|
33614
|
+
relativeTimeFormatState(receiver);
|
|
33615
|
+
const release = retainValues(budget, () => [receiver, input, unit]);
|
|
33616
|
+
try {
|
|
33617
|
+
const value = await sandboxNumber(input, budget, context);
|
|
33618
|
+
const convertedUnit = await sandboxString(unit, budget, context);
|
|
33619
|
+
budget.visitNode(convertedUnit.length);
|
|
33620
|
+
return allocateProducedSandboxValue(formatRelativeTime(receiver, value, convertedUnit, method === "formatToParts"), budget);
|
|
33621
|
+
} finally {
|
|
33622
|
+
release();
|
|
33623
|
+
}
|
|
33624
|
+
}
|
|
33625
|
+
}), writable: true, configurable: true });
|
|
33626
|
+
}
|
|
33627
|
+
return constructor;
|
|
33628
|
+
}
|
|
33629
|
+
|
|
33512
33630
|
// packages/safe-js/src/interp/globals/intl.ts
|
|
33513
33631
|
var supportedValuesOf = Intl.supportedValuesOf;
|
|
33514
33632
|
function createIntlGlobal(budget) {
|
|
@@ -33525,10 +33643,12 @@ function createIntlGlobal(budget) {
|
|
|
33525
33643
|
const collator = createCollatorConstructor(budget);
|
|
33526
33644
|
const numberFormat = createNumberFormatConstructor(budget);
|
|
33527
33645
|
const listFormat = createListFormatConstructor(budget);
|
|
33646
|
+
const relativeTimeFormat = createRelativeTimeFormatConstructor(budget);
|
|
33528
33647
|
Object.defineProperty(intl, "Locale", { value: locale, writable: true, configurable: true });
|
|
33529
33648
|
Object.defineProperty(intl, "Collator", { value: collator, writable: true, configurable: true });
|
|
33530
33649
|
Object.defineProperty(intl, "NumberFormat", { value: numberFormat, writable: true, configurable: true });
|
|
33531
33650
|
Object.defineProperty(intl, "ListFormat", { value: listFormat, writable: true, configurable: true });
|
|
33651
|
+
Object.defineProperty(intl, "RelativeTimeFormat", { value: relativeTimeFormat, writable: true, configurable: true });
|
|
33532
33652
|
for (const [name, call] of Object.entries(methods2)) {
|
|
33533
33653
|
const closure = createSandboxClosure({ guest: true, sandbox: true, name, length: 1, call });
|
|
33534
33654
|
Object.defineProperty(intl, name, { value: closure, writable: true, configurable: true });
|
|
@@ -33652,7 +33772,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
33652
33772
|
createRawJson(node.text);
|
|
33653
33773
|
return true;
|
|
33654
33774
|
}
|
|
33655
|
-
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-listformat", "guest-numberformat", "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;
|
|
33775
|
+
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-listformat", "guest-relativetimeformat", "guest-numberformat", "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;
|
|
33656
33776
|
const reference = (value, kinds) => {
|
|
33657
33777
|
const ref = record2(value);
|
|
33658
33778
|
fields(ref, ["kind", "id"]);
|
|
@@ -33931,8 +34051,8 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
33931
34051
|
if (Object.keys(options).length !== Object.keys(restored).length || Object.keys(restored).some((key) => options[key] !== restored[key]))
|
|
33932
34052
|
throw new TypeError("Invalid resolved NumberFormat options.");
|
|
33933
34053
|
if (node.format !== void 0) {
|
|
33934
|
-
const
|
|
33935
|
-
if (reference(
|
|
34054
|
+
const format3 = reference(node.format, ["bound-function"]);
|
|
34055
|
+
if (reference(format3.thisValue) !== node || array(format3.args).length !== 0 || format3.name !== "" || format3.length !== 1 || reference(format3.target, ["intrinsic"]).id !== '["%NumberFormatFormat%"]')
|
|
33936
34056
|
throw new TypeError("Invalid cached NumberFormat function.");
|
|
33937
34057
|
}
|
|
33938
34058
|
state(node.state);
|
|
@@ -33945,6 +34065,15 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
33945
34065
|
const restored = listFormatState(createSandboxListFormat(options.locale, options)).options;
|
|
33946
34066
|
if (names.some((key) => options[key] !== restored[key])) throw new TypeError("Invalid resolved ListFormat options.");
|
|
33947
34067
|
state(node.state);
|
|
34068
|
+
} else if (node.kind === "guest-relativetimeformat") {
|
|
34069
|
+
fields(node, ["kind", "options", "state"]);
|
|
34070
|
+
const options = record2(node.options);
|
|
34071
|
+
const names = ["locale", "numberingSystem", "style", "numeric"];
|
|
34072
|
+
fields(options, [...names]);
|
|
34073
|
+
if (names.some((key) => typeof options[key] !== "string")) throw new TypeError("Invalid RelativeTimeFormat option type.");
|
|
34074
|
+
const restored = relativeTimeFormatState(createSandboxRelativeTimeFormat(options.locale, options)).options;
|
|
34075
|
+
if (names.some((key) => options[key] !== restored[key])) throw new TypeError("Invalid resolved RelativeTimeFormat options.");
|
|
34076
|
+
state(node.state);
|
|
33948
34077
|
} else if (node.kind === "guest-collator") {
|
|
33949
34078
|
fields(node, ["kind", "options", "state"], ["compare"]);
|
|
33950
34079
|
const options = record2(node.options);
|
|
@@ -37701,6 +37830,7 @@ function measureSandboxData(values, options = {}) {
|
|
|
37701
37830
|
if (isSandboxDate(value)) usage += 8;
|
|
37702
37831
|
if (isSandboxLocale(value)) usage += localeTag(value).length;
|
|
37703
37832
|
if (isSandboxListFormat(value)) visit(listFormatState(value).options, depth + 1);
|
|
37833
|
+
if (isSandboxRelativeTimeFormat(value)) visit(relativeTimeFormatState(value).options, depth + 1);
|
|
37704
37834
|
if (isSandboxNumberFormat(value)) {
|
|
37705
37835
|
const state = numberFormatState(value);
|
|
37706
37836
|
visit(state.options, depth + 1);
|
|
@@ -55686,4 +55816,4 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
55686
55816
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
55687
55817
|
|
|
55688
55818
|
*/
|
|
55689
|
-
//# sourceMappingURL=chunk-
|
|
55819
|
+
//# sourceMappingURL=chunk-E2VDSNJC.js.map
|