mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-17 11:14:12 +01:00
5
.changeset/giant-steaks-argue.md
Normal file
5
.changeset/giant-steaks-argue.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: Return parsed config from mermaid.parse
|
||||||
5
.changeset/red-beans-cross.md
Normal file
5
.changeset/red-beans-cross.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: Replace $root with relative paths
|
||||||
42
.github/workflows/release-preview.yml
vendored
Normal file
42
.github/workflows/release-preview.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: Preview release
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [develop]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.number }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
preview:
|
||||||
|
if: ${{ github.repository_owner == 'mermaid-js' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
name: Publish preview release
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo
|
||||||
|
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
|
||||||
|
with:
|
||||||
|
cache: pnpm
|
||||||
|
node-version-file: '.node-version'
|
||||||
|
|
||||||
|
- name: Install Packages
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Publish packages
|
||||||
|
run: pnpx pkg-pr-new publish --pnpm './packages/*'
|
||||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -38,6 +38,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pnpm exec vitest run ./packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts --coverage
|
pnpm exec vitest run ./packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts --coverage
|
||||||
|
|
||||||
|
- name: Verify out-of-tree build with TypeScript
|
||||||
|
run: |
|
||||||
|
pnpm test:check:tsc
|
||||||
|
|
||||||
- name: Upload Coverage to Codecov
|
- name: Upload Coverage to Codecov
|
||||||
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
||||||
# Run step only pushes to develop and pull_requests
|
# Run step only pushes to develop and pull_requests
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ USER 0:0
|
|||||||
RUN corepack enable \
|
RUN corepack enable \
|
||||||
&& corepack enable pnpm
|
&& corepack enable pnpm
|
||||||
|
|
||||||
|
RUN apk add --no-cache git~=2.43.4 \
|
||||||
|
&& git config --add --system safe.directory /mermaid
|
||||||
|
|
||||||
ENV NODE_OPTIONS="--max_old_space_size=8192"
|
ENV NODE_OPTIONS="--max_old_space_size=8192"
|
||||||
|
|
||||||
EXPOSE 9000 3333
|
EXPOSE 9000 3333
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
|
|
||||||
### config
|
### config
|
||||||
|
|
||||||
• **config**: `MermaidConfig`
|
• **config**: [`MermaidConfig`](mermaid.MermaidConfig.md)
|
||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/rendering-util/types.d.ts:118](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.d.ts#L118)
|
[packages/mermaid/src/rendering-util/types.ts:117](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L117)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/rendering-util/types.d.ts:117](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.d.ts#L117)
|
[packages/mermaid/src/rendering-util/types.ts:116](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L116)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -40,4 +40,4 @@
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/rendering-util/types.d.ts:116](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.d.ts#L116)
|
[packages/mermaid/src/rendering-util/types.ts:115](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L115)
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ The `parseError` function will not be called.
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/types.ts:43](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L43)
|
[packages/mermaid/src/types.ts:45](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L45)
|
||||||
|
|||||||
@@ -10,6 +10,18 @@
|
|||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
|
### config
|
||||||
|
|
||||||
|
• **config**: [`MermaidConfig`](mermaid.MermaidConfig.md)
|
||||||
|
|
||||||
|
The config passed as YAML frontmatter or directives
|
||||||
|
|
||||||
|
#### Defined in
|
||||||
|
|
||||||
|
[packages/mermaid/src/types.ts:56](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L56)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### diagramType
|
### diagramType
|
||||||
|
|
||||||
• **diagramType**: `string`
|
• **diagramType**: `string`
|
||||||
@@ -18,4 +30,4 @@ The diagram type, e.g. 'flowchart', 'sequence', etc.
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/types.ts:50](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L50)
|
[packages/mermaid/src/types.ts:52](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L52)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ bindFunctions?.(div); // To call bindFunctions only if it's present.
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/types.ts:73](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L73)
|
[packages/mermaid/src/types.ts:79](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L79)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ The diagram type, e.g. 'flowchart', 'sequence', etc.
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/types.ts:63](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L63)
|
[packages/mermaid/src/types.ts:69](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L69)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -63,4 +63,4 @@ The svg code for the rendered graph.
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[packages/mermaid/src/types.ts:59](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L59)
|
[packages/mermaid/src/types.ts:65](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L65)
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ Communication tools and platforms
|
|||||||
- [Mermaid Extension](https://www.mediawiki.org/wiki/Extension:Mermaid)
|
- [Mermaid Extension](https://www.mediawiki.org/wiki/Extension:Mermaid)
|
||||||
- [PmWiki](https://www.pmwiki.org)
|
- [PmWiki](https://www.pmwiki.org)
|
||||||
- [MermaidJs Cookbook recipe](https://www.pmwiki.org/wiki/Cookbook/MermaidJs)
|
- [MermaidJs Cookbook recipe](https://www.pmwiki.org/wiki/Cookbook/MermaidJs)
|
||||||
- [Semantic Media Wiki](https://semantic-mediawiki.org)
|
- [Semantic Media Wiki](https://www.semantic-mediawiki.org)
|
||||||
- [Mermaid Plugin](https://github.com/SemanticMediaWiki/Mermaid)
|
- [Mermaid Plugin](https://github.com/SemanticMediaWiki/Mermaid)
|
||||||
- [TiddlyWiki](https://tiddlywiki.com/)
|
- [TiddlyWiki](https://tiddlywiki.com/)
|
||||||
- [mermaid-tw5: wrapper for Mermaid Live](https://github.com/efurlanm/mermaid-tw5)
|
- [mermaid-tw5: wrapper for Mermaid Live](https://github.com/efurlanm/mermaid-tw5)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export default tseslint.config(
|
|||||||
'**/generated/',
|
'**/generated/',
|
||||||
'**/coverage/',
|
'**/coverage/',
|
||||||
'packages/mermaid/src/config.type.ts',
|
'packages/mermaid/src/config.type.ts',
|
||||||
|
'packages/mermaid/src/docs/.vitepress/components.d.ts',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"test": "pnpm lint && vitest run",
|
"test": "pnpm lint && vitest run",
|
||||||
"test:watch": "vitest --watch",
|
"test:watch": "vitest --watch",
|
||||||
"test:coverage": "vitest --coverage",
|
"test:coverage": "vitest --coverage",
|
||||||
|
"test:check:tsc": "tsx scripts/tsc-check.ts",
|
||||||
"prepare": "husky && pnpm build",
|
"prepare": "husky && pnpm build",
|
||||||
"pre-commit": "lint-staged"
|
"pre-commit": "lint-staged"
|
||||||
},
|
},
|
||||||
@@ -96,7 +97,7 @@
|
|||||||
"eslint-plugin-cypress": "^3.3.0",
|
"eslint-plugin-cypress": "^3.3.0",
|
||||||
"eslint-plugin-html": "^8.1.1",
|
"eslint-plugin-html": "^8.1.1",
|
||||||
"eslint-plugin-jest": "^28.6.0",
|
"eslint-plugin-jest": "^28.6.0",
|
||||||
"eslint-plugin-jsdoc": "^48.2.9",
|
"eslint-plugin-jsdoc": "^50.0.0",
|
||||||
"eslint-plugin-json": "^4.0.0",
|
"eslint-plugin-json": "^4.0.0",
|
||||||
"eslint-plugin-lodash": "^8.0.0",
|
"eslint-plugin-lodash": "^8.0.0",
|
||||||
"eslint-plugin-markdown": "^5.0.0",
|
"eslint-plugin-markdown": "^5.0.0",
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ export const render = async (
|
|||||||
* Add edges to graph based on parsed graph definition
|
* Add edges to graph based on parsed graph definition
|
||||||
*/
|
*/
|
||||||
const addEdges = async function (
|
const addEdges = async function (
|
||||||
dataForLayout: { edges: any; direction: string },
|
dataForLayout: { edges: any; direction?: string },
|
||||||
graph: {
|
graph: {
|
||||||
id?: string;
|
id?: string;
|
||||||
layoutOptions?: {
|
layoutOptions?: {
|
||||||
@@ -749,12 +749,12 @@ export const render = async (
|
|||||||
layoutOptions: {
|
layoutOptions: {
|
||||||
'elk.hierarchyHandling': 'INCLUDE_CHILDREN',
|
'elk.hierarchyHandling': 'INCLUDE_CHILDREN',
|
||||||
'elk.algorithm': algorithm,
|
'elk.algorithm': algorithm,
|
||||||
'nodePlacement.strategy': data4Layout.config.elk.nodePlacementStrategy,
|
'nodePlacement.strategy': data4Layout.config.elk?.nodePlacementStrategy,
|
||||||
'elk.layered.mergeEdges': data4Layout.config.elk.mergeEdges,
|
'elk.layered.mergeEdges': data4Layout.config.elk?.mergeEdges,
|
||||||
'elk.direction': 'DOWN',
|
'elk.direction': 'DOWN',
|
||||||
'spacing.baseValue': 35,
|
'spacing.baseValue': 35,
|
||||||
'elk.layered.unnecessaryBendpoints': true,
|
'elk.layered.unnecessaryBendpoints': true,
|
||||||
'elk.layered.cycleBreaking.strategy': data4Layout.config.elk.cycleBreakingStrategy,
|
'elk.layered.cycleBreaking.strategy': data4Layout.config.elk?.cycleBreakingStrategy,
|
||||||
// 'spacing.nodeNode': 20,
|
// 'spacing.nodeNode': 20,
|
||||||
// 'spacing.nodeNodeBetweenLayers': 25,
|
// 'spacing.nodeNodeBetweenLayers': 25,
|
||||||
// 'spacing.edgeNode': 20,
|
// 'spacing.edgeNode': 20,
|
||||||
@@ -837,8 +837,8 @@ export const render = async (
|
|||||||
...node.layoutOptions,
|
...node.layoutOptions,
|
||||||
'elk.algorithm': algorithm,
|
'elk.algorithm': algorithm,
|
||||||
'elk.direction': dir2ElkDirection(node.dir),
|
'elk.direction': dir2ElkDirection(node.dir),
|
||||||
'nodePlacement.strategy': data4Layout.config['elk.nodePlacement.strategy'],
|
'nodePlacement.strategy': data4Layout.config.elk?.nodePlacementStrategy,
|
||||||
'elk.layered.mergeEdges': data4Layout.config['elk.mergeEdges'],
|
'elk.layered.mergeEdges': data4Layout.config.elk?.mergeEdges,
|
||||||
'elk.hierarchyHandling': 'SEPARATE_CHILDREN',
|
'elk.hierarchyHandling': 'SEPARATE_CHILDREN',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { unknownIcon } from '$root/rendering-util/icons.js';
|
import { unknownIcon } from '../../rendering-util/icons.js';
|
||||||
import type { IconifyJSON } from '@iconify/types';
|
import type { IconifyJSON } from '@iconify/types';
|
||||||
|
|
||||||
const wrapIcon = (icon: string) => {
|
const wrapIcon = (icon: string) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { registerIconPacks } from '$root/rendering-util/icons.js';
|
import { registerIconPacks } from '../../rendering-util/icons.js';
|
||||||
import type { Position } from 'cytoscape';
|
import type { Position } from 'cytoscape';
|
||||||
import cytoscape from 'cytoscape';
|
import cytoscape from 'cytoscape';
|
||||||
import type { FcoseLayoutOptions } from 'cytoscape-fcose';
|
import type { FcoseLayoutOptions } from 'cytoscape-fcose';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getIconSVG } from '$root/rendering-util/icons.js';
|
import { getIconSVG } from '../../rendering-util/icons.js';
|
||||||
import type cytoscape from 'cytoscape';
|
import type cytoscape from 'cytoscape';
|
||||||
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
||||||
import { createText } from '../../rendering-util/createText.js';
|
import { createText } from '../../rendering-util/createText.js';
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ Communication tools and platforms
|
|||||||
- [Mermaid Extension](https://www.mediawiki.org/wiki/Extension:Mermaid)
|
- [Mermaid Extension](https://www.mediawiki.org/wiki/Extension:Mermaid)
|
||||||
- [PmWiki](https://www.pmwiki.org)
|
- [PmWiki](https://www.pmwiki.org)
|
||||||
- [MermaidJs Cookbook recipe](https://www.pmwiki.org/wiki/Cookbook/MermaidJs)
|
- [MermaidJs Cookbook recipe](https://www.pmwiki.org/wiki/Cookbook/MermaidJs)
|
||||||
- [Semantic Media Wiki](https://semantic-mediawiki.org)
|
- [Semantic Media Wiki](https://www.semantic-mediawiki.org)
|
||||||
- [Mermaid Plugin](https://github.com/SemanticMediaWiki/Mermaid)
|
- [Mermaid Plugin](https://github.com/SemanticMediaWiki/Mermaid)
|
||||||
- [TiddlyWiki](https://tiddlywiki.com/)
|
- [TiddlyWiki](https://tiddlywiki.com/)
|
||||||
- [mermaid-tw5: wrapper for Mermaid Live](https://github.com/efurlanm/mermaid-tw5)
|
- [mermaid-tw5: wrapper for Mermaid Live](https://github.com/efurlanm/mermaid-tw5)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid
|
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid
|
||||||
* functionality and to render the diagrams to svg code!
|
* functionality and to render the diagrams to svg code!
|
||||||
*/
|
*/
|
||||||
import { registerIconPacks } from '$root/rendering-util/icons.js';
|
import { registerIconPacks } from './rendering-util/icons.js';
|
||||||
import { dedent } from 'ts-dedent';
|
import { dedent } from 'ts-dedent';
|
||||||
import type { MermaidConfig } from './config.type.js';
|
import type { MermaidConfig } from './config.type.js';
|
||||||
import { detectType, registerLazyLoadedDiagrams } from './diagram-api/detectType.js';
|
import { detectType, registerLazyLoadedDiagrams } from './diagram-api/detectType.js';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { vi, it, expect, describe, beforeEach } from 'vitest';
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
// Mocks and mocking
|
// Mocks and mocking
|
||||||
@@ -66,8 +66,8 @@ vi.mock('stylis', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
import { compile, serialize } from 'stylis';
|
import { compile, serialize } from 'stylis';
|
||||||
import { decodeEntities, encodeEntities } from './utils.js';
|
|
||||||
import { Diagram } from './Diagram.js';
|
import { Diagram } from './Diagram.js';
|
||||||
|
import { decodeEntities, encodeEntities } from './utils.js';
|
||||||
import { toBase64 } from './utils/base64.js';
|
import { toBase64 } from './utils/base64.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -693,15 +693,76 @@ describe('mermaidAPI', () => {
|
|||||||
await expect(mermaidAPI.parse('graph TD;A--x|text including URL space|B;')).resolves
|
await expect(mermaidAPI.parse('graph TD;A--x|text including URL space|B;')).resolves
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
|
"config": {},
|
||||||
"diagramType": "flowchart-v2",
|
"diagramType": "flowchart-v2",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
it('returns config when defined in frontmatter', async () => {
|
||||||
|
await expect(
|
||||||
|
mermaidAPI.parse(`---
|
||||||
|
config:
|
||||||
|
theme: base
|
||||||
|
flowchart:
|
||||||
|
htmlLabels: true
|
||||||
|
---
|
||||||
|
graph TD;A--x|text including URL space|B;`)
|
||||||
|
).resolves.toMatchInlineSnapshot(`
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"flowchart": {
|
||||||
|
"htmlLabels": true,
|
||||||
|
},
|
||||||
|
"theme": "base",
|
||||||
|
},
|
||||||
|
"diagramType": "flowchart-v2",
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns config when defined in directive', async () => {
|
||||||
|
await expect(
|
||||||
|
mermaidAPI.parse(`%%{init: { 'theme': 'base' } }%%
|
||||||
|
graph TD;A--x|text including URL space|B;`)
|
||||||
|
).resolves.toMatchInlineSnapshot(`
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"theme": "base",
|
||||||
|
},
|
||||||
|
"diagramType": "flowchart-v2",
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns merged config when defined in frontmatter and directive', async () => {
|
||||||
|
await expect(
|
||||||
|
mermaidAPI.parse(`---
|
||||||
|
config:
|
||||||
|
theme: forest
|
||||||
|
flowchart:
|
||||||
|
htmlLabels: true
|
||||||
|
---
|
||||||
|
%%{init: { 'theme': 'base' } }%%
|
||||||
|
graph TD;A--x|text including URL space|B;`)
|
||||||
|
).resolves.toMatchInlineSnapshot(`
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"flowchart": {
|
||||||
|
"htmlLabels": true,
|
||||||
|
},
|
||||||
|
"theme": "base",
|
||||||
|
},
|
||||||
|
"diagramType": "flowchart-v2",
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
it('returns true for valid definition with silent option', async () => {
|
it('returns true for valid definition with silent option', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
mermaidAPI.parse('graph TD;A--x|text including URL space|B;', { suppressErrors: true })
|
mermaidAPI.parse('graph TD;A--x|text including URL space|B;', { suppressErrors: true })
|
||||||
).resolves.toMatchInlineSnapshot(`
|
).resolves.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
|
"config": {},
|
||||||
"diagramType": "flowchart-v2",
|
"diagramType": "flowchart-v2",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ async function parse(text: string, parseOptions?: ParseOptions): Promise<ParseRe
|
|||||||
async function parse(text: string, parseOptions?: ParseOptions): Promise<ParseResult | false> {
|
async function parse(text: string, parseOptions?: ParseOptions): Promise<ParseResult | false> {
|
||||||
addDiagrams();
|
addDiagrams();
|
||||||
try {
|
try {
|
||||||
const { code } = processAndSetConfigs(text);
|
const { code, config } = processAndSetConfigs(text);
|
||||||
const diagram = await getDiagramFromText(code);
|
const diagram = await getDiagramFromText(code);
|
||||||
return { diagramType: diagram.type };
|
return { diagramType: diagram.type, config };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (parseOptions?.suppressErrors) {
|
if (parseOptions?.suppressErrors) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const processDirectives = (code: string) => {
|
|||||||
* @param code - The code to preprocess.
|
* @param code - The code to preprocess.
|
||||||
* @returns The object containing the preprocessed code, title, and configuration.
|
* @returns The object containing the preprocessed code, title, and configuration.
|
||||||
*/
|
*/
|
||||||
export function preprocessDiagram(code: string): DiagramMetadata & { code: string } {
|
export function preprocessDiagram(code: string) {
|
||||||
const cleanedCode = cleanupText(code);
|
const cleanedCode = cleanupText(code);
|
||||||
const frontMatterResult = processFrontmatter(cleanedCode);
|
const frontMatterResult = processFrontmatter(cleanedCode);
|
||||||
const directiveResult = processDirectives(frontMatterResult.text);
|
const directiveResult = processDirectives(frontMatterResult.text);
|
||||||
@@ -59,5 +59,5 @@ export function preprocessDiagram(code: string): DiagramMetadata & { code: strin
|
|||||||
code,
|
code,
|
||||||
title: frontMatterResult.title,
|
title: frontMatterResult.title,
|
||||||
config,
|
config,
|
||||||
};
|
} satisfies DiagramMetadata & { code: string };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
// @ts-nocheck TODO: Fix types
|
// @ts-nocheck TODO: Fix types
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../diagram-api/diagramAPI.js';
|
||||||
import common, { hasKatex, renderKatex } from '$root/diagrams/common/common.js';
|
import common, { hasKatex, renderKatex } from '../diagrams/common/common.js';
|
||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import type { MermaidConfig } from '../config.type.js';
|
import type { MermaidConfig } from '../config.type.js';
|
||||||
import type { SVGGroup } from '../diagram-api/types.js';
|
import type { SVGGroup } from '../diagram-api/types.js';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { log } from '$root/logger.js';
|
import { log } from '../logger.js';
|
||||||
import type { ExtendedIconifyIcon, IconifyIcon, IconifyJSON } from '@iconify/types';
|
import type { ExtendedIconifyIcon, IconifyIcon, IconifyJSON } from '@iconify/types';
|
||||||
import type { IconifyIconCustomisations } from '@iconify/utils';
|
import type { IconifyIconCustomisations } from '@iconify/utils';
|
||||||
import { getIconData, iconToHTML, iconToSVG, replaceIDs, stringToIcon } from '@iconify/utils';
|
import { getIconData, iconToHTML, iconToSVG, replaceIDs, stringToIcon } from '@iconify/utils';
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
insertEdge,
|
insertEdge,
|
||||||
clear as clearEdges,
|
clear as clearEdges,
|
||||||
} from '../../rendering-elements/edges.js';
|
} from '../../rendering-elements/edges.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../../logger.js';
|
||||||
import { getSubGraphTitleMargins } from '../../../utils/subGraphTitleMargins.js';
|
import { getSubGraphTitleMargins } from '../../../utils/subGraphTitleMargins.js';
|
||||||
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Decorates with functions required by mermaids dagre-wrapper. */
|
/** Decorates with functions required by mermaids dagre-wrapper. */
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../../logger.js';
|
||||||
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
||||||
import * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';
|
import * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
extractDescendants,
|
extractDescendants,
|
||||||
sortNodesByHierarchy,
|
sortNodesByHierarchy,
|
||||||
} from './mermaid-graphlib.js';
|
} from './mermaid-graphlib.js';
|
||||||
import { setLogLevel, log } from '$root/logger.js';
|
import { setLogLevel, log } from '../../../logger.js';
|
||||||
|
|
||||||
describe('Graphlib decorations', () => {
|
describe('Graphlib decorations', () => {
|
||||||
let g;
|
let g;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../diagram-api/types.js';
|
||||||
import type { InternalHelpers } from '$root/internals.js';
|
import type { InternalHelpers } from '../internals.js';
|
||||||
import { internalHelpers } from '$root/internals.js';
|
import { internalHelpers } from '../internals.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../logger.js';
|
||||||
import type { LayoutData } from './types.js';
|
import type { LayoutData } from './types.js';
|
||||||
|
|
||||||
export interface RenderOptions {
|
export interface RenderOptions {
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
||||||
import { evaluate } from '$root/diagrams/common/common.js';
|
import { evaluate } from '../../diagrams/common/common.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../logger.js';
|
||||||
import { getSubGraphTitleMargins } from '$root/utils/subGraphTitleMargins.js';
|
import { getSubGraphTitleMargins } from '../../utils/subGraphTitleMargins.js';
|
||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { createText } from '../createText.ts';
|
import { createText } from '../createText.ts';
|
||||||
import intersectRect from '../rendering-elements/intersect/intersect-rect.js';
|
import intersectRect from '../rendering-elements/intersect/intersect-rect.js';
|
||||||
import createLabel from './createLabel.js';
|
import createLabel from './createLabel.js';
|
||||||
import { createRoundedRectPathD } from './shapes/roundedRectPath.ts';
|
import { createRoundedRectPathD } from './shapes/roundedRectPath.ts';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './shapes/handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
|
|
||||||
const rect = async (parent, node) => {
|
const rect = async (parent, node) => {
|
||||||
log.info('Creating subgraph rect for ', node.id, node);
|
log.info('Creating subgraph rect for ', node.id, node);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../logger.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
||||||
import common, { evaluate, renderKatex, hasKatex } from '$root/diagrams/common/common.js';
|
import common, { evaluate, renderKatex, hasKatex } from '../../diagrams/common/common.js';
|
||||||
import { decodeEntities } from '$root/utils.js';
|
import { decodeEntities } from '../../utils.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dom
|
* @param dom
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../../diagram-api/types.js';
|
||||||
import type { Mocked } from 'vitest';
|
import type { Mocked } from 'vitest';
|
||||||
import { addEdgeMarkers } from './edgeMarker.js';
|
import { addEdgeMarkers } from './edgeMarker.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../../diagram-api/types.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../logger.js';
|
||||||
import type { EdgeData } from '$root/types.js';
|
import type { EdgeData } from '../../types.js';
|
||||||
/**
|
/**
|
||||||
* Adds SVG markers to a path element based on the arrow types specified in the edge.
|
* Adds SVG markers to a path element based on the arrow types specified in the edge.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
||||||
import { evaluate } from '$root/diagrams/common/common.js';
|
import { evaluate } from '../../diagrams/common/common.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../logger.js';
|
||||||
import { createText } from '$root/rendering-util/createText.ts';
|
import { createText } from '../createText.js';
|
||||||
import utils from '$root/utils.js';
|
import utils from '../../utils.js';
|
||||||
import { getLineFunctionsWithOffset } from '$root/utils/lineWithOffset.js';
|
import { getLineFunctionsWithOffset } from '../../utils/lineWithOffset.js';
|
||||||
import { getSubGraphTitleMargins } from '$root/utils/subGraphTitleMargins.js';
|
import { getSubGraphTitleMargins } from '../../utils/subGraphTitleMargins.js';
|
||||||
import { curveBasis, line, select } from 'd3';
|
import { curveBasis, line, select } from 'd3';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import createLabel from './createLabel.js';
|
import createLabel from './createLabel.js';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Setup arrow head and define the marker. The result is appended to the svg. */
|
/** Setup arrow head and define the marker. The result is appended to the svg. */
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../logger.js';
|
||||||
|
|
||||||
// Only add the number of markers that the diagram needs
|
// Only add the number of markers that the diagram needs
|
||||||
const insertMarkers = (elem, markerArray, type, id) => {
|
const insertMarkers = (elem, markerArray, type, id) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { log } from '$root/logger.js';
|
import { log } from '../../logger.js';
|
||||||
import { state } from './shapes/state.ts';
|
import { state } from './shapes/state.ts';
|
||||||
import { roundedRect } from './shapes/roundedRect.ts';
|
import { roundedRect } from './shapes/roundedRect.ts';
|
||||||
import { squareRect } from './shapes/squareRect.ts';
|
import { squareRect } from './shapes/squareRect.ts';
|
||||||
@@ -9,7 +9,7 @@ import { choice } from './shapes/choice.ts';
|
|||||||
import { note } from './shapes/note.ts';
|
import { note } from './shapes/note.ts';
|
||||||
import { stadium } from './shapes/stadium.js';
|
import { stadium } from './shapes/stadium.js';
|
||||||
import { rectWithTitle } from './shapes/rectWithTitle.js';
|
import { rectWithTitle } from './shapes/rectWithTitle.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
||||||
import { subroutine } from './shapes/subroutine.js';
|
import { subroutine } from './shapes/subroutine.js';
|
||||||
import { cylinder } from './shapes/cylinder.js';
|
import { cylinder } from './shapes/cylinder.js';
|
||||||
import { circle } from './shapes/circle.js';
|
import { circle } from './shapes/circle.js';
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../../../diagram-api/types.js';
|
||||||
// @ts-ignore TODO: Fix rough typings
|
// @ts-ignore TODO: Fix rough typings
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { solidStateFill, styles2String } from './handDrawnShapeStyles.js';
|
import { solidStateFill, styles2String } from './handDrawnShapeStyles.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
|
|
||||||
export const choice = (parent: SVG, node: Node) => {
|
export const choice = (parent: SVG, node: Node) => {
|
||||||
const { labelStyles, nodeStyles } = styles2String(node);
|
const { labelStyles, nodeStyles } = styles2String(node);
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { log } from '$root/logger.js';
|
import { log } from '../../../logger.js';
|
||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
|
|
||||||
export const circle = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
|
export const circle = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
|
|
||||||
export const createCylinderPathD = (
|
export const createCylinderPathD = (
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { log } from '$root/logger.js';
|
import { log } from '../../../logger.js';
|
||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
|
|
||||||
export const doublecircle = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
|
export const doublecircle = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';
|
import type { Node, RectOptions } from '../../types.js';
|
||||||
import { createRoundedRectPathD } from './roundedRectPath.js';
|
import { createRoundedRectPathD } from './roundedRectPath.js';
|
||||||
import {
|
import { userNodeOverrides, styles2String } from './handDrawnShapeStyles.js';
|
||||||
userNodeOverrides,
|
|
||||||
styles2String,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
|
|
||||||
export const drawRect = async (parent: SVGAElement, node: Node, options: RectOptions) => {
|
export const drawRect = async (parent: SVGAElement, node: Node, options: RectOptions) => {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { updateNodeBounds } from './util.js';
|
import { updateNodeBounds } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../../../diagram-api/types.js';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { solidStateFill } from './handDrawnShapeStyles.js';
|
import { solidStateFill } from './handDrawnShapeStyles.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
|
|
||||||
export const forkJoin = (parent: SVG, node: Node, dir: string) => {
|
export const forkJoin = (parent: SVG, node: Node, dir: string) => {
|
||||||
const { themeVariables } = getConfig();
|
const { themeVariables } = getConfig();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
|
|
||||||
// Striped fill like start or fork nodes in state diagrams
|
// Striped fill like start or fork nodes in state diagrams
|
||||||
export const solidStateFill = (color: string) => {
|
export const solidStateFill = (color: string) => {
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
|
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';
|
import type { Node, RectOptions } from '../../types.js';
|
||||||
import { drawRect } from './drawRect.js';
|
import { drawRect } from './drawRect.js';
|
||||||
import { labelHelper, updateNodeBounds } from './util.js';
|
import { labelHelper, updateNodeBounds } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { log } from '$root/logger.js';
|
import { log } from '../../../logger.js';
|
||||||
import { labelHelper, updateNodeBounds } from './util.js';
|
import { labelHelper, updateNodeBounds } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
|
|
||||||
export const note = async (parent: SVGAElement, node: Node) => {
|
export const note = async (parent: SVGAElement, node: Node) => {
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { log } from '$root/logger.js';
|
import { log } from '../../../logger.js';
|
||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import { evaluate } from '$root/diagrams/common/common.js';
|
import { evaluate } from '../../../diagrams/common/common.js';
|
||||||
import { updateNodeBounds } from './util.js';
|
import { updateNodeBounds } from './util.js';
|
||||||
import createLabel from '../createLabel.js';
|
import createLabel from '../createLabel.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
import { createRoundedRectPathD } from './roundedRectPath.js';
|
import { createRoundedRectPathD } from './roundedRectPath.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../../../logger.js';
|
||||||
|
|
||||||
export const rectWithTitle = async (parent: SVGElement, node: Node) => {
|
export const rectWithTitle = async (parent: SVGElement, node: Node) => {
|
||||||
const { labelStyles, nodeStyles } = styles2String(node);
|
const { labelStyles, nodeStyles } = styles2String(node);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';
|
import type { Node, RectOptions } from '../../types.js';
|
||||||
import { drawRect } from './drawRect.js';
|
import { drawRect } from './drawRect.js';
|
||||||
|
|
||||||
export const roundedRect = async (parent: SVGAElement, node: Node) => {
|
export const roundedRect = async (parent: SVGAElement, node: Node) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';
|
import type { Node, RectOptions } from '../../types.js';
|
||||||
import { drawRect } from './drawRect.js';
|
import { drawRect } from './drawRect.js';
|
||||||
|
|
||||||
export const squareRect = async (parent: SVGAElement, node: Node) => {
|
export const squareRect = async (parent: SVGAElement, node: Node) => {
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { createRoundedRectPathD } from './roundedRectPath.js';
|
import { createRoundedRectPathD } from './roundedRectPath.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Node, RectOptions } from '$root/rendering-util/types.d.ts';
|
import type { Node, RectOptions } from '../../types.js';
|
||||||
import { drawRect } from './drawRect.js';
|
import { drawRect } from './drawRect.js';
|
||||||
|
|
||||||
export const state = async (parent: SVGAElement, node: Node) => {
|
export const state = async (parent: SVGAElement, node: Node) => {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { updateNodeBounds } from './util.js';
|
import { updateNodeBounds } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../../../diagram-api/types.js';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { solidStateFill } from './handDrawnShapeStyles.js';
|
import { solidStateFill } from './handDrawnShapeStyles.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
|
|
||||||
export const stateEnd = (parent: SVG, node: Node) => {
|
export const stateEnd = (parent: SVG, node: Node) => {
|
||||||
const { themeVariables } = getConfig();
|
const { themeVariables } = getConfig();
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { updateNodeBounds } from './util.js';
|
import { updateNodeBounds } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../../../diagram-api/types.js';
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { solidStateFill } from './handDrawnShapeStyles.js';
|
import { solidStateFill } from './handDrawnShapeStyles.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
|
|
||||||
export const stateStart = (parent: SVG, node: Node) => {
|
export const stateStart = (parent: SVG, node: Node) => {
|
||||||
const { themeVariables } = getConfig();
|
const { themeVariables } = getConfig();
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
import { labelHelper, updateNodeBounds, getNodeClasses } from './util.js';
|
||||||
import intersect from '../intersect/index.js';
|
import intersect from '../intersect/index.js';
|
||||||
import type { Node } from '$root/rendering-util/types.d.ts';
|
import type { Node } from '../../types.js';
|
||||||
import {
|
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
|
||||||
styles2String,
|
|
||||||
userNodeOverrides,
|
|
||||||
} from '$root/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.js';
|
|
||||||
import rough from 'roughjs';
|
import rough from 'roughjs';
|
||||||
import { insertPolygonShape } from './insertPolygonShape.js';
|
import { insertPolygonShape } from './insertPolygonShape.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { createText } from '$root/rendering-util/createText.ts';
|
import { createText } from '../../createText.js';
|
||||||
import { getConfig } from '$root/diagram-api/diagramAPI.js';
|
import { getConfig } from '../../../diagram-api/diagramAPI.js';
|
||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import { evaluate, sanitizeText } from '$root/diagrams/common/common.js';
|
import { evaluate, sanitizeText } from '../../../diagrams/common/common.js';
|
||||||
import { decodeEntities } from '$root/utils.js';
|
import { decodeEntities } from '../../../utils.js';
|
||||||
|
|
||||||
export const labelHelper = async (parent, node, _classes) => {
|
export const labelHelper = async (parent, node, _classes) => {
|
||||||
let cssClasses;
|
let cssClasses;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { configureSvgSize } from '$root/setupGraphViewbox.js';
|
import { configureSvgSize } from '../setupGraphViewbox.js';
|
||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { SVG } from '../diagram-api/types.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '../logger.js';
|
||||||
|
|
||||||
export const setupViewPortForSVG = (
|
export const setupViewPortForSVG = (
|
||||||
svg: SVG,
|
svg: SVG,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export type MarkdownWordType = 'normal' | 'strong' | 'em';
|
export type MarkdownWordType = 'normal' | 'strong' | 'em';
|
||||||
import type { MermaidConfig } from '../../dist/config.type';
|
import type { MermaidConfig } from '../config.type.js';
|
||||||
export interface MarkdownWord {
|
export interface MarkdownWord {
|
||||||
content: string;
|
content: string;
|
||||||
type: MarkdownWordType;
|
type: MarkdownWordType;
|
||||||
@@ -9,7 +9,7 @@ export type MarkdownLine = MarkdownWord[];
|
|||||||
export type CheckFitFunction = (text: MarkdownLine) => boolean;
|
export type CheckFitFunction = (text: MarkdownLine) => boolean;
|
||||||
|
|
||||||
// Common properties for any node in the system
|
// Common properties for any node in the system
|
||||||
interface Node {
|
export interface Node {
|
||||||
id: string;
|
id: string;
|
||||||
label?: string;
|
label?: string;
|
||||||
description?: string[];
|
description?: string[];
|
||||||
@@ -38,7 +38,6 @@ interface Node {
|
|||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
padding?: number; //REMOVE?, use from LayoutData.config - Keep, this could be shape specific
|
padding?: number; //REMOVE?, use from LayoutData.config - Keep, this could be shape specific
|
||||||
shape?: string;
|
shape?: string;
|
||||||
tooltip?: string;
|
|
||||||
isGroup: boolean;
|
isGroup: boolean;
|
||||||
width?: number;
|
width?: number;
|
||||||
height?: number;
|
height?: number;
|
||||||
@@ -68,7 +67,7 @@ interface Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Common properties for any edge in the system
|
// Common properties for any edge in the system
|
||||||
interface Edge {
|
export interface Edge {
|
||||||
id: string;
|
id: string;
|
||||||
label?: string;
|
label?: string;
|
||||||
classes?: string;
|
classes?: string;
|
||||||
@@ -98,7 +97,7 @@ interface Edge {
|
|||||||
look?: string;
|
look?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RectOptions {
|
export interface RectOptions {
|
||||||
rx: number;
|
rx: number;
|
||||||
ry: number;
|
ry: number;
|
||||||
labelPaddingX: number;
|
labelPaddingX: number;
|
||||||
@@ -107,7 +106,7 @@ interface RectOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extending the Node interface for specific types if needed
|
// Extending the Node interface for specific types if needed
|
||||||
interface ClassDiagramNode extends Node {
|
export interface ClassDiagramNode extends Node {
|
||||||
memberData: any; // Specific property for class diagram nodes
|
memberData: any; // Specific property for class diagram nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { MermaidConfig } from './config.type.js';
|
||||||
|
|
||||||
export interface Point {
|
export interface Point {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
@@ -48,6 +50,10 @@ export interface ParseResult {
|
|||||||
* The diagram type, e.g. 'flowchart', 'sequence', etc.
|
* The diagram type, e.g. 'flowchart', 'sequence', etc.
|
||||||
*/
|
*/
|
||||||
diagramType: string;
|
diagramType: string;
|
||||||
|
/**
|
||||||
|
* The config passed as YAML frontmatter or directives
|
||||||
|
*/
|
||||||
|
config: MermaidConfig;
|
||||||
}
|
}
|
||||||
// This makes it clear that we're working with a d3 selected element of some kind, even though it's hard to specify the exact type.
|
// This makes it clear that we're working with a d3 selected element of some kind, even though it's hard to specify the exact type.
|
||||||
export type D3Element = any;
|
export type D3Element = any;
|
||||||
|
|||||||
@@ -3,11 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"types": ["vitest/importMeta", "vitest/globals"],
|
"types": ["vitest/importMeta", "vitest/globals"]
|
||||||
"baseUrl": ".", // This must be set if "paths" is set
|
|
||||||
"paths": {
|
|
||||||
"$root/*": ["src/*"]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/**/*.ts",
|
"./src/**/*.ts",
|
||||||
|
|||||||
179
pnpm-lock.yaml
generated
179
pnpm-lock.yaml
generated
@@ -111,8 +111,8 @@ importers:
|
|||||||
specifier: ^28.6.0
|
specifier: ^28.6.0
|
||||||
version: 28.7.0(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.4.5))(eslint@9.8.0)(typescript@5.4.5))(eslint@9.8.0)(jest@29.7.0(@types/node@20.16.2))(typescript@5.4.5)
|
version: 28.7.0(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.4.5))(eslint@9.8.0)(typescript@5.4.5))(eslint@9.8.0)(jest@29.7.0(@types/node@20.16.2))(typescript@5.4.5)
|
||||||
eslint-plugin-jsdoc:
|
eslint-plugin-jsdoc:
|
||||||
specifier: ^48.2.9
|
specifier: ^50.0.0
|
||||||
version: 48.11.0(eslint@9.8.0)
|
version: 50.2.2(eslint@9.8.0)
|
||||||
eslint-plugin-json:
|
eslint-plugin-json:
|
||||||
specifier: ^4.0.0
|
specifier: ^4.0.0
|
||||||
version: 4.0.1
|
version: 4.0.1
|
||||||
@@ -503,67 +503,6 @@ importers:
|
|||||||
specifier: ^7.0.0
|
specifier: ^7.0.0
|
||||||
version: 7.1.0
|
version: 7.1.0
|
||||||
|
|
||||||
packages/mermaid/src/vitepress:
|
|
||||||
dependencies:
|
|
||||||
'@mdi/font':
|
|
||||||
specifier: ^7.0.0
|
|
||||||
version: 7.4.47
|
|
||||||
'@vueuse/core':
|
|
||||||
specifier: ^10.9.0
|
|
||||||
version: 10.11.1(vue@3.4.38(typescript@5.4.5))
|
|
||||||
font-awesome:
|
|
||||||
specifier: ^4.7.0
|
|
||||||
version: 4.7.0
|
|
||||||
jiti:
|
|
||||||
specifier: ^1.21.0
|
|
||||||
version: 1.21.6
|
|
||||||
mermaid:
|
|
||||||
specifier: workspace:^
|
|
||||||
version: link:../..
|
|
||||||
vue:
|
|
||||||
specifier: ^3.4.21
|
|
||||||
version: 3.4.38(typescript@5.4.5)
|
|
||||||
devDependencies:
|
|
||||||
'@iconify-json/carbon':
|
|
||||||
specifier: ^1.1.31
|
|
||||||
version: 1.1.37
|
|
||||||
'@unocss/reset':
|
|
||||||
specifier: ^0.59.0
|
|
||||||
version: 0.59.4
|
|
||||||
'@vite-pwa/vitepress':
|
|
||||||
specifier: ^0.4.0
|
|
||||||
version: 0.4.0(vite-plugin-pwa@0.19.8(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0))
|
|
||||||
'@vitejs/plugin-vue':
|
|
||||||
specifier: ^5.0.0
|
|
||||||
version: 5.1.2(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))(vue@3.4.38(typescript@5.4.5))
|
|
||||||
fast-glob:
|
|
||||||
specifier: ^3.3.2
|
|
||||||
version: 3.3.2
|
|
||||||
https-localhost:
|
|
||||||
specifier: ^4.7.1
|
|
||||||
version: 4.7.1
|
|
||||||
pathe:
|
|
||||||
specifier: ^1.1.2
|
|
||||||
version: 1.1.2
|
|
||||||
unocss:
|
|
||||||
specifier: ^0.59.0
|
|
||||||
version: 0.59.4(postcss@8.4.41)(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))
|
|
||||||
unplugin-vue-components:
|
|
||||||
specifier: ^0.26.0
|
|
||||||
version: 0.26.0(@babel/parser@7.25.4)(rollup@4.21.1)(vue@3.4.38(typescript@5.4.5))
|
|
||||||
vite:
|
|
||||||
specifier: ^5.0.0
|
|
||||||
version: 5.4.2(@types/node@22.5.1)(terser@5.31.6)
|
|
||||||
vite-plugin-pwa:
|
|
||||||
specifier: ^0.19.7
|
|
||||||
version: 0.19.8(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0)
|
|
||||||
vitepress:
|
|
||||||
specifier: 1.1.4
|
|
||||||
version: 1.1.4(@algolia/client-search@4.24.0)(@types/node@22.5.1)(axios@1.7.5)(postcss@8.4.41)(search-insights@2.15.0)(terser@5.31.6)(typescript@5.4.5)
|
|
||||||
workbox-window:
|
|
||||||
specifier: ^7.0.0
|
|
||||||
version: 7.1.0
|
|
||||||
|
|
||||||
packages/parser:
|
packages/parser:
|
||||||
dependencies:
|
dependencies:
|
||||||
langium:
|
langium:
|
||||||
@@ -1871,8 +1810,8 @@ packages:
|
|||||||
'@emnapi/runtime@1.2.0':
|
'@emnapi/runtime@1.2.0':
|
||||||
resolution: {integrity: sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==}
|
resolution: {integrity: sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==}
|
||||||
|
|
||||||
'@es-joy/jsdoccomment@0.46.0':
|
'@es-joy/jsdoccomment@0.48.0':
|
||||||
resolution: {integrity: sha512-C3Axuq1xd/9VqFZpW4YAzOx5O9q/LP46uIQy/iNDpHG3fmPa6TBtvfglMCs3RBiBxAIi0Go97r8+jvTt55XMyQ==}
|
resolution: {integrity: sha512-G6QUWIcC+KvSwXNsJyDTHvqUdNoAVJPPgkc3+Uk4WBKqZvoXhlvazOgm9aL0HwihJLQf0l+tOE2UFzXBqCqgDw==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
|
|
||||||
'@esbuild/aix-ppc64@0.21.5':
|
'@esbuild/aix-ppc64@0.21.5':
|
||||||
@@ -5013,8 +4952,8 @@ packages:
|
|||||||
jest:
|
jest:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
eslint-plugin-jsdoc@48.11.0:
|
eslint-plugin-jsdoc@50.2.2:
|
||||||
resolution: {integrity: sha512-d12JHJDPNo7IFwTOAItCeJY1hcqoIxE0lHA8infQByLilQ9xkqrRa6laWCnsuCrf+8rUnvxXY1XuTbibRBNylA==}
|
resolution: {integrity: sha512-i0ZMWA199DG7sjxlzXn5AeYZxpRfMJjDPUl7lL9eJJX8TPRoIaxJU4ys/joP5faM5AXE1eqW/dslCj3uj4Nqpg==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
|
eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
|
||||||
@@ -6329,8 +6268,8 @@ packages:
|
|||||||
jsbn@0.1.1:
|
jsbn@0.1.1:
|
||||||
resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==}
|
resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==}
|
||||||
|
|
||||||
jsdoc-type-pratt-parser@4.0.0:
|
jsdoc-type-pratt-parser@4.1.0:
|
||||||
resolution: {integrity: sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==}
|
resolution: {integrity: sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==}
|
||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
|
|
||||||
jsdom@24.1.3:
|
jsdom@24.1.3:
|
||||||
@@ -11072,11 +11011,11 @@ snapshots:
|
|||||||
tslib: 2.7.0
|
tslib: 2.7.0
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@es-joy/jsdoccomment@0.46.0':
|
'@es-joy/jsdoccomment@0.48.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
comment-parser: 1.4.1
|
comment-parser: 1.4.1
|
||||||
esquery: 1.6.0
|
esquery: 1.6.0
|
||||||
jsdoc-type-pratt-parser: 4.0.0
|
jsdoc-type-pratt-parser: 4.1.0
|
||||||
|
|
||||||
'@esbuild/aix-ppc64@0.21.5':
|
'@esbuild/aix-ppc64@0.21.5':
|
||||||
optional: true
|
optional: true
|
||||||
@@ -12389,16 +12328,6 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- rollup
|
- rollup
|
||||||
|
|
||||||
'@unocss/astro@0.59.4(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))':
|
|
||||||
dependencies:
|
|
||||||
'@unocss/core': 0.59.4
|
|
||||||
'@unocss/reset': 0.59.4
|
|
||||||
'@unocss/vite': 0.59.4(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))
|
|
||||||
optionalDependencies:
|
|
||||||
vite: 5.4.2(@types/node@22.5.1)(terser@5.31.6)
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- rollup
|
|
||||||
|
|
||||||
'@unocss/cli@0.59.4(rollup@2.79.1)':
|
'@unocss/cli@0.59.4(rollup@2.79.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ampproject/remapping': 2.3.0
|
'@ampproject/remapping': 2.3.0
|
||||||
@@ -12417,24 +12346,6 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- rollup
|
- rollup
|
||||||
|
|
||||||
'@unocss/cli@0.59.4(rollup@4.21.1)':
|
|
||||||
dependencies:
|
|
||||||
'@ampproject/remapping': 2.3.0
|
|
||||||
'@rollup/pluginutils': 5.1.0(rollup@4.21.1)
|
|
||||||
'@unocss/config': 0.59.4
|
|
||||||
'@unocss/core': 0.59.4
|
|
||||||
'@unocss/preset-uno': 0.59.4
|
|
||||||
cac: 6.7.14
|
|
||||||
chokidar: 3.6.0
|
|
||||||
colorette: 2.0.20
|
|
||||||
consola: 3.2.3
|
|
||||||
fast-glob: 3.3.2
|
|
||||||
magic-string: 0.30.11
|
|
||||||
pathe: 1.1.2
|
|
||||||
perfect-debounce: 1.0.0
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- rollup
|
|
||||||
|
|
||||||
'@unocss/config@0.59.4':
|
'@unocss/config@0.59.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@unocss/core': 0.59.4
|
'@unocss/core': 0.59.4
|
||||||
@@ -12560,22 +12471,6 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- rollup
|
- rollup
|
||||||
|
|
||||||
'@unocss/vite@0.59.4(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))':
|
|
||||||
dependencies:
|
|
||||||
'@ampproject/remapping': 2.3.0
|
|
||||||
'@rollup/pluginutils': 5.1.0(rollup@4.21.1)
|
|
||||||
'@unocss/config': 0.59.4
|
|
||||||
'@unocss/core': 0.59.4
|
|
||||||
'@unocss/inspector': 0.59.4
|
|
||||||
'@unocss/scope': 0.59.4
|
|
||||||
'@unocss/transformer-directives': 0.59.4
|
|
||||||
chokidar: 3.6.0
|
|
||||||
fast-glob: 3.3.2
|
|
||||||
magic-string: 0.30.11
|
|
||||||
vite: 5.4.2(@types/node@22.5.1)(terser@5.31.6)
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- rollup
|
|
||||||
|
|
||||||
'@vite-pwa/vitepress@0.4.0(vite-plugin-pwa@0.19.8(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0))':
|
'@vite-pwa/vitepress@0.4.0(vite-plugin-pwa@0.19.8(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0))':
|
||||||
dependencies:
|
dependencies:
|
||||||
vite-plugin-pwa: 0.19.8(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0)
|
vite-plugin-pwa: 0.19.8(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))(workbox-build@7.1.1(@types/babel__core@7.20.5))(workbox-window@7.1.0)
|
||||||
@@ -14694,9 +14589,9 @@ snapshots:
|
|||||||
- supports-color
|
- supports-color
|
||||||
- typescript
|
- typescript
|
||||||
|
|
||||||
eslint-plugin-jsdoc@48.11.0(eslint@9.8.0):
|
eslint-plugin-jsdoc@50.2.2(eslint@9.8.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@es-joy/jsdoccomment': 0.46.0
|
'@es-joy/jsdoccomment': 0.48.0
|
||||||
are-docs-informative: 0.0.2
|
are-docs-informative: 0.0.2
|
||||||
comment-parser: 1.4.1
|
comment-parser: 1.4.1
|
||||||
debug: 4.3.6(supports-color@8.1.1)
|
debug: 4.3.6(supports-color@8.1.1)
|
||||||
@@ -16347,7 +16242,7 @@ snapshots:
|
|||||||
|
|
||||||
jsbn@0.1.1: {}
|
jsbn@0.1.1: {}
|
||||||
|
|
||||||
jsdoc-type-pratt-parser@4.0.0: {}
|
jsdoc-type-pratt-parser@4.1.0: {}
|
||||||
|
|
||||||
jsdom@24.1.3:
|
jsdom@24.1.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -18977,35 +18872,6 @@ snapshots:
|
|||||||
- rollup
|
- rollup
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
unocss@0.59.4(postcss@8.4.41)(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6)):
|
|
||||||
dependencies:
|
|
||||||
'@unocss/astro': 0.59.4(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))
|
|
||||||
'@unocss/cli': 0.59.4(rollup@4.21.1)
|
|
||||||
'@unocss/core': 0.59.4
|
|
||||||
'@unocss/extractor-arbitrary-variants': 0.59.4
|
|
||||||
'@unocss/postcss': 0.59.4(postcss@8.4.41)
|
|
||||||
'@unocss/preset-attributify': 0.59.4
|
|
||||||
'@unocss/preset-icons': 0.59.4
|
|
||||||
'@unocss/preset-mini': 0.59.4
|
|
||||||
'@unocss/preset-tagify': 0.59.4
|
|
||||||
'@unocss/preset-typography': 0.59.4
|
|
||||||
'@unocss/preset-uno': 0.59.4
|
|
||||||
'@unocss/preset-web-fonts': 0.59.4
|
|
||||||
'@unocss/preset-wind': 0.59.4
|
|
||||||
'@unocss/reset': 0.59.4
|
|
||||||
'@unocss/transformer-attributify-jsx': 0.59.4
|
|
||||||
'@unocss/transformer-attributify-jsx-babel': 0.59.4
|
|
||||||
'@unocss/transformer-compile-class': 0.59.4
|
|
||||||
'@unocss/transformer-directives': 0.59.4
|
|
||||||
'@unocss/transformer-variant-group': 0.59.4
|
|
||||||
'@unocss/vite': 0.59.4(rollup@4.21.1)(vite@5.4.2(@types/node@22.5.1)(terser@5.31.6))
|
|
||||||
optionalDependencies:
|
|
||||||
vite: 5.4.2(@types/node@22.5.1)(terser@5.31.6)
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- postcss
|
|
||||||
- rollup
|
|
||||||
- supports-color
|
|
||||||
|
|
||||||
unpipe@1.0.0: {}
|
unpipe@1.0.0: {}
|
||||||
|
|
||||||
unplugin-vue-components@0.26.0(@babel/parser@7.25.4)(rollup@2.79.1)(vue@3.4.38(typescript@5.4.5)):
|
unplugin-vue-components@0.26.0(@babel/parser@7.25.4)(rollup@2.79.1)(vue@3.4.38(typescript@5.4.5)):
|
||||||
@@ -19027,25 +18893,6 @@ snapshots:
|
|||||||
- rollup
|
- rollup
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
unplugin-vue-components@0.26.0(@babel/parser@7.25.4)(rollup@4.21.1)(vue@3.4.38(typescript@5.4.5)):
|
|
||||||
dependencies:
|
|
||||||
'@antfu/utils': 0.7.10
|
|
||||||
'@rollup/pluginutils': 5.1.0(rollup@4.21.1)
|
|
||||||
chokidar: 3.6.0
|
|
||||||
debug: 4.3.6(supports-color@8.1.1)
|
|
||||||
fast-glob: 3.3.2
|
|
||||||
local-pkg: 0.4.3
|
|
||||||
magic-string: 0.30.11
|
|
||||||
minimatch: 9.0.5
|
|
||||||
resolve: 1.22.8
|
|
||||||
unplugin: 1.12.0
|
|
||||||
vue: 3.4.38(typescript@5.4.5)
|
|
||||||
optionalDependencies:
|
|
||||||
'@babel/parser': 7.25.4
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- rollup
|
|
||||||
- supports-color
|
|
||||||
|
|
||||||
unplugin@1.12.0:
|
unplugin@1.12.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
acorn: 8.12.1
|
acorn: 8.12.1
|
||||||
|
|||||||
175
scripts/tsc-check.ts
Normal file
175
scripts/tsc-check.ts
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
/**
|
||||||
|
* Verify the as-built tarballs can be imported into a fresh, out-of-tree TypeScript project.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
import { mkdtemp, mkdir, writeFile, readFile, readdir, copyFile, rm } from 'node:fs/promises';
|
||||||
|
import { execFileSync } from 'child_process';
|
||||||
|
import * as path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
|
||||||
|
const __dirname = path.dirname(__filename); // get the name of the directory
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Packages to build and import
|
||||||
|
*/
|
||||||
|
const PACKAGES = {
|
||||||
|
mermaid: 'mermaid',
|
||||||
|
'@mermaid-js/layout-elk': 'mermaid-layout-elk',
|
||||||
|
// TODO: these don't import cleanly yet due to exotic tsconfig.json requirements
|
||||||
|
// '@mermaid-js/mermaid-zenuml': 'mermaid-zenuml',
|
||||||
|
// '@mermaid-js/parser': 'parser',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Files to create in the temporary package.
|
||||||
|
*/
|
||||||
|
const SRC = {
|
||||||
|
// a minimal description of a buildable package
|
||||||
|
'package.json': (tarballs: Record<string, string>) =>
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
dependencies: tarballs,
|
||||||
|
scripts: { build: 'tsc -b --verbose' },
|
||||||
|
devDependencies: {
|
||||||
|
// these are somewhat-unexpectedly required, and a downstream would need
|
||||||
|
// to match the real `package.json` values
|
||||||
|
'type-fest': '*',
|
||||||
|
'@types/d3': '^7.4.3',
|
||||||
|
'@types/dompurify': '^3.0.5',
|
||||||
|
typescript: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
),
|
||||||
|
// a fairly strict TypeScript configuration
|
||||||
|
'tsconfig.json': () =>
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
compilerOptions: {
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
composite: true,
|
||||||
|
declaration: true,
|
||||||
|
esModuleInterop: true,
|
||||||
|
incremental: true,
|
||||||
|
lib: ['dom', 'es2020'],
|
||||||
|
module: 'esnext',
|
||||||
|
moduleResolution: 'node',
|
||||||
|
noEmitOnError: true,
|
||||||
|
noImplicitAny: true,
|
||||||
|
noUnusedLocals: true,
|
||||||
|
sourceMap: true,
|
||||||
|
target: 'es2020',
|
||||||
|
rootDir: './src',
|
||||||
|
outDir: './lib',
|
||||||
|
strict: true,
|
||||||
|
tsBuildInfoFile: 'lib/.tsbuildinfo',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
),
|
||||||
|
// the simplest possible script: will everything even import?
|
||||||
|
'src/index.ts': (tarballs) => {
|
||||||
|
const imports: string[] = [];
|
||||||
|
const outputs: string[] = [];
|
||||||
|
let i = 0;
|
||||||
|
for (const pkg of Object.keys(tarballs)) {
|
||||||
|
imports.push(`import * as pkg_${i} from '${pkg}';`);
|
||||||
|
outputs.push(`console.log(pkg_${i});`);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return [...imports, ...outputs].join('\n');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commands to run after source files are created.
|
||||||
|
*
|
||||||
|
* `npm` is used to detect any unwanted `pnpm`-specific runtime "features".
|
||||||
|
*/
|
||||||
|
const COMMANDS = [
|
||||||
|
['npm', 'install'],
|
||||||
|
['npm', 'run', 'build'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Built files to expect after commands are executed.
|
||||||
|
*/
|
||||||
|
const LIB = ['lib/index.js', 'lib/index.js.map', 'lib/index.d.ts', 'lib/.tsbuildinfo'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run a small out-of-tree build.
|
||||||
|
*/
|
||||||
|
async function main() {
|
||||||
|
console.warn('Checking out-of-tree TypeScript build using', Object.keys(PACKAGES).join('\n'));
|
||||||
|
const cwd = await mkdtemp(path.join(tmpdir(), 'mermaid-tsc-check-'));
|
||||||
|
console.warn('... creating temporary folder', cwd);
|
||||||
|
const tarballs = await buildTarballs(cwd);
|
||||||
|
|
||||||
|
for (const [filename, generate] of Object.entries(SRC)) {
|
||||||
|
const dest = path.join(cwd, filename);
|
||||||
|
await mkdir(path.dirname(dest), { recursive: true });
|
||||||
|
console.warn('... creating', dest);
|
||||||
|
const text = generate(tarballs);
|
||||||
|
await writeFile(dest, text);
|
||||||
|
console.info(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const argv of COMMANDS) {
|
||||||
|
console.warn('... in', cwd);
|
||||||
|
console.warn('>>>', ...argv);
|
||||||
|
execFileSync(argv[0], argv.slice(1), { cwd });
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const lib of LIB) {
|
||||||
|
const checkLib = path.join(cwd, lib);
|
||||||
|
console.warn('... checking built file', checkLib);
|
||||||
|
await readFile(checkLib, 'utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('... deleting', cwd);
|
||||||
|
await rm(cwd, { recursive: true, force: true });
|
||||||
|
console.warn('... tsc-check OK for\n', Object.keys(PACKAGES).join('\n'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Build all the tarballs. */
|
||||||
|
async function buildTarballs(tmp: string): Promise<Record<string, string>> {
|
||||||
|
const dist = path.join(tmp, 'dist');
|
||||||
|
await mkdir(dist);
|
||||||
|
const promises: Promise<void>[] = [];
|
||||||
|
const tarballs: Record<string, string> = {};
|
||||||
|
for (const [pkg, srcPath] of Object.entries(PACKAGES)) {
|
||||||
|
promises.push(buildOneTarball(pkg, srcPath, dist, tarballs));
|
||||||
|
}
|
||||||
|
await Promise.all(promises);
|
||||||
|
return tarballs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Build a single tarball. */
|
||||||
|
async function buildOneTarball(
|
||||||
|
pkg: string,
|
||||||
|
srcPath: string,
|
||||||
|
dist: string,
|
||||||
|
tarballs: Record<string, string>
|
||||||
|
): Promise<void> {
|
||||||
|
const cwd = await mkdtemp(path.join(dist, 'pack-'));
|
||||||
|
const pkgDir = path.join(__dirname, '../packages', srcPath);
|
||||||
|
const argv = ['pnpm', 'pack', '--pack-destination', cwd];
|
||||||
|
console.warn('>>>', ...argv);
|
||||||
|
execFileSync(argv[0], argv.slice(1), { cwd: pkgDir });
|
||||||
|
const built = await readdir(cwd);
|
||||||
|
const dest = path.join(dist, built[0]);
|
||||||
|
await copyFile(path.join(cwd, built[0]), dest);
|
||||||
|
await rm(cwd, { recursive: true, force: true });
|
||||||
|
tarballs[pkg] = dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main().catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
console.error('!!! tsc-check FAIL: temp folder left in place. see logs above for failure notes');
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
@@ -2,15 +2,10 @@ import jison from './.vite/jisonPlugin.js';
|
|||||||
import jsonSchemaPlugin from './.vite/jsonSchemaPlugin.js';
|
import jsonSchemaPlugin from './.vite/jsonSchemaPlugin.js';
|
||||||
import typescript from '@rollup/plugin-typescript';
|
import typescript from '@rollup/plugin-typescript';
|
||||||
import { defaultExclude, defineConfig } from 'vitest/config';
|
import { defaultExclude, defineConfig } from 'vitest/config';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js'],
|
extensions: ['.js'],
|
||||||
alias: {
|
|
||||||
// Define your alias here
|
|
||||||
$root: path.resolve(__dirname, 'packages/mermaid/src'),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
jison(),
|
jison(),
|
||||||
|
|||||||
Reference in New Issue
Block a user