build(editor): Make frontend-utils htmlUtils loadable as native ESM (no-changelog) (#35622)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Alex Grozav
2026-08-13 13:11:18 +00:00
committed by GitHub
parent 1b4c0bab8e
commit de5ec12fd0
@@ -1,5 +1,5 @@
import { toValue, type MaybeRef } from 'vue';
import xss, { escapeAttrValue, escapeHtml } from 'xss';
import xss from 'xss';
import { ALLOWED_HTML_ATTRIBUTES, ALLOWED_HTML_TAGS } from './constants/sanitization';
@@ -7,6 +7,13 @@ import { ALLOWED_HTML_ATTRIBUTES, ALLOWED_HTML_TAGS } from './constants/sanitiza
Constants and utility functions that help in HTML, CSS and DOM manipulation
*/
// `xss` is CJS with no `exports` map, so Node's lexer cannot see these as named
// exports and `import { ... }` throws at link time under native ESM.
const { escapeAttrValue, escapeHtml } = xss as unknown as {
escapeAttrValue: (str: string) => string;
escapeHtml: (str: string) => string;
};
/**
* Escapes HTML entities in a string to prevent HTML injection.
* This should be used for user input that will be displayed in HTML contexts.