diff --git a/cSpell.json b/cSpell.json index 5711d29dc..4e9e4945a 100644 --- a/cSpell.json +++ b/cSpell.json @@ -85,6 +85,7 @@ "sveidqvist", "techn", "teststr", + "textlength", "treemap", "ts-nocheck", "tuleap", diff --git a/packages/mermaid/src/accessibility.ts b/packages/mermaid/src/accessibility.ts index b9e088e0b..ed28ff689 100644 --- a/packages/mermaid/src/accessibility.ts +++ b/packages/mermaid/src/accessibility.ts @@ -4,7 +4,7 @@ */ import { D3Element } from './mermaidAPI'; -import isEmpty from 'lodash-es/isEmpty'; +import isEmpty from 'lodash-es/isEmpty.js'; /** * Add aria-roledescription to the svg element to the diagramType diff --git a/packages/mermaid/src/mermaidAPI.ts b/packages/mermaid/src/mermaidAPI.ts index 193f5a9cc..a63071364 100644 --- a/packages/mermaid/src/mermaidAPI.ts +++ b/packages/mermaid/src/mermaidAPI.ts @@ -29,7 +29,7 @@ import utils, { directiveSanitizer } from './utils'; import DOMPurify from 'dompurify'; import { MermaidConfig } from './config.type'; import { evaluate } from './diagrams/common/common'; -import isEmpty from 'lodash-es/isEmpty'; +import isEmpty from 'lodash-es/isEmpty.js'; import { setA11yDiagramInfo, addSVGa11yTitleDescription } from './accessibility'; // diagram names that support classDef statements @@ -55,8 +55,8 @@ const IFRAME_SANDBOX_OPTS = 'allow-top-navigation-by-user-activation allow-popup const IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.'; // DOMPurify settings for svgCode -const DOMPURE_TAGS = ['foreignobject']; -const DOMPURE_ATTR = ['dominant-baseline']; +const DOMPURIFY_TAGS = ['foreignobject']; +const DOMPURIFY_ATTR = ['dominant-baseline']; // This is what is returned from getClasses(...) methods. // It is slightly renamed to ..StyleClassDef instead of just ClassDef because "class" is a greatly ambiguous and overloaded word. @@ -539,8 +539,8 @@ const render = function ( } else if (!isLooseSecurityLevel) { // Sanitize the svgCode using DOMPurify svgCode = DOMPurify.sanitize(svgCode, { - ADD_TAGS: DOMPURE_TAGS, - ADD_ATTR: DOMPURE_ATTR, + ADD_TAGS: DOMPURIFY_TAGS, + ADD_ATTR: DOMPURIFY_ATTR, }); } @@ -741,8 +741,8 @@ const renderAsync = async function ( } else if (!isLooseSecurityLevel) { // Sanitize the svgCode using DOMPurify svgCode = DOMPurify.sanitize(svgCode, { - ADD_TAGS: DOMPURE_TAGS, - ADD_ATTR: DOMPURE_ATTR, + ADD_TAGS: DOMPURIFY_TAGS, + ADD_ATTR: DOMPURIFY_ATTR, }); } diff --git a/packages/mermaid/src/utils.ts b/packages/mermaid/src/utils.ts index 767fdaa7d..628bf37d3 100644 --- a/packages/mermaid/src/utils.ts +++ b/packages/mermaid/src/utils.ts @@ -21,7 +21,7 @@ import { log } from './logger'; import { detectType } from './diagram-api/detectType'; import assignWithDepth from './assignWithDepth'; import { MermaidConfig } from './config.type'; -import memoize from 'lodash-es/memoize'; +import memoize from 'lodash-es/memoize.js'; // Effectively an enum of the supported curve types, accessible by name const d3CurveTypes = {