mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Merge pull request #4213 from remcohaszing/fix-node16-module-resolution
Support node16 module resolution
This commit is contained in:
commit
32d553a28f
@ -3,6 +3,7 @@ import { resolve } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import jisonPlugin from './jisonPlugin.js';
|
||||
import { readFileSync } from 'fs';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import type { TemplateType } from 'rollup-plugin-visualizer/dist/plugin/template-types.js';
|
||||
|
||||
@ -102,9 +103,14 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.jison', '.js', '.ts', '.json'],
|
||||
extensions: [],
|
||||
},
|
||||
plugins: [jisonPlugin(), ...visualizerOptions(packageName, core)],
|
||||
plugins: [
|
||||
jisonPlugin(),
|
||||
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
|
||||
typescript({ compilerOptions: { declaration: false } }),
|
||||
...visualizerOptions(packageName, core),
|
||||
],
|
||||
};
|
||||
|
||||
if (watch && config.build) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// @ts-nocheck TODO: Fix TS
|
||||
import { MockedD3 } from '../packages/mermaid/src/tests/MockedD3';
|
||||
import { MockedD3 } from '../packages/mermaid/src/tests/MockedD3.js';
|
||||
|
||||
export const select = function () {
|
||||
return new MockedD3();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { renderGraph } from '../../helpers/util';
|
||||
import { renderGraph } from '../../helpers/util.js';
|
||||
describe('Configuration', () => {
|
||||
describe('arrowMarkerAbsolute', () => {
|
||||
it('should handle default value false of arrowMarkerAbsolute', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { urlSnapshotTest } from '../../helpers/util';
|
||||
import { urlSnapshotTest } from '../../helpers/util.js';
|
||||
|
||||
describe('mermaid', () => {
|
||||
describe('registerDiagram', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { urlSnapshotTest } from '../../helpers/util';
|
||||
import { urlSnapshotTest } from '../../helpers/util.js';
|
||||
|
||||
describe('CSS injections', () => {
|
||||
it('should not allow CSS injections outside of the diagram', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest } from '../../helpers/util';
|
||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||
describe('Class diagram V2', () => {
|
||||
it('0: should render a simple class diagram', () => {
|
||||
imgSnapshotTest(
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe('Class diagram', () => {
|
||||
it('1: should render a simple class diagram', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest } from '../../helpers/util';
|
||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||
|
||||
describe('Current diagram', () => {
|
||||
it('should render a state with states in it', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest } from '../../helpers/util';
|
||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||
|
||||
describe('Flowchart', () => {
|
||||
it('34: testing the label width in percy', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe('Entity Relationship Diagram', () => {
|
||||
it('should render a simple ER diagram', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe.skip('Flowchart ELK', () => {
|
||||
it('1-elk: should render a simple flowchart', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe('Flowchart v2', () => {
|
||||
it('1: should render a simple flowchart', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe('Graph', () => {
|
||||
it('1: should render a simple flowchart no htmlLabels', () => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
context('Sequence diagram', () => {
|
||||
it('should render a sequence diagram with boxes', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe('State diagram', () => {
|
||||
it('v2 should render a simple info', () => {
|
||||
@ -530,7 +530,7 @@ stateDiagram-v2
|
||||
[*] --> A
|
||||
A --> B: test({ foo#colon; 'far' })
|
||||
B --> [*]
|
||||
classDef badBadEvent fill:#f00,color:white,font-weight:bold
|
||||
classDef badBadEvent fill:#f00,color:white,font-weight:bold
|
||||
class B badBadEvent
|
||||
`,
|
||||
{ logLevel: 0, fontFamily: 'courier' }
|
||||
@ -543,14 +543,14 @@ stateDiagram-v2
|
||||
classDef notMoving fill:white
|
||||
classDef movement font-style:italic;
|
||||
classDef badBadEvent fill:#f00,color:white,font-weight:bold
|
||||
|
||||
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
|
||||
|
||||
class Still notMoving
|
||||
class Moving, Crash movement
|
||||
class Crash badBadEvent
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe('State diagram', () => {
|
||||
it('should render a simple state diagrams', () => {
|
||||
|
@ -188,7 +188,7 @@ mindmap
|
||||
//import mindmap from '../../packages/mermaid-mindmap/src/detector';
|
||||
// import example from '../../packages/mermaid-example-diagram/src/detector';
|
||||
// import timeline from '../../packages/mermaid-timeline/src/detector';
|
||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||
import mermaid from './mermaid.esm.mjs';
|
||||
// await mermaid.registerExternalDiagrams([]);
|
||||
mermaid.parseError = function (err, hash) {
|
||||
// console.error('Mermaid error: ', err);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||
// TODO: this file should be testing the ./mermaid.core.mjs file, as that's the file listed in the package.json file that users will use
|
||||
import mermaid from './mermaid.esm.mjs';
|
||||
|
||||
let code = `flowchart LR
|
||||
Power_Supply --> Transmitter_A
|
||||
|
@ -11,9 +11,9 @@ example-diagram
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> -->
|
||||
<!-- <script type="module" src="./external-diagrams-mindmap.mjs" /> -->
|
||||
<script type="module">
|
||||
import exampleDiagram from '../../packages/mermaid-example-diagram/src/detector';
|
||||
import exampleDiagram from '../../packages/mermaid-example-diagram/dist/mermaid-example-diagram.core.mjs';
|
||||
// import example from '../../packages/mermaid-example-diagram/src/detector';
|
||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||
import mermaid from './mermaid.esm.mjs';
|
||||
|
||||
await mermaid.registerExternalDiagrams([exampleDiagram]);
|
||||
await mermaid.initialize({ logLevel: 0 });
|
||||
|
@ -30,7 +30,7 @@
|
||||
</pre>
|
||||
|
||||
<script type="module">
|
||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||
import mermaid from './mermaid.esm.mjs';
|
||||
|
||||
mermaid.initialize({
|
||||
theme: 'forest',
|
||||
|
@ -393,8 +393,8 @@ mindmap
|
||||
|
||||
<script type="module">
|
||||
// import mindmap from '../../packages/mermaid-mindmap/src/detector';
|
||||
import example from '../../packages/mermaid-example-diagram/src/detector';
|
||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||
import example from '../../packages/mermaid-example-diagram/src/mermaid-example-diagram.core.mjs';
|
||||
import mermaid from './mermaid.esm.mjs';
|
||||
await mermaid.registerExternalDiagrams([example]);
|
||||
mermaid.parseError = function (err, hash) {
|
||||
// console.error('Mermaid error: ', err);
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
<script type="module">
|
||||
// import mermaid from './mermaid.esm.mjs';
|
||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||
import mermaid from '../../packages/mermaid/dist/mermaid.esm.mjs';
|
||||
// import mermaidMindmap from './mermaid-mindmap.esm.mjs';
|
||||
|
||||
// import mermaidMindmap from 'https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-mindmap@9.3.0/+esm';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import mermaid2 from '../../packages/mermaid/src/mermaid';
|
||||
import externalExample from '../../packages/mermaid-example-diagram/src/detector';
|
||||
import mermaid2 from './mermaid.esm.mjs';
|
||||
import externalExample from '../../packages/mermaid-example-diagram/dist/mermaid-example-diagram.core.mjs';
|
||||
|
||||
function b64ToUtf8(str) {
|
||||
return decodeURIComponent(escape(window.atob(str)));
|
||||
|
@ -263,7 +263,7 @@ To Deploy Mermaid:
|
||||
|
||||
### [Mermaid API](../config/setup/README.md):
|
||||
|
||||
**To deploy mermaid without a bundler, one can insert a `script` tag with an absolute address and a `mermaid.initialize` call into the HTML like so:**
|
||||
**To deploy mermaid without a bundler, insert a `script` tag with an absolute address and a `mermaid.initialize` call into the HTML using the following example:**
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
@ -272,9 +272,9 @@ To Deploy Mermaid:
|
||||
</script>
|
||||
```
|
||||
|
||||
**Doing so will command the mermaid parser to look for the `<div>` or `<pre>` tags with `class="mermaid"`. From these tags mermaid will try to read the diagram/chart definitions and render them into SVG charts.**
|
||||
**Doing so commands the mermaid parser to look for the `<div>` or `<pre>` tags with `class="mermaid"`. From these tags, mermaid tries read the diagram/chart definitions and render them into SVG charts.**
|
||||
|
||||
**Examples can be found at** [Other examples](../syntax/examples.md)
|
||||
**Examples can be found in** [Other examples](../syntax/examples.md)
|
||||
|
||||
## Sibling projects
|
||||
|
||||
|
@ -58,6 +58,7 @@
|
||||
"@commitlint/cli": "^17.2.0",
|
||||
"@commitlint/config-conventional": "^17.2.0",
|
||||
"@cspell/eslint-plugin": "^6.14.2",
|
||||
"@rollup/plugin-typescript": "^11.0.0",
|
||||
"@types/cors": "^2.8.13",
|
||||
"@types/eslint": "^8.4.10",
|
||||
"@types/express": "^4.17.17",
|
||||
|
@ -1,9 +1,9 @@
|
||||
// @ts-ignore: TODO Fix ts errors
|
||||
import parser from './parser/exampleDiagram';
|
||||
import * as db from './exampleDiagramDb';
|
||||
import renderer from './exampleDiagramRenderer';
|
||||
import styles from './styles';
|
||||
import { injectUtils } from './mermaidUtils';
|
||||
import parser from './parser/exampleDiagram.jison';
|
||||
import * as db from './exampleDiagramDb.js';
|
||||
import renderer from './exampleDiagramRenderer.js';
|
||||
import styles from './styles.js';
|
||||
import { injectUtils } from './mermaidUtils.js';
|
||||
|
||||
export const diagram = {
|
||||
db,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { parser } from './parser/exampleDiagram';
|
||||
import * as db from './exampleDiagramDb';
|
||||
import { injectUtils } from './mermaidUtils';
|
||||
import { parser } from './parser/exampleDiagram.jison';
|
||||
import * as db from './exampleDiagramDb.js';
|
||||
import { injectUtils } from './mermaidUtils.js';
|
||||
// Todo fix utils functions for tests
|
||||
import {
|
||||
log,
|
||||
@ -8,7 +8,7 @@ import {
|
||||
getConfig,
|
||||
sanitizeText,
|
||||
setupGraphViewBox,
|
||||
} from '../../mermaid/src/diagram-api/diagramAPI';
|
||||
} from '../../mermaid/src/diagram-api/diagramAPI.js';
|
||||
|
||||
injectUtils(log, setLogLevel, getConfig, sanitizeText, setupGraphViewBox);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/** Created by knut on 15-01-14. */
|
||||
import { log } from './mermaidUtils';
|
||||
import { log } from './mermaidUtils.js';
|
||||
|
||||
var message = '';
|
||||
var info = false;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** Created by knut on 14-12-11. */
|
||||
import { select } from 'd3';
|
||||
import { log, getConfig, setupGraphViewbox } from './mermaidUtils';
|
||||
import { log, getConfig, setupGraphViewbox } from './mermaidUtils.js';
|
||||
|
||||
/**
|
||||
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
||||
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"module": "esnext",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
|
@ -1,11 +1,11 @@
|
||||
import * as configApi from './config';
|
||||
import { log } from './logger';
|
||||
import { getDiagram, registerDiagram } from './diagram-api/diagramAPI';
|
||||
import { detectType, getDiagramLoader } from './diagram-api/detectType';
|
||||
import { extractFrontMatter } from './diagram-api/frontmatter';
|
||||
import { UnknownDiagramError } from './errors';
|
||||
import { DetailedError } from './utils';
|
||||
import { cleanupComments } from './diagram-api/comments';
|
||||
import * as configApi from './config.js';
|
||||
import { log } from './logger.js';
|
||||
import { getDiagram, registerDiagram } from './diagram-api/diagramAPI.js';
|
||||
import { detectType, getDiagramLoader } from './diagram-api/detectType.js';
|
||||
import { extractFrontMatter } from './diagram-api/frontmatter.js';
|
||||
import { UnknownDiagramError } from './errors.js';
|
||||
import { DetailedError } from './utils.js';
|
||||
import { cleanupComments } from './diagram-api/comments.js';
|
||||
|
||||
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
*
|
||||
* We can't easily use `vi.spyOn(mermaidAPI, "function")` since the object is frozen with `Object.freeze()`.
|
||||
*/
|
||||
import * as configApi from '../config';
|
||||
import * as configApi from '../config.js';
|
||||
import { vi } from 'vitest';
|
||||
import { mermaidAPI as mAPI } from '../mermaidAPI';
|
||||
import { mermaidAPI as mAPI } from '../mermaidAPI.js';
|
||||
|
||||
// original version cannot be modified since it was frozen with `Object.freeze()`
|
||||
export const mermaidAPI = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { MockedD3 } from './tests/MockedD3';
|
||||
import { setA11yDiagramInfo, addSVGa11yTitleDescription } from './accessibility';
|
||||
import { D3Element } from './mermaidAPI';
|
||||
import { MockedD3 } from './tests/MockedD3.js';
|
||||
import { setA11yDiagramInfo, addSVGa11yTitleDescription } from './accessibility.js';
|
||||
import { D3Element } from './mermaidAPI.js';
|
||||
|
||||
describe('accessibility', () => {
|
||||
const fauxSvgNode = new MockedD3();
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @see https://www.w3.org/TR/svg-aam-1.0/
|
||||
*
|
||||
*/
|
||||
import { D3Element } from './mermaidAPI';
|
||||
import { D3Element } from './mermaidAPI.js';
|
||||
|
||||
import isEmpty from 'lodash-es/isEmpty.js';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { sanitizeText as _sanitizeText } from './diagrams/common/common';
|
||||
import { getConfig } from './config';
|
||||
import { sanitizeText as _sanitizeText } from './diagrams/common/common.js';
|
||||
import { getConfig } from './config.js';
|
||||
let title = '';
|
||||
let diagramTitle = '';
|
||||
let description = '';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as configApi from './config';
|
||||
import * as configApi from './config.js';
|
||||
|
||||
describe('when working with site config', function () {
|
||||
beforeEach(() => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import assignWithDepth from './assignWithDepth';
|
||||
import { log } from './logger';
|
||||
import theme from './themes';
|
||||
import config from './defaultConfig';
|
||||
import type { MermaidConfig } from './config.type';
|
||||
import assignWithDepth from './assignWithDepth.js';
|
||||
import { log } from './logger.js';
|
||||
import theme from './themes/index.js';
|
||||
import config from './defaultConfig.js';
|
||||
import type { MermaidConfig } from './config.type.js';
|
||||
|
||||
export const defaultConfig: MermaidConfig = Object.freeze(config);
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import intersectRect from './intersect/intersect-rect';
|
||||
import { log } from '../logger';
|
||||
import createLabel from './createLabel';
|
||||
import { createText } from '../rendering-util/createText';
|
||||
import intersectRect from './intersect/intersect-rect.js';
|
||||
import { log } from '../logger.js';
|
||||
import createLabel from './createLabel.js';
|
||||
import { createText } from '../rendering-util/createText.js';
|
||||
import { select } from 'd3';
|
||||
import { getConfig } from '../config';
|
||||
import { evaluate } from '../diagrams/common/common';
|
||||
import { getConfig } from '../config.js';
|
||||
import { evaluate } from '../diagrams/common/common.js';
|
||||
|
||||
const rect = (parent, node) => {
|
||||
log.info('Creating subgraph rect for ', node.id, node);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { select } from 'd3';
|
||||
import { log } from '../logger';
|
||||
import { getConfig } from '../config';
|
||||
import { evaluate } from '../diagrams/common/common';
|
||||
import { decodeEntities } from '../mermaidAPI';
|
||||
import { log } from '../logger.js';
|
||||
import { getConfig } from '../config.js';
|
||||
import { evaluate } from '../diagrams/common/common.js';
|
||||
import { decodeEntities } from '../mermaidAPI.js';
|
||||
|
||||
/**
|
||||
* @param dom
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { log } from '../logger';
|
||||
import createLabel from './createLabel';
|
||||
import { createText } from '../rendering-util/createText';
|
||||
import { log } from '../logger.js';
|
||||
import createLabel from './createLabel.js';
|
||||
import { createText } from '../rendering-util/createText.js';
|
||||
import { line, curveBasis, select } from 'd3';
|
||||
import { getConfig } from '../config';
|
||||
import utils from '../utils';
|
||||
import { evaluate } from '../diagrams/common/common';
|
||||
import { getConfig } from '../config.js';
|
||||
import utils from '../utils.js';
|
||||
import { evaluate } from '../diagrams/common/common.js';
|
||||
|
||||
let edgeLabels = {};
|
||||
let terminalLabels = {};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { intersection } from './edges';
|
||||
import { setLogLevel } from '../logger';
|
||||
import { intersection } from './edges.js';
|
||||
import { setLogLevel } from '../logger.js';
|
||||
|
||||
describe('Graphlib decorations', () => {
|
||||
let node;
|
||||
|
@ -1,18 +1,18 @@
|
||||
import { layout as dagreLayout } from 'dagre-d3-es/src/dagre/index.js';
|
||||
import * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';
|
||||
import insertMarkers from './markers';
|
||||
import { updateNodeBounds } from './shapes/util';
|
||||
import insertMarkers from './markers.js';
|
||||
import { updateNodeBounds } from './shapes/util.js';
|
||||
import {
|
||||
clear as clearGraphlib,
|
||||
clusterDb,
|
||||
adjustClustersAndEdges,
|
||||
findNonClusterChild,
|
||||
sortNodesByHierarchy,
|
||||
} from './mermaid-graphlib';
|
||||
import { insertNode, positionNode, clear as clearNodes, setNodeElem } from './nodes';
|
||||
import { insertCluster, clear as clearClusters } from './clusters';
|
||||
import { insertEdgeLabel, positionEdgeLabel, insertEdge, clear as clearEdges } from './edges';
|
||||
import { log } from '../logger';
|
||||
} from './mermaid-graphlib.js';
|
||||
import { insertNode, positionNode, clear as clearNodes, setNodeElem } from './nodes.js';
|
||||
import { insertCluster, clear as clearClusters } from './clusters.js';
|
||||
import { insertEdgeLabel, positionEdgeLabel, insertEdge, clear as clearEdges } from './edges.js';
|
||||
import { log } from '../logger.js';
|
||||
|
||||
const recursiveRender = async (_elem, graph, diagramtype, parentCluster) => {
|
||||
log.info('Graph in recursive render: XXX', graphlibJson.write(graph), parentCluster);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import intersectEllipse from './intersect-ellipse';
|
||||
import intersectEllipse from './intersect-ellipse.js';
|
||||
|
||||
/**
|
||||
* @param node
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint "no-console": off */
|
||||
|
||||
import intersectLine from './intersect-line';
|
||||
import intersectLine from './intersect-line.js';
|
||||
|
||||
export default intersectPolygon;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** Setup arrow head and define the marker. The result is appended to the svg. */
|
||||
|
||||
import { log } from '../logger';
|
||||
import { log } from '../logger.js';
|
||||
|
||||
// Only add the number of markers that the diagram needs
|
||||
const insertMarkers = (elem, markerArray, type, id) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/** Decorates with functions required by mermaids dagre-wrapper. */
|
||||
import { log } from '../logger';
|
||||
import { log } from '../logger.js';
|
||||
import * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';
|
||||
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
||||
|
||||
|
@ -5,8 +5,8 @@ import {
|
||||
adjustClustersAndEdges,
|
||||
extractDescendants,
|
||||
sortNodesByHierarchy,
|
||||
} from './mermaid-graphlib';
|
||||
import { setLogLevel, log } from '../logger';
|
||||
} from './mermaid-graphlib.js';
|
||||
import { setLogLevel, log } from '../logger.js';
|
||||
|
||||
describe('Graphlib decorations', () => {
|
||||
let g;
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { select } from 'd3';
|
||||
import { log } from '../logger';
|
||||
import { labelHelper, updateNodeBounds, insertPolygonShape } from './shapes/util';
|
||||
import { getConfig } from '../config';
|
||||
import { log } from '../logger.js';
|
||||
import { labelHelper, updateNodeBounds, insertPolygonShape } from './shapes/util.js';
|
||||
import { getConfig } from '../config.js';
|
||||
import intersect from './intersect/index.js';
|
||||
import createLabel from './createLabel';
|
||||
import note from './shapes/note';
|
||||
import { parseMember } from '../diagrams/class/svgDraw';
|
||||
import { evaluate } from '../diagrams/common/common';
|
||||
import createLabel from './createLabel.js';
|
||||
import note from './shapes/note.js';
|
||||
import { parseMember } from '../diagrams/class/svgDraw.js';
|
||||
import { evaluate } from '../diagrams/common/common.js';
|
||||
|
||||
const question = async (parent, node) => {
|
||||
const { shapeSvg, bbox } = await labelHelper(parent, node, undefined, true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** Setup arrow head and define the marker. The result is appended to the svg. */
|
||||
|
||||
// import { log } from '../logger';
|
||||
// import { log } from '../logger.js';
|
||||
|
||||
// Only add the number of markers that the diagram needs
|
||||
const insertPatterns = (elem, patternArray, type, id) => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { updateNodeBounds, labelHelper } from './util';
|
||||
import { log } from '../../logger';
|
||||
import { getConfig } from '../../config';
|
||||
import { updateNodeBounds, labelHelper } from './util.js';
|
||||
import { log } from '../../logger.js';
|
||||
import { getConfig } from '../../config.js';
|
||||
import intersect from '../intersect/index.js';
|
||||
|
||||
const note = async (parent, node) => {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import createLabel from '../createLabel';
|
||||
import { createText } from '../../rendering-util/createText';
|
||||
import { getConfig } from '../../config';
|
||||
import { decodeEntities } from '../../mermaidAPI';
|
||||
import createLabel from '../createLabel.js';
|
||||
import { createText } from '../../rendering-util/createText.js';
|
||||
import { getConfig } from '../../config.js';
|
||||
import { decodeEntities } from '../../mermaidAPI.js';
|
||||
import { select } from 'd3';
|
||||
import { evaluate, sanitizeText } from '../../diagrams/common/common';
|
||||
import { evaluate, sanitizeText } from '../../diagrams/common/common.js';
|
||||
|
||||
export const labelHelper = async (parent, node, _classes, isNode) => {
|
||||
let classes;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import theme from './themes';
|
||||
import { MermaidConfig } from './config.type';
|
||||
import theme from './themes/index.js';
|
||||
import { MermaidConfig } from './config.type.js';
|
||||
/**
|
||||
* **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click
|
||||
* here](8.6.0_docs.md)].**
|
||||
|
@ -1,12 +1,12 @@
|
||||
// tests to check that comments are removed
|
||||
|
||||
import { cleanupComments } from './comments';
|
||||
import { cleanupComments } from './comments.js';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('comments', () => {
|
||||
it('should remove comments', () => {
|
||||
const text = `
|
||||
|
||||
|
||||
%% This is a comment
|
||||
%% This is another comment
|
||||
graph TD
|
||||
@ -27,7 +27,7 @@ graph TD
|
||||
%% This is another comment
|
||||
%%{init: {'theme': 'forest'}}%%
|
||||
%%{ init: {'theme': 'space before init'}}%%
|
||||
%%{init: {'theme': 'space after ending'}}%%
|
||||
%%{init: {'theme': 'space after ending'}}%%
|
||||
graph TD
|
||||
A-->B
|
||||
|
||||
@ -37,7 +37,7 @@ graph TD
|
||||
expect(cleanupComments(text)).toMatchInlineSnapshot(`
|
||||
"%%{init: {'theme': 'forest'}}%%
|
||||
%%{ init: {'theme': 'space before init'}}%%
|
||||
%%{init: {'theme': 'space after ending'}}%%
|
||||
%%{init: {'theme': 'space after ending'}}%%
|
||||
graph TD
|
||||
A-->B
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { MermaidConfig } from '../config.type';
|
||||
import { log } from '../logger';
|
||||
import { MermaidConfig } from '../config.type.js';
|
||||
import { log } from '../logger.js';
|
||||
import type {
|
||||
DetectorRecord,
|
||||
DiagramDetector,
|
||||
DiagramLoader,
|
||||
ExternalDiagramDefinition,
|
||||
} from './types';
|
||||
import { frontMatterRegex } from './frontmatter';
|
||||
import { getDiagram, registerDiagram } from './diagramAPI';
|
||||
import { UnknownDiagramError } from '../errors';
|
||||
} from './types.js';
|
||||
import { frontMatterRegex } from './frontmatter.js';
|
||||
import { getDiagram, registerDiagram } from './diagramAPI.js';
|
||||
import { UnknownDiagramError } from '../errors.js';
|
||||
|
||||
const directive = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
||||
const anyComment = /\s*%%.*\n/gm;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { it, describe, expect } from 'vitest';
|
||||
import { detectType } from './detectType';
|
||||
import { addDiagrams } from './diagram-orchestration';
|
||||
import { detectType } from './detectType.js';
|
||||
import { addDiagrams } from './diagram-orchestration.js';
|
||||
|
||||
describe('diagram-orchestration', () => {
|
||||
it('should register diagrams', () => {
|
||||
|
@ -1,24 +1,24 @@
|
||||
import c4 from '../diagrams/c4/c4Detector';
|
||||
import flowchart from '../diagrams/flowchart/flowDetector';
|
||||
import flowchartV2 from '../diagrams/flowchart/flowDetector-v2';
|
||||
import er from '../diagrams/er/erDetector';
|
||||
import git from '../diagrams/git/gitGraphDetector';
|
||||
import gantt from '../diagrams/gantt/ganttDetector';
|
||||
import info from '../diagrams/info/infoDetector';
|
||||
import pie from '../diagrams/pie/pieDetector';
|
||||
import requirement from '../diagrams/requirement/requirementDetector';
|
||||
import sequence from '../diagrams/sequence/sequenceDetector';
|
||||
import classDiagram from '../diagrams/class/classDetector';
|
||||
import classDiagramV2 from '../diagrams/class/classDetector-V2';
|
||||
import state from '../diagrams/state/stateDetector';
|
||||
import stateV2 from '../diagrams/state/stateDetector-V2';
|
||||
import journey from '../diagrams/user-journey/journeyDetector';
|
||||
import errorDiagram from '../diagrams/error/errorDiagram';
|
||||
import flowchartElk from '../diagrams/flowchart/elk/detector';
|
||||
import timeline from '../diagrams/timeline/detector';
|
||||
import mindmap from '../diagrams/mindmap/detector';
|
||||
import { registerLazyLoadedDiagrams } from './detectType';
|
||||
import { registerDiagram } from './diagramAPI';
|
||||
import c4 from '../diagrams/c4/c4Detector.js';
|
||||
import flowchart from '../diagrams/flowchart/flowDetector.js';
|
||||
import flowchartV2 from '../diagrams/flowchart/flowDetector-v2.js';
|
||||
import er from '../diagrams/er/erDetector.js';
|
||||
import git from '../diagrams/git/gitGraphDetector.js';
|
||||
import gantt from '../diagrams/gantt/ganttDetector.js';
|
||||
import info from '../diagrams/info/infoDetector.js';
|
||||
import pie from '../diagrams/pie/pieDetector.js';
|
||||
import requirement from '../diagrams/requirement/requirementDetector.js';
|
||||
import sequence from '../diagrams/sequence/sequenceDetector.js';
|
||||
import classDiagram from '../diagrams/class/classDetector.js';
|
||||
import classDiagramV2 from '../diagrams/class/classDetector-V2.js';
|
||||
import state from '../diagrams/state/stateDetector.js';
|
||||
import stateV2 from '../diagrams/state/stateDetector-V2.js';
|
||||
import journey from '../diagrams/user-journey/journeyDetector.js';
|
||||
import errorDiagram from '../diagrams/error/errorDiagram.js';
|
||||
import flowchartElk from '../diagrams/flowchart/elk/detector.js';
|
||||
import timeline from '../diagrams/timeline/detector.js';
|
||||
import mindmap from '../diagrams/mindmap/detector.js';
|
||||
import { registerLazyLoadedDiagrams } from './detectType.js';
|
||||
import { registerDiagram } from './diagramAPI.js';
|
||||
|
||||
let hasLoadedDiagrams = false;
|
||||
export const addDiagrams = () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { detectType } from './detectType';
|
||||
import { getDiagram, registerDiagram } from './diagramAPI';
|
||||
import { addDiagrams } from './diagram-orchestration';
|
||||
import { DiagramDetector } from './types';
|
||||
import { getDiagramFromText } from '../Diagram';
|
||||
import { detectType } from './detectType.js';
|
||||
import { getDiagram, registerDiagram } from './diagramAPI.js';
|
||||
import { addDiagrams } from './diagram-orchestration.js';
|
||||
import { DiagramDetector } from './types.js';
|
||||
import { getDiagramFromText } from '../Diagram.js';
|
||||
import { it, describe, expect, beforeAll } from 'vitest';
|
||||
|
||||
addDiagrams();
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { addDetector } from './detectType';
|
||||
import { log as _log, setLogLevel as _setLogLevel } from '../logger';
|
||||
import { getConfig as _getConfig } from '../config';
|
||||
import { sanitizeText as _sanitizeText } from '../diagrams/common/common';
|
||||
import { setupGraphViewbox as _setupGraphViewbox } from '../setupGraphViewbox';
|
||||
import { addStylesForDiagram } from '../styles';
|
||||
import { DiagramDefinition, DiagramDetector } from './types';
|
||||
import * as _commonDb from '../commonDb';
|
||||
import { parseDirective as _parseDirective } from '../directiveUtils';
|
||||
import { addDetector } from './detectType.js';
|
||||
import { log as _log, setLogLevel as _setLogLevel } from '../logger.js';
|
||||
import { getConfig as _getConfig } from '../config.js';
|
||||
import { sanitizeText as _sanitizeText } from '../diagrams/common/common.js';
|
||||
import { setupGraphViewbox as _setupGraphViewbox } from '../setupGraphViewbox.js';
|
||||
import { addStylesForDiagram } from '../styles.js';
|
||||
import { DiagramDefinition, DiagramDetector } from './types.js';
|
||||
import * as _commonDb from '../commonDb.js';
|
||||
import { parseDirective as _parseDirective } from '../directiveUtils.js';
|
||||
|
||||
/*
|
||||
Packaging and exposing resources for external diagrams so that they can import
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { vi } from 'vitest';
|
||||
import { extractFrontMatter } from './frontmatter';
|
||||
import { extractFrontMatter } from './frontmatter.js';
|
||||
|
||||
const dbMock = () => ({ setDiagramTitle: vi.fn() });
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { DiagramDb } from './types';
|
||||
import { DiagramDb } from './types.js';
|
||||
// The "* as yaml" part is necessary for tree-shaking
|
||||
import * as yaml from 'js-yaml';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MermaidConfig } from '../config.type';
|
||||
import { MermaidConfig } from '../config.type.js';
|
||||
|
||||
export interface InjectUtils {
|
||||
_log: any;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { describe, test, expect } from 'vitest';
|
||||
import { Diagram, getDiagramFromText } from './Diagram';
|
||||
import { addDetector } from './diagram-api/detectType';
|
||||
import { addDiagrams } from './diagram-api/diagram-orchestration';
|
||||
import { Diagram, getDiagramFromText } from './Diagram.js';
|
||||
import { addDetector } from './diagram-api/detectType.js';
|
||||
import { addDiagrams } from './diagram-api/diagram-orchestration.js';
|
||||
|
||||
addDiagrams();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import mermaidAPI from '../../mermaidAPI';
|
||||
import * as configApi from '../../config';
|
||||
import { sanitizeText } from '../common/common';
|
||||
import { setAccTitle, getAccTitle, getAccDescription, setAccDescription } from '../../commonDb';
|
||||
import mermaidAPI from '../../mermaidAPI.js';
|
||||
import * as configApi from '../../config.js';
|
||||
import { sanitizeText } from '../common/common.js';
|
||||
import { setAccTitle, getAccTitle, getAccDescription, setAccDescription } from '../../commonDb.js';
|
||||
|
||||
let c4ShapeArray = [];
|
||||
let boundaryParseStack = [''];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { ExternalDiagramDefinition } from '../../diagram-api/types';
|
||||
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||
|
||||
const id = 'c4';
|
||||
|
||||
@ -7,7 +7,7 @@ const detector = (txt: string) => {
|
||||
};
|
||||
|
||||
const loader = async () => {
|
||||
const { diagram } = await import('./c4Diagram');
|
||||
const { diagram } = await import('./c4Diagram.js');
|
||||
return { id, diagram };
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
// @ts-ignore: TODO Fix ts errors
|
||||
import c4Parser from './parser/c4Diagram';
|
||||
import c4Db from './c4Db';
|
||||
import c4Renderer from './c4Renderer';
|
||||
import c4Styles from './styles';
|
||||
import { MermaidConfig } from '../../config.type';
|
||||
import { DiagramDefinition } from '../../diagram-api/types';
|
||||
import c4Parser from './parser/c4Diagram.jison';
|
||||
import c4Db from './c4Db.js';
|
||||
import c4Renderer from './c4Renderer.js';
|
||||
import c4Styles from './styles.js';
|
||||
import { MermaidConfig } from '../../config.type.js';
|
||||
import { DiagramDefinition } from '../../diagram-api/types.js';
|
||||
|
||||
export const diagram: DiagramDefinition = {
|
||||
parser: c4Parser,
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { select } from 'd3';
|
||||
import svgDraw from './svgDraw';
|
||||
import { log } from '../../logger';
|
||||
import { parser } from './parser/c4Diagram';
|
||||
import common from '../common/common';
|
||||
import c4Db from './c4Db';
|
||||
import * as configApi from '../../config';
|
||||
import assignWithDepth from '../../assignWithDepth';
|
||||
import { wrapLabel, calculateTextWidth, calculateTextHeight } from '../../utils';
|
||||
import { configureSvgSize } from '../../setupGraphViewbox';
|
||||
import svgDraw from './svgDraw.js';
|
||||
import { log } from '../../logger.js';
|
||||
import { parser } from './parser/c4Diagram.jison';
|
||||
import common from '../common/common.js';
|
||||
import c4Db from './c4Db.js';
|
||||
import * as configApi from '../../config.js';
|
||||
import assignWithDepth from '../../assignWithDepth.js';
|
||||
import { wrapLabel, calculateTextWidth, calculateTextHeight } from '../../utils.js';
|
||||
import { configureSvgSize } from '../../setupGraphViewbox.js';
|
||||
|
||||
let globalBoundaryMaxX = 0,
|
||||
globalBoundaryMaxY = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import c4Db from '../c4Db';
|
||||
import c4Db from '../c4Db.js';
|
||||
import c4 from './c4Diagram.jison';
|
||||
import { setConfig } from '../../../config';
|
||||
import { setConfig } from '../../../config.js';
|
||||
|
||||
setConfig({
|
||||
securityLevel: 'strict',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import c4Db from '../c4Db';
|
||||
import c4Db from '../c4Db.js';
|
||||
import c4 from './c4Diagram.jison';
|
||||
import { setConfig } from '../../../config';
|
||||
import { setConfig } from '../../../config.js';
|
||||
|
||||
setConfig({
|
||||
securityLevel: 'strict',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import c4Db from '../c4Db';
|
||||
import c4Db from '../c4Db.js';
|
||||
import c4 from './c4Diagram.jison';
|
||||
import { setConfig } from '../../../config';
|
||||
import { setConfig } from '../../../config.js';
|
||||
|
||||
setConfig({
|
||||
securityLevel: 'strict',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import c4Db from '../c4Db';
|
||||
import c4Db from '../c4Db.js';
|
||||
import c4 from './c4Diagram.jison';
|
||||
import { setConfig } from '../../../config';
|
||||
import { setConfig } from '../../../config.js';
|
||||
|
||||
setConfig({
|
||||
securityLevel: 'strict',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import c4Db from '../c4Db';
|
||||
import c4Db from '../c4Db.js';
|
||||
import c4 from './c4Diagram.jison';
|
||||
import { setConfig } from '../../../config';
|
||||
import { setConfig } from '../../../config.js';
|
||||
|
||||
setConfig({
|
||||
securityLevel: 'strict',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import common from '../common/common';
|
||||
import common from '../common/common.js';
|
||||
import { sanitizeUrl } from '@braintree/sanitize-url';
|
||||
|
||||
export const drawRect = function (elem, rectData) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
// @ts-expect-error - d3 types issue
|
||||
import { select, Selection } from 'd3';
|
||||
import { log } from '../../logger';
|
||||
import * as configApi from '../../config';
|
||||
import common from '../common/common';
|
||||
import utils from '../../utils';
|
||||
import mermaidAPI from '../../mermaidAPI';
|
||||
import { log } from '../../logger.js';
|
||||
import * as configApi from '../../config.js';
|
||||
import common from '../common/common.js';
|
||||
import utils from '../../utils.js';
|
||||
import mermaidAPI from '../../mermaidAPI.js';
|
||||
import {
|
||||
setAccTitle,
|
||||
getAccTitle,
|
||||
@ -13,8 +13,8 @@ import {
|
||||
clear as commonClear,
|
||||
setDiagramTitle,
|
||||
getDiagramTitle,
|
||||
} from '../../commonDb';
|
||||
import { ClassRelation, ClassNode, ClassNote, ClassMap } from './classTypes';
|
||||
} from '../../commonDb.js';
|
||||
import { ClassRelation, ClassNode, ClassNote, ClassMap } from './classTypes.js';
|
||||
|
||||
const MERMAID_DOM_ID_PREFIX = 'classId-';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';
|
||||
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||
|
||||
const id = 'classDiagram';
|
||||
|
||||
@ -15,7 +15,7 @@ const detector: DiagramDetector = (txt, config) => {
|
||||
};
|
||||
|
||||
const loader = async () => {
|
||||
const { diagram } = await import('./classDiagram-v2');
|
||||
const { diagram } = await import('./classDiagram-v2.js');
|
||||
return { id, diagram };
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';
|
||||
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||
|
||||
const id = 'class';
|
||||
|
||||
@ -12,7 +12,7 @@ const detector: DiagramDetector = (txt, config) => {
|
||||
};
|
||||
|
||||
const loader = async () => {
|
||||
const { diagram } = await import('./classDiagram');
|
||||
const { diagram } = await import('./classDiagram.js');
|
||||
return { id, diagram };
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { parser } from './parser/classDiagram';
|
||||
import classDb from './classDb';
|
||||
import { parser } from './parser/classDiagram.jison';
|
||||
import classDb from './classDb.js';
|
||||
|
||||
describe('class diagram, ', function () {
|
||||
describe('when parsing data from a classDiagram it', function () {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { DiagramDefinition } from '../../diagram-api/types';
|
||||
import { DiagramDefinition } from '../../diagram-api/types.js';
|
||||
// @ts-ignore: TODO Fix ts errors
|
||||
import parser from './parser/classDiagram';
|
||||
import db from './classDb';
|
||||
import styles from './styles';
|
||||
import renderer from './classRenderer-v2';
|
||||
import parser from './parser/classDiagram.jison';
|
||||
import db from './classDb.js';
|
||||
import styles from './styles.js';
|
||||
import renderer from './classRenderer-v2.js';
|
||||
|
||||
export const diagram: DiagramDefinition = {
|
||||
parser,
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-expect-error Jison doesn't export types
|
||||
import { parser } from './parser/classDiagram';
|
||||
import classDb from './classDb';
|
||||
import { parser } from './parser/classDiagram.jison';
|
||||
import classDb from './classDb.js';
|
||||
import { vi, describe, it, expect } from 'vitest';
|
||||
const spyOn = vi.spyOn;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { DiagramDefinition } from '../../diagram-api/types';
|
||||
import { DiagramDefinition } from '../../diagram-api/types.js';
|
||||
// @ts-ignore: TODO Fix ts errors
|
||||
import parser from './parser/classDiagram';
|
||||
import db from './classDb';
|
||||
import styles from './styles';
|
||||
import renderer from './classRenderer';
|
||||
import parser from './parser/classDiagram.jison';
|
||||
import db from './classDb.js';
|
||||
import styles from './styles.js';
|
||||
import renderer from './classRenderer.js';
|
||||
|
||||
export const diagram: DiagramDefinition = {
|
||||
parser,
|
||||
|
@ -1,14 +1,14 @@
|
||||
// @ts-ignore d3 types are not available
|
||||
import { select, curveLinear } from 'd3';
|
||||
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
||||
import { log } from '../../logger';
|
||||
import { getConfig } from '../../config';
|
||||
import { log } from '../../logger.js';
|
||||
import { getConfig } from '../../config.js';
|
||||
import { render } from '../../dagre-wrapper/index.js';
|
||||
import utils from '../../utils';
|
||||
import { interpolateToCurve, getStylesFromArray } from '../../utils';
|
||||
import { setupGraphViewbox } from '../../setupGraphViewbox';
|
||||
import common from '../common/common';
|
||||
import { ClassRelation, ClassNote, ClassMap, EdgeData } from './classTypes';
|
||||
import utils from '../../utils.js';
|
||||
import { interpolateToCurve, getStylesFromArray } from '../../utils.js';
|
||||
import { setupGraphViewbox } from '../../setupGraphViewbox.js';
|
||||
import common from '../common/common.js';
|
||||
import { ClassRelation, ClassNote, ClassMap, EdgeData } from './classTypes.js';
|
||||
|
||||
const sanitizeText = (txt: string) => common.sanitizeText(txt, getConfig());
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { select } from 'd3';
|
||||
import { layout as dagreLayout } from 'dagre-d3-es/src/dagre/index.js';
|
||||
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
||||
import { log } from '../../logger';
|
||||
import svgDraw from './svgDraw';
|
||||
import { configureSvgSize } from '../../setupGraphViewbox';
|
||||
import { getConfig } from '../../config';
|
||||
import { log } from '../../logger.js';
|
||||
import svgDraw from './svgDraw.js';
|
||||
import { configureSvgSize } from '../../setupGraphViewbox.js';
|
||||
import { getConfig } from '../../config.js';
|
||||
|
||||
let idCache = {};
|
||||
const padding = 20;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { line, curveBasis } from 'd3';
|
||||
import utils from '../../utils';
|
||||
import { log } from '../../logger';
|
||||
import { parseGenericTypes } from '../common/common';
|
||||
import utils from '../../utils.js';
|
||||
import { log } from '../../logger.js';
|
||||
import { parseGenericTypes } from '../common/common.js';
|
||||
|
||||
let edgeCount = 0;
|
||||
export const drawEdge = function (elem, path, relation, conf, diagObj) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import svgDraw from './svgDraw';
|
||||
import svgDraw from './svgDraw.js';
|
||||
|
||||
describe('class member Renderer, ', function () {
|
||||
describe('when parsing text to build method display string', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { sanitizeText, removeScript, parseGenericTypes } from './common';
|
||||
import { sanitizeText, removeScript, parseGenericTypes } from './common.js';
|
||||
|
||||
describe('when securityLevel is antiscript, all script must be removed', function () {
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import DOMPurify from 'dompurify';
|
||||
import { MermaidConfig } from '../../config.type';
|
||||
import { MermaidConfig } from '../../config.type.js';
|
||||
|
||||
/**
|
||||
* Gets the rows of lines in a string
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { log } from '../../logger';
|
||||
import mermaidAPI from '../../mermaidAPI';
|
||||
import * as configApi from '../../config';
|
||||
import { log } from '../../logger.js';
|
||||
import mermaidAPI from '../../mermaidAPI.js';
|
||||
import * as configApi from '../../config.js';
|
||||
|
||||
import {
|
||||
setAccTitle,
|
||||
@ -10,7 +10,7 @@ import {
|
||||
clear as commonClear,
|
||||
setDiagramTitle,
|
||||
getDiagramTitle,
|
||||
} from '../../commonDb';
|
||||
} from '../../commonDb.js';
|
||||
|
||||
let entities = {};
|
||||
let relationships = [];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';
|
||||
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||
|
||||
const id = 'er';
|
||||
|
||||
@ -7,7 +7,7 @@ const detector: DiagramDetector = (txt) => {
|
||||
};
|
||||
|
||||
const loader = async () => {
|
||||
const { diagram } = await import('./erDiagram');
|
||||
const { diagram } = await import('./erDiagram.js');
|
||||
return { id, diagram };
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// @ts-ignore: TODO Fix ts errors
|
||||
import erParser from './parser/erDiagram';
|
||||
import erDb from './erDb';
|
||||
import erRenderer from './erRenderer';
|
||||
import erStyles from './styles';
|
||||
import erParser from './parser/erDiagram.jison';
|
||||
import erDb from './erDb.js';
|
||||
import erRenderer from './erRenderer.js';
|
||||
import erStyles from './styles.js';
|
||||
|
||||
export const diagram = {
|
||||
parser: erParser,
|
||||
|
@ -1,12 +1,12 @@
|
||||
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
||||
import { line, curveBasis, select } from 'd3';
|
||||
import { layout as dagreLayout } from 'dagre-d3-es/src/dagre/index.js';
|
||||
import { getConfig } from '../../config';
|
||||
import { log } from '../../logger';
|
||||
import utils from '../../utils';
|
||||
import erMarkers from './erMarkers';
|
||||
import { configureSvgSize } from '../../setupGraphViewbox';
|
||||
import { parseGenericTypes } from '../common/common';
|
||||
import { getConfig } from '../../config.js';
|
||||
import { log } from '../../logger.js';
|
||||
import utils from '../../utils.js';
|
||||
import erMarkers from './erMarkers.js';
|
||||
import { configureSvgSize } from '../../setupGraphViewbox.js';
|
||||
import { parseGenericTypes } from '../common/common.js';
|
||||
import { v5 as uuid5 } from 'uuid';
|
||||
|
||||
/** Regex used to remove chars from the entity name so the result can be used in an id */
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { generateId } from './erRenderer';
|
||||
import { generateId } from './erRenderer.js';
|
||||
|
||||
describe('erRenderer', () => {
|
||||
describe('generateId', () => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { setConfig } from '../../../config';
|
||||
import erDb from '../erDb';
|
||||
import erDiagram from './erDiagram'; // jison file
|
||||
import { setConfig } from '../../../config.js';
|
||||
import erDb from '../erDb.js';
|
||||
import erDiagram from './erDiagram.jison'; // jison file
|
||||
|
||||
setConfig({
|
||||
securityLevel: 'strict',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { DiagramDefinition } from '../../diagram-api/types';
|
||||
import styles from './styles';
|
||||
import renderer from './errorRenderer';
|
||||
import { DiagramDefinition } from '../../diagram-api/types.js';
|
||||
import styles from './styles.js';
|
||||
import renderer from './errorRenderer.js';
|
||||
export const diagram: DiagramDefinition = {
|
||||
db: {
|
||||
clear: () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
/** Created by knut on 14-12-11. */
|
||||
// @ts-ignore TODO: Investigate D3 issue
|
||||
import { select } from 'd3';
|
||||
import { log } from '../../logger';
|
||||
import { getErrorMessage } from '../../utils';
|
||||
import { log } from '../../logger.js';
|
||||
import { getErrorMessage } from '../../utils.js';
|
||||
|
||||
/**
|
||||
* Merges the value of `conf` with the passed `cnf`
|
||||
|
@ -1,4 +1,4 @@
|
||||
import plugin from './detector';
|
||||
import plugin from './detector.js';
|
||||
import { describe, it } from 'vitest';
|
||||
|
||||
const { detector } = plugin;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { MermaidConfig } from '../../../config.type';
|
||||
import type { ExternalDiagramDefinition, DiagramDetector } from '../../../diagram-api/types';
|
||||
import type { MermaidConfig } from '../../../config.type.js';
|
||||
import type { ExternalDiagramDefinition, DiagramDetector } from '../../../diagram-api/types.js';
|
||||
|
||||
const id = 'flowchart-elk';
|
||||
|
||||
|
@ -2,14 +2,14 @@ import { select, line, curveLinear } from 'd3';
|
||||
import { insertNode } from '../../../dagre-wrapper/nodes.js';
|
||||
import insertMarkers from '../../../dagre-wrapper/markers.js';
|
||||
import { insertEdgeLabel } from '../../../dagre-wrapper/edges.js';
|
||||
import { findCommonAncestor } from './render-utils';
|
||||
import { labelHelper } from '../../../dagre-wrapper/shapes/util';
|
||||
import { findCommonAncestor } from './render-utils.js';
|
||||
import { labelHelper } from '../../../dagre-wrapper/shapes/util.js';
|
||||
import { addHtmlLabel } from 'dagre-d3-es/src/dagre-js/label/add-html-label.js';
|
||||
import { getConfig } from '../../../config';
|
||||
import { log } from '../../../logger';
|
||||
import { setupGraphViewbox } from '../../../setupGraphViewbox';
|
||||
import common, { evaluate } from '../../common/common';
|
||||
import { interpolateToCurve, getStylesFromArray } from '../../../utils';
|
||||
import { getConfig } from '../../../config.js';
|
||||
import { log } from '../../../logger.js';
|
||||
import { setupGraphViewbox } from '../../../setupGraphViewbox.js';
|
||||
import common, { evaluate } from '../../common/common.js';
|
||||
import { interpolateToCurve, getStylesFromArray } from '../../../utils.js';
|
||||
import ELK from 'elkjs/lib/elk.bundled.js';
|
||||
const elk = new ELK();
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
// @ts-ignore: JISON typing missing
|
||||
import parser from '../parser/flow';
|
||||
import parser from '../parser/flow.jison';
|
||||
|
||||
import * as db from '../flowDb';
|
||||
import renderer from './flowRenderer-elk';
|
||||
import styles from './styles';
|
||||
import * as db from '../flowDb.js';
|
||||
import renderer from './flowRenderer-elk.js';
|
||||
import styles from './styles.js';
|
||||
|
||||
export const diagram = {
|
||||
db,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { findCommonAncestor, TreeData } from './render-utils';
|
||||
import { findCommonAncestor, TreeData } from './render-utils.js';
|
||||
describe('when rendering a flowchart using elk ', () => {
|
||||
let lookupDb: TreeData;
|
||||
beforeEach(() => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { addToRender } from './flowChartShapes';
|
||||
import { addToRender } from './flowChartShapes.js';
|
||||
|
||||
describe('flowchart shapes', function () {
|
||||
// rect-based shapes
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { select } from 'd3';
|
||||
import utils from '../../utils';
|
||||
import * as configApi from '../../config';
|
||||
import common from '../common/common';
|
||||
import mermaidAPI from '../../mermaidAPI';
|
||||
import { log } from '../../logger';
|
||||
import utils from '../../utils.js';
|
||||
import * as configApi from '../../config.js';
|
||||
import common from '../common/common.js';
|
||||
import mermaidAPI from '../../mermaidAPI.js';
|
||||
import { log } from '../../logger.js';
|
||||
import {
|
||||
setAccTitle,
|
||||
getAccTitle,
|
||||
@ -12,7 +12,7 @@ import {
|
||||
clear as commonClear,
|
||||
setDiagramTitle,
|
||||
getDiagramTitle,
|
||||
} from '../../commonDb';
|
||||
} from '../../commonDb.js';
|
||||
|
||||
const MERMAID_DOM_ID_PREFIX = 'flowchart-';
|
||||
let vertexCounter = 0;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user