@poe-platform/safe-js 0.1.448 → 0.1.450

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.
@@ -22,7 +22,7 @@ import {
22
22
  resolveFsConfig,
23
23
  splitFrontmatter,
24
24
  withBrokenPipeGuard
25
- } from "./chunks/chunk-HPTZH7MW.js";
25
+ } from "./chunks/chunk-6BQOHEVM.js";
26
26
  import {
27
27
  Budget,
28
28
  SandboxError,
@@ -34,7 +34,7 @@ import {
34
34
  replaceErrorStack,
35
35
  restore,
36
36
  run
37
- } from "./chunks/chunk-D32JKK5K.js";
37
+ } from "./chunks/chunk-D5ZEIZYV.js";
38
38
  import "./chunks/chunk-4YIDX44G.js";
39
39
 
40
40
  // packages/safe-js/src/cli.ts
@@ -5,7 +5,7 @@ import {
5
5
  defineExtension,
6
6
  lint,
7
7
  run
8
- } from "./chunks/chunk-D32JKK5K.js";
8
+ } from "./chunks/chunk-D5ZEIZYV.js";
9
9
  import "./chunks/chunk-4YIDX44G.js";
10
10
  export {
11
11
  Budget,
@@ -26,7 +26,7 @@ import {
26
26
  runWithSpawnUsageAccumulator,
27
27
  splitFrontmatter,
28
28
  supportsSpawnMode
29
- } from "./chunks/chunk-HPTZH7MW.js";
29
+ } from "./chunks/chunk-6BQOHEVM.js";
30
30
  import {
31
31
  Budget,
32
32
  FileSnapshotBackend,
@@ -50,7 +50,7 @@ import {
50
50
  registerPendingHostCallPolicy,
51
51
  restore,
52
52
  run
53
- } from "./chunks/chunk-D32JKK5K.js";
53
+ } from "./chunks/chunk-D5ZEIZYV.js";
54
54
  import "./chunks/chunk-4YIDX44G.js";
55
55
 
56
56
  // packages/safe-js/src/parse.ts
@@ -0,0 +1,20 @@
1
+ import type { Budget } from "./budget.js";
2
+ import type { SandboxCallContext, SandboxClosure, SandboxObject, SandboxValue } from "./values.js";
3
+ export type ResolvedCollatorOptions = {
4
+ locale: string;
5
+ usage: "sort" | "search";
6
+ sensitivity: "base" | "accent" | "case" | "variant";
7
+ ignorePunctuation: boolean;
8
+ collation: string;
9
+ numeric: boolean;
10
+ caseFirst: "upper" | "lower" | "false";
11
+ };
12
+ export declare function readCollatorOptions(input: SandboxValue, budget: Budget, context?: SandboxCallContext, invalid?: (key: string, text: string) => void): Promise<Record<string, string | boolean>>;
13
+ export declare function createSandboxCollator(locales: string | string[], options: Record<string, string | boolean>): SandboxObject;
14
+ export declare function isSandboxCollator(value: unknown): value is SandboxObject;
15
+ export declare function collatorState(value: unknown): {
16
+ options: ResolvedCollatorOptions;
17
+ native: Intl.Collator;
18
+ compare?: SandboxClosure;
19
+ };
20
+ export declare function compareCollatorStrings(value: unknown, first: string, second: string): number;
@@ -0,0 +1,13 @@
1
+ import type { Budget } from "./budget.js";
2
+ import { createNumberFormatter } from "./numberformat-backend.js";
3
+ import type { SandboxCallContext, SandboxClosure, SandboxObject, SandboxValue } from "./values.js";
4
+ export type NumberFormatOptions = Record<string, string | number | boolean>;
5
+ export declare function createSandboxNumberFormat(locales: string | string[], options: NumberFormatOptions): SandboxObject;
6
+ export declare function isSandboxNumberFormat(value: unknown): value is SandboxObject;
7
+ export declare function numberFormatState(value: unknown): {
8
+ native: ReturnType<typeof createNumberFormatter>;
9
+ options: NumberFormatOptions;
10
+ format?: SandboxClosure;
11
+ };
12
+ export declare function numberFormatValue(value: SandboxValue, budget: Budget, context?: SandboxCallContext): Promise<number | bigint | string>;
13
+ export declare function formatNumberValue(receiver: unknown, method: "format" | "formatToParts" | "formatRange" | "formatRangeToParts", values: Array<number | bigint | string>): SandboxValue;
@@ -0,0 +1,7 @@
1
+ import type { PortableFormatter, Options } from "./numberformat-portable.js";
2
+ import type { SandboxValue } from "./values.js";
3
+ type Formatter = Intl.NumberFormat | PortableFormatter;
4
+ export declare function createNumberFormatter(locales: string | string[], options: Options): Formatter;
5
+ export declare function numberFormatterOptions(formatter: Formatter): Options;
6
+ export declare function numberFormatterResult(formatter: Formatter, method: "format" | "formatToParts" | "formatRange" | "formatRangeToParts", values: Array<string | number | bigint>): SandboxValue;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import { NumberFormat as PortableNumberFormat } from "../intl-data/dist/numberformat-engine.js";
2
+ import type { SandboxValue } from "./values.js";
3
+ export type Options = Record<string, string | number | boolean>;
4
+ export type PortableFormatter = InstanceType<typeof PortableNumberFormat>;
5
+ type Formatter = PortableFormatter;
6
+ export declare function createPortableNumberFormatter(locales: string | string[], options: Options): Formatter;
7
+ export declare function numberFormatterOptions(formatter: Formatter): Options;
8
+ export declare function numberFormatterResult(formatter: Formatter, method: "format" | "formatToParts" | "formatRange" | "formatRangeToParts", values: Array<string | number | bigint>): SandboxValue;
9
+ export {};
@@ -0,0 +1 @@
1
+ export { NumberFormat } from "@formatjs/intl-numberformat";
@@ -1,4 +1,6 @@
1
1
  import { type SandboxErrorName } from "../error/shape.js";
2
+ import { type ResolvedCollatorOptions } from "../interp/intl-collator.js";
3
+ import { type NumberFormatOptions } from "../interp/intl-numberformat.js";
2
4
  import { type CollectionIterationMethod } from "../interp/collection-iterator.js";
3
5
  import { type IteratorHelperState } from "../interp/iterator-helper.js";
4
6
  import { type ScopeFrame } from "../interp/scope.js";
@@ -217,6 +219,16 @@ export type GuestHeapNode<T> = {
217
219
  kind: "guest-locale";
218
220
  tag: string;
219
221
  state: GuestObjectState<T>;
222
+ } | {
223
+ kind: "guest-collator";
224
+ options: ResolvedCollatorOptions;
225
+ compare?: T;
226
+ state: GuestObjectState<T>;
227
+ } | {
228
+ kind: "guest-numberformat";
229
+ options: NumberFormatOptions;
230
+ format?: T;
231
+ state: GuestObjectState<T>;
220
232
  } | {
221
233
  kind: "iterator-helper";
222
234
  method: IteratorHelperState["method"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.448",
3
+ "version": "0.1.450",
4
4
  "description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,10 +58,13 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@poe-platform/safe-fs": "0.1.448",
61
+ "@poe-platform/safe-fs": "0.1.450",
62
62
  "@petamoriken/float16": "^3.9.3",
63
+ "@formatjs/intl-localematcher": "0.8.13",
64
+ "@formatjs/bigdecimal": "0.2.7",
63
65
  "yaml": "^2.8.2",
64
66
  "jose": "^6.1.3",
67
+ "@formatjs/intl-numberformat": "9.4.0",
65
68
  "@types/node": "^25.2.2"
66
69
  },
67
70
  "bin": {