@poe-platform/safe-js 0.1.455 → 0.1.457
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-JB2Z6L3C.js → chunk-ENSU5YTC.js} +2 -2
- package/dist/safe-js/chunks/{chunk-TZUXEKIQ.js → chunk-OXTOMAYL.js} +138 -9
- package/dist/safe-js/chunks/{chunk-TZUXEKIQ.js.map → chunk-OXTOMAYL.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-displaynames.d.ts +15 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +5 -0
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-JB2Z6L3C.js.map → chunk-ENSU5YTC.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-OXTOMAYL.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-ENSU5YTC.js.map
|
|
@@ -28619,7 +28619,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
28619
28619
|
}
|
|
28620
28620
|
const updated = Object.values(base).filter((value) => value !== void 0).join("-") + canonical.slice(native.baseName.length);
|
|
28621
28621
|
const extension = unicodeKeywords(updated);
|
|
28622
|
-
const
|
|
28622
|
+
const optionTypes5 = [
|
|
28623
28623
|
["calendar", "ca", "unicodeType"],
|
|
28624
28624
|
["collation", "co", "unicodeType"],
|
|
28625
28625
|
["firstDayOfWeek", "fw", "unicodeType"],
|
|
@@ -28628,7 +28628,7 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
28628
28628
|
["numeric", "kn", "boolean"],
|
|
28629
28629
|
["numberingSystem", "nu", "unicodeType"]
|
|
28630
28630
|
];
|
|
28631
|
-
for (const [key, extensionKey, type] of
|
|
28631
|
+
for (const [key, extensionKey, type] of optionTypes5) {
|
|
28632
28632
|
let value = await readIntlProperty(options, key, budget, context);
|
|
28633
28633
|
if (value === void 0) continue;
|
|
28634
28634
|
if (key === "firstDayOfWeek") {
|
|
@@ -28694,20 +28694,42 @@ function formatRelativeTime(value, amount, unit, parts) {
|
|
|
28694
28694
|
return Reflect.apply(parts ? formatToParts3 : format2, relativeTimeFormatState(value).native, [amount, unit]);
|
|
28695
28695
|
}
|
|
28696
28696
|
|
|
28697
|
-
// packages/safe-js/src/interp/intl-
|
|
28697
|
+
// packages/safe-js/src/interp/intl-displaynames.ts
|
|
28698
|
+
var NativeDisplayNames = Intl.DisplayNames;
|
|
28699
|
+
var resolvedOptions4 = NativeDisplayNames.prototype.resolvedOptions;
|
|
28700
|
+
var of = NativeDisplayNames.prototype.of;
|
|
28698
28701
|
var states8 = /* @__PURE__ */ new WeakMap();
|
|
28702
|
+
function createSandboxDisplayNames(locales2, options) {
|
|
28703
|
+
const native = new NativeDisplayNames(locales2, options);
|
|
28704
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
28705
|
+
states8.set(value, { native, options: Reflect.apply(resolvedOptions4, native, []) });
|
|
28706
|
+
return value;
|
|
28707
|
+
}
|
|
28708
|
+
function isSandboxDisplayNames(value) {
|
|
28709
|
+
return typeof value === "object" && value !== null && states8.has(value);
|
|
28710
|
+
}
|
|
28711
|
+
function displayNamesState(value) {
|
|
28712
|
+
if (!isSandboxDisplayNames(value)) throw new TypeError("Intl.DisplayNames requires a DisplayNames receiver.");
|
|
28713
|
+
return states8.get(value);
|
|
28714
|
+
}
|
|
28715
|
+
function displayName(value, code) {
|
|
28716
|
+
return Reflect.apply(of, displayNamesState(value).native, [code]);
|
|
28717
|
+
}
|
|
28718
|
+
|
|
28719
|
+
// packages/safe-js/src/interp/intl-numberformat.ts
|
|
28720
|
+
var states9 = /* @__PURE__ */ new WeakMap();
|
|
28699
28721
|
function createSandboxNumberFormat(locales2, options) {
|
|
28700
28722
|
const native = createNumberFormatter(locales2, options);
|
|
28701
28723
|
const value = /* @__PURE__ */ Object.create(null);
|
|
28702
|
-
|
|
28724
|
+
states9.set(value, { native, options: numberFormatterOptions2(native) });
|
|
28703
28725
|
return value;
|
|
28704
28726
|
}
|
|
28705
28727
|
function isSandboxNumberFormat(value) {
|
|
28706
|
-
return typeof value === "object" && value !== null &&
|
|
28728
|
+
return typeof value === "object" && value !== null && states9.has(value);
|
|
28707
28729
|
}
|
|
28708
28730
|
function numberFormatState(value) {
|
|
28709
28731
|
if (!isSandboxNumberFormat(value)) throw new TypeError("Intl.NumberFormat requires a NumberFormat receiver.");
|
|
28710
|
-
return
|
|
28732
|
+
return states9.get(value);
|
|
28711
28733
|
}
|
|
28712
28734
|
async function numberFormatValue(value, budget, context) {
|
|
28713
28735
|
const primitive = typeof value === "object" && value !== null ? await objectToPrimitive(value, budget, context, /* @__PURE__ */ new Set(), "number") : value;
|
|
@@ -29063,6 +29085,7 @@ function captureGuestHeapNode(value, encode) {
|
|
|
29063
29085
|
if (isSandboxLocale(value)) return { kind: "guest-locale", tag: localeTag(value), state: captureObjectState(value, encode) };
|
|
29064
29086
|
if (isSandboxListFormat(value)) return { kind: "guest-listformat", options: { ...listFormatState(value).options }, state: captureObjectState(value, encode) };
|
|
29065
29087
|
if (isSandboxRelativeTimeFormat(value)) return { kind: "guest-relativetimeformat", options: { ...relativeTimeFormatState(value).options }, state: captureObjectState(value, encode) };
|
|
29088
|
+
if (isSandboxDisplayNames(value)) return { kind: "guest-displaynames", options: { ...displayNamesState(value).options }, state: captureObjectState(value, encode) };
|
|
29066
29089
|
if (isSandboxNumberFormat(value)) {
|
|
29067
29090
|
const { options, format: format3 } = numberFormatState(value);
|
|
29068
29091
|
return { kind: "guest-numberformat", options: { ...options }, ...format3 === void 0 ? {} : { format: encode(format3) }, state: captureObjectState(value, encode) };
|
|
@@ -33792,6 +33815,100 @@ function createRelativeTimeFormatConstructor(budget) {
|
|
|
33792
33815
|
return constructor;
|
|
33793
33816
|
}
|
|
33794
33817
|
|
|
33818
|
+
// packages/safe-js/src/interp/globals/intl-displaynames.ts
|
|
33819
|
+
var supportedLocalesOf6 = Intl.DisplayNames.supportedLocalesOf;
|
|
33820
|
+
var optionTypes4 = [
|
|
33821
|
+
["localeMatcher", ["lookup", "best fit"]],
|
|
33822
|
+
["style", ["long", "short", "narrow"]],
|
|
33823
|
+
["type", ["language", "region", "script", "currency", "calendar", "dateTimeField"]],
|
|
33824
|
+
["fallback", ["code", "none"]],
|
|
33825
|
+
["languageDisplay", ["dialect", "standard"]]
|
|
33826
|
+
];
|
|
33827
|
+
function createDisplayNamesConstructor(budget) {
|
|
33828
|
+
const prototype = createIntrinsicObject();
|
|
33829
|
+
const constructor = createSandboxClosure({
|
|
33830
|
+
guest: true,
|
|
33831
|
+
sandbox: true,
|
|
33832
|
+
name: "DisplayNames",
|
|
33833
|
+
length: 2,
|
|
33834
|
+
call: () => {
|
|
33835
|
+
throw new TypeError("Constructor DisplayNames requires 'new'.");
|
|
33836
|
+
},
|
|
33837
|
+
construct: async ([input, options], context) => {
|
|
33838
|
+
const target = context?.newTarget;
|
|
33839
|
+
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);
|
|
33840
|
+
let locales2 = [];
|
|
33841
|
+
const converted = /* @__PURE__ */ Object.create(null);
|
|
33842
|
+
const release = retainValues(budget, () => [selected, locales2, converted]);
|
|
33843
|
+
try {
|
|
33844
|
+
locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
33845
|
+
if (options === void 0) throw new TypeError("DisplayNames requires options.");
|
|
33846
|
+
const source = intlOptionsObject(options, budget);
|
|
33847
|
+
for (const [key, type] of optionTypes4) {
|
|
33848
|
+
const raw = await readIntlProperty(source, key, budget, context);
|
|
33849
|
+
if (key === "type" && raw === void 0) throw new TypeError("DisplayNames requires a type.");
|
|
33850
|
+
if (raw !== void 0) converted[key] = await convertIntlOption(raw, key, type, budget, context);
|
|
33851
|
+
}
|
|
33852
|
+
const value = createSandboxDisplayNames(locales2, converted);
|
|
33853
|
+
setSandboxPrototype(value, typeof selected === "object" && selected !== null ? selected : prototype, budget);
|
|
33854
|
+
return allocateProducedSandboxValue(value, budget);
|
|
33855
|
+
} finally {
|
|
33856
|
+
release();
|
|
33857
|
+
}
|
|
33858
|
+
}
|
|
33859
|
+
});
|
|
33860
|
+
const properties = materializeFunctionProperties(constructor);
|
|
33861
|
+
Object.defineProperty(properties, "prototype", { value: prototype, writable: false, configurable: false });
|
|
33862
|
+
Object.defineProperty(properties, "supportedLocalesOf", { value: createSandboxClosure({
|
|
33863
|
+
guest: true,
|
|
33864
|
+
sandbox: true,
|
|
33865
|
+
name: "supportedLocalesOf",
|
|
33866
|
+
length: 1,
|
|
33867
|
+
call: async ([input, options], context) => {
|
|
33868
|
+
const locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
33869
|
+
const release = retainValues(budget, () => [locales2]);
|
|
33870
|
+
try {
|
|
33871
|
+
const source = intlOptionsObject(options, budget);
|
|
33872
|
+
const raw = await readIntlProperty(source, "localeMatcher", budget, context);
|
|
33873
|
+
const matcher = raw === void 0 ? void 0 : await convertIntlOption(raw, "localeMatcher", ["lookup", "best fit"], budget, context);
|
|
33874
|
+
return allocateProducedSandboxValue(supportedLocalesOf6(locales2, { localeMatcher: matcher }), budget);
|
|
33875
|
+
} finally {
|
|
33876
|
+
release();
|
|
33877
|
+
}
|
|
33878
|
+
}
|
|
33879
|
+
}), writable: true, configurable: true });
|
|
33880
|
+
Object.defineProperties(prototype, {
|
|
33881
|
+
constructor: { value: constructor, writable: true, configurable: true },
|
|
33882
|
+
[Symbol.toStringTag]: { value: "Intl.DisplayNames", configurable: true },
|
|
33883
|
+
resolvedOptions: { value: createSandboxClosure({
|
|
33884
|
+
guest: true,
|
|
33885
|
+
sandbox: true,
|
|
33886
|
+
name: "resolvedOptions",
|
|
33887
|
+
length: 0,
|
|
33888
|
+
call: (_args, context) => allocateProducedSandboxValue({ ...displayNamesState(context?.thisValue).options }, budget)
|
|
33889
|
+
}), writable: true, configurable: true }
|
|
33890
|
+
});
|
|
33891
|
+
Object.defineProperty(prototype, "of", { value: createSandboxClosure({
|
|
33892
|
+
guest: true,
|
|
33893
|
+
sandbox: true,
|
|
33894
|
+
name: "of",
|
|
33895
|
+
length: 1,
|
|
33896
|
+
call: async ([input], context) => {
|
|
33897
|
+
const receiver = context?.thisValue;
|
|
33898
|
+
displayNamesState(receiver);
|
|
33899
|
+
const release = retainValues(budget, () => [receiver, input]);
|
|
33900
|
+
try {
|
|
33901
|
+
const code = await sandboxString(input, budget, context);
|
|
33902
|
+
budget.visitNode(code.length);
|
|
33903
|
+
return allocateProducedSandboxValue(displayName(receiver, code), budget);
|
|
33904
|
+
} finally {
|
|
33905
|
+
release();
|
|
33906
|
+
}
|
|
33907
|
+
}
|
|
33908
|
+
}), writable: true, configurable: true });
|
|
33909
|
+
return constructor;
|
|
33910
|
+
}
|
|
33911
|
+
|
|
33795
33912
|
// packages/safe-js/src/interp/globals/intl.ts
|
|
33796
33913
|
var supportedValuesOf = Intl.supportedValuesOf;
|
|
33797
33914
|
function createIntlGlobal(budget) {
|
|
@@ -33809,18 +33926,20 @@ function createIntlGlobal(budget) {
|
|
|
33809
33926
|
const numberFormat = createNumberFormatConstructor(budget);
|
|
33810
33927
|
const listFormat = createListFormatConstructor(budget);
|
|
33811
33928
|
const relativeTimeFormat = createRelativeTimeFormatConstructor(budget);
|
|
33929
|
+
const displayNames = createDisplayNamesConstructor(budget);
|
|
33812
33930
|
Object.defineProperty(intl, "Locale", { value: locale, writable: true, configurable: true });
|
|
33813
33931
|
Object.defineProperty(intl, "Collator", { value: collator, writable: true, configurable: true });
|
|
33814
33932
|
Object.defineProperty(intl, "NumberFormat", { value: numberFormat, writable: true, configurable: true });
|
|
33815
33933
|
Object.defineProperty(intl, "ListFormat", { value: listFormat, writable: true, configurable: true });
|
|
33816
33934
|
Object.defineProperty(intl, "RelativeTimeFormat", { value: relativeTimeFormat, writable: true, configurable: true });
|
|
33935
|
+
Object.defineProperty(intl, "DisplayNames", { value: displayNames, writable: true, configurable: true });
|
|
33817
33936
|
for (const [name, call] of Object.entries(methods2)) {
|
|
33818
33937
|
const closure = createSandboxClosure({ guest: true, sandbox: true, name, length: 1, call });
|
|
33819
33938
|
Object.defineProperty(intl, name, { value: closure, writable: true, configurable: true });
|
|
33820
33939
|
}
|
|
33821
33940
|
Object.defineProperty(intl, Symbol.toStringTag, { value: "Intl", configurable: true });
|
|
33822
33941
|
registerBuiltinIdentities(budget, { Intl: intl });
|
|
33823
|
-
for (const constructor of [locale, collator, numberFormat, listFormat]) {
|
|
33942
|
+
for (const constructor of [locale, collator, numberFormat, listFormat, relativeTimeFormat, displayNames]) {
|
|
33824
33943
|
const prototype = constructor.properties.prototype;
|
|
33825
33944
|
for (const owner of [prototype, constructor.properties])
|
|
33826
33945
|
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(owner)))
|
|
@@ -33937,7 +34056,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
33937
34056
|
createRawJson(node.text);
|
|
33938
34057
|
return true;
|
|
33939
34058
|
}
|
|
33940
|
-
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;
|
|
34059
|
+
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-displaynames", "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;
|
|
33941
34060
|
const reference = (value, kinds) => {
|
|
33942
34061
|
const ref = record2(value);
|
|
33943
34062
|
fields(ref, ["kind", "id"]);
|
|
@@ -34230,6 +34349,15 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
34230
34349
|
const restored = listFormatState(createSandboxListFormat(options.locale, options)).options;
|
|
34231
34350
|
if (names.some((key) => options[key] !== restored[key])) throw new TypeError("Invalid resolved ListFormat options.");
|
|
34232
34351
|
state(node.state);
|
|
34352
|
+
} else if (node.kind === "guest-displaynames") {
|
|
34353
|
+
fields(node, ["kind", "options", "state"]);
|
|
34354
|
+
const options = record2(node.options);
|
|
34355
|
+
fields(options, ["locale", "style", "type", "fallback"], ["languageDisplay"]);
|
|
34356
|
+
if (Object.values(options).some((value) => typeof value !== "string")) throw new TypeError("Invalid DisplayNames option type.");
|
|
34357
|
+
const restored = displayNamesState(createSandboxDisplayNames(options.locale, options)).options;
|
|
34358
|
+
if (Object.keys(options).length !== Object.keys(restored).length || Object.keys(restored).some((key) => options[key] !== restored[key]))
|
|
34359
|
+
throw new TypeError("Invalid resolved DisplayNames options.");
|
|
34360
|
+
state(node.state);
|
|
34233
34361
|
} else if (node.kind === "guest-relativetimeformat") {
|
|
34234
34362
|
fields(node, ["kind", "options", "state"]);
|
|
34235
34363
|
const options = record2(node.options);
|
|
@@ -37996,6 +38124,7 @@ function measureSandboxData(values, options = {}) {
|
|
|
37996
38124
|
if (isSandboxLocale(value)) usage += localeTag(value).length;
|
|
37997
38125
|
if (isSandboxListFormat(value)) visit(listFormatState(value).options, depth + 1);
|
|
37998
38126
|
if (isSandboxRelativeTimeFormat(value)) visit(relativeTimeFormatState(value).options, depth + 1);
|
|
38127
|
+
if (isSandboxDisplayNames(value)) visit(displayNamesState(value).options, depth + 1);
|
|
37999
38128
|
if (isSandboxNumberFormat(value)) {
|
|
38000
38129
|
const state = numberFormatState(value);
|
|
38001
38130
|
visit(state.options, depth + 1);
|
|
@@ -55981,4 +56110,4 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
55981
56110
|
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.
|
|
55982
56111
|
|
|
55983
56112
|
*/
|
|
55984
|
-
//# sourceMappingURL=chunk-
|
|
56113
|
+
//# sourceMappingURL=chunk-OXTOMAYL.js.map
|