From ccd55a0bde2782546d49eb62c19478cf305c7bf3 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 14 Nov 2022 11:24:59 -0800 Subject: [PATCH 01/13] add stateDiagram-v2 to list of graphs with classDefs --- packages/mermaid/src/mermaidAPI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mermaid/src/mermaidAPI.ts b/packages/mermaid/src/mermaidAPI.ts index b921655ab..7a67c708e 100644 --- a/packages/mermaid/src/mermaidAPI.ts +++ b/packages/mermaid/src/mermaidAPI.ts @@ -32,7 +32,7 @@ import { evaluate } from './diagrams/common/common'; import { isEmpty } from 'lodash'; // diagram names that support classDef statements -const CLASSDEF_DIAGRAMS = ['graph', 'flowchart', 'flowchart-v2', 'stateDiagram']; +const CLASSDEF_DIAGRAMS = ['graph', 'flowchart', 'flowchart-v2', 'stateDiagram', 'stateDiagram-v2']; const MAX_TEXTLENGTH_EXCEEDED_MSG = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa'; From 345eaade221fb15b0777ff07f74219d06ce61d41 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 14 Nov 2022 11:39:58 -0800 Subject: [PATCH 02/13] stateDB classes must be a {} not [] --- packages/mermaid/src/diagrams/state/stateDb.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/mermaid/src/diagrams/state/stateDb.js b/packages/mermaid/src/diagrams/state/stateDb.js index d0877847c..914ac7410 100644 --- a/packages/mermaid/src/diagrams/state/stateDb.js +++ b/packages/mermaid/src/diagrams/state/stateDb.js @@ -31,9 +31,15 @@ const FILL_KEYWORD = 'fill'; const BG_FILL = 'bgFill'; const STYLECLASS_SEP = ','; +// Returns a new list of classes. +// In the future, this can be replaced with a class common to all diagrams. +function newClassesList() { + return {}; +} + let direction = DEFAULT_DIAGRAM_DIRECTION; let rootDoc = []; -let classes = []; // style classes defined by a classDef +let classes = newClassesList(); // style classes defined by a classDef const newDoc = () => { return { @@ -274,7 +280,7 @@ export const clear = function (saveCommon) { // number of start and end nodes; used to construct ids startEndCount = 0; - classes = []; + classes = newClassesList(); if (!saveCommon) { commonClear(); } From 9996e53e24cced6bbfc0681161345cc0a313a1d8 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 08:50:20 -0800 Subject: [PATCH 03/13] (minor) add comments, remove duplicated line --- packages/mermaid/src/diagrams/state/stateDb.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/mermaid/src/diagrams/state/stateDb.js b/packages/mermaid/src/diagrams/state/stateDb.js index 914ac7410..cf012fc2c 100644 --- a/packages/mermaid/src/diagrams/state/stateDb.js +++ b/packages/mermaid/src/diagrams/state/stateDb.js @@ -31,8 +31,13 @@ const FILL_KEYWORD = 'fill'; const BG_FILL = 'bgFill'; const STYLECLASS_SEP = ','; -// Returns a new list of classes. -// In the future, this can be replaced with a class common to all diagrams. +/** + * Returns a new list of classes. + * In the future, this can be replaced with a class common to all diagrams. + * ClassDef information = { id: id, styles: [], textStyles: [] } + * + * @return {{}} + */ function newClassesList() { return {}; } @@ -276,8 +281,6 @@ export const clear = function (saveCommon) { }; currentDocument = documents.root; - currentDocument = documents.root; - // number of start and end nodes; used to construct ids startEndCount = 0; classes = newClassesList(); @@ -453,7 +456,7 @@ const getDividerId = () => { export const addStyleClass = function (id, styleAttributes = '') { // create a new style class object with this id if (typeof classes[id] === 'undefined') { - classes[id] = { id: id, styles: [], textStyles: [] }; + classes[id] = { id: id, styles: [], textStyles: [] }; // This is a classDef } const foundClass = classes[id]; if (typeof styleAttributes !== 'undefined') { From d3f5474f38155d3af63718e90b646d58123ff88c Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 08:59:01 -0800 Subject: [PATCH 04/13] (minor) fix JSdoc types in comments --- packages/mermaid/src/diagrams/state/stateDb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mermaid/src/diagrams/state/stateDb.js b/packages/mermaid/src/diagrams/state/stateDb.js index cf012fc2c..3c7ca6b6a 100644 --- a/packages/mermaid/src/diagrams/state/stateDb.js +++ b/packages/mermaid/src/diagrams/state/stateDb.js @@ -309,7 +309,7 @@ export const getRelations = function () { * else return the given id * * @param {string} id - * @returns {{id: string, type: string}} - the id and type that should be used + * @returns {string} - the id (original or constructed) */ function startIdIfNeeded(id = '') { let fixedId = id; @@ -338,7 +338,7 @@ function startTypeIfNeeded(id = '', type = DEFAULT_STATE_TYPE) { * else return the given id * * @param {string} id - * @returns {{id: string, type: string}} - the id and type that should be used + * @returns {string} - the id (original or constructed) */ function endIdIfNeeded(id = '') { let fixedId = id; @@ -451,7 +451,7 @@ const getDividerId = () => { * @example classDef my-style fill:#f96; * * @param {string} id - the id of this (style) class - * @param {string} styleAttributes - the string with 1 or more style attributes (each separated by a comma) + * @param {string | null} styleAttributes - the string with 1 or more style attributes (each separated by a comma) */ export const addStyleClass = function (id, styleAttributes = '') { // create a new style class object with this id From c6db0524bd39ba85f390b615959ee7431a053d9b Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 09:01:34 -0800 Subject: [PATCH 05/13] + spec stateRenderer-v2.js getClasses() to verify it returns a {} --- .../diagrams/state/stateDiagram-v2.spec.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js b/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js index 39ec0f0d2..81dae6dbb 100644 --- a/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js +++ b/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js @@ -1,8 +1,24 @@ import { parser } from './parser/stateDiagram'; import stateDb from './stateDb'; import stateDiagram from './parser/stateDiagram.jison'; +import stateRendererV2 from './stateRenderer-v2'; + +// Can use this instead of having to register diagrams and load/orchestrate them, etc. +class FauxDiagramObj { + db = stateDb; + parser = parser; + renderer = stateRendererV2; + + constructor(options = { db: stateDb, parser: parser, renderer: stateRendererV2 }) { + this.db = options.db; + this.parser = options.parser; + this.renderer = options.renderer; + this.parser.yy = this.db; + } +} describe('state diagram V2, ', function () { + // TODO - these examples should be put into ./parser/stateDiagram.spec.js describe('when parsing an info graph it', function () { beforeEach(function () { parser.yy = stateDb; @@ -423,4 +439,16 @@ describe('state diagram V2, ', function () { expect(rel_Active_Active.relationTitle).toEqual('LOG'); }); }); + + describe('stateRenderer-v2', () => { + describe('getClasses', () => { + const diagramText = 'statediagram-v2\n'; + const fauxStateDiagram = new FauxDiagramObj(); + + it('returns a {}', () => { + const result = stateRendererV2.getClasses(diagramText, fauxStateDiagram); + expectTypeOf(result).toBeObject(); + }); + }); + }); }); From 1ecd4a551d042ddb652b060b1db318751399e70e Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 09:13:27 -0800 Subject: [PATCH 06/13] (minor) fix JSdoc tag --- packages/mermaid/src/diagrams/state/stateDb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mermaid/src/diagrams/state/stateDb.js b/packages/mermaid/src/diagrams/state/stateDb.js index 3c7ca6b6a..5e82eaf78 100644 --- a/packages/mermaid/src/diagrams/state/stateDb.js +++ b/packages/mermaid/src/diagrams/state/stateDb.js @@ -36,7 +36,7 @@ const STYLECLASS_SEP = ','; * In the future, this can be replaced with a class common to all diagrams. * ClassDef information = { id: id, styles: [], textStyles: [] } * - * @return {{}} + * @returns {{}} */ function newClassesList() { return {}; From 6090a1f65ab0045b11b3818c18ea17af58b41b2b Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 09:14:00 -0800 Subject: [PATCH 07/13] (minor) import expectTypeOf in spec --- packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js b/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js index 81dae6dbb..38bb44727 100644 --- a/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js +++ b/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js @@ -1,3 +1,5 @@ +import { expectTypeOf } from 'vitest'; + import { parser } from './parser/stateDiagram'; import stateDb from './stateDb'; import stateDiagram from './parser/stateDiagram.jison'; From 13f3008f8200102e3f442f819c6d39380246973a Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 09:18:10 -0800 Subject: [PATCH 08/13] diagramClasses no longer needs to be cached; mermaidAPI no longer calls it repeatedly --- .../src/diagrams/state/stateRenderer-v2.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/mermaid/src/diagrams/state/stateRenderer-v2.js b/packages/mermaid/src/diagrams/state/stateRenderer-v2.js index 1011fb6b1..f9e6d4183 100644 --- a/packages/mermaid/src/diagrams/state/stateRenderer-v2.js +++ b/packages/mermaid/src/diagrams/state/stateRenderer-v2.js @@ -58,11 +58,7 @@ const G_EDGE_LABELTYPE = 'text'; const G_EDGE_THICKNESS = 'normal'; // -------------------------------------- -// When information is parsed and processed (extracted) by stateDb.extract() -// These are globals so the information can be accessed as needed (e.g. in setUpNode, etc.) let diagramStates = []; -let diagramClasses = []; - // List of nodes created from the parsed diagram statement items let nodeDb = {}; @@ -81,18 +77,14 @@ export const setConf = function (cnf) { }; /** - * Returns the all the styles from classDef statements in the graph definition. + * Returns the all the classdef styles (a.k.a. classes) from classDef statements in the graph definition. * * @param {string} text - the diagram text to be parsed - * @param {Diagram} diagramObj - * @returns {object} ClassDef styles + * @param diagramObj + * @returns {object} ClassDef styles (a Map with keys = strings, values = ) */ export const getClasses = function (text, diagramObj) { log.trace('Extracting classes'); - if (diagramClasses.length > 0) { - return diagramClasses; // we have already extracted the classes - } - diagramObj.db.clear(); try { // Parse the graph definition @@ -407,8 +399,7 @@ export const draw = function (text, id, _version, diag) { diag.db.extract(diag.db.getRootDocV2()); log.info(diag.db.getRootDocV2()); - diagramStates = diag.db.getStates(); - diagramClasses = diag.db.getClasses(); + const diagramStates = diag.db.getStates(); // Create the input mermaid.graph const g = new graphlib.Graph({ From fcec9adbcd734137a0e581adac4299e3bb23f987 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 09:19:27 -0800 Subject: [PATCH 09/13] diagramStates should not be global; pass it into functions; minor comment fixes --- .../src/diagrams/state/stateRenderer-v2.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/mermaid/src/diagrams/state/stateRenderer-v2.js b/packages/mermaid/src/diagrams/state/stateRenderer-v2.js index f9e6d4183..752b70e44 100644 --- a/packages/mermaid/src/diagrams/state/stateRenderer-v2.js +++ b/packages/mermaid/src/diagrams/state/stateRenderer-v2.js @@ -58,7 +58,6 @@ const G_EDGE_LABELTYPE = 'text'; const G_EDGE_THICKNESS = 'normal'; // -------------------------------------- -let diagramStates = []; // List of nodes created from the parsed diagram statement items let nodeDb = {}; @@ -91,7 +90,6 @@ export const getClasses = function (text, diagramObj) { diagramObj.parser.parse(text); // must run extract() to turn the parsed statements into states, relationships, classes, etc. diagramObj.db.extract(diagramObj.db.getRootDocV2()); - return diagramObj.db.getClasses(); } catch (e) { return e; @@ -99,7 +97,7 @@ export const getClasses = function (text, diagramObj) { }; /** - * Get classes from the db info item. + * Get classes from the db for the info item. * If there aren't any or if dbInfoItem isn't defined, return an empty string. * Else create 1 string from the list of classes found * @@ -124,7 +122,7 @@ function getClassesFromDbInfo(dbInfoItem) { * * @param itemId * @param counter - * @param type + * @param {string | null} type * @param typeSpacer * @returns {string} */ @@ -139,10 +137,11 @@ export function stateDomId(itemId = '', counter = 0, type = '', typeSpacer = DOM * @param g - graph * @param {object} parent * @param {object} parsedItem - parsed statement item + * @param {object[]} diagramStates - the list of all known states for the diagram * @param {object} diagramDb * @param {boolean} altFlag - for clusters, add the "statediagram-cluster-alt" CSS class */ -const setupNode = (g, parent, parsedItem, diagramDb, altFlag) => { +const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) => { const itemId = parsedItem.id; const classStr = getClassesFromDbInfo(diagramStates[itemId]); @@ -299,7 +298,7 @@ const setupNode = (g, parent, parsedItem, diagramDb, altFlag) => { } if (parsedItem.doc) { log.trace('Adding nodes children '); - setupDoc(g, parsedItem, parsedItem.doc, diagramDb, !altFlag); + setupDoc(g, parsedItem, parsedItem.doc, diagramStates, diagramDb, !altFlag); } }; @@ -310,25 +309,26 @@ const setupNode = (g, parent, parsedItem, diagramDb, altFlag) => { * @param g * @param parentParsedItem - parsed Item that is the parent of this document (doc) * @param doc - the document to set up + * @param {object} diagramStates - the list of all known states for the diagram * @param diagramDb - * @param altFlag + * @param {boolean} altFlag * @todo This duplicates some of what is done in stateDb.js extract method */ -const setupDoc = (g, parentParsedItem, doc, diagramDb, altFlag) => { +const setupDoc = (g, parentParsedItem, doc, diagramStates, diagramDb, altFlag) => { // graphItemCount = 0; log.trace('items', doc); doc.forEach((item) => { switch (item.stmt) { case STMT_STATE: - setupNode(g, parentParsedItem, item, diagramDb, altFlag); + setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag); break; case DEFAULT_STATE_TYPE: - setupNode(g, parentParsedItem, item, diagramDb, altFlag); + setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag); break; case STMT_RELATION: { - setupNode(g, parentParsedItem, item.state1, diagramDb, altFlag); - setupNode(g, parentParsedItem, item.state2, diagramDb, altFlag); + setupNode(g, parentParsedItem, item.state1, diagramStates, diagramDb, altFlag); + setupNode(g, parentParsedItem, item.state2, diagramStates, diagramDb, altFlag); const edgeData = { id: 'edge' + graphItemCount, arrowhead: 'normal', @@ -417,7 +417,7 @@ export const draw = function (text, id, _version, diag) { return {}; }); - setupNode(g, undefined, diag.db.getRootDocV2(), diag.db, true); + setupNode(g, undefined, diag.db.getRootDocV2(), diagramStates, diag.db, true); // Set up an SVG group so that we can translate the final graph. let sandboxElement; From 2cbf6110a6266fd20ad0f32b98293c8181abe92f Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 12:30:10 -0800 Subject: [PATCH 10/13] create separate spec for stateRenderer-v2 --- .../diagrams/state/stateDiagram-v2.spec.js | 29 ----------------- .../diagrams/state/stateRenderer-v2.spec.js | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 packages/mermaid/src/diagrams/state/stateRenderer-v2.spec.js diff --git a/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js b/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js index 38bb44727..7ed5555db 100644 --- a/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js +++ b/packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js @@ -1,23 +1,6 @@ -import { expectTypeOf } from 'vitest'; - import { parser } from './parser/stateDiagram'; import stateDb from './stateDb'; import stateDiagram from './parser/stateDiagram.jison'; -import stateRendererV2 from './stateRenderer-v2'; - -// Can use this instead of having to register diagrams and load/orchestrate them, etc. -class FauxDiagramObj { - db = stateDb; - parser = parser; - renderer = stateRendererV2; - - constructor(options = { db: stateDb, parser: parser, renderer: stateRendererV2 }) { - this.db = options.db; - this.parser = options.parser; - this.renderer = options.renderer; - this.parser.yy = this.db; - } -} describe('state diagram V2, ', function () { // TODO - these examples should be put into ./parser/stateDiagram.spec.js @@ -441,16 +424,4 @@ describe('state diagram V2, ', function () { expect(rel_Active_Active.relationTitle).toEqual('LOG'); }); }); - - describe('stateRenderer-v2', () => { - describe('getClasses', () => { - const diagramText = 'statediagram-v2\n'; - const fauxStateDiagram = new FauxDiagramObj(); - - it('returns a {}', () => { - const result = stateRendererV2.getClasses(diagramText, fauxStateDiagram); - expectTypeOf(result).toBeObject(); - }); - }); - }); }); diff --git a/packages/mermaid/src/diagrams/state/stateRenderer-v2.spec.js b/packages/mermaid/src/diagrams/state/stateRenderer-v2.spec.js new file mode 100644 index 000000000..3a118e607 --- /dev/null +++ b/packages/mermaid/src/diagrams/state/stateRenderer-v2.spec.js @@ -0,0 +1,31 @@ +import { expectTypeOf } from 'vitest'; + +import { parser } from './parser/stateDiagram'; +import stateDb from './stateDb'; +import stateRendererV2 from './stateRenderer-v2'; + +// Can use this instead of having to register diagrams and load/orchestrate them, etc. +class FauxDiagramObj { + db = stateDb; + parser = parser; + renderer = stateRendererV2; + + constructor(options = { db: stateDb, parser: parser, renderer: stateRendererV2 }) { + this.db = options.db; + this.parser = options.parser; + this.renderer = options.renderer; + this.parser.yy = this.db; + } +} + +describe('stateRenderer-v2', () => { + describe('getClasses', () => { + const diagramText = 'statediagram-v2\n'; + const fauxStateDiagram = new FauxDiagramObj(); + + it('returns a {}', () => { + const result = stateRendererV2.getClasses(diagramText, fauxStateDiagram); + expectTypeOf(result).toBeObject(); + }); + }); +}); From 717aca6824aac2ffa32f553065116532506665cf Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Tue, 15 Nov 2022 13:09:16 -0800 Subject: [PATCH 11/13] change shiki getHighlighter import --- .../mermaid/src/docs/.vitepress/mermaid-markdown-all.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/mermaid/src/docs/.vitepress/mermaid-markdown-all.ts b/packages/mermaid/src/docs/.vitepress/mermaid-markdown-all.ts index 7006f20e9..db9b764bc 100644 --- a/packages/mermaid/src/docs/.vitepress/mermaid-markdown-all.ts +++ b/packages/mermaid/src/docs/.vitepress/mermaid-markdown-all.ts @@ -1,5 +1,7 @@ import type { MarkdownRenderer } from 'vitepress'; -import shiki from 'shiki'; + +// Note: using "import shiki from 'shiki' and then "const highlighter = await shiki.getHighlighter(...) does not work 2022-11-15 +import { getHighlighter } from 'shiki'; const MermaidExample = async (md: MarkdownRenderer) => { const defaultRenderer = md.renderer.rules.fence; @@ -8,7 +10,7 @@ const MermaidExample = async (md: MarkdownRenderer) => { throw new Error('defaultRenderer is undefined'); } - const highlighter = await shiki.getHighlighter({ + const highlighter = await getHighlighter({ theme: 'material-palenight', langs: ['mermaid'], }); From 476917bda93ef59c66c8395dfc12ec57a0c2a4fd Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sat, 22 Oct 2022 18:38:15 +0100 Subject: [PATCH 12/13] Revert "chore(deps): pin dependencies" This reverts commit 17b72d565de595c94c1e339da37fc81676c4b200. --- package.json | 102 +++++----- packages/mermaid-example-diagram/package.json | 4 +- packages/mermaid-mindmap/package.json | 4 +- packages/mermaid/package.json | 56 +++--- pnpm-lock.yaml | 178 +++++++++--------- 5 files changed, 171 insertions(+), 173 deletions(-) diff --git a/package.json b/package.json index c23f632df..7bd648877 100644 --- a/package.json +++ b/package.json @@ -53,60 +53,60 @@ ] }, "devDependencies": { - "@applitools/eyes-cypress": "3.27.6", - "@commitlint/cli": "17.2.0", - "@commitlint/config-conventional": "17.2.0", - "@cspell/eslint-plugin": "6.14.2", - "@types/eslint": "8.4.10", - "@types/express": "4.17.14", - "@types/jsdom": "20.0.1", - "@types/lodash": "4.14.188", - "@types/mdast": "3.0.10", + "@applitools/eyes-cypress": "^3.27.6", + "@commitlint/cli": "^17.2.0", + "@commitlint/config-conventional": "^17.2.0", + "@cspell/eslint-plugin": "^6.14.2", + "@types/eslint": "^8.4.10", + "@types/express": "^4.17.14", + "@types/jsdom": "^20.0.1", + "@types/lodash": "^4.14.188", + "@types/mdast": "^3.0.10", "@types/node": "^18.11.9", - "@types/prettier": "2.7.1", - "@typescript-eslint/eslint-plugin": "5.42.1", - "@typescript-eslint/parser": "5.42.1", - "@vitest/coverage-c8": "0.25.1", - "@vitest/ui": "0.25.1", - "concurrently": "7.5.0", - "coveralls": "3.1.1", - "cypress": "10.11.0", - "cypress-image-snapshot": "4.0.1", - "esbuild": "0.15.13", - "eslint": "8.27.0", - "eslint-config-prettier": "8.5.0", - "eslint-plugin-cypress": "2.12.1", - "eslint-plugin-html": "7.1.0", - "eslint-plugin-jest": "27.1.5", - "eslint-plugin-jsdoc": "39.6.2", - "eslint-plugin-json": "3.1.0", - "eslint-plugin-markdown": "3.0.0", - "eslint-plugin-no-only-tests": "3.1.0", - "eslint-plugin-tsdoc": "0.2.17", - "express": "4.18.2", - "globby": "13.1.2", - "husky": "8.0.2", - "identity-obj-proxy": "3.0.0", - "jest": "29.3.1", - "jison": "0.4.18", - "jsdom": "20.0.2", - "lint-staged": "13.0.3", - "path-browserify": "1.0.1", - "pnpm": "7.15.0", - "prettier": "2.7.1", - "prettier-plugin-jsdoc": "0.4.2", - "rimraf": "3.0.2", - "start-server-and-test": "1.14.0", - "ts-node": "10.9.1", - "typescript": "4.8.4", - "vite": "3.2.3", - "vitepress": "1.0.0-alpha.28", - "vitepress-plugin-mermaid": "2.0.8", - "vitepress-plugin-search": "1.0.4-alpha.15", - "vitest": "0.25.1" + "@types/prettier": "^2.7.1", + "@typescript-eslint/eslint-plugin": "^5.42.1", + "@typescript-eslint/parser": "^5.42.1", + "@vitest/coverage-c8": "^0.25.1", + "@vitest/ui": "^0.25.1", + "concurrently": "^7.5.0", + "coveralls": "^3.1.1", + "cypress": "^10.11.0", + "cypress-image-snapshot": "^4.0.1", + "esbuild": "^0.15.13", + "eslint": "^8.27.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-html": "^7.1.0", + "eslint-plugin-jest": "^27.1.5", + "eslint-plugin-jsdoc": "^39.6.2", + "eslint-plugin-json": "^3.1.0", + "eslint-plugin-markdown": "^3.0.0", + "eslint-plugin-no-only-tests": "^3.1.0", + "eslint-plugin-tsdoc": "^0.2.17", + "express": "^4.18.2", + "globby": "^13.1.2", + "husky": "^8.0.2", + "identity-obj-proxy": "^3.0.0", + "jest": "^29.3.1", + "jison": "^0.4.18", + "jsdom": "^20.0.2", + "lint-staged": "^13.0.3", + "path-browserify": "^1.0.1", + "pnpm": "^7.15.0", + "prettier": "^2.7.1", + "prettier-plugin-jsdoc": "^0.4.2", + "rimraf": "^3.0.2", + "start-server-and-test": "^1.14.0", + "ts-node": "^10.9.1", + "typescript": "^4.8.4", + "vite": "^3.2.3", + "vitepress": "^1.0.0-alpha.28", + "vitepress-plugin-mermaid": "^2.0.8", + "vitepress-plugin-search": "^1.0.4-alpha.15", + "vitest": "^0.25.1" }, "resolutions": { - "d3": "7.6.1" + "d3": "^7.6.1" }, "sideEffects": [ "**/*.css", diff --git a/packages/mermaid-example-diagram/package.json b/packages/mermaid-example-diagram/package.json index f05a0bb49..8e958806a 100644 --- a/packages/mermaid-example-diagram/package.json +++ b/packages/mermaid-example-diagram/package.json @@ -50,8 +50,8 @@ }, "dependencies": {}, "devDependencies": { - "concurrently": "7.5.0", - "rimraf": "3.0.2" + "concurrently": "^7.5.0", + "rimraf": "^3.0.2" }, "resolutions": { "d3": "^7.0.0" diff --git a/packages/mermaid-mindmap/package.json b/packages/mermaid-mindmap/package.json index 43dcf49fc..852c0871b 100644 --- a/packages/mermaid-mindmap/package.json +++ b/packages/mermaid-mindmap/package.json @@ -47,9 +47,9 @@ "non-layered-tidy-tree-layout": "^2.0.2" }, "devDependencies": { - "concurrently": "7.5.0", + "concurrently": "^7.5.0", "mermaid": "workspace:*", - "rimraf": "3.0.2" + "rimraf": "^3.0.2" }, "resolutions": { "d3": "^7.0.0" diff --git a/packages/mermaid/package.json b/packages/mermaid/package.json index 648c114e7..842e9ba9a 100644 --- a/packages/mermaid/package.json +++ b/packages/mermaid/package.json @@ -67,36 +67,36 @@ "uuid": "^9.0.0" }, "devDependencies": { - "@types/d3": "7.4.0", - "@types/dompurify": "2.4.0", - "@types/jsdom": "20.0.1", - "@types/lodash": "4.14.188", - "@types/micromatch": "4.0.2", - "@types/prettier": "2.7.1", - "@types/stylis": "4.0.2", - "@types/uuid": "8.3.4", - "@typescript-eslint/eslint-plugin": "5.42.1", - "@typescript-eslint/parser": "5.42.1", - "chokidar": "3.5.3", - "concurrently": "7.5.0", - "coveralls": "3.1.1", - "globby": "13.1.2", - "identity-obj-proxy": "3.0.0", - "jison": "0.4.18", - "js-base64": "3.7.2", - "jsdom": "20.0.2", + "@types/d3": "^7.4.0", + "@types/dompurify": "^2.4.0", + "@types/jsdom": "^20.0.1", + "@types/lodash": "^4.14.188", + "@types/micromatch": "^4.0.2", + "@types/prettier": "^2.7.1", + "@types/stylis": "^4.0.2", + "@types/uuid": "^8.3.4", + "@typescript-eslint/eslint-plugin": "^5.42.1", + "@typescript-eslint/parser": "^5.42.1", + "chokidar": "^3.5.3", + "concurrently": "^7.5.0", + "coveralls": "^3.1.1", + "globby": "^13.1.2", + "identity-obj-proxy": "^3.0.0", + "jison": "^0.4.18", + "js-base64": "^3.7.2", + "jsdom": "^20.0.2", "micromatch": "^4.0.5", - "moment": "2.29.4", - "path-browserify": "1.0.1", - "prettier": "2.7.1", - "remark": "14.0.2", - "rimraf": "3.0.2", + "moment": "^2.29.4", + "path-browserify": "^1.0.1", + "prettier": "^2.7.1", + "remark": "^14.0.2", + "rimraf": "^3.0.2", "shiki": "^0.11.1", - "start-server-and-test": "1.14.0", - "typedoc": "0.23.18", - "typedoc-plugin-markdown": "3.13.6", - "typescript": "4.8.4", - "unist-util-flatmap": "1.0.0" + "start-server-and-test": "^1.14.0", + "typedoc": "^0.23.18", + "typedoc-plugin-markdown": "^3.13.6", + "typescript": "^4.8.4", + "unist-util-flatmap": "^1.0.0" }, "resolutions": { "d3": "^7.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e5b7f5779..11703bd03 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,164 +1,164 @@ lockfileVersion: 5.4-inlineSpecifiers overrides: - d3: 7.6.1 + d3: ^7.6.1 importers: .: devDependencies: '@applitools/eyes-cypress': - specifier: 3.27.6 + specifier: ^3.27.6 version: 3.27.6 '@commitlint/cli': - specifier: 17.2.0 + specifier: ^17.2.0 version: 17.2.0 '@commitlint/config-conventional': - specifier: 17.2.0 + specifier: ^17.2.0 version: 17.2.0 '@cspell/eslint-plugin': - specifier: 6.14.2 + specifier: ^6.14.2 version: 6.14.2 '@types/eslint': - specifier: 8.4.10 + specifier: ^8.4.10 version: 8.4.10 '@types/express': - specifier: 4.17.14 + specifier: ^4.17.14 version: 4.17.14 '@types/jsdom': - specifier: 20.0.1 + specifier: ^20.0.1 version: 20.0.1 '@types/lodash': - specifier: 4.14.188 + specifier: ^4.14.188 version: 4.14.188 '@types/mdast': - specifier: 3.0.10 + specifier: ^3.0.10 version: 3.0.10 '@types/node': specifier: ^18.11.9 version: 18.11.9 '@types/prettier': - specifier: 2.7.1 + specifier: ^2.7.1 version: 2.7.1 '@typescript-eslint/eslint-plugin': - specifier: 5.42.1 + specifier: ^5.42.1 version: 5.42.1_2udltptbznfmezdozpdoa2aemq '@typescript-eslint/parser': - specifier: 5.42.1 + specifier: ^5.42.1 version: 5.42.1_rmayb2veg2btbq6mbmnyivgasy '@vitest/coverage-c8': - specifier: 0.25.1 + specifier: ^0.25.1 version: 0.25.1_iyb77cyw3lw7duusvxyjdsflhu '@vitest/ui': - specifier: 0.25.1 + specifier: ^0.25.1 version: 0.25.1 concurrently: - specifier: 7.5.0 + specifier: ^7.5.0 version: 7.5.0 coveralls: - specifier: 3.1.1 + specifier: ^3.1.1 version: 3.1.1 cypress: - specifier: 10.11.0 + specifier: ^10.11.0 version: 10.11.0 cypress-image-snapshot: - specifier: 4.0.1 + specifier: ^4.0.1 version: 4.0.1_bg25yee4qeg7mpleuvd346a3tq esbuild: - specifier: 0.15.13 + specifier: ^0.15.13 version: 0.15.13 eslint: - specifier: 8.27.0 + specifier: ^8.27.0 version: 8.27.0 eslint-config-prettier: - specifier: 8.5.0 + specifier: ^8.5.0 version: 8.5.0_eslint@8.27.0 eslint-plugin-cypress: - specifier: 2.12.1 + specifier: ^2.12.1 version: 2.12.1_eslint@8.27.0 eslint-plugin-html: - specifier: 7.1.0 + specifier: ^7.1.0 version: 7.1.0 eslint-plugin-jest: - specifier: 27.1.5 + specifier: ^27.1.5 version: 27.1.5_kdswgjmqcx7mthqz7ow2zlfevy eslint-plugin-jsdoc: - specifier: 39.6.2 + specifier: ^39.6.2 version: 39.6.2_eslint@8.27.0 eslint-plugin-json: - specifier: 3.1.0 + specifier: ^3.1.0 version: 3.1.0 eslint-plugin-markdown: - specifier: 3.0.0 + specifier: ^3.0.0 version: 3.0.0_eslint@8.27.0 eslint-plugin-no-only-tests: - specifier: 3.1.0 + specifier: ^3.1.0 version: 3.1.0 eslint-plugin-tsdoc: - specifier: 0.2.17 + specifier: ^0.2.17 version: 0.2.17 express: - specifier: 4.18.2 + specifier: ^4.18.2 version: 4.18.2 globby: - specifier: 13.1.2 + specifier: ^13.1.2 version: 13.1.2 husky: - specifier: 8.0.2 + specifier: ^8.0.2 version: 8.0.2 identity-obj-proxy: - specifier: 3.0.0 + specifier: ^3.0.0 version: 3.0.0 jest: - specifier: 29.3.1 + specifier: ^29.3.1 version: 29.3.1_odkjkoia5xunhxkdrka32ib6vi jison: - specifier: 0.4.18 + specifier: ^0.4.18 version: 0.4.18 jsdom: - specifier: 20.0.2 + specifier: ^20.0.2 version: 20.0.2 lint-staged: - specifier: 13.0.3 + specifier: ^13.0.3 version: 13.0.3 path-browserify: - specifier: 1.0.1 + specifier: ^1.0.1 version: 1.0.1 pnpm: - specifier: 7.15.0 + specifier: ^7.15.0 version: 7.15.0 prettier: - specifier: 2.7.1 + specifier: ^2.7.1 version: 2.7.1 prettier-plugin-jsdoc: - specifier: 0.4.2 + specifier: ^0.4.2 version: 0.4.2_prettier@2.7.1 rimraf: - specifier: 3.0.2 + specifier: ^3.0.2 version: 3.0.2 start-server-and-test: - specifier: 1.14.0 + specifier: ^1.14.0 version: 1.14.0 ts-node: - specifier: 10.9.1 + specifier: ^10.9.1 version: 10.9.1_cbe7ovvae6zqfnmtgctpgpys54 typescript: - specifier: 4.8.4 + specifier: ^4.8.4 version: 4.8.4 vite: - specifier: 3.2.3 + specifier: ^3.2.3 version: 3.2.3_@types+node@18.11.9 vitepress: - specifier: 1.0.0-alpha.28 + specifier: ^1.0.0-alpha.28 version: 1.0.0-alpha.28_ysryt2e75uhznkanan6iyjk4mi vitepress-plugin-mermaid: - specifier: 2.0.8 + specifier: ^2.0.8 version: 2.0.8_2q5vfj2vm6nj3r62ddjdsi7aoe vitepress-plugin-search: - specifier: 1.0.4-alpha.15 + specifier: ^1.0.4-alpha.15 version: 1.0.4-alpha.15_s3edpouswd4dgoi2en7bdlrp54 vitest: - specifier: 0.25.1 + specifier: ^0.25.1 version: 0.25.1_iyb77cyw3lw7duusvxyjdsflhu packages/mermaid: @@ -167,7 +167,7 @@ importers: specifier: ^6.0.0 version: 6.0.0 d3: - specifier: 7.6.1 + specifier: ^7.6.1 version: 7.6.1 dagre: specifier: ^0.8.5 @@ -204,103 +204,103 @@ importers: version: 9.0.0 devDependencies: '@types/d3': - specifier: 7.4.0 + specifier: ^7.4.0 version: 7.4.0 '@types/dompurify': - specifier: 2.4.0 + specifier: ^2.4.0 version: 2.4.0 '@types/jsdom': - specifier: 20.0.1 + specifier: ^20.0.1 version: 20.0.1 '@types/lodash': - specifier: 4.14.188 + specifier: ^4.14.188 version: 4.14.188 '@types/micromatch': - specifier: 4.0.2 + specifier: ^4.0.2 version: 4.0.2 '@types/prettier': - specifier: 2.7.1 + specifier: ^2.7.1 version: 2.7.1 '@types/stylis': - specifier: 4.0.2 + specifier: ^4.0.2 version: 4.0.2 '@types/uuid': - specifier: 8.3.4 + specifier: ^8.3.4 version: 8.3.4 '@typescript-eslint/eslint-plugin': - specifier: 5.42.1 + specifier: ^5.42.1 version: 5.42.1_2udltptbznfmezdozpdoa2aemq '@typescript-eslint/parser': - specifier: 5.42.1 + specifier: ^5.42.1 version: 5.42.1_rmayb2veg2btbq6mbmnyivgasy chokidar: - specifier: 3.5.3 + specifier: ^3.5.3 version: 3.5.3 concurrently: - specifier: 7.5.0 + specifier: ^7.5.0 version: 7.5.0 coveralls: - specifier: 3.1.1 + specifier: ^3.1.1 version: 3.1.1 globby: - specifier: 13.1.2 + specifier: ^13.1.2 version: 13.1.2 identity-obj-proxy: - specifier: 3.0.0 + specifier: ^3.0.0 version: 3.0.0 jison: - specifier: 0.4.18 + specifier: ^0.4.18 version: 0.4.18 js-base64: - specifier: 3.7.2 + specifier: ^3.7.2 version: 3.7.2 jsdom: - specifier: 20.0.2 + specifier: ^20.0.2 version: 20.0.2 micromatch: specifier: ^4.0.5 version: 4.0.5 moment: - specifier: 2.29.4 + specifier: ^2.29.4 version: 2.29.4 path-browserify: - specifier: 1.0.1 + specifier: ^1.0.1 version: 1.0.1 prettier: - specifier: 2.7.1 + specifier: ^2.7.1 version: 2.7.1 remark: - specifier: 14.0.2 + specifier: ^14.0.2 version: 14.0.2 rimraf: - specifier: 3.0.2 + specifier: ^3.0.2 version: 3.0.2 shiki: specifier: ^0.11.1 version: 0.11.1 start-server-and-test: - specifier: 1.14.0 + specifier: ^1.14.0 version: 1.14.0 typedoc: - specifier: 0.23.18 + specifier: ^0.23.18 version: 0.23.18_typescript@4.8.4 typedoc-plugin-markdown: - specifier: 3.13.6 + specifier: ^3.13.6 version: 3.13.6_typedoc@0.23.18 typescript: - specifier: 4.8.4 + specifier: ^4.8.4 version: 4.8.4 unist-util-flatmap: - specifier: 1.0.0 + specifier: ^1.0.0 version: 1.0.0 packages/mermaid-example-diagram: devDependencies: concurrently: - specifier: 7.5.0 + specifier: ^7.5.0 version: 7.5.0 rimraf: - specifier: 3.0.2 + specifier: ^3.0.2 version: 3.0.2 packages/mermaid-mindmap: @@ -318,7 +318,7 @@ importers: specifier: ^2.1.0 version: 2.1.0_cytoscape@3.23.0 d3: - specifier: 7.6.1 + specifier: ^7.6.1 version: 7.6.1 khroma: specifier: ^2.0.0 @@ -328,13 +328,13 @@ importers: version: 2.0.2 devDependencies: concurrently: - specifier: 7.5.0 + specifier: ^7.5.0 version: 7.5.0 mermaid: specifier: workspace:* version: link:../mermaid rimraf: - specifier: 3.0.2 + specifier: ^3.0.2 version: 3.0.2 tests/webpack: @@ -3537,7 +3537,7 @@ packages: /axios/0.21.4_debug@4.3.2: resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} dependencies: - follow-redirects: 1.15.2_debug@4.3.2 + follow-redirects: 1.15.2 transitivePeerDependencies: - debug dev: true @@ -6047,7 +6047,7 @@ packages: resolution: {integrity: sha512-XGozTsMPYkm+6b5QL3Z9wQcJjNYxp0CYn3U1gO7dwD6PAqU1SVWZxI9CCg3z+ml3YfqdPnrBehaBrnH2AGKbNA==} dev: true - /follow-redirects/1.15.2_debug@4.3.2: + /follow-redirects/1.15.2: resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} engines: {node: '>=4.0'} peerDependencies: @@ -6055,8 +6055,6 @@ packages: peerDependenciesMeta: debug: optional: true - dependencies: - debug: 4.3.2 dev: true /foreground-child/2.0.0: @@ -6633,7 +6631,7 @@ packages: engines: {node: '>=8.0.0'} dependencies: eventemitter3: 4.0.7 - follow-redirects: 1.15.2_debug@4.3.2 + follow-redirects: 1.15.2 requires-port: 1.0.0 transitivePeerDependencies: - debug From c2bd6a490fb8db60302b7a225b7e5250f2c8b74a Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sat, 22 Oct 2022 18:38:48 +0100 Subject: [PATCH 13/13] ci(renovate): disable pinning dependencies We shouldn't pin dependencies unless we have to. This is for two reasons: - If a dependency has a security issue, users should be able to easily update the dependency, before `mermaid` makes a new release - If using `mermaid.core.js` in an app, using a dependency range means that users can bundle less dependencies. E.g. they won't need to bundle `lodash@4.17.y` just becasue mermaid needs `lodash@4.17.x`. For development/CI, our dependencies are pinned by pnpm-lock.yaml file anyway. --- renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index 1413a3cea..548f5b5be 100644 --- a/renovate.json +++ b/renovate.json @@ -12,7 +12,7 @@ ], "packageRules": [ { - "matchUpdateTypes": ["minor", "patch", "pin", "digest"], + "matchUpdateTypes": ["minor", "patch", "digest"], "automerge": true } ],