mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-09 10:36:43 +02:00

The `node16` module resolution requires imports to use the `.js` file extension in type definitions. `@rollup/plugin-typescript` is needed to make this work with the Vite setup used by Mermaid. The module option for Mermaid internally is set to `nodenext`. This is needed to support `.json` imports. Note that setting `module` to `node16` or `nodenext` implies a matching `moduleResolution` value.
21 lines
493 B
TypeScript
21 lines
493 B
TypeScript
import { DiagramDefinition } from '../../diagram-api/types.js';
|
|
// @ts-ignore: TODO Fix ts errors
|
|
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,
|
|
db,
|
|
renderer,
|
|
styles,
|
|
init: (cnf) => {
|
|
if (!cnf.class) {
|
|
cnf.class = {};
|
|
}
|
|
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
db.clear();
|
|
},
|
|
};
|