mirror of
https://github.com/n8n-io/n8n.git
synced 2026-09-01 05:38:33 +08:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user