@poe-platform/safe-js 0.1.470 → 0.1.471

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.
@@ -19873,8 +19873,37 @@ async function compareStringLocale(value, args, budget, context) {
19873
19873
  }
19874
19874
  }
19875
19875
 
19876
+ // packages/safe-js/src/interp/methods/string-html.ts
19877
+ var stringHtmlMethods = {
19878
+ anchor: ["a", "name"],
19879
+ big: ["big", ""],
19880
+ blink: ["blink", ""],
19881
+ bold: ["b", ""],
19882
+ fixed: ["tt", ""],
19883
+ fontcolor: ["font", "color"],
19884
+ fontsize: ["font", "size"],
19885
+ italics: ["i", ""],
19886
+ link: ["a", "href"],
19887
+ small: ["small", ""],
19888
+ strike: ["strike", ""],
19889
+ sub: ["sub", ""],
19890
+ sup: ["sup", ""]
19891
+ };
19892
+ async function createStringHtml(value, [tag, attribute], argument, budget, context) {
19893
+ const release = retainValues(budget, () => [value, argument]);
19894
+ try {
19895
+ const text = attribute === "" ? "" : await sandboxString(argument, budget, context);
19896
+ budget.visitNode(value.length + text.length);
19897
+ const opening = attribute === "" ? `<${tag}>` : `<${tag} ${attribute}="${text.replaceAll('"', "&quot;")}">`;
19898
+ return budget.allocateString(`${opening}${value}</${tag}>`);
19899
+ } finally {
19900
+ release();
19901
+ }
19902
+ }
19903
+
19876
19904
  // packages/safe-js/src/interp/methods/string.ts
19877
19905
  var stringMethodLengths = {
19906
+ ...Object.fromEntries(Object.entries(stringHtmlMethods).map(([name, [, attribute]]) => [name, attribute === "" ? 0 : 1])),
19878
19907
  at: 1,
19879
19908
  charAt: 1,
19880
19909
  charCodeAt: 1,
@@ -20012,6 +20041,9 @@ function callStringMethod(value, methodName, args, budget, callClosure = async (
20012
20041
  return dispatch();
20013
20042
  }
20014
20043
  function callStringMethodBody(value, methodName, args, budget, parent, context) {
20044
+ if (Object.hasOwn(stringHtmlMethods, methodName)) {
20045
+ return createStringHtml(value, stringHtmlMethods[methodName], args[0], budget, context);
20046
+ }
20015
20047
  if (methodName === "concat" && args.some((argument) => argument !== null && typeof argument === "object")) {
20016
20048
  return callConcat(value, args, budget, context);
20017
20049
  }
@@ -57043,4 +57075,4 @@ authorization of the copyright holder.
57043
57075
  SPDX-License-Identifier: Unicode-3.0
57044
57076
 
57045
57077
  */
57046
- //# sourceMappingURL=chunk-4LQGK4QH.js.map
57078
+ //# sourceMappingURL=chunk-D26DLMQR.js.map