@mermaid-js/parser
Advanced tools
Comparing version 0.1.0-rc.1 to 0.1.0-rc.2
@@ -1,3 +0,9 @@ | ||
export type { Info } from './language/index.js'; | ||
export type { DiagramAST } from './parse.js'; | ||
export { parse, MermaidParseError } from './parse.js'; | ||
import type { AstNode } from 'langium'; | ||
export * from './language/index.js'; | ||
export * from './parse.js'; | ||
/** | ||
* Exclude/omit all `AstNode` attributes recursively. | ||
*/ | ||
export type RecursiveAstOmit<T> = T extends object ? { | ||
[P in keyof T as Exclude<P, keyof AstNode>]: RecursiveAstOmit<T[P]>; | ||
} : T; |
@@ -1,3 +0,2 @@ | ||
export * from './lexer.js'; | ||
export * from './tokenBuilder.js'; | ||
export { MermaidValueConverter } from './valueConverter.js'; | ||
export * from './valueConverter.js'; |
/** | ||
* Matches single and multiline accessible description | ||
* Matches single and multi line accessible description | ||
*/ | ||
@@ -4,0 +4,0 @@ export declare const accessibilityDescrRegex: RegExp; |
import type { GrammarAST, Stream, TokenBuilderOptions } from 'langium'; | ||
import type { TokenType } from '../chevrotainWrapper.js'; | ||
import type { TokenType } from 'chevrotain'; | ||
import { DefaultTokenBuilder } from 'langium'; | ||
export declare abstract class MermaidTokenBuilder extends DefaultTokenBuilder { | ||
export declare abstract class AbstractMermaidTokenBuilder extends DefaultTokenBuilder { | ||
private keywords; | ||
@@ -9,1 +9,3 @@ constructor(keywords: string[]); | ||
} | ||
export declare class CommonTokenBuilder extends AbstractMermaidTokenBuilder { | ||
} |
import type { CstNode, GrammarAST, ValueType } from 'langium'; | ||
import { DefaultValueConverter } from 'langium'; | ||
export declare abstract class MermaidValueConverter extends DefaultValueConverter { | ||
export declare abstract class AbstractMermaidValueConverter extends DefaultValueConverter { | ||
/** | ||
@@ -16,4 +16,4 @@ * A method contains convert logic to be used by class. | ||
} | ||
export declare class CommonValueConverter extends MermaidValueConverter { | ||
export declare class CommonValueConverter extends AbstractMermaidValueConverter { | ||
protected runCustomConverter(_rule: GrammarAST.AbstractRule, _input: string, _cstNode: CstNode): ValueType | undefined; | ||
} |
/****************************************************************************** | ||
* This file was generated by langium-cli 2.0.1. | ||
* This file was generated by langium-cli 3.0.3. | ||
* DO NOT EDIT MANUALLY! | ||
@@ -16,2 +16,6 @@ ******************************************************************************/ | ||
SINGLE_LINE_COMMENT: RegExp; | ||
INT: RegExp; | ||
STRING: RegExp; | ||
PIE_SECTION_LABEL: RegExp; | ||
PIE_SECTION_VALUE: RegExp; | ||
}; | ||
@@ -34,5 +38,45 @@ export interface Common extends AstNode { | ||
export declare function isInfo(item: unknown): item is Info; | ||
export interface Packet extends AstNode { | ||
readonly $type: 'Packet'; | ||
accDescr?: string; | ||
accTitle?: string; | ||
blocks: Array<PacketBlock>; | ||
title?: string; | ||
} | ||
export declare const Packet = "Packet"; | ||
export declare function isPacket(item: unknown): item is Packet; | ||
export interface PacketBlock extends AstNode { | ||
readonly $container: Packet; | ||
readonly $type: 'PacketBlock'; | ||
end?: number; | ||
label: string; | ||
start: number; | ||
} | ||
export declare const PacketBlock = "PacketBlock"; | ||
export declare function isPacketBlock(item: unknown): item is PacketBlock; | ||
export interface Pie extends AstNode { | ||
readonly $type: 'Pie'; | ||
accDescr?: string; | ||
accTitle?: string; | ||
sections: Array<PieSection>; | ||
showData: boolean; | ||
title?: string; | ||
} | ||
export declare const Pie = "Pie"; | ||
export declare function isPie(item: unknown): item is Pie; | ||
export interface PieSection extends AstNode { | ||
readonly $container: Pie; | ||
readonly $type: 'PieSection'; | ||
label: string; | ||
value: number; | ||
} | ||
export declare const PieSection = "PieSection"; | ||
export declare function isPieSection(item: unknown): item is PieSection; | ||
export type MermaidAstType = { | ||
Common: Common; | ||
Info: Info; | ||
Packet: Packet; | ||
PacketBlock: PacketBlock; | ||
Pie: Pie; | ||
PieSection: PieSection; | ||
}; | ||
@@ -39,0 +83,0 @@ export declare class MermaidAstReflection extends AbstractAstReflection { |
/****************************************************************************** | ||
* This file was generated by langium-cli 2.0.1. | ||
* This file was generated by langium-cli 3.0.3. | ||
* DO NOT EDIT MANUALLY! | ||
@@ -7,1 +7,3 @@ ******************************************************************************/ | ||
export declare const InfoGrammar: () => Grammar; | ||
export declare const PacketGrammar: () => Grammar; | ||
export declare const PieGrammar: () => Grammar; |
/****************************************************************************** | ||
* This file was generated by langium-cli 2.0.1. | ||
* This file was generated by langium-cli 3.0.3. | ||
* DO NOT EDIT MANUALLY! | ||
******************************************************************************/ | ||
import type { LangiumGeneratedServices, LangiumGeneratedSharedServices, LangiumSharedServices, LangiumServices, Module } from 'langium'; | ||
import type { LangiumSharedCoreServices, LangiumCoreServices, LangiumGeneratedCoreServices, LangiumGeneratedSharedCoreServices, Module } from 'langium'; | ||
export declare const InfoLanguageMetaData: { | ||
@@ -11,3 +11,15 @@ readonly languageId: "info"; | ||
}; | ||
export declare const MermaidGeneratedSharedModule: Module<LangiumSharedServices, LangiumGeneratedSharedServices>; | ||
export declare const InfoGeneratedModule: Module<LangiumServices, LangiumGeneratedServices>; | ||
export declare const PacketLanguageMetaData: { | ||
readonly languageId: "packet"; | ||
readonly fileExtensions: readonly [".mmd", ".mermaid"]; | ||
readonly caseInsensitive: false; | ||
}; | ||
export declare const PieLanguageMetaData: { | ||
readonly languageId: "pie"; | ||
readonly fileExtensions: readonly [".mmd", ".mermaid"]; | ||
readonly caseInsensitive: false; | ||
}; | ||
export declare const MermaidGeneratedSharedModule: Module<LangiumSharedCoreServices, LangiumGeneratedSharedCoreServices>; | ||
export declare const InfoGeneratedModule: Module<LangiumCoreServices, LangiumGeneratedCoreServices>; | ||
export declare const PacketGeneratedModule: Module<LangiumCoreServices, LangiumGeneratedCoreServices>; | ||
export declare const PieGeneratedModule: Module<LangiumCoreServices, LangiumGeneratedCoreServices>; |
@@ -1,5 +0,6 @@ | ||
export * from './generated/ast.js'; | ||
export * from './generated/grammar.js'; | ||
export * from './generated/module.js'; | ||
export { Info, MermaidAstType, Packet, PacketBlock, Pie, PieSection, isCommon, isInfo, isPacket, isPacketBlock, isPie, isPieSection, } from './generated/ast.js'; | ||
export { InfoGeneratedModule, MermaidGeneratedSharedModule, PacketGeneratedModule, PieGeneratedModule, } from './generated/module.js'; | ||
export * from './common/index.js'; | ||
export * from './info/index.js'; | ||
export * from './packet/index.js'; | ||
export * from './pie/index.js'; |
@@ -1,4 +0,3 @@ | ||
import type { DefaultSharedModuleContext, LangiumServices, LangiumSharedServices, Module, PartialLangiumServices } from 'langium'; | ||
import { CommonLexer } from '../common/lexer.js'; | ||
import { CommonValueConverter } from '../common/valueConverter.js'; | ||
import type { DefaultSharedCoreModuleContext, LangiumCoreServices, LangiumSharedCoreServices, Module, PartialLangiumCoreServices } from 'langium'; | ||
import { CommonValueConverter } from '../common/index.js'; | ||
import { InfoTokenBuilder } from './tokenBuilder.js'; | ||
@@ -8,13 +7,12 @@ /** | ||
*/ | ||
type InfoAddedServices = { | ||
interface InfoAddedServices { | ||
parser: { | ||
Lexer: CommonLexer; | ||
TokenBuilder: InfoTokenBuilder; | ||
ValueConverter: CommonValueConverter; | ||
}; | ||
}; | ||
} | ||
/** | ||
* Union of Langium default services and `Info` services. | ||
*/ | ||
export type InfoServices = LangiumServices & InfoAddedServices; | ||
export type InfoServices = LangiumCoreServices & InfoAddedServices; | ||
/** | ||
@@ -24,3 +22,3 @@ * Dependency injection module that overrides Langium default services and | ||
*/ | ||
export declare const InfoModule: Module<InfoServices, PartialLangiumServices & InfoAddedServices>; | ||
export declare const InfoModule: Module<InfoServices, PartialLangiumCoreServices & InfoAddedServices>; | ||
/** | ||
@@ -40,6 +38,6 @@ * Create the full set of services required by Langium. | ||
*/ | ||
export declare function createInfoServices(context?: DefaultSharedModuleContext): { | ||
shared: LangiumSharedServices; | ||
export declare function createInfoServices(context?: DefaultSharedCoreModuleContext): { | ||
shared: LangiumSharedCoreServices; | ||
Info: InfoServices; | ||
}; | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import { MermaidTokenBuilder } from '../common/index.js'; | ||
export declare class InfoTokenBuilder extends MermaidTokenBuilder { | ||
import { AbstractMermaidTokenBuilder } from '../common/index.js'; | ||
export declare class InfoTokenBuilder extends AbstractMermaidTokenBuilder { | ||
constructor(); | ||
} |
import type { ParseResult } from 'langium'; | ||
import type { Info } from './index.js'; | ||
export type DiagramAST = Info; | ||
export declare function parse(diagramType: 'info', text: string): Info; | ||
import type { Info, Packet, Pie } from './index.js'; | ||
export type DiagramAST = Info | Packet | Pie; | ||
export declare function parse(diagramType: 'info', text: string): Promise<Info>; | ||
export declare function parse(diagramType: 'packet', text: string): Promise<Packet>; | ||
export declare function parse(diagramType: 'pie', text: string): Promise<Pie>; | ||
export declare class MermaidParseError extends Error { | ||
@@ -6,0 +8,0 @@ result: ParseResult<DiagramAST>; |
import type { ParseResult } from 'langium'; | ||
import type { Info, InfoServices, Pie, PieServices } from '../src/language/index.js'; | ||
/** | ||
@@ -8,2 +9,12 @@ * A helper test function that validate that the result doesn't have errors | ||
*/ | ||
export declare function noErrorsOrAlternatives(result: ParseResult): void; | ||
export declare function expectNoErrorsOrAlternatives(result: ParseResult): void; | ||
export declare function createInfoTestServices(): { | ||
services: InfoServices; | ||
parse: (input: string) => ParseResult<Info>; | ||
}; | ||
export declare const infoParse: (input: string) => ParseResult<Info>; | ||
export declare function createPieTestServices(): { | ||
services: PieServices; | ||
parse: (input: string) => ParseResult<Pie>; | ||
}; | ||
export declare const pieParse: (input: string) => ParseResult<Pie>; |
{ | ||
"name": "@mermaid-js/parser", | ||
"version": "0.1.0-rc.1", | ||
"version": "0.1.0-rc.2", | ||
"description": "MermaidJS parser", | ||
@@ -15,3 +15,3 @@ "author": "Yokozuna59", | ||
".": { | ||
"import": "./dist/mermaid-parser.esm.mjs", | ||
"import": "./dist/mermaid-parser.core.mjs", | ||
"types": "./dist/src/index.d.ts" | ||
@@ -32,6 +32,6 @@ } | ||
"dependencies": { | ||
"langium": "2.0.1" | ||
"langium": "3.0.0" | ||
}, | ||
"devDependencies": { | ||
"langium-cli": "2.0.1" | ||
"chevrotain": "^11.0.3" | ||
}, | ||
@@ -38,0 +38,0 @@ "files": [ |
@@ -13,3 +13,3 @@ <p align="center"> | ||
[![NPM](https://img.shields.io/npm/v/mermaid-parser)](https://www.npmjs.com/package/mermaid-parser) | ||
[![NPM](https://img.shields.io/npm/v/@mermaid-js/parser)](https://www.npmjs.com/package/@mermaid-js/parser) | ||
@@ -16,0 +16,0 @@ ## How the package works |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
74
2
1
4586369
23070
+ Addedlangium@3.0.0(transitive)
+ Addedvscode-jsonrpc@8.2.0(transitive)
+ Addedvscode-languageserver@9.0.1(transitive)
+ Addedvscode-languageserver-protocol@3.17.5(transitive)
+ Addedvscode-languageserver-types@3.17.5(transitive)
- Removedlangium@2.0.1(transitive)
- Removedvscode-jsonrpc@8.0.2(transitive)
- Removedvscode-languageserver@8.0.2(transitive)
- Removedvscode-languageserver-protocol@3.17.2(transitive)
- Removedvscode-languageserver-types@3.17.2(transitive)
Updatedlangium@3.0.0