poe-code 12.0.0 → 12.0.2

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 CHANGED
@@ -142912,7 +142912,9 @@ function createObjectArrayGlobals(options) {
142912
142912
  }),
142913
142913
  String: createSandboxClosure({
142914
142914
  sandbox: true,
142915
- call: ([value]) => options.budget.allocateString(String(value)),
142915
+ call: ([value]) => options.budget.allocateString(
142916
+ typeof value === "object" && value !== null && sandboxErrorTypes.has(value) && !Object.hasOwn(value, "toString") ? Error.prototype.toString.call(value) : String(value)
142917
+ ),
142916
142918
  name: "String",
142917
142919
  properties: {
142918
142920
  raw: createSandboxClosure({
@@ -143124,6 +143126,7 @@ function getTemplateRawParts(template2) {
143124
143126
  var init_object_array = __esm({
143125
143127
  "packages/safejs/src/interp/globals/object-array.ts"() {
143126
143128
  "use strict";
143129
+ init_shape();
143127
143130
  init_iteration();
143128
143131
  init_values();
143129
143132
  }
@@ -144321,6 +144324,7 @@ function getStringMember(value, property, budget) {
144321
144324
  return createSandboxClosure({
144322
144325
  sandbox: true,
144323
144326
  name: `String#${property}`,
144327
+ ...property === "localeCompare" ? { length: 1 } : {},
144324
144328
  call: (args) => callStringMethod(value, property, args, budget)
144325
144329
  });
144326
144330
  }
@@ -144346,6 +144350,42 @@ function callStringMethod(value, methodName, args, budget, callClosure = async (
144346
144350
  if (methodName === "match" || methodName === "matchAll" || methodName === "search") {
144347
144351
  return callMatchLikeMethod(value, methodName, args);
144348
144352
  }
144353
+ if (methodName === "localeCompare") {
144354
+ if (isSandboxClosure(args[0])) {
144355
+ throw new TypeError("String#localeCompare does not support function comparison values.");
144356
+ }
144357
+ const comparison = budget.allocateString(String(deepCopyFromSandbox(args[0])));
144358
+ const locales = Reflect.apply(Intl.getCanonicalLocales, Intl, [
144359
+ deepCopyFromSandbox(args[1])
144360
+ ]);
144361
+ const options = args[2];
144362
+ const nativeOptions = options === void 0 || options === null ? options : Object.fromEntries(
144363
+ [
144364
+ "usage",
144365
+ "localeMatcher",
144366
+ "collation",
144367
+ "numeric",
144368
+ "caseFirst",
144369
+ "sensitivity",
144370
+ "ignorePunctuation"
144371
+ ].map((property) => {
144372
+ const descriptor = Object.getOwnPropertyDescriptor(options, property);
144373
+ if (descriptor !== void 0 && !("value" in descriptor)) {
144374
+ throw new TypeError("String#localeCompare only supports data option properties.");
144375
+ }
144376
+ const option = descriptor?.value;
144377
+ return [
144378
+ property,
144379
+ option === void 0 ? void 0 : property === "numeric" || property === "ignorePunctuation" ? Boolean(option) : deepCopyFromSandbox(option)
144380
+ ];
144381
+ })
144382
+ );
144383
+ return Reflect.apply(String.prototype.localeCompare, value, [
144384
+ comparison,
144385
+ locales,
144386
+ nativeOptions
144387
+ ]);
144388
+ }
144349
144389
  if (args.some(isSandboxClosure)) {
144350
144390
  throw new TypeError(`String#${methodName} does not support function arguments.`);
144351
144391
  }
@@ -144621,6 +144661,7 @@ var init_string = __esm({
144621
144661
  "includes",
144622
144662
  "indexOf",
144623
144663
  "lastIndexOf",
144664
+ "localeCompare",
144624
144665
  "match",
144625
144666
  "matchAll",
144626
144667
  "normalize",
@@ -155751,7 +155792,7 @@ var init_package2 = __esm({
155751
155792
  "package.json"() {
155752
155793
  package_default2 = {
155753
155794
  name: "poe-code",
155754
- version: "12.0.0",
155795
+ version: "12.0.2",
155755
155796
  description: "CLI tool to configure Poe API for developer workflows.",
155756
155797
  license: "MIT",
155757
155798
  type: "module",