mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-16 18:54:12 +01:00
Added the langium module for gitGraph
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import type { LangiumParser, ParseResult } from 'langium';
|
||||
|
||||
import type { Info, Packet, Pie } from './index.js';
|
||||
import type { Info, Packet, Pie, GitGraph } from './index.js';
|
||||
|
||||
export type DiagramAST = Info | Packet | Pie;
|
||||
export type DiagramAST = Info | Packet | Pie | GitGraph;
|
||||
|
||||
const parsers: Record<string, LangiumParser> = {};
|
||||
const initializers = {
|
||||
@@ -21,11 +21,18 @@ const initializers = {
|
||||
const parser = createPieServices().Pie.parser.LangiumParser;
|
||||
parsers.pie = parser;
|
||||
},
|
||||
gitGraph: async () => {
|
||||
const { createGitGraphServices } = await import('./language/gitGraph/index.js');
|
||||
const parser = createGitGraphServices().GitGraph.parser.LangiumParser;
|
||||
parsers.gitGraph = parser;
|
||||
},
|
||||
} as const;
|
||||
|
||||
export async function parse(diagramType: 'info', text: string): Promise<Info>;
|
||||
export async function parse(diagramType: 'packet', text: string): Promise<Packet>;
|
||||
export async function parse(diagramType: 'pie', text: string): Promise<Pie>;
|
||||
export async function parse(diagramType: 'gitGraph', text: string): Promise<GitGraph>;
|
||||
|
||||
export async function parse<T extends DiagramAST>(
|
||||
diagramType: keyof typeof initializers,
|
||||
text: string
|
||||
|
||||
Reference in New Issue
Block a user