Skip to content

Commit

Permalink
fix: add .js to external imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Dec 12, 2022
1 parent fac3a4d commit 89451ca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"sveidqvist",
"techn",
"teststr",
"textlength",
"treemap",
"ts-nocheck",
"tuleap",
Expand Down
2 changes: 1 addition & 1 deletion packages/mermaid/src/accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions packages/mermaid/src/mermaidAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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,
});
}

Expand Down Expand Up @@ -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,
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/mermaid/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 89451ca

Please sign in to comment.