From 269722fb6531659c4d821d85a06bae84731b5c9f Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 2 Sep 2022 11:44:06 +0530 Subject: [PATCH 001/115] Introduce stricter linting --- .eslintignore | 2 + .eslintrc.json | 15 +++- cypress/support/eyes-index.d.ts | 2 +- demos/index.html | 4 +- jest.config.js | 1 + package.json | 4 +- src/Diagram.ts | 2 + src/config.ts | 6 +- src/config.type.ts | 2 +- src/diagram-api/diagram-orchestration.ts | 2 +- src/diagram-api/diagramAPI.ts | 22 ++--- .../class/classDiagramGrammar.spec.js | 1 + src/diagrams/git/mockDb.js | 4 +- src/diagrams/info/info.spec.js | 10 ++- src/diagrams/mindmap/info.spc.js | 1 + src/diagrams/sequence/sequenceRenderer.js | 3 +- src/diagrams/sequence/svgDraw.spec.js | 4 +- src/diagrams/state/stateRenderer.js | 4 +- src/diagrams/user-journey/journeyRenderer.js | 1 + src/interactionDb.ts | 4 +- src/jison/transformer.js | 1 + src/logger.ts | 3 + src/mermaid.ts | 11 ++- src/mermaidAPI.ts | 15 ++-- src/styles.ts | 2 +- src/utils.ts | 76 ++++++++--------- yarn.lock | 81 +++++++++++++++++++ 27 files changed, 208 insertions(+), 75 deletions(-) diff --git a/.eslintignore b/.eslintignore index 9d8891de0..60c278861 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,5 @@ dist/** .github/** docs/Setup.md +cypress.config.js +cypress/plugins/index.js diff --git a/.eslintrc.json b/.eslintrc.json index 9c755a0e2..a629acdae 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,7 @@ "jest/globals": true, "node": true }, - "parser": "@babel/eslint-parser", + "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, @@ -15,12 +15,13 @@ }, "extends": [ "eslint:recommended", + "plugin:@typescript-eslint/recommended", "plugin:jsdoc/recommended", "plugin:json/recommended", "plugin:markdown/recommended", "plugin:prettier/recommended" ], - "plugins": ["html", "jest", "jsdoc", "json", "prettier"], + "plugins": ["@typescript-eslint", "html", "jest", "jsdoc", "json", "prettier"], "rules": { "no-prototype-builtins": "off", "no-unused-vars": "off", @@ -31,6 +32,16 @@ "jsdoc/newline-after-description": "off", "jsdoc/tag-lines": "off", "cypress/no-async-tests": "off", + "@typescript-eslint/ban-ts-comment": [ + "error", + { + "ts-expect-error": "allow-with-description", + "ts-ignore": "allow-with-description", + "ts-nocheck": "allow-with-description", + "ts-check": "allow-with-description", + "minimumDescriptionLength": 10 + } + ], "json/*": ["error", "allowComments"], "no-empty": ["error", { "allowEmptyCatch": true }] }, diff --git a/cypress/support/eyes-index.d.ts b/cypress/support/eyes-index.d.ts index b7a17d9de..59fc1eca4 100644 --- a/cypress/support/eyes-index.d.ts +++ b/cypress/support/eyes-index.d.ts @@ -1 +1 @@ -import "@applitools/eyes-cypress" \ No newline at end of file +import '@applitools/eyes-cypress'; diff --git a/demos/index.html b/demos/index.html index 904fde7df..921ffa64e 100644 --- a/demos/index.html +++ b/demos/index.html @@ -1087,7 +1087,9 @@ Enterprise_Boundary(b0, "BankBoundary0") { diff --git a/src/diagram-api/detectType.js b/src/diagram-api/detectType.js index a5f074e3e..63dddffb8 100644 --- a/src/diagram-api/detectType.js +++ b/src/diagram-api/detectType.js @@ -31,6 +31,9 @@ const detectType = function (text, cnf) { return 'c4'; } + if (text === 'error') { + return 'error'; + } if (text.match(/^\s*sequenceDiagram/)) { return 'sequence'; } diff --git a/src/diagram-api/diagramAPI.js b/src/diagram-api/diagramAPI.js index 62c884368..d47bb8c59 100644 --- a/src/diagram-api/diagramAPI.js +++ b/src/diagram-api/diagramAPI.js @@ -7,6 +7,7 @@ import classRendererV2 from '../diagrams/class/classRenderer-v2'; import classParser from '../diagrams/class/parser/classDiagram'; import erDb from '../diagrams/er/erDb'; import erRenderer from '../diagrams/er/erRenderer'; +import errorRenderer from '../diagrams/error/errorRenderer'; import erParser from '../diagrams/er/parser/erDiagram'; import flowDb from '../diagrams/flowchart/flowDb'; import flowRenderer from '../diagrams/flowchart/flowRenderer'; @@ -54,6 +55,13 @@ const diagrams = { classDb.clear(); }, }, + // Special diagram with error messages but setup as a regular diagram + error: { + db: {}, + renderer: errorRenderer, + parser: { parser: { yy: {} }, parse: () => {} }, + init: () => {}, + }, classDiagram: { db: classDb, renderer: classRendererV2, diff --git a/src/errorRenderer.js b/src/diagrams/error/errorRenderer.js similarity index 93% rename from src/errorRenderer.js rename to src/diagrams/error/errorRenderer.js index 28a9579ad..82f71fcde 100644 --- a/src/errorRenderer.js +++ b/src/diagrams/error/errorRenderer.js @@ -1,6 +1,6 @@ /** Created by knut on 14-12-11. */ import { select } from 'd3'; -import { log } from './logger'; +import { log } from '../../logger'; const conf = {}; @@ -20,10 +20,11 @@ export const setConf = function (cnf) { /** * Draws a an info picture in the tag with id: id based on the graph definition in text. * + * @param _txt * @param {string} id The text for the error * @param {string} ver The version */ -export const draw = (id, ver) => { +export const draw = (_txt, id, ver) => { try { log.debug('Renering svg for syntax error\n'); @@ -75,22 +76,22 @@ export const draw = (id, ver) => { g.append('text') // text label for the x axis .attr('class', 'error-text') - .attr('x', 1240) + .attr('x', 1440) .attr('y', 250) .attr('font-size', '150px') .style('text-anchor', 'middle') .text('Syntax error in graph'); g.append('text') // text label for the x axis .attr('class', 'error-text') - .attr('x', 1050) + .attr('x', 1250) .attr('y', 400) .attr('font-size', '100px') .style('text-anchor', 'middle') .text('mermaid version ' + ver); svg.attr('height', 100); - svg.attr('width', 400); - svg.attr('viewBox', '768 0 512 512'); + svg.attr('width', 500); + svg.attr('viewBox', '768 0 912 512'); } catch (e) { log.error('Error while rendering info diagram'); log.error(e.message); diff --git a/src/diagrams/error/styles.js b/src/diagrams/error/styles.js new file mode 100644 index 000000000..0b0729813 --- /dev/null +++ b/src/diagrams/error/styles.js @@ -0,0 +1,3 @@ +const getStyles = () => ``; + +export default getStyles; diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 2d25d1f58..016fbde1c 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -31,7 +31,7 @@ import stateRenderer from './diagrams/state/stateRenderer'; import stateRendererV2 from './diagrams/state/stateRenderer-v2'; import journeyRenderer from './diagrams/user-journey/journeyRenderer'; import Diagram from './Diagram'; -import errorRenderer from './errorRenderer'; +import errorRenderer from './diagrams/error/errorRenderer'; import { attachFunctions } from './interactionDb'; import { log, setLogLevel } from './logger'; import getStyles from './styles'; @@ -259,7 +259,14 @@ const render = function (id, _txt, cb, container) { txt = encodeEntities(txt); // Important that we do not create the diagram until after the directives have been included - const diag = new Diagram(txt); + let diag; + let parseEncounteredException; + try { + diag = new Diagram(txt); + } catch (error) { + diag = new Diagram('error'); + parseEncounteredException = error; + } // Get the tmp element containing the the svg const element = root.select('#d' + id).node(); const graphType = diag.type; @@ -404,6 +411,10 @@ const render = function (id, _txt, cb, container) { select(tmpElementSelector).node().remove(); } + if (parseEncounteredException) { + throw parseEncounteredException; + } + return svgCode; }; diff --git a/src/styles.js b/src/styles.js index 15e804ef9..db8e3efe5 100644 --- a/src/styles.js +++ b/src/styles.js @@ -1,5 +1,6 @@ import classDiagram from './diagrams/class/styles'; import er from './diagrams/er/styles'; +import error from './diagrams/error/styles'; import flowchart from './diagrams/flowchart/styles'; import gantt from './diagrams/gantt/styles'; import gitGraph from './diagrams/git/styles'; @@ -26,6 +27,7 @@ const themes = { info, pie, er, + error, journey, requirement, c4, From e9fb2c8a54ac80b90c95c46ac6db45935ed514e9 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 17:17:08 +0200 Subject: [PATCH 005/115] Fix test and variable names that were copied from flowchart --- .../{flow.spec.js => c4Diagram.spec.js} | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) rename src/diagrams/c4/parser/{flow.spec.js => c4Diagram.spec.js} (82%) diff --git a/src/diagrams/c4/parser/flow.spec.js b/src/diagrams/c4/parser/c4Diagram.spec.js similarity index 82% rename from src/diagrams/c4/parser/flow.spec.js rename to src/diagrams/c4/parser/c4Diagram.spec.js index c01d99e40..08ad3fcea 100644 --- a/src/diagrams/c4/parser/flow.spec.js +++ b/src/diagrams/c4/parser/c4Diagram.spec.js @@ -1,23 +1,23 @@ -import flowDb from '../c4Db'; -import flow from './c4Diagram.jison'; +import c4Db from '../c4Db'; +import c4 from './c4Diagram.jison'; import { setConfig } from '../../../config'; setConfig({ securityLevel: 'strict', }); -describe('parsing a flow chart', function () { +describe('parsing a C4 diagram', function () { beforeEach(function () { - flow.parser.yy = flowDb; - flow.parser.yy.clear(); + c4.parser.yy = c4Db; + c4.parser.yy.clear(); }); it('should parse a C4 diagram with one Person correctly', function () { - flow.parser.parse(`C4Context + c4.parser.parse(`C4Context title System Context diagram for Internet Banking System Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")`); - const yy = flow.parser.yy; + const yy = c4.parser.yy; expect(yy.getC4Type()).toBe('C4Context'); expect(yy.getTitle()).toBe('System Context diagram for Internet Banking System'); @@ -43,7 +43,7 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b it('should handle a trailing whitespaces after statements', function () { const whitespace = ' '; - const rendered = flow.parser.parse(`C4Context${whitespace} + const rendered = c4.parser.parse(`C4Context${whitespace} title System Context diagram for Internet Banking System${whitespace} Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")${whitespace}`); @@ -51,11 +51,11 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b }); it('should handle parameter names that are keywords', function () { - flow.parser.parse(`C4Context + c4.parser.parse(`C4Context title title Person(Person, "Person", "Person")`); - const yy = flow.parser.yy; + const yy = c4.parser.yy; expect(yy.getTitle()).toBe('title'); const shapes = yy.getC4ShapeArray(); @@ -68,10 +68,10 @@ Person(Person, "Person", "Person")`); }); it('should allow default in the parameters', function () { - flow.parser.parse(`C4Context + c4.parser.parse(`C4Context Person(default, "default", "default")`); - const yy = flow.parser.yy; + const yy = c4.parser.yy; const shapes = yy.getC4ShapeArray(); expect(shapes.length).toBe(1); From aee1a87347da0b04dd555000cccb76a4730002f5 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 23:22:50 +0200 Subject: [PATCH 006/115] Move test for basic Person to separate file --- src/diagrams/c4/parser/c4Diagram.spec.js | 29 ----------------- src/diagrams/c4/parser/c4Person.spec.js | 41 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 src/diagrams/c4/parser/c4Person.spec.js diff --git a/src/diagrams/c4/parser/c4Diagram.spec.js b/src/diagrams/c4/parser/c4Diagram.spec.js index 08ad3fcea..b79934b84 100644 --- a/src/diagrams/c4/parser/c4Diagram.spec.js +++ b/src/diagrams/c4/parser/c4Diagram.spec.js @@ -12,35 +12,6 @@ describe('parsing a C4 diagram', function () { c4.parser.yy.clear(); }); - it('should parse a C4 diagram with one Person correctly', function () { - c4.parser.parse(`C4Context -title System Context diagram for Internet Banking System -Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")`); - - const yy = c4.parser.yy; - expect(yy.getC4Type()).toBe('C4Context'); - expect(yy.getTitle()).toBe('System Context diagram for Internet Banking System'); - - const shapes = yy.getC4ShapeArray(); - expect(shapes.length).toBe(1); - const onlyShape = shapes[0]; - - expect(onlyShape).toEqual({ - alias: 'customerA', - descr: { - text: 'A customer of the bank, with personal bank accounts.', - }, - label: { - text: 'Banking Customer A', - }, - parentBoundary: 'global', - typeC4Shape: { - text: 'person', - }, - wrap: false, - }); - }); - it('should handle a trailing whitespaces after statements', function () { const whitespace = ' '; const rendered = c4.parser.parse(`C4Context${whitespace} diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js new file mode 100644 index 000000000..44294b97e --- /dev/null +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -0,0 +1,41 @@ +import c4Db from '../c4Db'; +import c4 from './c4Diagram.jison'; +import { setConfig } from '../../../config'; + +setConfig({ + securityLevel: 'strict', +}); + +describe('parsing a C4 diagram', function () { + beforeEach(function () { + c4.parser.yy = c4Db; + c4.parser.yy.clear(); + }); + + it('should parse a C4 diagram with one Person correctly', function () { + c4.parser.parse(`C4Context +title System Context diagram for Internet Banking System +Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")`); + + const yy = c4.parser.yy; + + const shapes = yy.getC4ShapeArray(); + expect(shapes.length).toBe(1); + const onlyShape = shapes[0]; + + expect(onlyShape).toEqual({ + alias: 'customerA', + descr: { + text: 'A customer of the bank, with personal bank accounts.', + }, + label: { + text: 'Banking Customer A', + }, + parentBoundary: 'global', + typeC4Shape: { + text: 'person', + }, + wrap: false, + }); + }); +}); From 8ee534f7fbb5eaef7a5c78833a8a3303abe134bc Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 23:31:52 +0200 Subject: [PATCH 007/115] Add test for $sprite --- src/diagrams/c4/parser/c4Person.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js index 44294b97e..5f620baf9 100644 --- a/src/diagrams/c4/parser/c4Person.spec.js +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -38,4 +38,17 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b wrap: false, }); }); + + it('should parse a sprite', function () { + c4.parser.parse(`C4Context +Person(customerA, $sprite="users")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + sprite: 'users', + }, + }, + }); + }); }); From 5378316cc3a0fa0577c69b087656da23f907d01f Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 23:36:14 +0200 Subject: [PATCH 008/115] Add test for $link --- src/diagrams/c4/parser/c4Person.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js index 5f620baf9..1e1b11163 100644 --- a/src/diagrams/c4/parser/c4Person.spec.js +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -51,4 +51,17 @@ Person(customerA, $sprite="users")`); }, }); }); + + it('should parse a link', function () { + c4.parser.parse(`C4Context +Person(customerA, $link="https://github.com/mermaidjs")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + link: 'https://github.com/mermaidjs', + }, + }, + }); + }); }); From 90d472042ba6820a3463b7e42e3b3fa6a863eb81 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 23:38:55 +0200 Subject: [PATCH 009/115] Add test for $tags --- src/diagrams/c4/parser/c4Person.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js index 1e1b11163..bf91d74c4 100644 --- a/src/diagrams/c4/parser/c4Person.spec.js +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -64,4 +64,17 @@ Person(customerA, $link="https://github.com/mermaidjs")`); }, }); }); + + it('should parse tags', function () { + c4.parser.parse(`C4Context +Person(customerA, $tags="tag1,tag2")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + tags: 'tag1,tag2', + }, + }, + }); + }); }); From be5b8012bd17b5d8b32c69059f4eebc419681f39 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 23:44:29 +0200 Subject: [PATCH 010/115] Add test for description --- src/diagrams/c4/parser/c4Person.spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js index bf91d74c4..7d3b92c44 100644 --- a/src/diagrams/c4/parser/c4Person.spec.js +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -39,6 +39,17 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b }); }); + it('should parse the description', function () { + c4.parser.parse(`C4Context +Person(customerA, "", "A customer of the bank, with personal bank accounts.")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + descr: { + text: 'A customer of the bank, with personal bank accounts.', + }, + }); + }); + it('should parse a sprite', function () { c4.parser.parse(`C4Context Person(customerA, $sprite="users")`); From 6f7ae17fc6e7959b6900ac45ccd6a271077f7c17 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 23:46:42 +0200 Subject: [PATCH 011/115] Add test for label --- src/diagrams/c4/parser/c4Person.spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js index 7d3b92c44..49d52bbea 100644 --- a/src/diagrams/c4/parser/c4Person.spec.js +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -39,6 +39,17 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b }); }); + it('should parse the label', function () { + c4.parser.parse(`C4Context +Person(customerA, "Banking Customer A")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: 'Banking Customer A', + }, + }); + }); + it('should parse the description', function () { c4.parser.parse(`C4Context Person(customerA, "", "A customer of the bank, with personal bank accounts.")`); From 3bc5cfa554b548a44fbd8ec64bae20738571407c Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Wed, 24 Aug 2022 23:47:41 +0200 Subject: [PATCH 012/115] Add test for alias --- src/diagrams/c4/parser/c4Person.spec.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js index 49d52bbea..f4ea9bc23 100644 --- a/src/diagrams/c4/parser/c4Person.spec.js +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -39,6 +39,15 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b }); }); + it('should parse the alias', function () { + c4.parser.parse(`C4Context +Person(customerA, "Banking Customer A")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + alias: 'customerA', + }); + }); + it('should parse the label', function () { c4.parser.parse(`C4Context Person(customerA, "Banking Customer A")`); From 92f0c8f8b14407b2c3e0064f2b22bf7dcf55eca6 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:29:23 +0200 Subject: [PATCH 013/115] Add test for structure of Person_Ext --- src/diagrams/c4/parser/c4PersonExt.spec.js | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/diagrams/c4/parser/c4PersonExt.spec.js diff --git a/src/diagrams/c4/parser/c4PersonExt.spec.js b/src/diagrams/c4/parser/c4PersonExt.spec.js new file mode 100644 index 000000000..71faabdc3 --- /dev/null +++ b/src/diagrams/c4/parser/c4PersonExt.spec.js @@ -0,0 +1,44 @@ +import c4Db from '../c4Db'; +import c4 from './c4Diagram.jison'; +import { setConfig } from '../../../config'; + +setConfig({ + securityLevel: 'strict', +}); + +describe('parsing a C4 diagram', function () { + beforeEach(function () { + c4.parser.yy = c4Db; + c4.parser.yy.clear(); + }); + + it('should parse a C4 diagram with one Person_Ext correctly', function () { + c4.parser.parse(`C4Context +title System Context diagram for Internet Banking System +Person_Ext(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")`); + + const yy = c4.parser.yy; + + const shapes = yy.getC4ShapeArray(); + expect(shapes.length).toBe(1); + const onlyShape = shapes[0]; + + expect(onlyShape).toEqual({ + alias: 'customerA', + descr: { + text: 'A customer of the bank, with personal bank accounts.', + }, + label: { + text: 'Banking Customer A', + }, + link: undefined, + sprite: undefined, + tags: undefined, + parentBoundary: 'global', + typeC4Shape: { + text: 'external_person', + }, + wrap: false, + }); + }); +}); From a196aeb29b1c45a30987098929b9fd3e311acbf2 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:32:57 +0200 Subject: [PATCH 014/115] Add question on Person_Ext --- src/diagrams/c4/parser/c4PersonExt.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/diagrams/c4/parser/c4PersonExt.spec.js b/src/diagrams/c4/parser/c4PersonExt.spec.js index 71faabdc3..9841fff35 100644 --- a/src/diagrams/c4/parser/c4PersonExt.spec.js +++ b/src/diagrams/c4/parser/c4PersonExt.spec.js @@ -31,6 +31,8 @@ Person_Ext(customerA, "Banking Customer A", "A customer of the bank, with person label: { text: 'Banking Customer A', }, + // TODO: Why are link, sprite, and tags undefined instead of not appearing at all? + // Compare to Person where they don't show up. link: undefined, sprite: undefined, tags: undefined, From db0d6075cab3e1a3d65c6e4a8ce88c023c4d0678 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:34:20 +0200 Subject: [PATCH 015/115] Add test for link to Person_Ext --- src/diagrams/c4/parser/c4PersonExt.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/diagrams/c4/parser/c4PersonExt.spec.js b/src/diagrams/c4/parser/c4PersonExt.spec.js index 9841fff35..38d8777be 100644 --- a/src/diagrams/c4/parser/c4PersonExt.spec.js +++ b/src/diagrams/c4/parser/c4PersonExt.spec.js @@ -43,4 +43,17 @@ Person_Ext(customerA, "Banking Customer A", "A customer of the bank, with person wrap: false, }); }); + + it('should parse a link', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, $link="https://github.com/mermaidjs")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + link: 'https://github.com/mermaidjs', + }, + }, + }); + }); }); From 700e25382bf51a9fa8b3609d3e69d1c9198b6355 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:38:10 +0200 Subject: [PATCH 016/115] Copy tests from Person to PersonExt --- src/diagrams/c4/parser/c4PersonExt.spec.js | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/diagrams/c4/parser/c4PersonExt.spec.js b/src/diagrams/c4/parser/c4PersonExt.spec.js index 38d8777be..b9c0e1d7a 100644 --- a/src/diagrams/c4/parser/c4PersonExt.spec.js +++ b/src/diagrams/c4/parser/c4PersonExt.spec.js @@ -44,6 +44,50 @@ Person_Ext(customerA, "Banking Customer A", "A customer of the bank, with person }); }); + it('should parse the alias', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, "Banking Customer A")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + alias: 'customerA', + }); + }); + + it('should parse the label', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, "Banking Customer A")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: 'Banking Customer A', + }, + }); + }); + + it('should parse the description', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, "", "A customer of the bank, with personal bank accounts.")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + descr: { + text: 'A customer of the bank, with personal bank accounts.', + }, + }); + }); + + it('should parse a sprite', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, $sprite="users")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + sprite: 'users', + }, + }, + }); + }); + it('should parse a link', function () { c4.parser.parse(`C4Context Person_Ext(customerA, $link="https://github.com/mermaidjs")`); @@ -56,4 +100,17 @@ Person_Ext(customerA, $link="https://github.com/mermaidjs")`); }, }); }); + + it('should parse tags', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, $tags="tag1,tag2")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + tags: 'tag1,tag2', + }, + }, + }); + }); }); From 2afcd54184a5355ca39353fae3040f4a07ed8f4d Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:42:48 +0200 Subject: [PATCH 017/115] Make test grouping more explicit --- src/diagrams/c4/parser/c4Person.spec.js | 2 +- src/diagrams/c4/parser/c4PersonExt.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diagrams/c4/parser/c4Person.spec.js b/src/diagrams/c4/parser/c4Person.spec.js index f4ea9bc23..b504c0384 100644 --- a/src/diagrams/c4/parser/c4Person.spec.js +++ b/src/diagrams/c4/parser/c4Person.spec.js @@ -6,7 +6,7 @@ setConfig({ securityLevel: 'strict', }); -describe('parsing a C4 diagram', function () { +describe('parsing a C4 Person', function () { beforeEach(function () { c4.parser.yy = c4Db; c4.parser.yy.clear(); diff --git a/src/diagrams/c4/parser/c4PersonExt.spec.js b/src/diagrams/c4/parser/c4PersonExt.spec.js index b9c0e1d7a..76547600a 100644 --- a/src/diagrams/c4/parser/c4PersonExt.spec.js +++ b/src/diagrams/c4/parser/c4PersonExt.spec.js @@ -6,7 +6,7 @@ setConfig({ securityLevel: 'strict', }); -describe('parsing a C4 diagram', function () { +describe('parsing a C4 Person_Ext', function () { beforeEach(function () { c4.parser.yy = c4Db; c4.parser.yy.clear(); From 2414435641a1c9b45e677cd3469dd73813e35715 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:51:49 +0200 Subject: [PATCH 018/115] Add tests for C4 System --- src/diagrams/c4/parser/c4System.spec.js | 116 ++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 src/diagrams/c4/parser/c4System.spec.js diff --git a/src/diagrams/c4/parser/c4System.spec.js b/src/diagrams/c4/parser/c4System.spec.js new file mode 100644 index 000000000..fb8a2aaa4 --- /dev/null +++ b/src/diagrams/c4/parser/c4System.spec.js @@ -0,0 +1,116 @@ +import c4Db from '../c4Db'; +import c4 from './c4Diagram.jison'; +import { setConfig } from '../../../config'; + +setConfig({ + securityLevel: 'strict', +}); + +describe('parsing a C4 System', function () { + beforeEach(function () { + c4.parser.yy = c4Db; + c4.parser.yy.clear(); + }); + + it('should parse a C4 diagram with one System correctly', function () { + c4.parser.parse(`C4Context +title System Context diagram for Internet Banking System +System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")`); + + const yy = c4.parser.yy; + + const shapes = yy.getC4ShapeArray(); + expect(shapes.length).toBe(1); + const onlyShape = shapes[0]; + + expect(onlyShape).toEqual({ + alias: 'SystemAA', + descr: { + text: 'Allows customers to view information about their bank accounts, and make payments.', + }, + label: { + text: 'Internet Banking System', + }, + // TODO: Why are link, sprite, and tags undefined instead of not appearing at all? + // Compare to Person where they don't show up. + link: undefined, + sprite: undefined, + tags: undefined, + parentBoundary: 'global', + typeC4Shape: { + text: 'system', + }, + wrap: false, + }); + }); + + it('should parse the alias', function () { + c4.parser.parse(`C4Context +System(SystemAA, "Internet Banking System")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + alias: 'SystemAA', + }); + }); + + it('should parse the label', function () { + c4.parser.parse(`C4Context +System(SystemAA, "Internet Banking System")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: 'Internet Banking System', + }, + }); + }); + + it('should parse the description', function () { + c4.parser.parse(`C4Context +System(SystemAA, "", "Allows customers to view information about their bank accounts, and make payments.")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + descr: { + text: 'Allows customers to view information about their bank accounts, and make payments.', + }, + }); + }); + + it('should parse a sprite', function () { + c4.parser.parse(`C4Context +System(SystemAA, $sprite="users")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + sprite: 'users', + }, + }, + }); + }); + + it('should parse a link', function () { + c4.parser.parse(`C4Context +System(SystemAA, $link="https://github.com/mermaidjs")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + link: 'https://github.com/mermaidjs', + }, + }, + }); + }); + + it('should parse tags', function () { + c4.parser.parse(`C4Context +System(SystemAA, $tags="tag1,tag2")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + tags: 'tag1,tag2', + }, + }, + }); + }); +}); From 65c73f2eec22b91f6ceb6b91749cbacbd8dc2f1a Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:54:32 +0200 Subject: [PATCH 019/115] Introduce shape list in test --- src/diagrams/c4/parser/c4System.spec.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/diagrams/c4/parser/c4System.spec.js b/src/diagrams/c4/parser/c4System.spec.js index fb8a2aaa4..fa0a4b089 100644 --- a/src/diagrams/c4/parser/c4System.spec.js +++ b/src/diagrams/c4/parser/c4System.spec.js @@ -6,7 +6,7 @@ setConfig({ securityLevel: 'strict', }); -describe('parsing a C4 System', function () { +describe.each([['System', 'system']])('parsing a C4 %s', function (macroName, elementName) { beforeEach(function () { c4.parser.yy = c4Db; c4.parser.yy.clear(); @@ -15,7 +15,7 @@ describe('parsing a C4 System', function () { it('should parse a C4 diagram with one System correctly', function () { c4.parser.parse(`C4Context title System Context diagram for Internet Banking System -System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")`); +${macroName}(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")`); const yy = c4.parser.yy; @@ -38,7 +38,7 @@ System(SystemAA, "Internet Banking System", "Allows customers to view informatio tags: undefined, parentBoundary: 'global', typeC4Shape: { - text: 'system', + text: elementName, }, wrap: false, }); @@ -46,7 +46,7 @@ System(SystemAA, "Internet Banking System", "Allows customers to view informatio it('should parse the alias', function () { c4.parser.parse(`C4Context -System(SystemAA, "Internet Banking System")`); +${macroName}(SystemAA, "Internet Banking System")`); expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ alias: 'SystemAA', @@ -55,7 +55,7 @@ System(SystemAA, "Internet Banking System")`); it('should parse the label', function () { c4.parser.parse(`C4Context -System(SystemAA, "Internet Banking System")`); +${macroName}(SystemAA, "Internet Banking System")`); expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ label: { @@ -66,7 +66,7 @@ System(SystemAA, "Internet Banking System")`); it('should parse the description', function () { c4.parser.parse(`C4Context -System(SystemAA, "", "Allows customers to view information about their bank accounts, and make payments.")`); +${macroName}(SystemAA, "", "Allows customers to view information about their bank accounts, and make payments.")`); expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ descr: { @@ -77,7 +77,7 @@ System(SystemAA, "", "Allows customers to view information about their bank acco it('should parse a sprite', function () { c4.parser.parse(`C4Context -System(SystemAA, $sprite="users")`); +${macroName}(SystemAA, $sprite="users")`); expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ label: { @@ -90,7 +90,7 @@ System(SystemAA, $sprite="users")`); it('should parse a link', function () { c4.parser.parse(`C4Context -System(SystemAA, $link="https://github.com/mermaidjs")`); +${macroName}(SystemAA, $link="https://github.com/mermaidjs")`); expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ label: { @@ -103,7 +103,7 @@ System(SystemAA, $link="https://github.com/mermaidjs")`); it('should parse tags', function () { c4.parser.parse(`C4Context -System(SystemAA, $tags="tag1,tag2")`); +${macroName}(SystemAA, $tags="tag1,tag2")`); expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ label: { From 092c15a37c16a1b4997f862917118b4b70f653f1 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sun, 28 Aug 2022 17:01:39 +0200 Subject: [PATCH 020/115] Test all different types of systems --- src/diagrams/c4/parser/c4System.spec.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/diagrams/c4/parser/c4System.spec.js b/src/diagrams/c4/parser/c4System.spec.js index fa0a4b089..6d81c7379 100644 --- a/src/diagrams/c4/parser/c4System.spec.js +++ b/src/diagrams/c4/parser/c4System.spec.js @@ -6,7 +6,14 @@ setConfig({ securityLevel: 'strict', }); -describe.each([['System', 'system']])('parsing a C4 %s', function (macroName, elementName) { +describe.each([ + ['System', 'system'], + ['SystemDb', 'system_db'], + ['SystemQueue', 'system_queue'], + ['System_Ext', 'external_system'], + ['SystemDb_Ext', 'external_system_db'], + ['SystemQueue_Ext', 'external_system_queue'], +])('parsing a C4 %s', function (macroName, elementName) { beforeEach(function () { c4.parser.yy = c4Db; c4.parser.yy.clear(); From b86476331fe74f4332f9ccd7de45be8fb82351b8 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sun, 28 Aug 2022 17:14:19 +0200 Subject: [PATCH 021/115] Add first test for Boundary --- src/diagrams/c4/parser/c4Boundary.spec.js | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/diagrams/c4/parser/c4Boundary.spec.js diff --git a/src/diagrams/c4/parser/c4Boundary.spec.js b/src/diagrams/c4/parser/c4Boundary.spec.js new file mode 100644 index 000000000..b531b5bd5 --- /dev/null +++ b/src/diagrams/c4/parser/c4Boundary.spec.js @@ -0,0 +1,45 @@ +import c4Db from '../c4Db'; +import c4 from './c4Diagram.jison'; +import { setConfig } from '../../../config'; + +setConfig({ + securityLevel: 'strict', +}); + +describe.each(['Boundary'])('parsing a C4 %s', function (macroName) { + beforeEach(function () { + c4.parser.yy = c4Db; + c4.parser.yy.clear(); + }); + + it('should parse a C4 diagram with one Boundary correctly', function () { + c4.parser.parse(`C4Context +title System Context diagram for Internet Banking System +${macroName}(b1, "BankBoundary") { +System(SystemAA, "Internet Banking System") +}`); + + const yy = c4.parser.yy; + + const boundaries = yy.getBoundarys(); + expect(boundaries.length).toBe(2); + const onlyShape = boundaries[1]; + + expect(onlyShape).toEqual({ + alias: 'b1', + label: { + text: 'BankBoundary', + }, + // TODO: Why are link, and tags undefined instead of not appearing at all? + // Compare to Person where they don't show up. + link: undefined, + tags: undefined, + parentBoundary: 'global', + type: { + // TODO: Why is this `system` instead of `boundary`? + text: 'system', + }, + wrap: false, + }); + }); +}); From 1a6305c0796780745d6c36edd496c80d02f7de37 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sun, 28 Aug 2022 17:22:22 +0200 Subject: [PATCH 022/115] Add tests for other boundary properties --- src/diagrams/c4/parser/c4Boundary.spec.js | 69 ++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/src/diagrams/c4/parser/c4Boundary.spec.js b/src/diagrams/c4/parser/c4Boundary.spec.js index b531b5bd5..c7130f557 100644 --- a/src/diagrams/c4/parser/c4Boundary.spec.js +++ b/src/diagrams/c4/parser/c4Boundary.spec.js @@ -23,9 +23,9 @@ System(SystemAA, "Internet Banking System") const boundaries = yy.getBoundarys(); expect(boundaries.length).toBe(2); - const onlyShape = boundaries[1]; + const boundary = boundaries[1]; - expect(onlyShape).toEqual({ + expect(boundary).toEqual({ alias: 'b1', label: { text: 'BankBoundary', @@ -42,4 +42,69 @@ System(SystemAA, "Internet Banking System") wrap: false, }); }); + + it('should parse the alias', function () { + c4.parser.parse(`C4Context +${macroName}(b1, "BankBoundary") { +System(SystemAA, "Internet Banking System") +}`); + + expect(c4.parser.yy.getBoundarys()[1]).toMatchObject({ + alias: 'b1', + }); + }); + + it('should parse the label', function () { + c4.parser.parse(`C4Context +${macroName}(b1, "BankBoundary") { +System(SystemAA, "Internet Banking System") +}`); + + expect(c4.parser.yy.getBoundarys()[1]).toMatchObject({ + label: { + text: 'BankBoundary', + }, + }); + }); + + it('should parse the type', function () { + c4.parser.parse(`C4Context +${macroName}(b1, "", "company") { +System(SystemAA, "Internet Banking System") +}`); + + expect(c4.parser.yy.getBoundarys()[1]).toMatchObject({ + type: { text: 'company' }, + }); + }); + + it('should parse a link', function () { + c4.parser.parse(`C4Context +${macroName}(b1, $link="https://github.com/mermaidjs") { +System(SystemAA, "Internet Banking System") +}`); + + expect(c4.parser.yy.getBoundarys()[1]).toMatchObject({ + label: { + text: { + link: 'https://github.com/mermaidjs', + }, + }, + }); + }); + + it('should parse tags', function () { + c4.parser.parse(`C4Context +${macroName}(b1, $tags="tag1,tag2") { +System(SystemAA, "Internet Banking System") +}`); + + expect(c4.parser.yy.getBoundarys()[1]).toMatchObject({ + label: { + text: { + tags: 'tag1,tag2', + }, + }, + }); + }); }); From cb4935258ce9653969cf55c02fef03abc61521e9 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sat, 3 Sep 2022 23:34:19 +0100 Subject: [PATCH 023/115] style: forbid using `console` in mermaid src code Adds an eslint rule forbidding using `console` in the mermaid source code. Instead, the `src/logger` should be used instead, so that websites can disable logging. This is allowed in the `cypress/` and `demos/` folder. I've also removed the two instances on `console.log`/`console.error` that currently exist in the mermaid source code. --- .eslintrc.json | 7 +++++++ src/diagrams/git/gitGraphParserV2.spec.js | 2 -- src/diagrams/info/infoRenderer.js | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9c755a0e2..7b8091dde 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -22,6 +22,7 @@ ], "plugins": ["html", "jest", "jsdoc", "json", "prettier"], "rules": { + "no-console": "error", "no-prototype-builtins": "off", "no-unused-vars": "off", "jsdoc/check-indentation": "off", @@ -47,6 +48,12 @@ "rules": { "prettier/prettier": "off" } + }, + { + "files": ["./cypress/**", "./demos/**"], + "rules": { + "no-console": "off" + } } ] } diff --git a/src/diagrams/git/gitGraphParserV2.spec.js b/src/diagrams/git/gitGraphParserV2.spec.js index 9a5cc59f1..219dbb57c 100644 --- a/src/diagrams/git/gitGraphParserV2.spec.js +++ b/src/diagrams/git/gitGraphParserV2.spec.js @@ -535,8 +535,6 @@ describe('when parsing a gitGraph', function () { testBranch3Merge, ] = Object.values(commits); - console.log(Object.keys(commits)); - expect(mainCommit.branch).toBe('main'); expect(mainCommit.parents).toStrictEqual([]); diff --git a/src/diagrams/info/infoRenderer.js b/src/diagrams/info/infoRenderer.js index 8976abb75..9e81b9ffb 100644 --- a/src/diagrams/info/infoRenderer.js +++ b/src/diagrams/info/infoRenderer.js @@ -49,7 +49,6 @@ export const draw = (text, id, version, diagObj) => { svg.attr('width', 400); // svg.attr('viewBox', '0 0 300 150'); } catch (e) { - console.error(e); log.error('Error while rendering info diagram'); log.error(e.message); } From 106672bc7564a61ab99f0a3e11d792a0061517b3 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sat, 3 Sep 2022 23:57:17 +0100 Subject: [PATCH 024/115] refactor: remove `console.log` in c4Diagram.jison These aren't caught by eslint, since they're in a .jison file. --- src/diagrams/c4/parser/c4Diagram.jison | 208 ++++++++++++------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/src/diagrams/c4/parser/c4Diagram.jison b/src/diagrams/c4/parser/c4Diagram.jison index 10783db53..03b851458 100644 --- a/src/diagrams/c4/parser/c4Diagram.jison +++ b/src/diagrams/c4/parser/c4Diagram.jison @@ -115,80 +115,80 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multiline");} "C4Dynamic" return 'C4_DYNAMIC'; "C4Deployment" return 'C4_DEPLOYMENT'; -"Person_Ext" { this.begin("person_ext"); console.log('begin person_ext'); return 'PERSON_EXT';} -"Person" { this.begin("person"); console.log('begin person'); return 'PERSON';} -"SystemQueue_Ext" { this.begin("system_ext_queue"); console.log('begin system_ext_queue'); return 'SYSTEM_EXT_QUEUE';} -"SystemDb_Ext" { this.begin("system_ext_db"); console.log('begin system_ext_db'); return 'SYSTEM_EXT_DB';} -"System_Ext" { this.begin("system_ext"); console.log('begin system_ext'); return 'SYSTEM_EXT';} -"SystemQueue" { this.begin("system_queue"); console.log('begin system_queue'); return 'SYSTEM_QUEUE';} -"SystemDb" { this.begin("system_db"); console.log('begin system_db'); return 'SYSTEM_DB';} -"System" { this.begin("system"); console.log('begin system'); return 'SYSTEM';} +"Person_Ext" { this.begin("person_ext"); return 'PERSON_EXT';} +"Person" { this.begin("person"); return 'PERSON';} +"SystemQueue_Ext" { this.begin("system_ext_queue"); return 'SYSTEM_EXT_QUEUE';} +"SystemDb_Ext" { this.begin("system_ext_db"); return 'SYSTEM_EXT_DB';} +"System_Ext" { this.begin("system_ext"); return 'SYSTEM_EXT';} +"SystemQueue" { this.begin("system_queue"); return 'SYSTEM_QUEUE';} +"SystemDb" { this.begin("system_db"); return 'SYSTEM_DB';} +"System" { this.begin("system"); return 'SYSTEM';} -"Boundary" { this.begin("boundary"); console.log('begin boundary'); return 'BOUNDARY';} -"Enterprise_Boundary" { this.begin("enterprise_boundary"); console.log('begin enterprise_boundary'); return 'ENTERPRISE_BOUNDARY';} -"System_Boundary" { this.begin("system_boundary"); console.log('begin system_boundary'); return 'SYSTEM_BOUNDARY';} +"Boundary" { this.begin("boundary"); return 'BOUNDARY';} +"Enterprise_Boundary" { this.begin("enterprise_boundary"); return 'ENTERPRISE_BOUNDARY';} +"System_Boundary" { this.begin("system_boundary"); return 'SYSTEM_BOUNDARY';} -"ContainerQueue_Ext" { this.begin("container_ext_queue"); console.log('begin container_ext_queue'); return 'CONTAINER_EXT_QUEUE';} -"ContainerDb_Ext" { this.begin("container_ext_db"); console.log('begin container_ext_db'); return 'CONTAINER_EXT_DB';} -"Container_Ext" { this.begin("container_ext"); console.log('begin container_ext'); return 'CONTAINER_EXT';} -"ContainerQueue" { this.begin("container_queue"); console.log('begin container_queue'); return 'CONTAINER_QUEUE';} -"ContainerDb" { this.begin("container_db"); console.log('begin container_db'); return 'CONTAINER_DB';} -"Container" { this.begin("container"); console.log('begin container'); return 'CONTAINER';} +"ContainerQueue_Ext" { this.begin("container_ext_queue"); return 'CONTAINER_EXT_QUEUE';} +"ContainerDb_Ext" { this.begin("container_ext_db"); return 'CONTAINER_EXT_DB';} +"Container_Ext" { this.begin("container_ext"); return 'CONTAINER_EXT';} +"ContainerQueue" { this.begin("container_queue"); return 'CONTAINER_QUEUE';} +"ContainerDb" { this.begin("container_db"); return 'CONTAINER_DB';} +"Container" { this.begin("container"); return 'CONTAINER';} -"Container_Boundary" { this.begin("container_boundary"); console.log('begin container_boundary'); return 'CONTAINER_BOUNDARY';} +"Container_Boundary" { this.begin("container_boundary"); return 'CONTAINER_BOUNDARY';} -"ComponentQueue_Ext" { this.begin("component_ext_queue"); console.log('begin component_ext_queue'); return 'COMPONENT_EXT_QUEUE';} -"ComponentDb_Ext" { this.begin("component_ext_db"); console.log('begin component_ext_db'); return 'COMPONENT_EXT_DB';} -"Component_Ext" { this.begin("component_ext"); console.log('begin component_ext'); return 'COMPONENT_EXT';} -"ComponentQueue" { this.begin("component_queue"); console.log('begin component_queue'); return 'COMPONENT_QUEUE';} -"ComponentDb" { this.begin("component_db"); console.log('begin component_db'); return 'COMPONENT_DB';} -"Component" { this.begin("component"); console.log('begin component'); return 'COMPONENT';} +"ComponentQueue_Ext" { this.begin("component_ext_queue"); return 'COMPONENT_EXT_QUEUE';} +"ComponentDb_Ext" { this.begin("component_ext_db"); return 'COMPONENT_EXT_DB';} +"Component_Ext" { this.begin("component_ext"); return 'COMPONENT_EXT';} +"ComponentQueue" { this.begin("component_queue"); return 'COMPONENT_QUEUE';} +"ComponentDb" { this.begin("component_db"); return 'COMPONENT_DB';} +"Component" { this.begin("component"); return 'COMPONENT';} -"Deployment_Node" { this.begin("node"); console.log('begin node'); return 'NODE';} -"Node" { this.begin("node"); console.log('begin node'); return 'NODE';} -"Node_L" { this.begin("node_l"); console.log('begin node_l'); return 'NODE_L';} -"Node_R" { this.begin("node_r"); console.log('begin node_r'); return 'NODE_R';} +"Deployment_Node" { this.begin("node"); return 'NODE';} +"Node" { this.begin("node"); return 'NODE';} +"Node_L" { this.begin("node_l"); return 'NODE_L';} +"Node_R" { this.begin("node_r"); return 'NODE_R';} -"Rel" { this.begin("rel"); console.log('begin rel'); return 'REL';} -"BiRel" { this.begin("birel"); console.log('begin birel'); return 'BIREL';} -"Rel_Up" { this.begin("rel_u"); console.log('begin rel_u'); return 'REL_U';} -"Rel_U" { this.begin("rel_u"); console.log('begin rel_u'); return 'REL_U';} -"Rel_Down" { this.begin("rel_d"); console.log('begin rel_d'); return 'REL_D';} -"Rel_D" { this.begin("rel_d"); console.log('begin rel_d'); return 'REL_D';} -"Rel_Left" { this.begin("rel_l"); console.log('begin rel_l'); return 'REL_L';} -"Rel_L" { this.begin("rel_l"); console.log('begin rel_l'); return 'REL_L';} -"Rel_Right" { this.begin("rel_r"); console.log('begin rel_r'); return 'REL_R';} -"Rel_R" { this.begin("rel_r"); console.log('begin rel_r'); return 'REL_R';} -"Rel_Back" { this.begin("rel_b"); console.log('begin rel_b'); return 'REL_B';} -"RelIndex" { this.begin("rel_index"); console.log('begin rel_index'); return 'REL_INDEX';} +"Rel" { this.begin("rel"); return 'REL';} +"BiRel" { this.begin("birel"); return 'BIREL';} +"Rel_Up" { this.begin("rel_u"); return 'REL_U';} +"Rel_U" { this.begin("rel_u"); return 'REL_U';} +"Rel_Down" { this.begin("rel_d"); return 'REL_D';} +"Rel_D" { this.begin("rel_d"); return 'REL_D';} +"Rel_Left" { this.begin("rel_l"); return 'REL_L';} +"Rel_L" { this.begin("rel_l"); return 'REL_L';} +"Rel_Right" { this.begin("rel_r"); return 'REL_R';} +"Rel_R" { this.begin("rel_r"); return 'REL_R';} +"Rel_Back" { this.begin("rel_b"); return 'REL_B';} +"RelIndex" { this.begin("rel_index"); return 'REL_INDEX';} -"UpdateElementStyle" { this.begin("update_el_style"); console.log('begin update_el_style'); return 'UPDATE_EL_STYLE';} -"UpdateRelStyle" { this.begin("update_rel_style"); console.log('begin update_rel_style'); return 'UPDATE_REL_STYLE';} -"UpdateLayoutConfig" { this.begin("update_layout_config"); console.log('begin update_layout_config'); return 'UPDATE_LAYOUT_CONFIG';} +"UpdateElementStyle" { this.begin("update_el_style"); return 'UPDATE_EL_STYLE';} +"UpdateRelStyle" { this.begin("update_rel_style"); return 'UPDATE_REL_STYLE';} +"UpdateLayoutConfig" { this.begin("update_layout_config"); return 'UPDATE_LAYOUT_CONFIG';} <> return "EOF_IN_STRUCT"; -[(][ ]*[,] { console.log('begin attribute with ATTRIBUTE_EMPTY'); this.begin("attribute"); return "ATTRIBUTE_EMPTY";} -[(] { console.log('begin attribute'); this.begin("attribute"); } -[)] { console.log('STOP attribute'); this.popState();console.log('STOP diagram'); this.popState();} +[(][ ]*[,] { this.begin("attribute"); return "ATTRIBUTE_EMPTY";} +[(] { this.begin("attribute"); } +[)] { this.popState();this.popState();} -",," { console.log(',,'); return 'ATTRIBUTE_EMPTY';} -"," { console.log(','); } -[ ]*["]["] { console.log('ATTRIBUTE_EMPTY'); return 'ATTRIBUTE_EMPTY';} -[ ]*["] { console.log('begin string'); this.begin("string");} -["] { console.log('STOP string'); this.popState(); } -[^"]* { console.log('STR'); return "STR";} +",," { return 'ATTRIBUTE_EMPTY';} +"," { } +[ ]*["]["] { return 'ATTRIBUTE_EMPTY';} +[ ]*["] { this.begin("string");} +["] { this.popState(); } +[^"]* { return "STR";} -[ ]*[\$] { console.log('begin string_kv'); this.begin("string_kv");} -[^=]* { console.log('STR_KEY'); this.begin("string_kv_key"); return "STR_KEY";} -[=][ ]*["] { console.log('begin string_kv_value'); this.popState(); this.begin("string_kv_value"); } -[^"]+ { console.log('STR_VALUE'); return "STR_VALUE";} -["] { console.log('STOP string_kv_value'); this.popState(); this.popState(); } +[ ]*[\$] { this.begin("string_kv");} +[^=]* { this.begin("string_kv_key"); return "STR_KEY";} +[=][ ]*["] { this.popState(); this.begin("string_kv_value"); } +[^"]+ { return "STR_VALUE";} +["] { this.popState(); this.popState(); } -[^,]+ { console.log('not STR'); return "STR";} +[^,]+ { return "STR";} -'{' { /* this.begin("lbrace"); */ console.log('begin boundary block'); return "LBRACE";} -'}' { /* this.popState(); */ console.log('STOP boundary block'); return "RBRACE";} +'{' { /* this.begin("lbrace"); */ return "LBRACE";} +'}' { /* this.popState(); */ return "RBRACE";} [\s]+ return 'SPACE'; [\n\r]+ return 'EOL'; @@ -231,7 +231,7 @@ directive ; openDirective - : open_directive { console.log("open_directive: ", $1); yy.parseDirective('%%{', 'open_directive'); } + : open_directive { yy.parseDirective('%%{', 'open_directive'); } ; typeDirective @@ -239,11 +239,11 @@ typeDirective ; argDirective - : arg_directive { $1 = $1.trim().replace(/'/g, '"'); console.log("arg_directive: ", $1); yy.parseDirective($1, 'arg_directive'); } + : arg_directive { $1 = $1.trim().replace(/'/g, '"'); yy.parseDirective($1, 'arg_directive'); } ; closeDirective - : close_directive { console.log("close_directive: ", $1); yy.parseDirective('}%%', 'close_directive', 'c4Context'); } + : close_directive { yy.parseDirective('}%%', 'close_directive', 'c4Context'); } ; graphConfig @@ -285,13 +285,13 @@ boundaryStartStatement ; boundaryStart - : ENTERPRISE_BOUNDARY attributes {console.log($1,JSON.stringify($2)); $2.splice(2, 0, 'ENTERPRISE'); yy.addPersonOrSystemBoundary(...$2); $$=$2;} - | SYSTEM_BOUNDARY attributes {console.log($1,JSON.stringify($2)); $2.splice(2, 0, 'ENTERPRISE'); yy.addPersonOrSystemBoundary(...$2); $$=$2;} - | BOUNDARY attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystemBoundary(...$2); $$=$2;} - | CONTAINER_BOUNDARY attributes {console.log($1,JSON.stringify($2)); $2.splice(2, 0, 'CONTAINER'); yy.addContainerBoundary(...$2); $$=$2;} - | NODE attributes {console.log($1,JSON.stringify($2)); yy.addDeploymentNode('node', ...$2); $$=$2;} - | NODE_L attributes {console.log($1,JSON.stringify($2)); yy.addDeploymentNode('nodeL', ...$2); $$=$2;} - | NODE_R attributes {console.log($1,JSON.stringify($2)); yy.addDeploymentNode('nodeR', ...$2); $$=$2;} + : ENTERPRISE_BOUNDARY attributes {$2.splice(2, 0, 'ENTERPRISE'); yy.addPersonOrSystemBoundary(...$2); $$=$2;} + | SYSTEM_BOUNDARY attributes {$2.splice(2, 0, 'ENTERPRISE'); yy.addPersonOrSystemBoundary(...$2); $$=$2;} + | BOUNDARY attributes {yy.addPersonOrSystemBoundary(...$2); $$=$2;} + | CONTAINER_BOUNDARY attributes {$2.splice(2, 0, 'CONTAINER'); yy.addContainerBoundary(...$2); $$=$2;} + | NODE attributes {yy.addDeploymentNode('node', ...$2); $$=$2;} + | NODE_L attributes {yy.addDeploymentNode('nodeL', ...$2); $$=$2;} + | NODE_R attributes {yy.addDeploymentNode('nodeR', ...$2); $$=$2;} ; boundaryStopStatement @@ -305,48 +305,48 @@ diagramStatements ; diagramStatement - : PERSON attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('person', ...$2); $$=$2;} - | PERSON_EXT attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('external_person', ...$2); $$=$2;} - | SYSTEM attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('system', ...$2); $$=$2;} - | SYSTEM_DB attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('system_db', ...$2); $$=$2;} - | SYSTEM_QUEUE attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('system_queue', ...$2); $$=$2;} - | SYSTEM_EXT attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('external_system', ...$2); $$=$2;} - | SYSTEM_EXT_DB attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('external_system_db', ...$2); $$=$2;} - | SYSTEM_EXT_QUEUE attributes {console.log($1,JSON.stringify($2)); yy.addPersonOrSystem('external_system_queue', ...$2); $$=$2;} - | CONTAINER attributes {console.log($1,JSON.stringify($2)); yy.addContainer('container', ...$2); $$=$2;} - | CONTAINER_DB attributes {console.log($1,JSON.stringify($2)); yy.addContainer('container_db', ...$2); $$=$2;} - | CONTAINER_QUEUE attributes {console.log($1,JSON.stringify($2)); yy.addContainer('container_queue', ...$2); $$=$2;} - | CONTAINER_EXT attributes {console.log($1,JSON.stringify($2)); yy.addContainer('external_container', ...$2); $$=$2;} - | CONTAINER_EXT_DB attributes {console.log($1,JSON.stringify($2)); yy.addContainer('external_container_db', ...$2); $$=$2;} - | CONTAINER_EXT_QUEUE attributes {console.log($1,JSON.stringify($2)); yy.addContainer('external_container_queue', ...$2); $$=$2;} - | COMPONENT attributes {console.log($1,JSON.stringify($2)); yy.addComponent('component', ...$2); $$=$2;} - | COMPONENT_DB attributes {console.log($1,JSON.stringify($2)); yy.addComponent('component_db', ...$2); $$=$2;} - | COMPONENT_QUEUE attributes {console.log($1,JSON.stringify($2)); yy.addComponent('component_queue', ...$2); $$=$2;} - | COMPONENT_EXT attributes {console.log($1,JSON.stringify($2)); yy.addComponent('external_component', ...$2); $$=$2;} - | COMPONENT_EXT_DB attributes {console.log($1,JSON.stringify($2)); yy.addComponent('external_component_db', ...$2); $$=$2;} - | COMPONENT_EXT_QUEUE attributes {console.log($1,JSON.stringify($2)); yy.addComponent('external_component_queue', ...$2); $$=$2;} + : PERSON attributes {yy.addPersonOrSystem('person', ...$2); $$=$2;} + | PERSON_EXT attributes {yy.addPersonOrSystem('external_person', ...$2); $$=$2;} + | SYSTEM attributes {yy.addPersonOrSystem('system', ...$2); $$=$2;} + | SYSTEM_DB attributes {yy.addPersonOrSystem('system_db', ...$2); $$=$2;} + | SYSTEM_QUEUE attributes {yy.addPersonOrSystem('system_queue', ...$2); $$=$2;} + | SYSTEM_EXT attributes {yy.addPersonOrSystem('external_system', ...$2); $$=$2;} + | SYSTEM_EXT_DB attributes {yy.addPersonOrSystem('external_system_db', ...$2); $$=$2;} + | SYSTEM_EXT_QUEUE attributes {yy.addPersonOrSystem('external_system_queue', ...$2); $$=$2;} + | CONTAINER attributes {yy.addContainer('container', ...$2); $$=$2;} + | CONTAINER_DB attributes {yy.addContainer('container_db', ...$2); $$=$2;} + | CONTAINER_QUEUE attributes {yy.addContainer('container_queue', ...$2); $$=$2;} + | CONTAINER_EXT attributes {yy.addContainer('external_container', ...$2); $$=$2;} + | CONTAINER_EXT_DB attributes {yy.addContainer('external_container_db', ...$2); $$=$2;} + | CONTAINER_EXT_QUEUE attributes {yy.addContainer('external_container_queue', ...$2); $$=$2;} + | COMPONENT attributes {yy.addComponent('component', ...$2); $$=$2;} + | COMPONENT_DB attributes {yy.addComponent('component_db', ...$2); $$=$2;} + | COMPONENT_QUEUE attributes {yy.addComponent('component_queue', ...$2); $$=$2;} + | COMPONENT_EXT attributes {yy.addComponent('external_component', ...$2); $$=$2;} + | COMPONENT_EXT_DB attributes {yy.addComponent('external_component_db', ...$2); $$=$2;} + | COMPONENT_EXT_QUEUE attributes {yy.addComponent('external_component_queue', ...$2); $$=$2;} | boundaryStatement - | REL attributes {console.log($1,JSON.stringify($2)); yy.addRel('rel', ...$2); $$=$2;} - | BIREL attributes {console.log($1,JSON.stringify($2)); yy.addRel('birel', ...$2); $$=$2;} - | REL_U attributes {console.log($1,JSON.stringify($2)); yy.addRel('rel_u', ...$2); $$=$2;} - | REL_D attributes {console.log($1,JSON.stringify($2)); yy.addRel('rel_d', ...$2); $$=$2;} - | REL_L attributes {console.log($1,JSON.stringify($2)); yy.addRel('rel_l', ...$2); $$=$2;} - | REL_R attributes {console.log($1,JSON.stringify($2)); yy.addRel('rel_r', ...$2); $$=$2;} - | REL_B attributes {console.log($1,JSON.stringify($2)); yy.addRel('rel_b', ...$2); $$=$2;} - | REL_INDEX attributes {console.log($1,JSON.stringify($2)); $2.splice(0, 1); yy.addRel('rel', ...$2); $$=$2;} - | UPDATE_EL_STYLE attributes {console.log($1,JSON.stringify($2)); yy.updateElStyle('update_el_style', ...$2); $$=$2;} - | UPDATE_REL_STYLE attributes {console.log($1,JSON.stringify($2)); yy.updateRelStyle('update_rel_style', ...$2); $$=$2;} - | UPDATE_LAYOUT_CONFIG attributes {console.log($1,JSON.stringify($2)); yy.updateLayoutConfig('update_layout_config', ...$2); $$=$2;} + | REL attributes {yy.addRel('rel', ...$2); $$=$2;} + | BIREL attributes {yy.addRel('birel', ...$2); $$=$2;} + | REL_U attributes {yy.addRel('rel_u', ...$2); $$=$2;} + | REL_D attributes {yy.addRel('rel_d', ...$2); $$=$2;} + | REL_L attributes {yy.addRel('rel_l', ...$2); $$=$2;} + | REL_R attributes {yy.addRel('rel_r', ...$2); $$=$2;} + | REL_B attributes {yy.addRel('rel_b', ...$2); $$=$2;} + | REL_INDEX attributes {$2.splice(0, 1); yy.addRel('rel', ...$2); $$=$2;} + | UPDATE_EL_STYLE attributes {yy.updateElStyle('update_el_style', ...$2); $$=$2;} + | UPDATE_REL_STYLE attributes {yy.updateRelStyle('update_rel_style', ...$2); $$=$2;} + | UPDATE_LAYOUT_CONFIG attributes {yy.updateLayoutConfig('update_layout_config', ...$2); $$=$2;} ; attributes - : attribute { console.log('PUSH ATTRIBUTE: ', $1); $$ = [$1]; } - | attribute attributes { console.log('PUSH ATTRIBUTE: ', $1); $2.unshift($1); $$=$2;} + : attribute { $$ = [$1]; } + | attribute attributes { $2.unshift($1); $$=$2;} ; attribute : STR { $$ = $1.trim(); } - | STR_KEY STR_VALUE { console.log('kv: ', $1, $2); let kv={}; kv[$1.trim()]=$2.trim(); $$=kv; } + | STR_KEY STR_VALUE { let kv={}; kv[$1.trim()]=$2.trim(); $$=kv; } | ATTRIBUTE { $$ = $1.trim(); } | ATTRIBUTE_EMPTY { $$ = ""; } ; From 0780668239053ec1fe5e12cfe0d27504f371d824 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 16:54:31 -0700 Subject: [PATCH 025/115] change references from /docs to /src/docs; rework doc section in CONTRIBUTING --- CONTRIBUTING.md | 34 +++++++++++++++++++++++++++------- docs/development.md | 14 +++++++------- docs/mindmap.md | 10 +++++----- src/docs/development.md | 14 +++++++------- src/docs/mindmap.md | 10 +++++----- 5 files changed, 51 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb7f3bf5a..1d65e93f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,8 +20,8 @@ yarn test We make all changes via pull requests. As we have many pull requests from developers new to mermaid, the current approach is to have _knsv, Knut Sveidqvist_ as a main reviewer of changes and merging pull requests. More precisely like this: - Large changes reviewed by knsv or other developer asked to review by knsv -- Smaller low-risk changes like dependencies, documentation etc can be merged by active collaborators -- documentation (updates to the docs folder is also allowed via direct commits) +- Smaller low-risk changes like dependencies, documentation, etc. can be merged by active collaborators +- Documentation (updates to the `src/docs` folder is also allowed via direct commits) To commit code, create a branch, let it start with the type like feature or bug followed by the issue number for reference and some describing text. @@ -37,12 +37,28 @@ Another: Less strict here, it is OK to commit directly in the `develop` branch if you are a collaborator. -The documentation is located in the `docs` directory and published using GitHub Pages. -The documentation site is powered by [Docsify](https://docsify.js.org), a simple documentation site generator. +The documentation is written in **Markdown**. For more information about Markdown [see the GitHub Markdown help page](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax). -The documentation is written in Markdown, for more information about Markdown [see the GitHub Markdown help page](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax). +### Documentation source files are in /src/docs -If you want to preview the documentation site on your machine, you need to install `docsify-cli`: +The source files for the project documentation are located in the `/src/docs` directory. This is where you should make changes. +The files under `/src/docs` are processed to generate the published documentation, and the resulting files are put into the `/docs` directory. + +```mermaid +flowchart LR + classDef default fill:#fff,color:black,stroke:black + + source["files in /src/docs\n(changes should be done here)"] -- automatic processing\nto generate the final documentation--> published["files in /docs\ndisplayed on the official documentation site"] + +``` + +**_DO NOT CHANGE FILES IN `/docs`_** + +### The official documentation site + +**[The mermaid documentation site](https://mermaid-js.github.io/mermaid/) is powered by [Docsify](https://docsify.js.org), a simple documentation site generator.** + +If you want to preview the whole documentation site on your machine, you need to install `docsify-cli`: ```sh $ npm i docsify-cli -g @@ -121,7 +137,11 @@ it('should render forks and joins', () => { Finally, if it is not in the documentation, no one will know about it and then **no one will use it**. Wouldn't that be sad? With all the effort that was put into the feature? -The docs are located in the docs folder and are ofc written in markdown. Just pick the right section and start typing. If you want to add to the structure as in adding a new section and new file you do that via the \_navbar.md. +The source files for documentation are in `/src/docs` and are written in markdown. Just pick the right section and start typing. See the [Committing Documentation](#committing-documentation) section for more about how the documentation is generated. + +#### Adding to or changing the documentation organization + +If you want to add a new section or change the organization (structure), then you need to make sure to **change the side navigation** in `src/docs/_sidebar.md`. The changes in master is reflected in https://mermaid-js.github.io/mermaid/ once released the updates are committed to https://mermaid-js.github.io/#/ diff --git a/docs/development.md b/docs/development.md index d5cbe891e..365f639d7 100644 --- a/docs/development.md +++ b/docs/development.md @@ -8,7 +8,7 @@ So you want to help? That's great! Here are a few things to get you started on the right path. -**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)** +**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)** **Note: Commits and Pull Requests should be directed to the develop branch.** @@ -46,9 +46,9 @@ Start with the type, such as **feature** or **bug**, followed by the issue numbe If it is not in the documentation, it's like it never happened. Wouldn't that be sad? With all the effort that was put into the feature? -The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. -> **All the documents displayed in the github.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +> **All the documents displayed in the GitHub.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. The contents of are based on the docs from the `master` branch. Updates committed to the `master` branch are reflected in the [Mermaid Docs](https://mermaid-js.github.io/mermaid/) once released. @@ -60,7 +60,7 @@ The documentation is located in the `src/docs` directory and organized according The `docs` folder will be automatically generated when committing to `src/docs` and should not be edited manually. -We encourage contributions to the documentation at [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) +We encourage contributions to the documentation at [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) ### Add Unit Tests for Parsing @@ -73,7 +73,7 @@ This tests the rendering and visual appearance of the diagrams. This ensures tha To start working with the e2e tests: 1. Run `yarn dev` to start the dev server -2. Start **Cypress** by running `cypress open` in the **mermaid** folder.\ +2. Start **Cypress** by running `cypress open` in the **mermaid** folder. (Make sure you have path to Cypress in order, the binary is located in `node_modules/.bin`). The rendering tests are very straightforward to create. There is a function `imgSnapshotTest`, which takes a diagram in text form and the mermaid options, and it renders that diagram in Cypress. @@ -114,7 +114,7 @@ Markdown is used to format the text, for more information about Markdown [see th To edit Docs on your computer: -1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs) directory in the `develop` branch. +1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs) directory in the `develop` branch. 2. Create a fork of the develop branch. 3. Make changes or add new documentation. 4. Commit changes to your fork and push it to GitHub. @@ -123,7 +123,7 @@ To edit Docs on your computer: To edit Docs on GitHub: 1. Login to [GitHub.com](https://www.github.com). -2. Navigate to [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). +2. Navigate to [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). 3. To edit a file, click the pencil icon at the top-right of the file contents panel. 4. Describe what you changed in the **Propose file change** section, located at the bottom of the page. 5. Submit your changes by clicking the button **Propose file change** at the bottom (by automatic creation of a fork and a new branch). diff --git a/docs/mindmap.md b/docs/mindmap.md index f9d732463..6ab954f5b 100644 --- a/docs/mindmap.md +++ b/docs/mindmap.md @@ -2,7 +2,7 @@ # Mindmap -**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/docs/mindmap.md) +**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/docs/mindmap.md) > Mindmap: This is an experimental diagram for now. The syntax and properties can change in future releases. The syntax is stabel except for the icon integration which is the experimental part. @@ -64,7 +64,7 @@ In the following example you can see how there are 3 dufferent levels. One with B C -In summary is is a simple text outline where there are one node at the root level called `Root` which has one child `A`. A in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. +In summary is a simple text outline where there are one node at the root level called `Root` which has one child `A`. `A` in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. ```mermaid-example mindmap @@ -168,7 +168,7 @@ More shapes will be added, beginning with the shapes available in flowcharts. ## icons -As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parethesis like in the following example where icons for material design and fontwaresome 4. is displayed. The intention is that this approach should be used for all diagrams supporting icons. **Expermental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. +As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parenthesis like in the following example where icons for material design and fontawesome 4 are displayed. The intention is that this approach should be used for all diagrams supporting icons. **Experimental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. ```mermaid-example mindmap @@ -190,7 +190,7 @@ mindmap ## Classes -Again the syntax for adding classes is similar to flowcharts and you can add classes using a tripple colon following a numver of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text whiet and large increasing the font size: +Again the syntax for adding classes is similar to flowcharts. You can add classes using a triple colon following a number of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text white and large increasing the font size: ```mermaid-example mindmap @@ -222,7 +222,7 @@ The actual indentation does not really matter only compared with the previous ro B C -This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a highter indentation nor does ot haver the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as sieblings. +This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a higher indentation nor does it have the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as siblings. ```mermaid-example mindmap diff --git a/src/docs/development.md b/src/docs/development.md index 96da46c11..95e5fe417 100644 --- a/src/docs/development.md +++ b/src/docs/development.md @@ -6,7 +6,7 @@ So you want to help? That's great! Here are a few things to get you started on the right path. -**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)** +**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)** **Note: Commits and Pull Requests should be directed to the develop branch.** @@ -44,9 +44,9 @@ Start with the type, such as **feature** or **bug**, followed by the issue numbe If it is not in the documentation, it's like it never happened. Wouldn't that be sad? With all the effort that was put into the feature? -The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. -> **All the documents displayed in the github.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +> **All the documents displayed in the GitHub.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. The contents of [https://mermaid-js.github.io/mermaid/](https://mermaid-js.github.io/mermaid/) are based on the docs from the `master` branch. Updates committed to the `master` branch are reflected in the [Mermaid Docs](https://mermaid-js.github.io/mermaid/) once released. @@ -58,7 +58,7 @@ The documentation is located in the `src/docs` directory and organized according The `docs` folder will be automatically generated when committing to `src/docs` and should not be edited manually. -We encourage contributions to the documentation at [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) +We encourage contributions to the documentation at [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) ### Add Unit Tests for Parsing @@ -71,7 +71,7 @@ This tests the rendering and visual appearance of the diagrams. This ensures tha To start working with the e2e tests: 1. Run `yarn dev` to start the dev server -2. Start **Cypress** by running `cypress open` in the **mermaid** folder. +2. Start **Cypress** by running `cypress open` in the **mermaid** folder. (Make sure you have path to Cypress in order, the binary is located in `node_modules/.bin`). The rendering tests are very straightforward to create. There is a function `imgSnapshotTest`, which takes a diagram in text form and the mermaid options, and it renders that diagram in Cypress. @@ -112,7 +112,7 @@ Markdown is used to format the text, for more information about Markdown [see th To edit Docs on your computer: -1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs) directory in the `develop` branch. +1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs) directory in the `develop` branch. 2. Create a fork of the develop branch. 3. Make changes or add new documentation. 4. Commit changes to your fork and push it to GitHub. @@ -121,7 +121,7 @@ To edit Docs on your computer: To edit Docs on GitHub: 1. Login to [GitHub.com](https://www.github.com). -2. Navigate to [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). +2. Navigate to [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). 3. To edit a file, click the pencil icon at the top-right of the file contents panel. 4. Describe what you changed in the **Propose file change** section, located at the bottom of the page. 5. Submit your changes by clicking the button **Propose file change** at the bottom (by automatic creation of a fork and a new branch). diff --git a/src/docs/mindmap.md b/src/docs/mindmap.md index 141808514..d7f1b4817 100644 --- a/src/docs/mindmap.md +++ b/src/docs/mindmap.md @@ -1,6 +1,6 @@ # Mindmap -**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/docs/mindmap.md) +**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/docs/mindmap.md) > Mindmap: This is an experimental diagram for now. The syntax and properties can change in future releases. The syntax is stabel except for the icon integration which is the experimental part. @@ -43,7 +43,7 @@ mindmap C ``` -In summary is is a simple text outline where there are one node at the root level called `Root` which has one child `A`. A in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. +In summary is a simple text outline where there are one node at the root level called `Root` which has one child `A`. `A` in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. ```mermaid mindmap @@ -109,7 +109,7 @@ More shapes will be added, beginning with the shapes available in flowcharts. ## icons -As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parethesis like in the following example where icons for material design and fontwaresome 4. is displayed. The intention is that this approach should be used for all diagrams supporting icons. **Expermental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. +As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parenthesis like in the following example where icons for material design and fontawesome 4 are displayed. The intention is that this approach should be used for all diagrams supporting icons. **Experimental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. ```mermaid-example mindmap @@ -122,7 +122,7 @@ mindmap ## Classes -Again the syntax for adding classes is similar to flowcharts and you can add classes using a tripple colon following a numver of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text whiet and large increasing the font size: +Again the syntax for adding classes is similar to flowcharts. You can add classes using a triple colon following a number of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text white and large increasing the font size: ```mermaid-example mindmap @@ -147,7 +147,7 @@ mindmap C ``` -This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a highter indentation nor does ot haver the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as sieblings. +This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a higher indentation nor does it have the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as siblings. ```mermaid mindmap From aa42aabb308862b66e80e514821d9d4faf42449d Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 17:01:03 -0700 Subject: [PATCH 026/115] unmangle sentence about doc changes committed and showing up on docsify site --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d65e93f2..1d55fe3b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -143,7 +143,8 @@ The source files for documentation are in `/src/docs` and are written in markdow If you want to add a new section or change the organization (structure), then you need to make sure to **change the side navigation** in `src/docs/_sidebar.md`. -The changes in master is reflected in https://mermaid-js.github.io/mermaid/ once released the updates are committed to https://mermaid-js.github.io/#/ + +When changes are committed and then released, they become part of the `master` branch and become part of the published documentation on https://mermaid-js.github.io/mermaid/ ## Last words From 0c85e8ee53725f0371c2fe0952c011846e971c1b Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 18:27:58 -0700 Subject: [PATCH 027/115] eslint (mostly use double quotes) --- src/docs.mts | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 76594c4bf..9e3b9ddef 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,26 +1,26 @@ -import { remark } from 'remark'; -import type { Code, Root } from 'mdast'; -import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; +import { remark } from "remark"; +import type { Code, Root } from "mdast"; +import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs"; // @ts-ignore -import flatmap from 'unist-util-flatmap'; -import { globby } from 'globby'; -import { join, dirname } from 'path'; -import { exec } from 'child_process'; -import prettier from 'prettier'; +import flatmap from "unist-util-flatmap"; +import { globby } from "globby"; +import { join, dirname } from "path"; +import { exec } from "child_process"; +import prettier from "prettier"; -const verify = process.argv.includes('--verify'); -const git = process.argv.includes('--git'); +const verify = process.argv.includes("--verify"); +const git = process.argv.includes("--git"); let fileChanged = false; // Possible Improvement: combine with lint-staged to only copy files that have changed const prepareOutFile = (file: string): string => { - const outFile = join('docs', file.replace('src/docs/', '')); + const outFile = join("docs", file.replace("src/docs/", "")); mkdirSync(dirname(outFile), { recursive: true }); return outFile; }; const verifyAndCopy = (file: string, content?: string) => { const outFile = prepareOutFile(file); - const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from('#NEW FILE#'); + const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from("#NEW FILE#"); const newBuffer = content ? Buffer.from(content) : readFileSync(file); if (existingBuffer.equals(newBuffer)) { // Files are same, skip. @@ -34,16 +34,16 @@ const verifyAndCopy = (file: string, content?: string) => { }; const transform = (file: string) => { - const doc = readFileSync(file, 'utf8'); + const doc = readFileSync(file, "utf8"); const ast: Root = remark.parse(doc); const out = flatmap(ast, (c: Code) => { - if (c.type !== 'code' || !c.lang?.startsWith('mermaid')) { + if (c.type !== "code" || !c.lang?.startsWith("mermaid")) { return [c]; } - if (c.lang === 'mermaid' || c.lang === 'mmd') { - c.lang = 'mermaid-example'; + if (c.lang === "mermaid" || c.lang === "mmd") { + c.lang = "mermaid-example"; } - return [c, Object.assign({}, c, { lang: 'mermaid' })]; + return [c, Object.assign({}, c, { lang: "mermaid" })]; }); const transformed = `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs.\n${remark.stringify( @@ -52,20 +52,20 @@ const transform = (file: string) => { verifyAndCopy( file, prettier.format(transformed, { - parser: 'markdown', + parser: "markdown", useTabs: false, tabWidth: 2, - endOfLine: 'auto', + endOfLine: "auto", printWidth: 100, - singleQuote: true, + singleQuote: true }) ); }; (async () => { - const mdFiles = await globby(['./src/docs/**/*.md'], { dot: true }); + const mdFiles = await globby(["./src/docs/**/*.md"], { dot: true }); mdFiles.forEach(transform); - const nonMDFiles = await globby(['src/docs/**', '!**/*.md'], { dot: true }); + const nonMDFiles = await globby(["src/docs/**", "!**/*.md"], { dot: true }); nonMDFiles.forEach((file) => { verifyAndCopy(file); }); @@ -77,8 +77,8 @@ const transform = (file: string) => { process.exit(1); } if (git) { - console.log('Adding changes in docs folder to git'); - exec('git add docs'); + console.log("Adding changes in docs folder to git"); + exec("git add docs"); } } })(); From 703b7eb91d38d0248d2bccfe7d1b753355326a45 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 18:33:17 -0700 Subject: [PATCH 028/115] rename vars so intent is clearer, add doc, use constants --- src/docs.mts | 55 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 9e3b9ddef..fe38cf52e 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -6,18 +6,41 @@ import flatmap from "unist-util-flatmap"; import { globby } from "globby"; import { join, dirname } from "path"; import { exec } from "child_process"; +// @ts-ignore import prettier from "prettier"; -const verify = process.argv.includes("--verify"); +const SOURCE_DOCS_DIR = 'src/docs/'; +const FINAL_DOCS_DIR = 'docs/'; +const AUTOGENERATED_TEXT = + "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs."; + +const verifyOnly = process.argv.includes("--verify"); const git = process.argv.includes("--git"); -let fileChanged = false; -// Possible Improvement: combine with lint-staged to only copy files that have changed + +let filesWereChanged = false; + + +/** + * Given a source file name and path, return the documentation destination full path and file name + * Create the destination path if it does not already exist. + * Possible Improvement: combine with lint-staged to only copy files that have changed + * + * @param file {string} name of the file (including full path) + * @returns {string} name of the file with the path changed from src/docs to docs + */ const prepareOutFile = (file: string): string => { - const outFile = join("docs", file.replace("src/docs/", "")); + const outFile = join(FINAL_DOCS_DIR, file.replace(SOURCE_DOCS_DIR, "")); mkdirSync(dirname(outFile), { recursive: true }); return outFile; }; +/** + * Verify that a file was changed and (potentially) write the new contents out to the file. Log a message to the console + * If the file was not changed, do nothing. (No message is logged to the console.) + * + * @param file {string} name of the file that will be verified + * @param content {string} new contents for the file + */ const verifyAndCopy = (file: string, content?: string) => { const outFile = prepareOutFile(file); const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from("#NEW FILE#"); @@ -27,12 +50,22 @@ const verifyAndCopy = (file: string, content?: string) => { return; } console.log(`File changed: ${outFile}`); - fileChanged = true; - if (!verify) { + filesWereChanged = true; + if (!verifyOnly) { writeFileSync(outFile, newBuffer); } }; +/** + * Transform a markdown file and write the transformed file to the directory for published documentation + * 1. add a `mermaid-example` block before every `mermaid` or `mmd` block + * On the docsify site (one place where the documentation is published), this will show the code used for the mermaid diagram + * 2. add the text that says the file is automatically generated + * 3. use prettier to format the file + * Verify that the file has been changed and write out the changes + * + * @param file {string} name of the file that will be verified + */ const transform = (file: string) => { const doc = readFileSync(file, "utf8"); const ast: Root = remark.parse(doc); @@ -46,9 +79,9 @@ const transform = (file: string) => { return [c, Object.assign({}, c, { lang: "mermaid" })]; }); - const transformed = `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs.\n${remark.stringify( - out - )}`; + // Add the AUTOGENERATED_TEXT to the start of the file + const transformed = `${AUTOGENERATED_TEXT}\n${remark.stringify(out)}`; + verifyAndCopy( file, prettier.format(transformed, { @@ -69,8 +102,8 @@ const transform = (file: string) => { nonMDFiles.forEach((file) => { verifyAndCopy(file); }); - if (fileChanged) { - if (verify) { + if (filesWereChanged) { + if (verifyOnly) { console.log( "Changes detected in files in `docs`. Please run `yarn docs:build` after making changes to 'src/docs' to update the `docs` folder." ); From d38f0e9e03794b01bd6ee652e36d98b78478aeeb Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 18:36:17 -0700 Subject: [PATCH 029/115] adjust console log message if only verifying, if copied actually happened --- src/docs.mts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/docs.mts b/src/docs.mts index fe38cf52e..4ed1f7feb 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -49,11 +49,18 @@ const verifyAndCopy = (file: string, content?: string) => { // Files are same, skip. return; } - console.log(`File changed: ${outFile}`); + let changeMsg = 'changed'; + if (verifyOnly) { + changeMsg = 'to be changed'; + } + let logMsg = ` File ${changeMsg}: ${outFile}` + filesWereChanged = true; if (!verifyOnly) { writeFileSync(outFile, newBuffer); + logMsg += ' ...and copied to /docs' } + console.log(logMsg); }; /** From 6554a41f6dfd054d6540b4e101e25e4b7213780a Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 18:39:36 -0700 Subject: [PATCH 030/115] transform HTML (insert comment); add console msgs and clarify; add file doc --- src/docs.mts | 71 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 4ed1f7feb..d211e0fbf 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,6 +1,24 @@ +/** + * @overview Process and potentially transform documentation source files into files suitable for publishing. + * Copy files from the source directory (/src/docs) to the directory used for the final, published documentation (/docs). + * The list of files changed (transformed) and copied to /docs are logged to the console. + * If a file in /src/docs has the same contents in /docs, nothing is done (it is not copied to /docs). + * + * @example docs + * @example docs --verify + * If the --verify option is used, no files will be copied to /docs, but the list of files to be changed is still shown on the console. + * A message to the console will show that this command should be run without the --verify flag so that the 'docs' folder is be updated. + * Note that the command will return an exit code (1), which will show that it failed. + * @example docs --git + * If the --git option is used, the command `git add docs` will be run + * + */ + import { remark } from "remark"; import type { Code, Root } from "mdast"; import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs"; +import { JSDOM } from "jsdom"; + // @ts-ignore import flatmap from "unist-util-flatmap"; import { globby } from "globby"; @@ -63,6 +81,10 @@ const verifyAndCopy = (file: string, content?: string) => { console.log(logMsg); }; +const readSyncedUTF8file = (file: string): string => { + return readFileSync(file, "utf8"); +} + /** * Transform a markdown file and write the transformed file to the directory for published documentation * 1. add a `mermaid-example` block before every `mermaid` or `mmd` block @@ -73,8 +95,8 @@ const verifyAndCopy = (file: string, content?: string) => { * * @param file {string} name of the file that will be verified */ -const transform = (file: string) => { - const doc = readFileSync(file, "utf8"); +const transformMarkdown = (file: string) => { + const doc = readSyncedUTF8file(file); const ast: Root = remark.parse(doc); const out = flatmap(ast, (c: Code) => { if (c.type !== "code" || !c.lang?.startsWith("mermaid")) { @@ -102,17 +124,54 @@ const transform = (file: string) => { ); }; +/** + * Transform a HTML file and write the transformed file to the directory for published documentation + * - add the text that says the file is automatically generated + * Verify that the file has been changed and write out the changes + * + * @param filename {string} name of the HTML file to transform + */ +const transformHtml = (filename: string) => { + + /** + * Insert the '...auto generated...' comment into an HTML file after the element + * + * @param fname {string} file name that should have the comment inserted + * @returns {string} the contents of the file with the comment inserted + */ + function insertAutoGeneratedComment(fname: string): string { + const fileContents = readSyncedUTF8file(fname); + const jsdom = new JSDOM(fileContents); + const htmlDoc = jsdom.window.document; + const autoGeneratedComment = jsdom.window.document.createComment(AUTOGENERATED_TEXT); + + let rootElement = htmlDoc.documentElement; + rootElement.prepend(autoGeneratedComment); + return jsdom.serialize(); + } + + let transformedHTML = insertAutoGeneratedComment(filename); + verifyAndCopy(filename, transformedHTML); +}; + (async () => { + console.log("Transforming markdown files..."); const mdFiles = await globby(["./src/docs/**/*.md"], { dot: true }); - mdFiles.forEach(transform); - const nonMDFiles = await globby(["src/docs/**", "!**/*.md"], { dot: true }); - nonMDFiles.forEach((file) => { + mdFiles.forEach(transformMarkdown); + + console.log("Transforming html files..."); + const htmlFiles = await globby(["./src/docs/**/*.html"], { dot: true }); + htmlFiles.forEach(transformHtml); + + console.log("Transforming all other files..."); + const otherFiles = await globby(["src/docs/**", "!**/*.md", "!**/*.html"], { dot: true }); + otherFiles.forEach((file) => { verifyAndCopy(file); }); if (filesWereChanged) { if (verifyOnly) { console.log( - "Changes detected in files in `docs`. Please run `yarn docs:build` after making changes to 'src/docs' to update the `docs` folder." + "Changes detected in files in `src/docs`. Please run `yarn docs:build` after making changes to 'src/docs' to update the `docs` folder." ); process.exit(1); } From 22d20cc76e670ec521c191519a2ee117dde15784 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Tue, 6 Sep 2022 03:22:18 +0100 Subject: [PATCH 031/115] ci: lint .jison files for any console.log() Converts the *.jison files into .js, then lints them using just the `no-console` rule. To keep things simple, I've just made this run only on CI. If we want to do more complex linting on `*.jison` files, it might be worth making an `eslint-plugin-jison`, so that we can directly parse jison in ESLint. --- .github/workflows/lint.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 050667a8f..e538372ad 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -37,3 +37,17 @@ jobs: - name: Run Linting run: yarn lint + - name: Check no `console.log()` in .jison files + # ESLint can't parse .jison files directly + # In the future, it might be worth making a `eslint-plugin-jison`, so + # that this will be built into the `yarn lint` command. + run: | + shopt -s globstar + mkdir -p tmp/ + for jison_file in src/**/*.jison; do + outfile="tmp/$(basename -- "$jison_file" .jison)-jison.js" + echo "Converting $jison_file to $outfile" + # default module-type (CJS) always adds a console.log() + yarn jison "$jison_file" --outfile "$outfile" --module-type "amd" + done + yarn eslint --no-eslintrc --rule no-console:error --parser "@babel/eslint-parser" "./tmp/*-jison.js" From 0832b24d66d07b9f71160ad29edae60026cd35e8 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 23:43:57 -0700 Subject: [PATCH 032/115] use single quotes; use const instead of let (2); use const instead of function --- src/docs.mts | 78 +++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index d211e0fbf..ad9ab1bf0 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -14,30 +14,29 @@ * */ -import { remark } from "remark"; -import type { Code, Root } from "mdast"; -import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs"; -import { JSDOM } from "jsdom"; +import { remark } from 'remark'; +import type { Code, Root } from 'mdast'; +import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; +import { JSDOM } from 'jsdom'; // @ts-ignore -import flatmap from "unist-util-flatmap"; -import { globby } from "globby"; -import { join, dirname } from "path"; -import { exec } from "child_process"; +import flatmap from 'unist-util-flatmap'; +import { globby } from 'globby'; +import { join, dirname } from 'path'; +import { exec } from 'child_process'; // @ts-ignore -import prettier from "prettier"; +import prettier from 'prettier'; const SOURCE_DOCS_DIR = 'src/docs/'; const FINAL_DOCS_DIR = 'docs/'; const AUTOGENERATED_TEXT = - "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs."; + '# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.'; -const verifyOnly = process.argv.includes("--verify"); -const git = process.argv.includes("--git"); +const verifyOnly = process.argv.includes('--verify'); +const git = process.argv.includes('--git'); let filesWereChanged = false; - /** * Given a source file name and path, return the documentation destination full path and file name * Create the destination path if it does not already exist. @@ -47,7 +46,7 @@ let filesWereChanged = false; * @returns {string} name of the file with the path changed from src/docs to docs */ const prepareOutFile = (file: string): string => { - const outFile = join(FINAL_DOCS_DIR, file.replace(SOURCE_DOCS_DIR, "")); + const outFile = join(FINAL_DOCS_DIR, file.replace(SOURCE_DOCS_DIR, '')); mkdirSync(dirname(outFile), { recursive: true }); return outFile; }; @@ -61,7 +60,7 @@ const prepareOutFile = (file: string): string => { */ const verifyAndCopy = (file: string, content?: string) => { const outFile = prepareOutFile(file); - const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from("#NEW FILE#"); + const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from('#NEW FILE#'); const newBuffer = content ? Buffer.from(content) : readFileSync(file); if (existingBuffer.equals(newBuffer)) { // Files are same, skip. @@ -71,19 +70,19 @@ const verifyAndCopy = (file: string, content?: string) => { if (verifyOnly) { changeMsg = 'to be changed'; } - let logMsg = ` File ${changeMsg}: ${outFile}` + let logMsg = ` File ${changeMsg}: ${outFile}`; filesWereChanged = true; if (!verifyOnly) { writeFileSync(outFile, newBuffer); - logMsg += ' ...and copied to /docs' + logMsg += ' ...and copied to /docs'; } console.log(logMsg); }; const readSyncedUTF8file = (file: string): string => { - return readFileSync(file, "utf8"); -} + return readFileSync(file, 'utf8'); +}; /** * Transform a markdown file and write the transformed file to the directory for published documentation @@ -99,13 +98,13 @@ const transformMarkdown = (file: string) => { const doc = readSyncedUTF8file(file); const ast: Root = remark.parse(doc); const out = flatmap(ast, (c: Code) => { - if (c.type !== "code" || !c.lang?.startsWith("mermaid")) { + if (c.type !== 'code' || !c.lang?.startsWith('mermaid')) { return [c]; } - if (c.lang === "mermaid" || c.lang === "mmd") { - c.lang = "mermaid-example"; + if (c.lang === 'mermaid' || c.lang === 'mmd') { + c.lang = 'mermaid-example'; } - return [c, Object.assign({}, c, { lang: "mermaid" })]; + return [c, Object.assign({}, c, { lang: 'mermaid' })]; }); // Add the AUTOGENERATED_TEXT to the start of the file @@ -114,12 +113,12 @@ const transformMarkdown = (file: string) => { verifyAndCopy( file, prettier.format(transformed, { - parser: "markdown", + parser: 'markdown', useTabs: false, tabWidth: 2, - endOfLine: "auto", + endOfLine: 'auto', printWidth: 100, - singleQuote: true + singleQuote: true, }) ); }; @@ -132,39 +131,38 @@ const transformMarkdown = (file: string) => { * @param filename {string} name of the HTML file to transform */ const transformHtml = (filename: string) => { - /** * Insert the '...auto generated...' comment into an HTML file after the element * - * @param fname {string} file name that should have the comment inserted + * @param fileName {string} file name that should have the comment inserted * @returns {string} the contents of the file with the comment inserted */ - function insertAutoGeneratedComment(fname: string): string { - const fileContents = readSyncedUTF8file(fname); + const insertAutoGeneratedComment = (fileName: string): string => { + const fileContents = readSyncedUTF8file(fileName); const jsdom = new JSDOM(fileContents); const htmlDoc = jsdom.window.document; const autoGeneratedComment = jsdom.window.document.createComment(AUTOGENERATED_TEXT); - let rootElement = htmlDoc.documentElement; + const rootElement = htmlDoc.documentElement; rootElement.prepend(autoGeneratedComment); return jsdom.serialize(); } - let transformedHTML = insertAutoGeneratedComment(filename); + const transformedHTML = insertAutoGeneratedComment(filename); verifyAndCopy(filename, transformedHTML); }; (async () => { - console.log("Transforming markdown files..."); - const mdFiles = await globby(["./src/docs/**/*.md"], { dot: true }); + console.log('Transforming markdown files...'); + const mdFiles = await globby(['./src/docs/**/*.md'], { dot: true }); mdFiles.forEach(transformMarkdown); - console.log("Transforming html files..."); - const htmlFiles = await globby(["./src/docs/**/*.html"], { dot: true }); + console.log('Transforming html files...'); + const htmlFiles = await globby(['./src/docs/**/*.html'], { dot: true }); htmlFiles.forEach(transformHtml); - console.log("Transforming all other files..."); - const otherFiles = await globby(["src/docs/**", "!**/*.md", "!**/*.html"], { dot: true }); + console.log('Transforming all other files...'); + const otherFiles = await globby(['src/docs/**', '!**/*.md', '!**/*.html'], { dot: true }); otherFiles.forEach((file) => { verifyAndCopy(file); }); @@ -176,8 +174,8 @@ const transformHtml = (filename: string) => { process.exit(1); } if (git) { - console.log("Adding changes in docs folder to git"); - exec("git add docs"); + console.log('Adding changes in docs folder to git'); + exec('git add docs'); } } })(); From c50a7533f648ddeb991d2ebe947a4aea9a2bc48e Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Wed, 7 Sep 2022 12:38:26 +0200 Subject: [PATCH 033/115] Removed warnings in the grammar oand some console logging --- src/diagrams/mindmap/mindmap.spec.js | 48 ++++++++------- src/diagrams/mindmap/mindmapDb.js | 7 ++- src/diagrams/mindmap/parser/mindmap.jison | 75 ++++++++++++----------- 3 files changed, 69 insertions(+), 61 deletions(-) diff --git a/src/diagrams/mindmap/mindmap.spec.js b/src/diagrams/mindmap/mindmap.spec.js index 2b88a579d..4e11dbd8b 100644 --- a/src/diagrams/mindmap/mindmap.spec.js +++ b/src/diagrams/mindmap/mindmap.spec.js @@ -1,4 +1,5 @@ import * as mindmapDB from './mindmapDb'; +import { setLogLevel } from '../../logger'; describe('when parsing a mindmap ', function () { let mindmap; @@ -6,9 +7,10 @@ describe('when parsing a mindmap ', function () { mindmap = require('./parser/mindmap').parser; mindmap.yy = require('./mindmapDb'); mindmap.yy.clear(); + setLogLevel('trace'); }); describe('hiearchy', function () { - it('should handle a simple root definition', function () { + it('MMP-1 should handle a simple root definition abc122', function () { let str = `mindmap root`; @@ -16,7 +18,7 @@ describe('when parsing a mindmap ', function () { // console.log('Time for checks', mindmap.yy.getMindmap().descr); expect(mindmap.yy.getMindmap().descr).toEqual('root'); }); - it('should handle a hierachial mindmap definition', function () { + it('MMP-2 should handle a hierachial mindmap definition', function () { let str = `mindmap root child1 @@ -31,7 +33,7 @@ describe('when parsing a mindmap ', function () { expect(mm.children[1].descr).toEqual('child2'); }); - it('should handle a simple root definition with a shape and without an id abc123', function () { + it('3 should handle a simple root definition with a shape and without an id abc123', function () { let str = `mindmap (root)`; @@ -40,7 +42,7 @@ describe('when parsing a mindmap ', function () { expect(mindmap.yy.getMindmap().descr).toEqual('root'); }); - it('should handle a deeper hierachial mindmap definition', function () { + it('MMP-4 should handle a deeper hierachial mindmap definition', function () { let str = `mindmap root child1 @@ -55,7 +57,7 @@ describe('when parsing a mindmap ', function () { expect(mm.children[0].children[0].descr).toEqual('leaf1'); expect(mm.children[1].descr).toEqual('child2'); }); - it('Multiple roots are illegal', function () { + it('5 Multiple roots are illegal', function () { let str = `mindmap root fakeRoot`; @@ -70,7 +72,7 @@ describe('when parsing a mindmap ', function () { ); } }); - it('real root in wrong place', function () { + it('MMP-6 real root in wrong place', function () { let str = `mindmap root fakeRoot @@ -88,7 +90,7 @@ describe('when parsing a mindmap ', function () { }); }); describe('nodes', function () { - it('should handle an id and type for a node definition', function () { + it('MMP-7 should handle an id and type for a node definition', function () { let str = `mindmap root[The root] `; @@ -99,7 +101,7 @@ describe('when parsing a mindmap ', function () { expect(mm.descr).toEqual('The root'); expect(mm.type).toEqual(mindmap.yy.nodeType.RECT); }); - it('should handle an id and type for a node definition', function () { + it('MMP-8 should handle an id and type for a node definition', function () { let str = `mindmap root theId(child1)`; @@ -113,7 +115,7 @@ describe('when parsing a mindmap ', function () { expect(child.nodeId).toEqual('theId'); expect(child.type).toEqual(mindmap.yy.nodeType.ROUNDED_RECT); }); - it('should handle an id and type for a node definition', function () { + it('MMP-9 should handle an id and type for a node definition', function () { let str = `mindmap root theId(child1)`; @@ -127,10 +129,10 @@ root expect(child.nodeId).toEqual('theId'); expect(child.type).toEqual(mindmap.yy.nodeType.ROUNDED_RECT); }); - it('mutiple types (circle)', function () { + it('MMP-10 mutiple types (circle)', function () { let str = `mindmap root((the root)) -`; + `; mindmap.parse(str); const mm = mindmap.yy.getMindmap(); @@ -139,7 +141,7 @@ root expect(mm.type).toEqual(mindmap.yy.nodeType.CIRCLE); }); - it('mutiple types (cloud)', function () { + it('MMP-11 mutiple types (cloud)', function () { let str = `mindmap root)the root( `; @@ -150,7 +152,7 @@ root expect(mm.children.length).toEqual(0); expect(mm.type).toEqual(mindmap.yy.nodeType.CLOUD); }); - it('mutiple types (bang)', function () { + it('MMP-12 mutiple types (bang)', function () { let str = `mindmap root))the root(( `; @@ -163,7 +165,7 @@ root }); }); describe('decorations', function () { - it('should be possible to set an icon for the node', function () { + it('MMP-13 should be possible to set an icon for the node', function () { let str = `mindmap root[The root] ::icon(bomb) @@ -177,7 +179,7 @@ root expect(mm.type).toEqual(mindmap.yy.nodeType.RECT); expect(mm.icon).toEqual('bomb'); }); - it('should be possible to set classes for the node', function () { + it('MMP-14 should be possible to set classes for the node', function () { let str = `mindmap root[The root] :::m-4 p-8 @@ -191,7 +193,7 @@ root expect(mm.type).toEqual(mindmap.yy.nodeType.RECT); expect(mm.class).toEqual('m-4 p-8'); }); - it('should be possible to set both classes and icon for the node', function () { + it('MMP-15 should be possible to set both classes and icon for the node', function () { let str = `mindmap root[The root] :::m-4 p-8 @@ -207,7 +209,7 @@ root expect(mm.class).toEqual('m-4 p-8'); expect(mm.icon).toEqual('bomb'); }); - it('should be possible to set both classes and icon for the node', function () { + it('MMP-16 should be possible to set both classes and icon for the node', function () { let str = `mindmap root[The root] ::icon(bomb) @@ -225,7 +227,7 @@ root }); }); describe('descriptions', function () { - it('should be possible to use node syntax in the descriptions', function () { + it('MMP-17 should be possible to use node syntax in the descriptions', function () { let str = `mindmap root["String containing []"] `; @@ -234,7 +236,7 @@ root expect(mm.nodeId).toEqual('root'); expect(mm.descr).toEqual('String containing []'); }); - it('should be possible to use node syntax in the descriptions in children', function () { + it('MMP-18 should be possible to use node syntax in the descriptions in children', function () { let str = `mindmap root["String containing []"] child1["String containing ()"] @@ -246,7 +248,7 @@ root expect(mm.children.length).toEqual(1); expect(mm.children[0].descr).toEqual('String containing ()'); }); - it('should be possible to have a child after a class assignment', function () { + it('MMP-19 should be possible to have a child after a class assignment', function () { let str = `mindmap root(Root) Child(Child) @@ -266,7 +268,7 @@ root expect(child.children[1].nodeId).toEqual('b'); }); }); - it('should be possible to have meaningless empty rows in a mindmap abc124', function () { + it('MMP-20 should be possible to have meaningless empty rows in a mindmap abc124', function () { let str = `mindmap root(Root) Child(Child) @@ -285,7 +287,7 @@ root expect(child.children.length).toEqual(2); expect(child.children[1].nodeId).toEqual('b'); }); - it('should be possible to have comments in a mindmap', function () { + it('MMP-21 should be possible to have comments in a mindmap', function () { let str = `mindmap root(Root) Child(Child) @@ -306,7 +308,7 @@ root expect(child.children[1].nodeId).toEqual('b'); }); - it('should be possible to have comments at the end of a line', function () { + it('MMP-22 should be possible to have comments at the end of a line', function () { let str = `mindmap root(Root) Child(Child) diff --git a/src/diagrams/mindmap/mindmapDb.js b/src/diagrams/mindmap/mindmapDb.js index 370b3f7d9..48b242c9e 100644 --- a/src/diagrams/mindmap/mindmapDb.js +++ b/src/diagrams/mindmap/mindmapDb.js @@ -1,6 +1,6 @@ /** Created by knut on 15-01-14. */ import { sanitizeText, getConfig } from '../../diagram-api/diagramAPI'; -import { log } from '../../logger'; +import { log as _log } from '../../logger'; let nodes = []; let cnt = 0; @@ -25,7 +25,7 @@ export const getMindmap = () => { return nodes.length > 0 ? nodes[0] : null; }; export const addNode = (level, id, descr, type) => { - console.info('addNode', level, id, descr, type); + log.info('addNode', level, id, descr, type); const conf = getConfig(); const node = { id: cnt++, @@ -132,7 +132,8 @@ export const type2Str = (type) => { return 'no-border'; } }; - +// Expose logger to grammar +export const log = _log; export const getNodeById = (id) => nodes[id]; export const getElementById = (id) => elements[id]; // export default { diff --git a/src/diagrams/mindmap/parser/mindmap.jison b/src/diagrams/mindmap/parser/mindmap.jison index d84c09495..f8c72787c 100644 --- a/src/diagrams/mindmap/parser/mindmap.jison +++ b/src/diagrams/mindmap/parser/mindmap.jison @@ -17,20 +17,21 @@ %% -\s*\%\%.*\n {console.log('Found comment',yytext);} +\s*\%\%.* {yy.log.trace('Found comment',yytext);} // \%\%[^\n]*\n /* skip comments */ "mindmap" return 'MINDMAP'; ":::" { this.begin('CLASS'); } .+ { this.popState();return 'CLASS'; } \n { this.popState();} -[\n\s]*"::icon(" { this.begin('ICON'); } -[\n]+ /* return 'NL'; */ +// [\s]*"::icon(" { this.begin('ICON'); } +"::icon(" { yy.log.trace('Begin icon');this.begin('ICON'); } +[\n]+ return 'NL'; [^\)]+ { return 'ICON'; } -\) {this.popState();} -"-)" { console.log('Exploding node'); this.begin('NODE');return 'NODE_DSTART'; } -"(-" { console.log('Cloud'); this.begin('NODE');return 'NODE_DSTART'; } -"))" { console.log('Explosion Bang'); this.begin('NODE');return 'NODE_DSTART'; } -")" { console.log('Cloud Bang'); this.begin('NODE');return 'NODE_DSTART'; } +\) {yy.log.trace('end icon');this.popState();} +"-)" { yy.log.trace('Exploding node'); this.begin('NODE');return 'NODE_DSTART'; } +"(-" { yy.log.trace('Cloud'); this.begin('NODE');return 'NODE_DSTART'; } +"))" { yy.log.trace('Explosion Bang'); this.begin('NODE');return 'NODE_DSTART'; } +")" { yy.log.trace('Cloud Bang'); this.begin('NODE');return 'NODE_DSTART'; } "((" { this.begin('NODE');return 'NODE_DSTART'; } "(" { this.begin('NODE');return 'NODE_DSTART'; } "[" { this.begin('NODE');return 'NODE_DSTART'; } @@ -38,18 +39,18 @@ // !(-\() return 'NODE_ID'; [^\(\[\n\-\)]+ return 'NODE_ID'; <> return 'EOF'; -["] { console.log('Starting NSTR');this.begin("NSTR");} -[^"]+ { console.log('description:', yytext); return "NODE_DESCR";} +["] { yy.log.trace('Starting NSTR');this.begin("NSTR");} +[^"]+ { yy.log.trace('description:', yytext); return "NODE_DESCR";} ["] {this.popState();} -[\)]\) {this.popState();console.log('node end ))');return "NODE_DEND";} -[\)] {this.popState();console.log('node end )');return "NODE_DEND";} -[\]] {this.popState();console.log('node end ...');return "NODE_DEND";} -"(-" {this.popState();console.log('node end (-');return "NODE_DEND";} -"-)" {this.popState();console.log('node end (-');return "NODE_DEND";} -"((" {this.popState();console.log('node end ((');return "NODE_DEND";} -"(" {this.popState();console.log('node end ((');return "NODE_DEND";} -[^\)\]\(]+ { console.log('Long description:', yytext); return 'NODE_DESCR';} -.+(?!\(\() { console.log('Long description:', yytext); return 'NODE_DESCR';} +[\)]\) {this.popState();yy.log.trace('node end ))');return "NODE_DEND";} +[\)] {this.popState();yy.log.trace('node end )');return "NODE_DEND";} +[\]] {this.popState();yy.log.trace('node end ...',yytext);return "NODE_DEND";} +"(-" {this.popState();yy.log.trace('node end (-');return "NODE_DEND";} +"-)" {this.popState();yy.log.trace('node end (-');return "NODE_DEND";} +"((" {this.popState();yy.log.trace('node end ((');return "NODE_DEND";} +"(" {this.popState();yy.log.trace('node end ((');return "NODE_DEND";} +[^\)\]\(]+ { yy.log.trace('Long description:', yytext); return 'NODE_DESCR';} +.+(?!\(\() { yy.log.trace('Long description:', yytext); return 'NODE_DESCR';} // [\[] return 'NODE_START'; // .+ return 'TXT' ; @@ -62,29 +63,33 @@ start // %{ : info document 'EOF' { return yy; } } : MINDMAP document { return yy; } + | MINDMAP NL document { return yy; } | SPACELIST MINDMAP document { return yy; } ; +stop + : NL {yy.log.trace('Stop NL ');} + | EOF {yy.log.trace('Stop EOF ');} + | stop NL {yy.log.trace('Stop NL2 ');} + | stop EOF {yy.log.trace('Stop EOF2 ');} + ; document - : document line - | line - ; - -line - : statement { } + : document statement stop + | statement stop ; statement - : SPACELIST node { yy.addNode($1.length, $2.id, $2.descr, $2.type); } - | SPACELIST ICON { yy.decorateNode({icon: $2}); } - | SPACELIST EOF - | SPACELIST NL - | node { console.log($1.id);yy.addNode(0, $1.id, $1.descr, $1.type); } + : SPACELIST node { yy.log.trace('Node: ',$2.id);yy.addNode($1.length, $2.id, $2.descr, $2.type); } + | SPACELIST ICON { yy.log.trace('Icon: ',$2);yy.decorateNode({icon: $2}); } + | SPACELIST CLASS { yy.decorateNode({class: $2}); } + | node { yy.log.trace('Node: ',$1.id);yy.addNode(0, $1.id, $1.descr, $1.type); } | ICON { yy.decorateNode({icon: $1}); } - | SPACELIST CLASS { yy.decorateNode({class: $2}); } - | CLASS { yy.decorateNode({class: $1}); } - | EOF + | CLASS { yy.decorateNode({class: $1}); } + | SPACELIST ; + + + node :nodeWithId |nodeWithoutId @@ -92,12 +97,12 @@ node nodeWithoutId : NODE_DSTART NODE_DESCR NODE_DEND - { console.log("node found ..", $1); $$ = { id: $2, descr: $2, type: yy.getType($1, $3) }; } + { yy.log.trace("node found ..", $1); $$ = { id: $2, descr: $2, type: yy.getType($1, $3) }; } ; nodeWithId : NODE_ID { $$ = { id: $1, descr: $1, type: yy.nodeType.DEFAULT }; } | NODE_ID NODE_DSTART NODE_DESCR NODE_DEND - { console.log("node found ..", $1); $$ = { id: $1, descr: $3, type: yy.getType($2, $4) }; } + { yy.log.trace("node found ..", $1); $$ = { id: $1, descr: $3, type: yy.getType($2, $4) }; } ; %% From 04a25092f4180274a410aeca4e1a053991f7360e Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 06:40:26 -0700 Subject: [PATCH 034/115] (formatting) prettier fix --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d55fe3b3..8171aeca9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -143,7 +143,6 @@ The source files for documentation are in `/src/docs` and are written in markdow If you want to add a new section or change the organization (structure), then you need to make sure to **change the side navigation** in `src/docs/_sidebar.md`. - When changes are committed and then released, they become part of the `master` branch and become part of the published documentation on https://mermaid-js.github.io/mermaid/ ## Last words From bb2002fce2f6f53ad68eee81b00c3b2b063c3cd0 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 20:51:46 +0530 Subject: [PATCH 035/115] chore: Run postbuild with prepare As postbuild was not running with prepare, PR that updated `documentation` package was green, although it should've failed. --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cacde6635..163e509bd 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,11 @@ "build": "concurrently \"yarn build:dev\" \"yarn build:prod\"", "docs:build": "ts-node-esm src/docs.mts", "docs:verify": "ts-node-esm src/docs.mts --verify", - "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md; yarn docs:build", + "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md && prettier --write src/docs/Setup.md && yarn docs:build", "build:watch": "yarn build:dev --watch", "release": "yarn build", - "lint": "eslint --cache --ignore-path .gitignore .; prettier --check .", - "lint:fix": "eslint --fix --ignore-path .gitignore .; prettier --write .", + "lint": "eslint --cache --ignore-path .gitignore . && prettier --check .", + "lint:fix": "eslint --fix --ignore-path .gitignore . && prettier --write .", "e2e:depr": "yarn lint && jest e2e --config e2e/jest.config.js", "cypress": "cypress run", "cypress:open": "cypress open", @@ -43,7 +43,7 @@ "test": "yarn lint && jest src/.*", "test:watch": "jest --watch src", "prepublishOnly": "yarn build && yarn test", - "prepare": "concurrently \"husky install\" \"yarn build:prod\"", + "prepare": "concurrently \"husky install\" \"yarn build:prod\" \"yarn postbuild\"", "pre-commit": "lint-staged" }, "repository": { From e310af76736f31d6e98103ea3d77bc949bb134dd Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 20:54:19 +0530 Subject: [PATCH 036/115] Update prettier --- package.json | 4 ++-- yarn.lock | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 163e509bd..a791f0574 100644 --- a/package.json +++ b/package.json @@ -115,8 +115,8 @@ "lint-staged": "^13.0.0", "moment": "^2.23.0", "path-browserify": "^1.0.1", - "prettier": "^2.3.2", - "prettier-plugin-jsdoc": "^0.3.30", + "prettier": "^2.7.1", + "prettier-plugin-jsdoc": "^0.4.2", "remark": "^14.0.2", "start-server-and-test": "^1.12.6", "terser-webpack-plugin": "^5.3.6", diff --git a/yarn.lock b/yarn.lock index 2834342ca..58c3d2818 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9873,16 +9873,16 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier-plugin-jsdoc@^0.3.30: - version "0.3.38" - resolved "https://registry.yarnpkg.com/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-0.3.38.tgz#b8adbe9efc1dc11f3cc5ff0b07e0233a0fdf533d" - integrity sha512-h81ZV/nFk5gr3fzWMWzWoz/M/8FneAZxscT7DVSy+5jMIuWYnBFZfSswVKYZyTaZ5r6+6k4hpFTDWhRp85C1tg== +prettier-plugin-jsdoc@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-0.4.2.tgz#c5668fc622ed10b87d988279476f96af96b058b7" + integrity sha512-w2jnAQm3z0GAG0bhzVJeehzDtrhGMSxJjit5ApCc2oxWfc7+jmLAkbtdOXaSpfwZz3IWkk+PiQPeRrLNpbM+Mw== dependencies: binary-searching "^2.0.5" comment-parser "^1.3.1" mdast-util-from-markdown "^1.2.0" -prettier@^2.3.2: +prettier@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== From 1a0fe0abf6ac06c38be700aafadce88e9394b5c9 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 08:19:34 -0700 Subject: [PATCH 037/115] (comments only) reword main docblock; clarify other comments; grammar etc. fixes --- src/docs.mts | 57 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index ad9ab1bf0..b090fdd8c 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,17 +1,25 @@ /** - * @overview Process and potentially transform documentation source files into files suitable for publishing. - * Copy files from the source directory (/src/docs) to the directory used for the final, published documentation (/docs). - * The list of files changed (transformed) and copied to /docs are logged to the console. - * If a file in /src/docs has the same contents in /docs, nothing is done (it is not copied to /docs). + * @file Transform documentation source files into files suitable for publishing and optionally copy + * the transformed files from the source directory to the directory used for the final, published + * documentation directory. The list of files transformed and copied to final documentation + * directory are logged to the console. If a file in the source directory has the same contents in + * the final directory, nothing is done (the final directory is up-to-date). + * @example + * docs + * Run with no option flags * - * @example docs - * @example docs --verify - * If the --verify option is used, no files will be copied to /docs, but the list of files to be changed is still shown on the console. - * A message to the console will show that this command should be run without the --verify flag so that the 'docs' folder is be updated. - * Note that the command will return an exit code (1), which will show that it failed. - * @example docs --git - * If the --git option is used, the command `git add docs` will be run + * @example + * docs --verify + * If the --verify option is used, it only _verifies_ that the final directory has been updated with the transformed files in the source directory. + * No files will be copied to the final documentation directory, but the list of files to be changed is shown on the console. + * If the final documentation directory does not have the transformed files from source directory + * - a message to the console will show that this command should be run without the --verify flag so that the final directory is updated, and + * - it will return a fail exit code (1) * + * @example + * docs --git + * If the --git option is used, the command `git add docs` will be run after all transformations (and/or verifications) have completed successfully + * If not files were transformed, the git command is not run. */ import { remark } from 'remark'; @@ -39,11 +47,12 @@ let filesWereChanged = false; /** * Given a source file name and path, return the documentation destination full path and file name - * Create the destination path if it does not already exist. - * Possible Improvement: combine with lint-staged to only copy files that have changed + * Create the destination path if it does not already exist. Possible Improvement: combine with + * lint-staged to only copy files that have changed * - * @param file {string} name of the file (including full path) - * @returns {string} name of the file with the path changed from src/docs to docs + * @param {string} file - Name of the file (including full path) + * @returns {string} Name of the file with the path changed from the source directory to final + * documentation directory */ const prepareOutFile = (file: string): string => { const outFile = join(FINAL_DOCS_DIR, file.replace(SOURCE_DOCS_DIR, '')); @@ -86,11 +95,10 @@ const readSyncedUTF8file = (file: string): string => { /** * Transform a markdown file and write the transformed file to the directory for published documentation - * 1. add a `mermaid-example` block before every `mermaid` or `mmd` block - * On the docsify site (one place where the documentation is published), this will show the code used for the mermaid diagram - * 2. add the text that says the file is automatically generated - * 3. use prettier to format the file - * Verify that the file has been changed and write out the changes + * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one + * place where the documentation is published), this will show the code used for the mermaid diagram + * 2. Add the text that says the file is automatically generated + * 3. Use prettier to format the file Verify that the file has been changed and write out the changes * * @param file {string} name of the file that will be verified */ @@ -124,9 +132,9 @@ const transformMarkdown = (file: string) => { }; /** - * Transform a HTML file and write the transformed file to the directory for published documentation - * - add the text that says the file is automatically generated - * Verify that the file has been changed and write out the changes + * Transform an HTML file and write the transformed file to the directory for published documentation + * - Add the text that says the file is automatically generated Verify that the file has been changed + * and write out the changes * * @param filename {string} name of the HTML file to transform */ @@ -135,7 +143,7 @@ const transformHtml = (filename: string) => { * Insert the '...auto generated...' comment into an HTML file after the element * * @param fileName {string} file name that should have the comment inserted - * @returns {string} the contents of the file with the comment inserted + * @returns {string} The contents of the file with the comment inserted */ const insertAutoGeneratedComment = (fileName: string): string => { const fileContents = readSyncedUTF8file(fileName); @@ -152,6 +160,7 @@ const transformHtml = (filename: string) => { verifyAndCopy(filename, transformedHTML); }; +/** Main method (entry point) */ (async () => { console.log('Transforming markdown files...'); const mdFiles = await globby(['./src/docs/**/*.md'], { dot: true }); From a878edfb9b230970902c3a38ee5702b7f5a24dad Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 08:32:52 -0700 Subject: [PATCH 038/115] add and use constants; DRY glob patterns in main --- src/docs.mts | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index b090fdd8c..7f1fe9d50 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -38,12 +38,19 @@ import prettier from 'prettier'; const SOURCE_DOCS_DIR = 'src/docs/'; const FINAL_DOCS_DIR = 'docs/'; const AUTOGENERATED_TEXT = - '# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.'; + '# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in ${SOURCE_DOCS_DIR}.'; + +const LOGMSG_TRANSFORMED = 'transformed'; +const LOGMSG_TO_BE_TRANSFORMED = 'to be transformed'; +const LOGMSG_COPIED = ' ...and copied to ${FINAL_DOCS_DIR}'; + +const WARN_DOCSDIR_DOESNT_MATCH = + "Changed files were transformed in `${SOURCE_DOCS_DIR}` but do not match the files in `${FINAL_DOCS_DIR}`. Please run `yarn docs:build` after making changes to '${SOURCE_DOCS_DIR}' to update the `${FINAL_DOCS_DIR}` directory with the transformed files."; const verifyOnly = process.argv.includes('--verify'); const git = process.argv.includes('--git'); -let filesWereChanged = false; +let filesWereTransformed = false; /** * Given a source file name and path, return the documentation destination full path and file name @@ -162,28 +169,33 @@ const transformHtml = (filename: string) => { /** Main method (entry point) */ (async () => { + const sourceDirGlob = join(__dirname, SOURCE_DOCS_DIR, '**'); + const includeFilesStartingWithDot = true; + console.log('Transforming markdown files...'); - const mdFiles = await globby(['./src/docs/**/*.md'], { dot: true }); + const mdFiles = await globby([join(sourceDirGlob, '*.md')], { dot: includeFilesStartingWithDot }); mdFiles.forEach(transformMarkdown); console.log('Transforming html files...'); - const htmlFiles = await globby(['./src/docs/**/*.html'], { dot: true }); + const htmlFiles = await globby([join(sourceDirGlob, '*.html')], { + dot: includeFilesStartingWithDot, + }); htmlFiles.forEach(transformHtml); console.log('Transforming all other files...'); - const otherFiles = await globby(['src/docs/**', '!**/*.md', '!**/*.html'], { dot: true }); + const otherFiles = await globby([sourceDirGlob, '!**/*.md', '!**/*.html'], { + dot: includeFilesStartingWithDot, + }); otherFiles.forEach((file) => { verifyAndCopy(file); }); if (filesWereChanged) { if (verifyOnly) { - console.log( - "Changes detected in files in `src/docs`. Please run `yarn docs:build` after making changes to 'src/docs' to update the `docs` folder." - ); + console.log(WARN_DOCSDIR_DOESNT_MATCH); process.exit(1); } if (git) { - console.log('Adding changes in docs folder to git'); + console.log('Adding changes in ${FINAL_DOCS_DIR} folder to git'); exec('git add docs'); } } From 411d641aa25dc203627ebfbc8a1c560984354890 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 08:35:51 -0700 Subject: [PATCH 039/115] simplfy method to copy transformation to /docs; extract logging Extract the logging so that it if later we want to turn it on/off with a --verbose flag --- src/docs.mts | 75 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 7f1fe9d50..e04296424 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -68,40 +68,59 @@ const prepareOutFile = (file: string): string => { }; /** - * Verify that a file was changed and (potentially) write the new contents out to the file. Log a message to the console - * If the file was not changed, do nothing. (No message is logged to the console.) + * Log messages to the console showing if the transformed file copied to the final documentation + * directory or still needs to be copied. * - * @param file {string} name of the file that will be verified - * @param content {string} new contents for the file + * @param {string} filename Name of the file that was transformed + * @param {boolean} wasCopied Whether or not the file was copied */ -const verifyAndCopy = (file: string, content?: string) => { - const outFile = prepareOutFile(file); - const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from('#NEW FILE#'); - const newBuffer = content ? Buffer.from(content) : readFileSync(file); - if (existingBuffer.equals(newBuffer)) { - // Files are same, skip. - return; - } - let changeMsg = 'changed'; - if (verifyOnly) { - changeMsg = 'to be changed'; - } - let logMsg = ` File ${changeMsg}: ${outFile}`; - - filesWereChanged = true; - if (!verifyOnly) { - writeFileSync(outFile, newBuffer); - logMsg += ' ...and copied to /docs'; +const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => { + let changeMsg: string; + let logMsg: string; + changeMsg = wasCopied ? LOGMSG_TRANSFORMED : LOGMSG_TO_BE_TRANSFORMED; + logMsg = ` File ${changeMsg}: ${filename}`; + if (wasCopied) { + logMsg += LOGMSG_COPIED; } console.log(logMsg); }; +/** + * If the file contents were transformed, set the _filesWereTransformed_ flag to true and copy the + * transformed contents to the final documentation directory if the doCopy flag is true. Log + * messages to the console. + * + * @param {string} file Name of the file that will be verified + * @param {string} [transformedContent] New contents for the file + * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final + * documentation directory. Default is `false` + */ +const copyTransformedContents = ( + file: string, + transformedContent?: string, + doCopy: boolean = false +) => { + const outFile = prepareOutFile(file); + const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from('#NEW FILE#'); + const newBuffer = transformedContent ? Buffer.from(transformedContent) : readFileSync(file); + if (existingBuffer.equals(newBuffer)) { + return; // Files are same, skip. + } + + filesWereTransformed = true; + if (doCopy) { + writeFileSync(outFile, newBuffer); + } + logWasOrShouldBeTransformed(outFile, doCopy); +}; + const readSyncedUTF8file = (file: string): string => { return readFileSync(file, 'utf8'); }; /** * Transform a markdown file and write the transformed file to the directory for published documentation + * * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one * place where the documentation is published), this will show the code used for the mermaid diagram * 2. Add the text that says the file is automatically generated @@ -125,7 +144,7 @@ const transformMarkdown = (file: string) => { // Add the AUTOGENERATED_TEXT to the start of the file const transformed = `${AUTOGENERATED_TEXT}\n${remark.stringify(out)}`; - verifyAndCopy( + copyTransformedContents( file, prettier.format(transformed, { parser: 'markdown', @@ -140,6 +159,7 @@ const transformMarkdown = (file: string) => { /** * Transform an HTML file and write the transformed file to the directory for published documentation + * * - Add the text that says the file is automatically generated Verify that the file has been changed * and write out the changes * @@ -161,10 +181,10 @@ const transformHtml = (filename: string) => { const rootElement = htmlDoc.documentElement; rootElement.prepend(autoGeneratedComment); return jsdom.serialize(); - } + }; const transformedHTML = insertAutoGeneratedComment(filename); - verifyAndCopy(filename, transformedHTML); + copyTransformedContents(filename, transformedHTML); }; /** Main method (entry point) */ @@ -187,9 +207,10 @@ const transformHtml = (filename: string) => { dot: includeFilesStartingWithDot, }); otherFiles.forEach((file) => { - verifyAndCopy(file); + copyTransformedContents(file); }); - if (filesWereChanged) { + + if (filesWereTransformed) { if (verifyOnly) { console.log(WARN_DOCSDIR_DOESNT_MATCH); process.exit(1); From 056d5200c6507a495690ffd01bed180116f67289 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 21:06:35 +0530 Subject: [PATCH 040/115] Fix postbuild --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 56af22bd5..9017a5936 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "test": "yarn lint && jest src/.*", "test:watch": "jest --watch src", "prepublishOnly": "yarn build && yarn test", - "prepare": "concurrently \"husky install\" \"yarn build:prod\" \"yarn postbuild\"", + "prepare": "concurrently \"husky install\" \"yarn build\"", "pre-commit": "lint-staged" }, "repository": { From c6ce5a80fa3ddcda81bd617355607124cbc1ec68 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 11:00:59 -0700 Subject: [PATCH 041/115] fix: pass in doCopy param --- src/docs.mts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index e04296424..088e004b0 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -111,7 +111,7 @@ const copyTransformedContents = ( if (doCopy) { writeFileSync(outFile, newBuffer); } - logWasOrShouldBeTransformed(outFile, doCopy); + logWasOrShouldBeTransformed(fileInFinalDocDir, doCopy); }; const readSyncedUTF8file = (file: string): string => { @@ -153,7 +153,8 @@ const transformMarkdown = (file: string) => { endOfLine: 'auto', printWidth: 100, singleQuote: true, - }) + }), + !verifyOnly ); }; From 3986f4819947183f0c51df9b53882b837271ec8b Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 8 Sep 2022 00:34:52 +0530 Subject: [PATCH 042/115] fix: Tsconfig --- src/mermaid.ts | 11 ++++------- tsconfig.json | 3 ++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/mermaid.ts b/src/mermaid.ts index 48c2f8790..c93c6c94e 100644 --- a/src/mermaid.ts +++ b/src/mermaid.ts @@ -30,12 +30,14 @@ import { isDetailedError } from './utils'; * ``` * * Renders the mermaid diagrams + * * @param config * @param nodes * @param callback */ const init = function ( config?: MermaidConfig, + // eslint-disable-next-line no-undef nodes?: string | HTMLElement | NodeListOf, callback?: Function ) { @@ -54,6 +56,7 @@ const init = function ( const initThrowsErrors = function ( config?: MermaidConfig, + // eslint-disable-next-line no-undef nodes?: string | HTMLElement | NodeListOf, callback?: Function ) { @@ -156,13 +159,7 @@ if (typeof document !== 'undefined') { /*! * Wait for document loaded before starting the execution */ - window.addEventListener( - 'load', - function () { - contentLoaded(); - }, - false - ); + window.addEventListener('load', contentLoaded, false); } /** diff --git a/tsconfig.json b/tsconfig.json index f3a860e32..6a29f8328 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ /* Language and Environment */ "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, "lib": [ - "ES2021" + "ES2021", + "DOM" ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ From d0074356e9ed9e37e35c2d5963f33c3994cadd23 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 11:01:50 -0700 Subject: [PATCH 043/115] fix: cannot use __dirname with .mts and latest Node --- src/docs.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs.mts b/src/docs.mts index 088e004b0..2baa87f01 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -190,7 +190,7 @@ const transformHtml = (filename: string) => { /** Main method (entry point) */ (async () => { - const sourceDirGlob = join(__dirname, SOURCE_DOCS_DIR, '**'); + const sourceDirGlob = join('.', SOURCE_DOCS_DIR, '**'); const includeFilesStartingWithDot = true; console.log('Transforming markdown files...'); From 73abcd869ca324798fe068ffefe0f67ec5b7658f Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 11:02:22 -0700 Subject: [PATCH 044/115] fix: also check other files --- src/docs.mts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 2baa87f01..877f7a022 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -207,8 +207,9 @@ const transformHtml = (filename: string) => { const otherFiles = await globby([sourceDirGlob, '!**/*.md', '!**/*.html'], { dot: includeFilesStartingWithDot, }); - otherFiles.forEach((file) => { - copyTransformedContents(file); + otherFiles.forEach((file: string) => { + const transformedContents = readSyncedUTF8file(file); // no transformation is done; just get the contents + copyTransformedContents(file, transformedContents, !verifyOnly); }); if (filesWereTransformed) { From 7fe8f260fc1edd5b5ba616d557442329d6cd76c4 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 11:03:22 -0700 Subject: [PATCH 045/115] minor cleanup, clarify var names, add @todos --- src/docs.mts | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 877f7a022..738e4c9c9 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -20,13 +20,18 @@ * docs --git * If the --git option is used, the command `git add docs` will be run after all transformations (and/or verifications) have completed successfully * If not files were transformed, the git command is not run. + * + * @todo Ensure that the documentation source and final paths are correct by using process.cwd() to + * get their absolute paths. Ensures that the location of those 2 directories is not dependent on + * where this file resides. + * + * @todo Write a test file for this. (Will need to be able to deal with globby. Jest has trouble with it. */ import { remark } from 'remark'; import type { Code, Root } from 'mdast'; import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; import { JSDOM } from 'jsdom'; - // @ts-ignore import flatmap from 'unist-util-flatmap'; import { globby } from 'globby'; @@ -35,36 +40,35 @@ import { exec } from 'child_process'; // @ts-ignore import prettier from 'prettier'; -const SOURCE_DOCS_DIR = 'src/docs/'; -const FINAL_DOCS_DIR = 'docs/'; -const AUTOGENERATED_TEXT = - '# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in ${SOURCE_DOCS_DIR}.'; +const SOURCE_DOCS_DIR = 'src/docs'; +const FINAL_DOCS_DIR = 'docs'; + +const AUTOGENERATED_TEXT = `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in ${SOURCE_DOCS_DIR}.`; const LOGMSG_TRANSFORMED = 'transformed'; const LOGMSG_TO_BE_TRANSFORMED = 'to be transformed'; -const LOGMSG_COPIED = ' ...and copied to ${FINAL_DOCS_DIR}'; +const LOGMSG_COPIED = ` ...and copied to ${FINAL_DOCS_DIR}`; -const WARN_DOCSDIR_DOESNT_MATCH = - "Changed files were transformed in `${SOURCE_DOCS_DIR}` but do not match the files in `${FINAL_DOCS_DIR}`. Please run `yarn docs:build` after making changes to '${SOURCE_DOCS_DIR}' to update the `${FINAL_DOCS_DIR}` directory with the transformed files."; +const WARN_DOCSDIR_DOESNT_MATCH = `Changed files were transformed in ${SOURCE_DOCS_DIR} but do not match the files in ${FINAL_DOCS_DIR}. Please run yarn docs:build after making changes to ${SOURCE_DOCS_DIR} to update the ${FINAL_DOCS_DIR} directory with the transformed files.`; -const verifyOnly = process.argv.includes('--verify'); -const git = process.argv.includes('--git'); +const verifyOnly: boolean = process.argv.includes('--verify'); +const git: boolean = process.argv.includes('--git'); let filesWereTransformed = false; /** * Given a source file name and path, return the documentation destination full path and file name - * Create the destination path if it does not already exist. Possible Improvement: combine with - * lint-staged to only copy files that have changed + * Create the destination path if it does not already exist. * * @param {string} file - Name of the file (including full path) * @returns {string} Name of the file with the path changed from the source directory to final * documentation directory + * @todo Possible Improvement: combine with lint-staged to only copy files that have changed */ -const prepareOutFile = (file: string): string => { - const outFile = join(FINAL_DOCS_DIR, file.replace(SOURCE_DOCS_DIR, '')); - mkdirSync(dirname(outFile), { recursive: true }); - return outFile; +const changeToFinalDocDir = (file: string): string => { + const newDir = file.replace(SOURCE_DOCS_DIR, FINAL_DOCS_DIR); + mkdirSync(dirname(newDir), { recursive: true }); + return newDir; }; /** @@ -100,8 +104,10 @@ const copyTransformedContents = ( transformedContent?: string, doCopy: boolean = false ) => { - const outFile = prepareOutFile(file); - const existingBuffer = existsSync(outFile) ? readFileSync(outFile) : Buffer.from('#NEW FILE#'); + const fileInFinalDocDir = changeToFinalDocDir(file); + const existingBuffer = existsSync(fileInFinalDocDir) + ? readFileSync(fileInFinalDocDir) + : Buffer.from('#NEW FILE#'); const newBuffer = transformedContent ? Buffer.from(transformedContent) : readFileSync(file); if (existingBuffer.equals(newBuffer)) { return; // Files are same, skip. @@ -109,7 +115,7 @@ const copyTransformedContents = ( filesWereTransformed = true; if (doCopy) { - writeFileSync(outFile, newBuffer); + writeFileSync(fileInFinalDocDir, newBuffer); } logWasOrShouldBeTransformed(fileInFinalDocDir, doCopy); }; @@ -185,7 +191,7 @@ const transformHtml = (filename: string) => { }; const transformedHTML = insertAutoGeneratedComment(filename); - copyTransformedContents(filename, transformedHTML); + copyTransformedContents(filename, transformedHTML, !verifyOnly); }; /** Main method (entry point) */ From d18624bbe97f26696c8399a959c5210b049b6bfb Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 16:54:31 -0700 Subject: [PATCH 046/115] change references from /docs to /src/docs; rework doc section in CONTRIBUTING --- CONTRIBUTING.md | 34 +++++++++++++++++++++++++++------- docs/development.md | 14 +++++++------- docs/mindmap.md | 10 +++++----- src/docs/development.md | 14 +++++++------- src/docs/mindmap.md | 10 +++++----- 5 files changed, 51 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb7f3bf5a..1d65e93f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,8 +20,8 @@ yarn test We make all changes via pull requests. As we have many pull requests from developers new to mermaid, the current approach is to have _knsv, Knut Sveidqvist_ as a main reviewer of changes and merging pull requests. More precisely like this: - Large changes reviewed by knsv or other developer asked to review by knsv -- Smaller low-risk changes like dependencies, documentation etc can be merged by active collaborators -- documentation (updates to the docs folder is also allowed via direct commits) +- Smaller low-risk changes like dependencies, documentation, etc. can be merged by active collaborators +- Documentation (updates to the `src/docs` folder is also allowed via direct commits) To commit code, create a branch, let it start with the type like feature or bug followed by the issue number for reference and some describing text. @@ -37,12 +37,28 @@ Another: Less strict here, it is OK to commit directly in the `develop` branch if you are a collaborator. -The documentation is located in the `docs` directory and published using GitHub Pages. -The documentation site is powered by [Docsify](https://docsify.js.org), a simple documentation site generator. +The documentation is written in **Markdown**. For more information about Markdown [see the GitHub Markdown help page](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax). -The documentation is written in Markdown, for more information about Markdown [see the GitHub Markdown help page](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax). +### Documentation source files are in /src/docs -If you want to preview the documentation site on your machine, you need to install `docsify-cli`: +The source files for the project documentation are located in the `/src/docs` directory. This is where you should make changes. +The files under `/src/docs` are processed to generate the published documentation, and the resulting files are put into the `/docs` directory. + +```mermaid +flowchart LR + classDef default fill:#fff,color:black,stroke:black + + source["files in /src/docs\n(changes should be done here)"] -- automatic processing\nto generate the final documentation--> published["files in /docs\ndisplayed on the official documentation site"] + +``` + +**_DO NOT CHANGE FILES IN `/docs`_** + +### The official documentation site + +**[The mermaid documentation site](https://mermaid-js.github.io/mermaid/) is powered by [Docsify](https://docsify.js.org), a simple documentation site generator.** + +If you want to preview the whole documentation site on your machine, you need to install `docsify-cli`: ```sh $ npm i docsify-cli -g @@ -121,7 +137,11 @@ it('should render forks and joins', () => { Finally, if it is not in the documentation, no one will know about it and then **no one will use it**. Wouldn't that be sad? With all the effort that was put into the feature? -The docs are located in the docs folder and are ofc written in markdown. Just pick the right section and start typing. If you want to add to the structure as in adding a new section and new file you do that via the \_navbar.md. +The source files for documentation are in `/src/docs` and are written in markdown. Just pick the right section and start typing. See the [Committing Documentation](#committing-documentation) section for more about how the documentation is generated. + +#### Adding to or changing the documentation organization + +If you want to add a new section or change the organization (structure), then you need to make sure to **change the side navigation** in `src/docs/_sidebar.md`. The changes in master is reflected in https://mermaid-js.github.io/mermaid/ once released the updates are committed to https://mermaid-js.github.io/#/ diff --git a/docs/development.md b/docs/development.md index d5cbe891e..365f639d7 100644 --- a/docs/development.md +++ b/docs/development.md @@ -8,7 +8,7 @@ So you want to help? That's great! Here are a few things to get you started on the right path. -**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)** +**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)** **Note: Commits and Pull Requests should be directed to the develop branch.** @@ -46,9 +46,9 @@ Start with the type, such as **feature** or **bug**, followed by the issue numbe If it is not in the documentation, it's like it never happened. Wouldn't that be sad? With all the effort that was put into the feature? -The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. -> **All the documents displayed in the github.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +> **All the documents displayed in the GitHub.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. The contents of are based on the docs from the `master` branch. Updates committed to the `master` branch are reflected in the [Mermaid Docs](https://mermaid-js.github.io/mermaid/) once released. @@ -60,7 +60,7 @@ The documentation is located in the `src/docs` directory and organized according The `docs` folder will be automatically generated when committing to `src/docs` and should not be edited manually. -We encourage contributions to the documentation at [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) +We encourage contributions to the documentation at [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) ### Add Unit Tests for Parsing @@ -73,7 +73,7 @@ This tests the rendering and visual appearance of the diagrams. This ensures tha To start working with the e2e tests: 1. Run `yarn dev` to start the dev server -2. Start **Cypress** by running `cypress open` in the **mermaid** folder.\ +2. Start **Cypress** by running `cypress open` in the **mermaid** folder. (Make sure you have path to Cypress in order, the binary is located in `node_modules/.bin`). The rendering tests are very straightforward to create. There is a function `imgSnapshotTest`, which takes a diagram in text form and the mermaid options, and it renders that diagram in Cypress. @@ -114,7 +114,7 @@ Markdown is used to format the text, for more information about Markdown [see th To edit Docs on your computer: -1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs) directory in the `develop` branch. +1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs) directory in the `develop` branch. 2. Create a fork of the develop branch. 3. Make changes or add new documentation. 4. Commit changes to your fork and push it to GitHub. @@ -123,7 +123,7 @@ To edit Docs on your computer: To edit Docs on GitHub: 1. Login to [GitHub.com](https://www.github.com). -2. Navigate to [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). +2. Navigate to [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). 3. To edit a file, click the pencil icon at the top-right of the file contents panel. 4. Describe what you changed in the **Propose file change** section, located at the bottom of the page. 5. Submit your changes by clicking the button **Propose file change** at the bottom (by automatic creation of a fork and a new branch). diff --git a/docs/mindmap.md b/docs/mindmap.md index f9d732463..6ab954f5b 100644 --- a/docs/mindmap.md +++ b/docs/mindmap.md @@ -2,7 +2,7 @@ # Mindmap -**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/docs/mindmap.md) +**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/docs/mindmap.md) > Mindmap: This is an experimental diagram for now. The syntax and properties can change in future releases. The syntax is stabel except for the icon integration which is the experimental part. @@ -64,7 +64,7 @@ In the following example you can see how there are 3 dufferent levels. One with B C -In summary is is a simple text outline where there are one node at the root level called `Root` which has one child `A`. A in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. +In summary is a simple text outline where there are one node at the root level called `Root` which has one child `A`. `A` in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. ```mermaid-example mindmap @@ -168,7 +168,7 @@ More shapes will be added, beginning with the shapes available in flowcharts. ## icons -As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parethesis like in the following example where icons for material design and fontwaresome 4. is displayed. The intention is that this approach should be used for all diagrams supporting icons. **Expermental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. +As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parenthesis like in the following example where icons for material design and fontawesome 4 are displayed. The intention is that this approach should be used for all diagrams supporting icons. **Experimental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. ```mermaid-example mindmap @@ -190,7 +190,7 @@ mindmap ## Classes -Again the syntax for adding classes is similar to flowcharts and you can add classes using a tripple colon following a numver of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text whiet and large increasing the font size: +Again the syntax for adding classes is similar to flowcharts. You can add classes using a triple colon following a number of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text white and large increasing the font size: ```mermaid-example mindmap @@ -222,7 +222,7 @@ The actual indentation does not really matter only compared with the previous ro B C -This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a highter indentation nor does ot haver the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as sieblings. +This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a higher indentation nor does it have the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as siblings. ```mermaid-example mindmap diff --git a/src/docs/development.md b/src/docs/development.md index 96da46c11..95e5fe417 100644 --- a/src/docs/development.md +++ b/src/docs/development.md @@ -6,7 +6,7 @@ So you want to help? That's great! Here are a few things to get you started on the right path. -**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)** +**The Docs Structure is dictated by [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)** **Note: Commits and Pull Requests should be directed to the develop branch.** @@ -44,9 +44,9 @@ Start with the type, such as **feature** or **bug**, followed by the issue numbe If it is not in the documentation, it's like it never happened. Wouldn't that be sad? With all the effort that was put into the feature? -The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +The docs are located in the `src/docs` folder and are written in Markdown. Just pick the right section and start typing. If you want to propose changes to the structure of the documentation, such as adding a new section or a new file you do that via the **[sidebar](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. -> **All the documents displayed in the github.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/docs/_sidebar.md)**. +> **All the documents displayed in the GitHub.io page are listed in [sidebar.md](https://github.com/mermaid-js/mermaid/edit/develop/src/docs/_sidebar.md)**. The contents of [https://mermaid-js.github.io/mermaid/](https://mermaid-js.github.io/mermaid/) are based on the docs from the `master` branch. Updates committed to the `master` branch are reflected in the [Mermaid Docs](https://mermaid-js.github.io/mermaid/) once released. @@ -58,7 +58,7 @@ The documentation is located in the `src/docs` directory and organized according The `docs` folder will be automatically generated when committing to `src/docs` and should not be edited manually. -We encourage contributions to the documentation at [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) +We encourage contributions to the documentation at [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). We publish documentation using GitHub Pages with [Docsify](https://www.youtube.com/watch?v=TV88lp7egMw&t=3s) ### Add Unit Tests for Parsing @@ -71,7 +71,7 @@ This tests the rendering and visual appearance of the diagrams. This ensures tha To start working with the e2e tests: 1. Run `yarn dev` to start the dev server -2. Start **Cypress** by running `cypress open` in the **mermaid** folder. +2. Start **Cypress** by running `cypress open` in the **mermaid** folder. (Make sure you have path to Cypress in order, the binary is located in `node_modules/.bin`). The rendering tests are very straightforward to create. There is a function `imgSnapshotTest`, which takes a diagram in text form and the mermaid options, and it renders that diagram in Cypress. @@ -112,7 +112,7 @@ Markdown is used to format the text, for more information about Markdown [see th To edit Docs on your computer: -1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs) directory in the `develop` branch. +1. Find the Markdown file (.md) to edit in the [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs) directory in the `develop` branch. 2. Create a fork of the develop branch. 3. Make changes or add new documentation. 4. Commit changes to your fork and push it to GitHub. @@ -121,7 +121,7 @@ To edit Docs on your computer: To edit Docs on GitHub: 1. Login to [GitHub.com](https://www.github.com). -2. Navigate to [mermaid-js/mermaid/docs](https://github.com/mermaid-js/mermaid/tree/develop/docs). +2. Navigate to [mermaid-js/mermaid/src/docs](https://github.com/mermaid-js/mermaid/tree/develop/src/docs). 3. To edit a file, click the pencil icon at the top-right of the file contents panel. 4. Describe what you changed in the **Propose file change** section, located at the bottom of the page. 5. Submit your changes by clicking the button **Propose file change** at the bottom (by automatic creation of a fork and a new branch). diff --git a/src/docs/mindmap.md b/src/docs/mindmap.md index 141808514..d7f1b4817 100644 --- a/src/docs/mindmap.md +++ b/src/docs/mindmap.md @@ -1,6 +1,6 @@ # Mindmap -**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/docs/mindmap.md) +**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/docs/mindmap.md) > Mindmap: This is an experimental diagram for now. The syntax and properties can change in future releases. The syntax is stabel except for the icon integration which is the experimental part. @@ -43,7 +43,7 @@ mindmap C ``` -In summary is is a simple text outline where there are one node at the root level called `Root` which has one child `A`. A in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. +In summary is a simple text outline where there are one node at the root level called `Root` which has one child `A`. `A` in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap. ```mermaid mindmap @@ -109,7 +109,7 @@ More shapes will be added, beginning with the shapes available in flowcharts. ## icons -As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parethesis like in the following example where icons for material design and fontwaresome 4. is displayed. The intention is that this approach should be used for all diagrams supporting icons. **Expermental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. +As with flowcharts you can add icons to your nodes but with an updated syntax. The styling for the font based icons are added during the integration so that they are available for the web page. _This is not something a diagram author can do but has to be done with the site administrator or the integrator_. Once the icon fonts are in place you add them to the mind map nodes using the `::icon()` syntax. You place the classes for the icon within the parenthesis like in the following example where icons for material design and fontawesome 4 are displayed. The intention is that this approach should be used for all diagrams supporting icons. **Experimental feature:** This wider scope is also the reason Mindmaps are experimental as this syntax and approach could change. ```mermaid-example mindmap @@ -122,7 +122,7 @@ mindmap ## Classes -Again the syntax for adding classes is similar to flowcharts and you can add classes using a tripple colon following a numver of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text whiet and large increasing the font size: +Again the syntax for adding classes is similar to flowcharts. You can add classes using a triple colon following a number of css classes separated by space. In the following example one of the nodes has two custom classes attached urgent turning the background red and the text white and large increasing the font size: ```mermaid-example mindmap @@ -147,7 +147,7 @@ mindmap C ``` -This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a highter indentation nor does ot haver the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as sieblings. +This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a higher indentation nor does it have the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as siblings. ```mermaid mindmap From be28160a4a9386246e487c6ba8c0c7170450b460 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 5 Sep 2022 17:01:03 -0700 Subject: [PATCH 047/115] unmangle sentence about doc changes committed and showing up on docsify site --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d65e93f2..1d55fe3b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -143,7 +143,8 @@ The source files for documentation are in `/src/docs` and are written in markdow If you want to add a new section or change the organization (structure), then you need to make sure to **change the side navigation** in `src/docs/_sidebar.md`. -The changes in master is reflected in https://mermaid-js.github.io/mermaid/ once released the updates are committed to https://mermaid-js.github.io/#/ + +When changes are committed and then released, they become part of the `master` branch and become part of the published documentation on https://mermaid-js.github.io/mermaid/ ## Last words From e690da638dc6467e93db5687aa0413d3eaeaea3d Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 06:40:26 -0700 Subject: [PATCH 048/115] (formatting) prettier fix --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d55fe3b3..8171aeca9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -143,7 +143,6 @@ The source files for documentation are in `/src/docs` and are written in markdow If you want to add a new section or change the organization (structure), then you need to make sure to **change the side navigation** in `src/docs/_sidebar.md`. - When changes are committed and then released, they become part of the `master` branch and become part of the published documentation on https://mermaid-js.github.io/mermaid/ ## Last words From 5f81e3d5ed4123a562651bd66831365c6648e56a Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 20:51:46 +0530 Subject: [PATCH 049/115] chore: Run postbuild with prepare As postbuild was not running with prepare, PR that updated `documentation` package was green, although it should've failed. --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index cacde6635..163e509bd 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,11 @@ "build": "concurrently \"yarn build:dev\" \"yarn build:prod\"", "docs:build": "ts-node-esm src/docs.mts", "docs:verify": "ts-node-esm src/docs.mts --verify", - "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md; yarn docs:build", + "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md && prettier --write src/docs/Setup.md && yarn docs:build", "build:watch": "yarn build:dev --watch", "release": "yarn build", - "lint": "eslint --cache --ignore-path .gitignore .; prettier --check .", - "lint:fix": "eslint --fix --ignore-path .gitignore .; prettier --write .", + "lint": "eslint --cache --ignore-path .gitignore . && prettier --check .", + "lint:fix": "eslint --fix --ignore-path .gitignore . && prettier --write .", "e2e:depr": "yarn lint && jest e2e --config e2e/jest.config.js", "cypress": "cypress run", "cypress:open": "cypress open", @@ -43,7 +43,7 @@ "test": "yarn lint && jest src/.*", "test:watch": "jest --watch src", "prepublishOnly": "yarn build && yarn test", - "prepare": "concurrently \"husky install\" \"yarn build:prod\"", + "prepare": "concurrently \"husky install\" \"yarn build:prod\" \"yarn postbuild\"", "pre-commit": "lint-staged" }, "repository": { From a800cb6fe62aa5fb7781cd8f40721acb4ea8d641 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 20:54:19 +0530 Subject: [PATCH 050/115] Update prettier --- package.json | 4 ++-- yarn.lock | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 163e509bd..a791f0574 100644 --- a/package.json +++ b/package.json @@ -115,8 +115,8 @@ "lint-staged": "^13.0.0", "moment": "^2.23.0", "path-browserify": "^1.0.1", - "prettier": "^2.3.2", - "prettier-plugin-jsdoc": "^0.3.30", + "prettier": "^2.7.1", + "prettier-plugin-jsdoc": "^0.4.2", "remark": "^14.0.2", "start-server-and-test": "^1.12.6", "terser-webpack-plugin": "^5.3.6", diff --git a/yarn.lock b/yarn.lock index 2834342ca..58c3d2818 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9873,16 +9873,16 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier-plugin-jsdoc@^0.3.30: - version "0.3.38" - resolved "https://registry.yarnpkg.com/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-0.3.38.tgz#b8adbe9efc1dc11f3cc5ff0b07e0233a0fdf533d" - integrity sha512-h81ZV/nFk5gr3fzWMWzWoz/M/8FneAZxscT7DVSy+5jMIuWYnBFZfSswVKYZyTaZ5r6+6k4hpFTDWhRp85C1tg== +prettier-plugin-jsdoc@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-0.4.2.tgz#c5668fc622ed10b87d988279476f96af96b058b7" + integrity sha512-w2jnAQm3z0GAG0bhzVJeehzDtrhGMSxJjit5ApCc2oxWfc7+jmLAkbtdOXaSpfwZz3IWkk+PiQPeRrLNpbM+Mw== dependencies: binary-searching "^2.0.5" comment-parser "^1.3.1" mdast-util-from-markdown "^1.2.0" -prettier@^2.3.2: +prettier@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== From 6376c9ae43420aa5a6c95a66ceac776e9496fe88 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 14:15:09 -0700 Subject: [PATCH 051/115] switch order of params so the last one can be omitted --- src/docs.mts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 738e4c9c9..cf5f54ae9 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -100,9 +100,9 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => { * documentation directory. Default is `false` */ const copyTransformedContents = ( - file: string, - transformedContent?: string, - doCopy: boolean = false + filename: string, + doCopy: boolean = false, + transformedContent?: string ) => { const fileInFinalDocDir = changeToFinalDocDir(file); const existingBuffer = existsSync(fileInFinalDocDir) @@ -152,6 +152,7 @@ const transformMarkdown = (file: string) => { copyTransformedContents( file, + !verifyOnly, prettier.format(transformed, { parser: 'markdown', useTabs: false, @@ -159,8 +160,7 @@ const transformMarkdown = (file: string) => { endOfLine: 'auto', printWidth: 100, singleQuote: true, - }), - !verifyOnly + }) ); }; @@ -191,7 +191,7 @@ const transformHtml = (filename: string) => { }; const transformedHTML = insertAutoGeneratedComment(filename); - copyTransformedContents(filename, transformedHTML, !verifyOnly); + copyTransformedContents(filename, !verifyOnly, transformedHTML); }; /** Main method (entry point) */ @@ -214,8 +214,7 @@ const transformHtml = (filename: string) => { dot: includeFilesStartingWithDot, }); otherFiles.forEach((file: string) => { - const transformedContents = readSyncedUTF8file(file); // no transformation is done; just get the contents - copyTransformedContents(file, transformedContents, !verifyOnly); + copyTransformedContents(file, !verifyOnly); // no transformation }); if (filesWereTransformed) { From fd567f833e76fd4ce4f9155ec0f781ba6c42158d Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Wed, 7 Sep 2022 14:15:54 -0700 Subject: [PATCH 052/115] (minor) clarify var names (file -> filename); comments --- src/docs.mts | 50 +++++++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index cf5f54ae9..0c62ea278 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,9 +1,8 @@ /** - * @file Transform documentation source files into files suitable for publishing and optionally copy - * the transformed files from the source directory to the directory used for the final, published - * documentation directory. The list of files transformed and copied to final documentation - * directory are logged to the console. If a file in the source directory has the same contents in - * the final directory, nothing is done (the final directory is up-to-date). + * @file Transform documentation source files into files suitable for publishing and optionally copy the transformed files from the source directory + * to the directory used for the final, published documentation directory. The list of files transformed and copied to final documentation directory + * are logged to the console. If a file in the source directory has the same contents in the final directory, nothing is done (the final directory + * is up-to-date). * @example * docs * Run with no option flags @@ -21,11 +20,10 @@ * If the --git option is used, the command `git add docs` will be run after all transformations (and/or verifications) have completed successfully * If not files were transformed, the git command is not run. * - * @todo Ensure that the documentation source and final paths are correct by using process.cwd() to - * get their absolute paths. Ensures that the location of those 2 directories is not dependent on - * where this file resides. + * @todo Ensure that the documentation source and final paths are correct by using process.cwd() to get their absolute paths. Ensures that the + * location of those 2 directories is not dependent on where this file resides. * - * @todo Write a test file for this. (Will need to be able to deal with globby. Jest has trouble with it. + * @todo Write a test file for this. (Will need to be able to deal .mts file. Jest has trouble with it.) */ import { remark } from 'remark'; @@ -57,12 +55,10 @@ const git: boolean = process.argv.includes('--git'); let filesWereTransformed = false; /** - * Given a source file name and path, return the documentation destination full path and file name - * Create the destination path if it does not already exist. + * Given a source file name and path, return the documentation destination full path and file name Create the destination path if it does not already exist. * * @param {string} file - Name of the file (including full path) - * @returns {string} Name of the file with the path changed from the source directory to final - * documentation directory + * @returns {string} Name of the file with the path changed from the source directory to final documentation directory * @todo Possible Improvement: combine with lint-staged to only copy files that have changed */ const changeToFinalDocDir = (file: string): string => { @@ -72,8 +68,7 @@ const changeToFinalDocDir = (file: string): string => { }; /** - * Log messages to the console showing if the transformed file copied to the final documentation - * directory or still needs to be copied. + * Log messages to the console showing if the transformed file copied to the final documentation directory or still needs to be copied. * * @param {string} filename Name of the file that was transformed * @param {boolean} wasCopied Whether or not the file was copied @@ -90,25 +85,23 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => { }; /** - * If the file contents were transformed, set the _filesWereTransformed_ flag to true and copy the - * transformed contents to the final documentation directory if the doCopy flag is true. Log - * messages to the console. + * If the file contents were transformed, set the _filesWereTransformed_ flag to true and copy the transformed contents to the final documentation + * directory if the doCopy flag is true. Log messages to the console. * - * @param {string} file Name of the file that will be verified + * @param {string} filename Name of the file that will be verified * @param {string} [transformedContent] New contents for the file - * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final - * documentation directory. Default is `false` + * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final documentation directory. Default is `false` */ const copyTransformedContents = ( filename: string, doCopy: boolean = false, transformedContent?: string ) => { - const fileInFinalDocDir = changeToFinalDocDir(file); + const fileInFinalDocDir = changeToFinalDocDir(filename); const existingBuffer = existsSync(fileInFinalDocDir) ? readFileSync(fileInFinalDocDir) : Buffer.from('#NEW FILE#'); - const newBuffer = transformedContent ? Buffer.from(transformedContent) : readFileSync(file); + const newBuffer = transformedContent ? Buffer.from(transformedContent) : readFileSync(filename); if (existingBuffer.equals(newBuffer)) { return; // Files are same, skip. } @@ -120,15 +113,15 @@ const copyTransformedContents = ( logWasOrShouldBeTransformed(fileInFinalDocDir, doCopy); }; -const readSyncedUTF8file = (file: string): string => { - return readFileSync(file, 'utf8'); +const readSyncedUTF8file = (filename: string): string => { + return readFileSync(filename, 'utf8'); }; /** * Transform a markdown file and write the transformed file to the directory for published documentation * - * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one - * place where the documentation is published), this will show the code used for the mermaid diagram + * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one place where the documentation is published), this will + * show the code used for the mermaid diagram * 2. Add the text that says the file is automatically generated * 3. Use prettier to format the file Verify that the file has been changed and write out the changes * @@ -167,8 +160,7 @@ const transformMarkdown = (file: string) => { /** * Transform an HTML file and write the transformed file to the directory for published documentation * - * - Add the text that says the file is automatically generated Verify that the file has been changed - * and write out the changes + * - Add the text that says the file is automatically generated Verify that the file has been changed and write out the changes * * @param filename {string} name of the HTML file to transform */ From fe8f52fb1b74820906d4ad13ee3467e88cc1ceca Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Thu, 8 Sep 2022 03:35:50 +0100 Subject: [PATCH 053/115] test: disable coverage for `.jison` files Coverage for `.jison` files doesn't make sense, since most of the created JS lines are auto-generated. If jison ever adds a source-map feature, we can renable coverage for jison. --- jest.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jest.config.js b/jest.config.js index 65ea3ef58..acb5d6c5d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,6 +11,10 @@ module.exports = { { 'token-stack': true }, ], }, + coveragePathIgnorePatterns: [ + '/node_modules/', + '^.+\\.jison$', // might be able to fix in future if .jison adds source-map support + ], transformIgnorePatterns: ['/node_modules/(?!dagre-d3-renderer/lib|khroma).*\\.js'], testPathIgnorePatterns: ['/node_modules/', '.cache', './cypress'], moduleNameMapper: { From b760e717d0985d1adc19c7bd703513217f4e03c0 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Thu, 8 Sep 2022 03:38:32 +0100 Subject: [PATCH 054/115] build(dev-deps): remove unused `coveralls` This devDependency is currently unused, and seems to have been unused for a while. --- package.json | 1 - yarn.lock | 93 ++-------------------------------------------------- 2 files changed, 2 insertions(+), 92 deletions(-) diff --git a/package.json b/package.json index a791f0574..fec1c6c48 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,6 @@ "babel-jest": "^29.0.2", "babel-loader": "^8.2.2", "concurrently": "^7.0.0", - "coveralls": "^3.0.2", "css-to-string-loader": "^0.1.3", "cypress": "9.7.0", "cypress-image-snapshot": "^4.0.1", diff --git a/yarn.lock b/yarn.lock index 58c3d2818..93968e5c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3245,7 +3245,7 @@ ajv-keywords@^5.0.0: dependencies: fast-deep-equal "^3.1.3" -ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5: +ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -4622,17 +4622,6 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -coveralls@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.1.1.tgz#f5d4431d8b5ae69c5079c8f8ca00d64ac77cf081" - integrity sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww== - dependencies: - js-yaml "^3.13.1" - lcov-parse "^1.0.0" - log-driver "^1.2.7" - minimist "^1.2.5" - request "^2.88.2" - create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -6697,19 +6686,6 @@ handlebars@^4.7.6: optionalDependencies: uglify-js "^3.1.4" -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" @@ -6972,15 +6948,6 @@ http-proxy@^1.18.1: follow-redirects "^1.0.0" requires-port "^1.0.0" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - http-signature@~1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9" @@ -8205,16 +8172,6 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - jsprim@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d" @@ -8297,11 +8254,6 @@ lazystream@^1.0.0: dependencies: readable-stream "^2.0.5" -lcov-parse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" - integrity sha1-6w1GtUER68VhrLTECO+TY73I9+A= - lead@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lead/-/lead-1.0.0.tgz#6f14f99a37be3a9dd784f5495690e5903466ee42" @@ -8491,11 +8443,6 @@ lodash@^4.17.10, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-driver@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" - integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== - log-symbols@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" @@ -9324,11 +9271,6 @@ nwsapi@^2.2.0: resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -10464,32 +10406,6 @@ request-progress@^3.0.0: dependencies: throttleit "^1.0.0" -request@^2.88.2: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -11124,7 +11040,7 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -sshpk@^1.14.1, sshpk@^1.7.0: +sshpk@^1.14.1: version "1.16.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== @@ -12080,11 +11996,6 @@ uuid@8.3.2, uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - uvu@^0.5.0: version "0.5.3" resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.3.tgz#3d83c5bc1230f153451877bfc7f4aea2392219ae" From 5d7258570523c02f82ffab3fd77e9cfda5215a17 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Thu, 8 Sep 2022 03:51:42 +0100 Subject: [PATCH 055/115] ci: re-enable coveralls coverage upload Reverts commits: - Disabling coveralls temporarilly https://github.com/mermaid-js/mermaid/commit/aedf0663379dc4d03e898b39874fc0686bfd8697 - Tmo disabling of coveralls https://github.com/mermaid-js/mermaid/commit/a6b4cb24b8208f661bae838489059296a0ec07e4 I'm not 100% sure whether the `parallel` option is needed, but I've left it disabled for now, since it'd would mean that we need to merge both the `test.yml` and the `e2e.yml` file together. --- .github/workflows/e2e | 6 ++++++ .github/workflows/test.yml | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/e2e b/.github/workflows/e2e index 5b716e429..338869490 100644 --- a/.github/workflows/e2e +++ b/.github/workflows/e2e @@ -36,3 +36,9 @@ jobs: run: yarn e2e env: CYPRESS_CACHE_FOLDER: .cache/Cypress + + - name: Upload Coverage to Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: e2e diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97aa0a377..08c35befa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,3 +32,12 @@ jobs: - name: Run Unit Tests run: | yarn ci --coverage + + - name: Upload Coverage to Coveralls + # it feels a bit weird to use @master, but that's what the docs use + # (coveralls also doesn't publish a @v1 we can use) + # https://github.com/marketplace/actions/coveralls-github-action + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: unit From 9acf63f7d6656877784a57f37aa9329a8f088b2d Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Thu, 8 Sep 2022 07:44:36 -0700 Subject: [PATCH 056/115] (formatting only) sort imports just to force a new CI lint check --- src/docs.mts | 63 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 0c62ea278..fe1922bdb 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,8 +1,9 @@ /** - * @file Transform documentation source files into files suitable for publishing and optionally copy the transformed files from the source directory - * to the directory used for the final, published documentation directory. The list of files transformed and copied to final documentation directory - * are logged to the console. If a file in the source directory has the same contents in the final directory, nothing is done (the final directory - * is up-to-date). + * @file Transform documentation source files into files suitable for publishing and optionally copy + * the transformed files from the source directory to the directory used for the final, published + * documentation directory. The list of files transformed and copied to final documentation + * directory are logged to the console. If a file in the source directory has the same contents in + * the final directory, nothing is done (the final directory is up-to-date). * @example * docs * Run with no option flags @@ -20,23 +21,24 @@ * If the --git option is used, the command `git add docs` will be run after all transformations (and/or verifications) have completed successfully * If not files were transformed, the git command is not run. * - * @todo Ensure that the documentation source and final paths are correct by using process.cwd() to get their absolute paths. Ensures that the - * location of those 2 directories is not dependent on where this file resides. + * @todo Ensure that the documentation source and final paths are correct by using process.cwd() to + * get their absolute paths. Ensures that the location of those 2 directories is not dependent on + * where this file resides. * - * @todo Write a test file for this. (Will need to be able to deal .mts file. Jest has trouble with it.) + * @todo Write a test file for this. (Will need to be able to deal .mts file. Jest has trouble with + * it.) */ - -import { remark } from 'remark'; -import type { Code, Root } from 'mdast'; import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; -import { JSDOM } from 'jsdom'; -// @ts-ignore -import flatmap from 'unist-util-flatmap'; -import { globby } from 'globby'; -import { join, dirname } from 'path'; import { exec } from 'child_process'; +import { globby } from 'globby'; +import { JSDOM } from 'jsdom'; +import type { Code, Root } from 'mdast'; +import { join, dirname } from 'path'; // @ts-ignore import prettier from 'prettier'; +import { remark } from 'remark'; +// @ts-ignore +import flatmap from 'unist-util-flatmap'; const SOURCE_DOCS_DIR = 'src/docs'; const FINAL_DOCS_DIR = 'docs'; @@ -55,10 +57,12 @@ const git: boolean = process.argv.includes('--git'); let filesWereTransformed = false; /** - * Given a source file name and path, return the documentation destination full path and file name Create the destination path if it does not already exist. + * Given a source file name and path, return the documentation destination full path and file name + * Create the destination path if it does not already exist. * * @param {string} file - Name of the file (including full path) - * @returns {string} Name of the file with the path changed from the source directory to final documentation directory + * @returns {string} Name of the file with the path changed from the source directory to final + * documentation directory * @todo Possible Improvement: combine with lint-staged to only copy files that have changed */ const changeToFinalDocDir = (file: string): string => { @@ -68,7 +72,8 @@ const changeToFinalDocDir = (file: string): string => { }; /** - * Log messages to the console showing if the transformed file copied to the final documentation directory or still needs to be copied. + * Log messages to the console showing if the transformed file copied to the final documentation + * directory or still needs to be copied. * * @param {string} filename Name of the file that was transformed * @param {boolean} wasCopied Whether or not the file was copied @@ -85,12 +90,14 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => { }; /** - * If the file contents were transformed, set the _filesWereTransformed_ flag to true and copy the transformed contents to the final documentation - * directory if the doCopy flag is true. Log messages to the console. + * If the file contents were transformed, set the _filesWereTransformed_ flag to true and copy the + * transformed contents to the final documentation directory if the doCopy flag is true. Log + * messages to the console. * * @param {string} filename Name of the file that will be verified * @param {string} [transformedContent] New contents for the file - * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final documentation directory. Default is `false` + * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final + * documentation directory. Default is `false` */ const copyTransformedContents = ( filename: string, @@ -118,10 +125,12 @@ const readSyncedUTF8file = (filename: string): string => { }; /** - * Transform a markdown file and write the transformed file to the directory for published documentation + * Transform a markdown file and write the transformed file to the directory for published + * documentation * - * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one place where the documentation is published), this will - * show the code used for the mermaid diagram + * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one + * place where the documentation is published), this will show the code used for the mermaid + * diagram * 2. Add the text that says the file is automatically generated * 3. Use prettier to format the file Verify that the file has been changed and write out the changes * @@ -158,9 +167,11 @@ const transformMarkdown = (file: string) => { }; /** - * Transform an HTML file and write the transformed file to the directory for published documentation + * Transform an HTML file and write the transformed file to the directory for published + * documentation * - * - Add the text that says the file is automatically generated Verify that the file has been changed and write out the changes + * - Add the text that says the file is automatically generated Verify that the file has been changed + * and write out the changes * * @param filename {string} name of the HTML file to transform */ From 2826bf6823e1270ff0d8d1b45395cce521f80e6c Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 8 Sep 2022 21:51:42 +0530 Subject: [PATCH 057/115] fix: Formatting issue --- src/docs.mts | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index fe1922bdb..dfd6a761f 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -54,6 +54,15 @@ const WARN_DOCSDIR_DOESNT_MATCH = `Changed files were transformed in ${SOURCE_DO const verifyOnly: boolean = process.argv.includes('--verify'); const git: boolean = process.argv.includes('--git'); +// TODO: Read from .prettierrc? +const prettierConfig: prettier.Config = { + useTabs: false, + tabWidth: 2, + endOfLine: 'auto', + printWidth: 100, + singleQuote: true, +}; + let filesWereTransformed = false; /** @@ -151,19 +160,11 @@ const transformMarkdown = (file: string) => { // Add the AUTOGENERATED_TEXT to the start of the file const transformed = `${AUTOGENERATED_TEXT}\n${remark.stringify(out)}`; - - copyTransformedContents( - file, - !verifyOnly, - prettier.format(transformed, { - parser: 'markdown', - useTabs: false, - tabWidth: 2, - endOfLine: 'auto', - printWidth: 100, - singleQuote: true, - }) - ); + const formatted = prettier.format(transformed, { + parser: 'markdown', + ...prettierConfig, + }); + copyTransformedContents(file, !verifyOnly, formatted); }; /** @@ -194,7 +195,11 @@ const transformHtml = (filename: string) => { }; const transformedHTML = insertAutoGeneratedComment(filename); - copyTransformedContents(filename, !verifyOnly, transformedHTML); + const formattedHTML = prettier.format(transformedHTML, { + parser: 'html', + ...prettierConfig, + }); + copyTransformedContents(filename, !verifyOnly, formattedHTML); }; /** Main method (entry point) */ From b0559df9033f120bd2b5e150a99db635a7900902 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 8 Sep 2022 21:52:31 +0530 Subject: [PATCH 058/115] chore: Updated doc files --- docs/8.6.0_docs.md | 2 +- docs/CHANGELOG.md | 2 +- docs/Configuration.md | 2 +- docs/README.md | 2 +- docs/SUMMARY.md | 2 +- docs/Setup.md | 2 +- docs/Tutorials.md | 2 +- docs/_navbar.md | 2 +- docs/_sidebar.md | 2 +- docs/accessibility.md | 2 +- docs/breakingChanges.md | 2 +- docs/c4c.md | 2 +- docs/classDiagram.md | 2 +- docs/developer-docs/configuration.md | 2 +- docs/development.md | 2 +- docs/diagrams-and-syntax-and-examples/flowchart.md | 2 +- docs/directives.md | 2 +- docs/entityRelationshipDiagram.md | 2 +- docs/examples.md | 2 +- docs/faq.md | 2 +- docs/flowchart.md | 2 +- docs/gantt.md | 2 +- docs/gitgraph.md | 2 +- docs/index.html | 2 +- docs/integrations.md | 2 +- docs/introduction.md | 2 +- docs/landing/index.html | 6 +++--- docs/mermaidCLI.md | 2 +- docs/mindmap.md | 2 +- docs/n00b-advanced.md | 2 +- docs/n00b-gettingStarted.md | 2 +- docs/n00b-overview.md | 2 +- docs/n00b-syntaxReference.md | 2 +- docs/newDiagram.md | 2 +- docs/pie.md | 2 +- docs/requirementDiagram.md | 2 +- docs/security.md | 2 +- docs/sequenceDiagram.md | 2 +- docs/stateDiagram.md | 2 +- docs/theming.md | 2 +- docs/upgrading.md | 2 +- docs/usage.md | 2 +- docs/user-journey.md | 2 +- 43 files changed, 45 insertions(+), 45 deletions(-) diff --git a/docs/8.6.0_docs.md b/docs/8.6.0_docs.md index b532a1c94..9cced28ca 100644 --- a/docs/8.6.0_docs.md +++ b/docs/8.6.0_docs.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Version 8.6.0 Changes diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d676920b7..20f7afe3a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Change Log diff --git a/docs/Configuration.md b/docs/Configuration.md index 0df2de104..1cbaa228f 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Configuration diff --git a/docs/README.md b/docs/README.md index 9e149dfdb..e22276488 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # About Mermaid diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 0d32a7010..1b6153b89 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Summary diff --git a/docs/Setup.md b/docs/Setup.md index 1f948ee01..e02cc1561 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. diff --git a/docs/Tutorials.md b/docs/Tutorials.md index 0211d35d0..0eac9ccfe 100644 --- a/docs/Tutorials.md +++ b/docs/Tutorials.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Tutorials diff --git a/docs/_navbar.md b/docs/_navbar.md index 6ec266461..222926fc4 100644 --- a/docs/_navbar.md +++ b/docs/_navbar.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. - Getting started diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 40e46d835..a97bd8d72 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. - 📔 Introduction diff --git a/docs/accessibility.md b/docs/accessibility.md index 820fe364a..70ebef9d1 100644 --- a/docs/accessibility.md +++ b/docs/accessibility.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Accessibility Options diff --git a/docs/breakingChanges.md b/docs/breakingChanges.md index f5bb4ddb3..01088b9dc 100644 --- a/docs/breakingChanges.md +++ b/docs/breakingChanges.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Breaking changes diff --git a/docs/c4c.md b/docs/c4c.md index 1b4251785..48688f1a0 100644 --- a/docs/c4c.md +++ b/docs/c4c.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # C4 Diagrams diff --git a/docs/classDiagram.md b/docs/classDiagram.md index 1576aaa17..6c9ae96fe 100644 --- a/docs/classDiagram.md +++ b/docs/classDiagram.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Class diagrams diff --git a/docs/developer-docs/configuration.md b/docs/developer-docs/configuration.md index a10954416..e764e200a 100644 --- a/docs/developer-docs/configuration.md +++ b/docs/developer-docs/configuration.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Configuration diff --git a/docs/development.md b/docs/development.md index 365f639d7..70762be86 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Development and Contribution 🙌 diff --git a/docs/diagrams-and-syntax-and-examples/flowchart.md b/docs/diagrams-and-syntax-and-examples/flowchart.md index 3aef42ef7..0f798d27f 100644 --- a/docs/diagrams-and-syntax-and-examples/flowchart.md +++ b/docs/diagrams-and-syntax-and-examples/flowchart.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. --- diff --git a/docs/directives.md b/docs/directives.md index 943dac53f..8ef732008 100644 --- a/docs/directives.md +++ b/docs/directives.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Directives diff --git a/docs/entityRelationshipDiagram.md b/docs/entityRelationshipDiagram.md index 34e6a3ac6..1f24796b6 100644 --- a/docs/entityRelationshipDiagram.md +++ b/docs/entityRelationshipDiagram.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Entity Relationship Diagrams diff --git a/docs/examples.md b/docs/examples.md index 174a2c986..d717083c6 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Examples diff --git a/docs/faq.md b/docs/faq.md index a1b6e4837..ac5eeeb80 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Frequently Asked Questions diff --git a/docs/flowchart.md b/docs/flowchart.md index 4d469f55e..3ff17ad02 100644 --- a/docs/flowchart.md +++ b/docs/flowchart.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Flowcharts - Basic Syntax diff --git a/docs/gantt.md b/docs/gantt.md index b0a302d9f..9d598d977 100644 --- a/docs/gantt.md +++ b/docs/gantt.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Gantt diagrams diff --git a/docs/gitgraph.md b/docs/gitgraph.md index c423c2515..5f86cf53c 100644 --- a/docs/gitgraph.md +++ b/docs/gitgraph.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Gitgraph Diagrams diff --git a/docs/index.html b/docs/index.html index 39d454533..8d291f8e5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,6 +1,6 @@ - + mermaid - Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, diff --git a/docs/integrations.md b/docs/integrations.md index 16e735779..57d3bd316 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Integrations diff --git a/docs/introduction.md b/docs/introduction.md index 38c7c7a0e..992fbafc1 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -1 +1 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. diff --git a/docs/landing/index.html b/docs/landing/index.html index 9b1e3749f..2431ad9bd 100644 --- a/docs/landing/index.html +++ b/docs/landing/index.html @@ -1,6 +1,6 @@ <!DOCTYPE html> <html lang="en"> - <head> + <!--# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.--><head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> @@ -64,7 +64,7 @@ using Mermaid.js. </p> <a - href="https://www.amazon.com/Official-Guide-Mermaid-js-beautiful-flowcharts-dp-1801078025/dp/1801078025/ref=mt_other?_encoding=UTF8&me=&qid=1628153965" + href="https://www.amazon.com/Official-Guide-Mermaid-js-beautiful-flowcharts-dp-1801078025/dp/1801078025/ref=mt_other?_encoding=UTF8&me=&qid=1628153965" > <button style="background: #ffa41c; border: 1px solid #ff8f00" @@ -322,7 +322,7 @@ </p> </h3> <a - href="https://www.amazon.com/Official-Guide-Mermaid-js-beautiful-flowcharts-dp-1801078025/dp/1801078025/ref=mt_other?_encoding=UTF8&me=&qid=1628153965" + href="https://www.amazon.com/Official-Guide-Mermaid-js-beautiful-flowcharts-dp-1801078025/dp/1801078025/ref=mt_other?_encoding=UTF8&me=&qid=1628153965" > <button style="background: #ffa41c; border: 1px solid #ff8f00" diff --git a/docs/mermaidCLI.md b/docs/mermaidCLI.md index e3249315b..0d32c5472 100644 --- a/docs/mermaidCLI.md +++ b/docs/mermaidCLI.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # mermaid CLI diff --git a/docs/mindmap.md b/docs/mindmap.md index 6ab954f5b..85dba5eb3 100644 --- a/docs/mindmap.md +++ b/docs/mindmap.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Mindmap diff --git a/docs/n00b-advanced.md b/docs/n00b-advanced.md index 4e9d74b98..b8970142a 100644 --- a/docs/n00b-advanced.md +++ b/docs/n00b-advanced.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Advanced n00b mermaid (Coming soon..) diff --git a/docs/n00b-gettingStarted.md b/docs/n00b-gettingStarted.md index f3ade5559..505542539 100644 --- a/docs/n00b-gettingStarted.md +++ b/docs/n00b-gettingStarted.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # A Mermaid User-Guide for Beginners diff --git a/docs/n00b-overview.md b/docs/n00b-overview.md index 913fcc2f6..c109b63f2 100644 --- a/docs/n00b-overview.md +++ b/docs/n00b-overview.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Overview for Beginners diff --git a/docs/n00b-syntaxReference.md b/docs/n00b-syntaxReference.md index 9f18e3d28..d25c6425e 100644 --- a/docs/n00b-syntaxReference.md +++ b/docs/n00b-syntaxReference.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Diagram Syntax diff --git a/docs/newDiagram.md b/docs/newDiagram.md index e2191f1de..285cb7637 100644 --- a/docs/newDiagram.md +++ b/docs/newDiagram.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Adding a New Diagram/Chart 📊 diff --git a/docs/pie.md b/docs/pie.md index 1e13e3872..79dcbfee5 100644 --- a/docs/pie.md +++ b/docs/pie.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Pie chart diagrams diff --git a/docs/requirementDiagram.md b/docs/requirementDiagram.md index c510183d9..d31967871 100644 --- a/docs/requirementDiagram.md +++ b/docs/requirementDiagram.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Requirement Diagram diff --git a/docs/security.md b/docs/security.md index e2990eb5b..ee9033ca2 100644 --- a/docs/security.md +++ b/docs/security.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Security diff --git a/docs/sequenceDiagram.md b/docs/sequenceDiagram.md index ae0bd5e45..97968a676 100644 --- a/docs/sequenceDiagram.md +++ b/docs/sequenceDiagram.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Sequence diagrams diff --git a/docs/stateDiagram.md b/docs/stateDiagram.md index 6af3b0bc4..8ea9fd239 100644 --- a/docs/stateDiagram.md +++ b/docs/stateDiagram.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # State diagrams diff --git a/docs/theming.md b/docs/theming.md index 287499eff..9ba136ec4 100644 --- a/docs/theming.md +++ b/docs/theming.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Theme Configuration diff --git a/docs/upgrading.md b/docs/upgrading.md index fd7f72d82..c4d7bd3bd 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Upgrading diff --git a/docs/usage.md b/docs/usage.md index 02bd1bb13..e59670d02 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # Usage diff --git a/docs/user-journey.md b/docs/user-journey.md index 9e213f425..e0d924f85 100644 --- a/docs/user-journey.md +++ b/docs/user-journey.md @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs. +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs. # User Journey Diagram From f8eaccb4c1bdf7fb0545c82adb5368db1ba9a3d3 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Thu, 8 Sep 2022 21:54:51 +0530 Subject: [PATCH 059/115] fix: Run precommit hook for doc.mts changes too --- .lintstagedrc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.lintstagedrc.json b/.lintstagedrc.json index db16ea99a..b88abda4b 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,4 +1,5 @@ { "src/docs/**": ["yarn docs:build --git"], - "*.{ts,js,json,html,md}": ["eslint --fix", "prettier --write"] + "src/docs.mts": ["yarn docs:build --git"], + "*.{ts,js,json,html,md,mts}": ["eslint --fix", "prettier --write"] } From 8a476f882da2af2825295f42861da60ae341f891 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 9 Sep 2022 16:02:26 +0530 Subject: [PATCH 060/115] Remove native memoize --- package.json | 1 + src/utils.ts | 51 ++++++++++++++------------------------------------- yarn.lock | 5 +++++ 3 files changed, 20 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 9017a5936..a4eaaea47 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "fast-clone": "^1.5.13", "graphlib": "^2.1.8", "khroma": "^2.0.0", + "micro-memoize": "^4.0.11", "moment-mini": "^2.24.0", "non-layered-tidy-tree-layout": "^2.0.2", "stylis": "^4.0.10" diff --git a/src/utils.ts b/src/utils.ts index f88327367..1eb6561e4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,6 +20,7 @@ import { log } from './logger'; import { detectType } from './diagram-api/detectType'; import assignWithDepth from './assignWithDepth'; import { MermaidConfig } from './config.type'; +import memoize from 'micro-memoize'; // Effectively an enum of the supported curve types, accessible by name const d3CurveTypes = { @@ -43,10 +44,10 @@ const anyComment = /\s*%%.*\n/gm; /** * @function detectInit Detects the init config object from the text - * * @param config + * * ```mermaid - * %%{init: {"theme": "debug", "logLevel": 1 }}%% + * %%{init: {"theme": "debug", "logLevel": 1 }}%% * graph LR * a-->b * b-->c @@ -165,27 +166,6 @@ export const detectDirective = function (text, type = null) { } }; -/** - * Caches results of functions based on input - * - * @param {Function} fn Function to run - * @param {Function} resolver Function that resolves to an ID given arguments the `fn` takes - * @returns {Function} An optimized caching function - */ -const memoize = (fn, resolver) => { - let cache = {}; - return (...args) => { - let n = resolver ? resolver.apply(this, args) : args[0]; - if (n in cache) { - return cache[n]; - } else { - let result = fn(...args); - cache[n] = result; - return result; - } - }; -}; - /** * @function isSubstringInArray Detects whether a substring in present in a given array * @param {string} str The substring to detect @@ -594,7 +574,7 @@ export const wrapLabel = memoize( return completedLines.filter((line) => line !== '').join(config.joinWith); }, (label, maxWidth, config) => - `${label}-${maxWidth}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}-${config.joinWith}` + `${label}${maxWidth}${config.fontSize}${config.fontWeight}${config.fontFamily}${config.joinWith}` ); const breakString = memoize( @@ -632,7 +612,8 @@ const breakString = memoize( * If the wrapped text text has greater height, we extend the height, so it's value won't overflow. * * @param {any} text The text to measure - * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size + * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the + * resulting size * @returns {any} - The height for the given text */ export const calculateTextHeight = function (text, config) { @@ -647,7 +628,8 @@ export const calculateTextHeight = function (text, config) { * This calculates the width of the given text, font size and family. * * @param {any} text - The text to calculate the width of - * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size + * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the + * resulting size * @returns {any} - The width for the given text */ export const calculateTextWidth = function (text, config) { @@ -656,7 +638,8 @@ export const calculateTextWidth = function (text, config) { }; /** - * This calculates the dimensions of the given text, font size, font family, font weight, and margins. + * This calculates the dimensions of the given text, font size, font family, font weight, and + * margins. * * @param {any} text - The text to calculate the width of * @param {any} config - The config for fontSize, fontFamily, fontWeight, and margin all impacting @@ -727,7 +710,8 @@ export const calculateTextDimensions = memoize( * Applys d3 attributes * * @param {any} d3Elem D3 Element to apply the attributes onto - * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of attributes + * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of + * attributes */ const d3Attrs = function (d3Elem, attrs) { for (let attr of attrs) { @@ -860,18 +844,12 @@ export interface DetailedError { hash: any; } -/** - * - * @param error - */ +/** @param error */ export function isDetailedError(error: unknown): error is DetailedError { return 'str' in error; } -/** - * - * @param error - */ +/** @param error */ export function getErrorMessage(error: unknown): string { if (error instanceof Error) return error.message; return String(error); @@ -894,7 +872,6 @@ export default { getStylesFromArray, generateId, random, - memoize, runFunc, entityDecode, initIdGenerator: initIdGenerator, diff --git a/yarn.lock b/yarn.lock index 148b07402..b8d72a344 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9070,6 +9070,11 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= +micro-memoize@^4.0.11: + version "4.0.11" + resolved "https://registry.yarnpkg.com/micro-memoize/-/micro-memoize-4.0.11.tgz#f664afc8bd8c11cb2838716a7306d6e1ec205d3a" + integrity sha512-CjxsaYe4j43df32DtzzNCwanPqZjZDwuQAZilsCYpa2ZVtSPDjHXbTlR4gsEZRyO9/twHs0b7HLjvy/sowl7sA== + micromark-core-commonmark@^1.0.1: version "1.0.6" resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz#edff4c72e5993d93724a3c206970f5a15b0585ad" From 5aae45dc978ce25947b24e1486ebccfcec3d8aa4 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 9 Sep 2022 16:34:57 +0530 Subject: [PATCH 061/115] fix: Use lodash memoize --- package.json | 2 +- src/utils.spec.js | 33 ++++++++++++++++++++++----------- src/utils.ts | 9 +++++---- yarn.lock | 10 +++++----- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index a4eaaea47..5e321f294 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "fast-clone": "^1.5.13", "graphlib": "^2.1.8", "khroma": "^2.0.0", - "micro-memoize": "^4.0.11", "moment-mini": "^2.24.0", "non-layered-tidy-tree-layout": "^2.0.2", "stylis": "^4.0.10" @@ -89,6 +88,7 @@ "@types/d3": "^7.4.0", "@types/dompurify": "^2.3.4", "@types/jest": "^28.1.7", + "@types/lodash": "^4.14.184", "@types/stylis": "^4.0.2", "@typescript-eslint/eslint-plugin": "^5.36.1", "@typescript-eslint/parser": "^5.36.1", diff --git a/src/utils.spec.js b/src/utils.spec.js index ebaa1415c..6ffbd3af1 100644 --- a/src/utils.spec.js +++ b/src/utils.spec.js @@ -2,6 +2,7 @@ import utils from './utils'; import assignWithDepth from './assignWithDepth'; import { detectType } from './diagram-api/detectType'; import { addDiagrams } from './diagram-api/diagram-orchestration'; +import { memoize } from 'lodash'; addDiagrams(); describe('when assignWithDepth: should merge objects within objects', function () { @@ -121,20 +122,30 @@ describe('when assignWithDepth: should merge objects within objects', function ( }); describe('when memoizing', function () { it('should return the same value', function () { - const fib = utils.memoize(function (n, canary) { - canary.flag = true; - if (n < 2) { - return 1; - } else { - //We'll console.log a loader every time we have to recurse - return fib(n - 2, canary) + fib(n - 1, canary); - } - }); + const fib = memoize( + function (n, x, canary) { + canary.flag = true; + if (n < 2) { + return 1; + } else { + //We'll console.log a loader every time we have to recurse + return fib(n - 2, x, canary) + fib(n - 1, x, canary); + } + }, + (n, x, _) => `${n}${x}` + ); let canary = { flag: false }; - fib(10, canary); + fib(10, 'a', canary); expect(canary.flag).toBe(true); canary = { flag: false }; - fib(10, canary); + fib(10, 'a', canary); + expect(canary.flag).toBe(false); + fib(10, 'b', canary); + fib(10, 'b', canary); + expect(canary.flag).toBe(true); + canary = { flag: false }; + fib(10, 'b', canary); + fib(10, 'a', canary); expect(canary.flag).toBe(false); }); }); diff --git a/src/utils.ts b/src/utils.ts index 1eb6561e4..200032435 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,7 +20,7 @@ import { log } from './logger'; import { detectType } from './diagram-api/detectType'; import assignWithDepth from './assignWithDepth'; import { MermaidConfig } from './config.type'; -import memoize from 'micro-memoize'; +import { memoize } from 'lodash'; // Effectively an enum of the supported curve types, accessible by name const d3CurveTypes = { @@ -47,7 +47,8 @@ const anyComment = /\s*%%.*\n/gm; * @param config * * ```mermaid - * %%{init: {"theme": "debug", "logLevel": 1 }}%% + * + * %%{init: {"theme": "debug", "logLevel": 1 }}%% * graph LR * a-->b * b-->c @@ -602,7 +603,7 @@ const breakString = memoize( return { hyphenatedStrings: lines, remainingWord: currentLine }; }, (word, maxWidth, hyphenCharacter = '-', config) => - `${word}-${maxWidth}-${hyphenCharacter}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}` + `${word}${maxWidth}${hyphenCharacter}${config.fontSize}${config.fontWeight}${config.fontFamily}` ); /** @@ -703,7 +704,7 @@ export const calculateTextDimensions = memoize( : 1; return dims[index]; }, - (text, config) => `${text}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}` + (text, config) => `${text}${config.fontSize}${config.fontWeight}${config.fontFamily}` ); /** diff --git a/yarn.lock b/yarn.lock index b8d72a344..1967b28b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2643,6 +2643,11 @@ dependencies: "@types/node" "*" +"@types/lodash@^4.14.184": + version "4.14.184" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe" + integrity sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q== + "@types/mdast@^3.0.0": version "3.0.10" resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af" @@ -9070,11 +9075,6 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -micro-memoize@^4.0.11: - version "4.0.11" - resolved "https://registry.yarnpkg.com/micro-memoize/-/micro-memoize-4.0.11.tgz#f664afc8bd8c11cb2838716a7306d6e1ec205d3a" - integrity sha512-CjxsaYe4j43df32DtzzNCwanPqZjZDwuQAZilsCYpa2ZVtSPDjHXbTlR4gsEZRyO9/twHs0b7HLjvy/sowl7sA== - micromark-core-commonmark@^1.0.1: version "1.0.6" resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz#edff4c72e5993d93724a3c206970f5a15b0585ad" From d2e7b1e56f551d776e89be077313674141a00103 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 9 Sep 2022 16:58:48 +0530 Subject: [PATCH 062/115] fix: Support treeshaking --- package.json | 1 + src/utils.spec.js | 2 +- src/utils.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5e321f294..e1709730e 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "fast-clone": "^1.5.13", "graphlib": "^2.1.8", "khroma": "^2.0.0", + "lodash": "^4.17.21", "moment-mini": "^2.24.0", "non-layered-tidy-tree-layout": "^2.0.2", "stylis": "^4.0.10" diff --git a/src/utils.spec.js b/src/utils.spec.js index 6ffbd3af1..d024da3db 100644 --- a/src/utils.spec.js +++ b/src/utils.spec.js @@ -2,7 +2,7 @@ import utils from './utils'; import assignWithDepth from './assignWithDepth'; import { detectType } from './diagram-api/detectType'; import { addDiagrams } from './diagram-api/diagram-orchestration'; -import { memoize } from 'lodash'; +import memoize from 'lodash/memoize'; addDiagrams(); describe('when assignWithDepth: should merge objects within objects', function () { diff --git a/src/utils.ts b/src/utils.ts index 200032435..7cd700e85 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,7 +20,7 @@ import { log } from './logger'; import { detectType } from './diagram-api/detectType'; import assignWithDepth from './assignWithDepth'; import { MermaidConfig } from './config.type'; -import { memoize } from 'lodash'; +import memoize from 'lodash/memoize'; // Effectively an enum of the supported curve types, accessible by name const d3CurveTypes = { From 0f56c9a85dbb098870f7e08fd94344278d240660 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Fri, 9 Sep 2022 13:37:37 +0200 Subject: [PATCH 063/115] Fix for issue #3428, load the configured diagrams even when initialize has not been called. --- package.json | 4 ++-- src/mermaidAPI.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1efc62c51..4cf174f3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "9.1.6", + "version": "9.1.7", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", "main": "dist/mermaid.min.js", "module": "dist/mermaid.esm.min.mjs", @@ -122,4 +122,4 @@ "**/*.css", "**/*.scss" ] -} \ No newline at end of file +} diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 016fbde1c..fab424d26 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -146,6 +146,10 @@ export const decodeEntities = function (text) { * @returns {any} */ const render = function (id, _txt, cb, container) { + if (!hasLoadedDiagrams) { + addDiagrams(); + hasLoadedDiagrams = true; + } configApi.reset(); let txt = _txt.replace(/\r\n?/g, '\n'); // parser problems on CRLF ignore all CR and leave LF;; const graphInit = utils.detectInit(txt); From 1029ce4527108756b0ebefa159be9f3460fb6bb7 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 9 Sep 2022 17:32:13 +0530 Subject: [PATCH 064/115] fix: Add `.core` build. --- .esbuild/esbuild.cjs | 7 +++++++ .esbuild/util.cjs | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs index 5cdee62c7..776ae6eec 100644 --- a/.esbuild/esbuild.cjs +++ b/.esbuild/esbuild.cjs @@ -7,8 +7,15 @@ const handler = (e) => { }; const watch = process.argv.includes('--watch'); +// mermaid.js build(umdBuild({ minify: false, watch })).catch(handler); +// mermaid.esm.mjs build(esmBuild({ minify: false, watch })).catch(handler); +// mermaid.core.js +build(umdBuild({ minify: false, core: true })).catch(handler); + +// mermaid.min.js build(esmBuild()).catch(handler); +// mermaid.esm.min.mjs build(umdBuild()).catch(handler); diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 7fc77d0c5..518bb723f 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -39,12 +39,17 @@ exports.esmBuild = (override = { minify: true }) => { }; /** - * @param {Options} override + * @param {Options & { core?: boolean }} override * @returns {Options} */ -exports.umdBuild = (override = { minify: true }) => { +exports.umdBuild = (override = { minify: true, core: false }) => { + const core = override.core; + if (core && override.minify) { + throw new Error('Cannot minify core build'); + } + delete override.core; return buildOptions({ - outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`, + outfile: `dist/mermaid${override.minify ? '.min' : core ? '.core' : ''}.js`, ...override, }); }; From c8d3c3ac4fd5c6a75b8840326c1c10f0588aa340 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 9 Sep 2022 17:48:09 +0530 Subject: [PATCH 065/115] Correct name `umd` -> `iife` --- .esbuild/esbuild.cjs | 8 ++++---- .esbuild/serve.cjs | 4 ++-- .esbuild/util.cjs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs index 776ae6eec..affd08ef9 100644 --- a/.esbuild/esbuild.cjs +++ b/.esbuild/esbuild.cjs @@ -1,4 +1,4 @@ -const { esmBuild, umdBuild } = require('./util.cjs'); +const { esmBuild, iifeBuild } = require('./util.cjs'); const { build } = require('esbuild'); const handler = (e) => { @@ -8,14 +8,14 @@ const handler = (e) => { const watch = process.argv.includes('--watch'); // mermaid.js -build(umdBuild({ minify: false, watch })).catch(handler); +build(iifeBuild({ minify: false, watch })).catch(handler); // mermaid.esm.mjs build(esmBuild({ minify: false, watch })).catch(handler); // mermaid.core.js -build(umdBuild({ minify: false, core: true })).catch(handler); +build(iifeBuild({ minify: false, core: true })).catch(handler); // mermaid.min.js build(esmBuild()).catch(handler); // mermaid.esm.min.mjs -build(umdBuild()).catch(handler); +build(iifeBuild()).catch(handler); diff --git a/.esbuild/serve.cjs b/.esbuild/serve.cjs index 13eba401d..c54ff1e9f 100644 --- a/.esbuild/serve.cjs +++ b/.esbuild/serve.cjs @@ -1,7 +1,7 @@ const esbuild = require('esbuild'); const http = require('http'); const path = require('path'); -const { umdBuild } = require('./util.cjs'); +const { iifeBuild } = require('./util.cjs'); // Start esbuild's server on a random local port esbuild @@ -9,7 +9,7 @@ esbuild { servedir: path.join(__dirname, '..'), }, - umdBuild({ minify: false }) + iifeBuild({ minify: false }) ) .then((result) => { // The result tells us where esbuild's local server is diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 518bb723f..e136ff52e 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -42,7 +42,7 @@ exports.esmBuild = (override = { minify: true }) => { * @param {Options & { core?: boolean }} override * @returns {Options} */ -exports.umdBuild = (override = { minify: true, core: false }) => { +exports.iifeBuild = (override = { minify: true, core: false }) => { const core = override.core; if (core && override.minify) { throw new Error('Cannot minify core build'); From 5148acb20fe0ad0e37ab458e0295eee21a1c049d Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 9 Sep 2022 17:49:11 +0530 Subject: [PATCH 066/115] Specify `iife` format --- .esbuild/util.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index e136ff52e..6b462ff4e 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -50,6 +50,7 @@ exports.iifeBuild = (override = { minify: true, core: false }) => { delete override.core; return buildOptions({ outfile: `dist/mermaid${override.minify ? '.min' : core ? '.core' : ''}.js`, + format: 'iife', ...override, }); }; From 9d0901801b0cfa2c14afda256e70bcc08b91038d Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 9 Sep 2022 18:26:57 +0530 Subject: [PATCH 067/115] Suppress errors --- cypress.config.js | 2 ++ cypress/plugins/index.js | 1 + src/docs.mts | 4 +++- src/logger.ts | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cypress.config.js b/cypress.config.js index 044c5d523..d7c9831d4 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ + const { defineConfig } = require('cypress'); const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin'); require('@applitools/eyes-cypress')(module); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 2c98a54ad..ca5a37d5a 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ // *********************************************************** // This example plugins/index.js can be used to load plugins // diff --git a/src/docs.mts b/src/docs.mts index 76594c4bf..5bc3a49cf 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,7 +1,9 @@ +/* eslint-disable no-console */ + import { remark } from 'remark'; import type { Code, Root } from 'mdast'; import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; -// @ts-ignore +// @ts-ignore: no typings import flatmap from 'unist-util-flatmap'; import { globby } from 'globby'; import { join, dirname } from 'path'; diff --git a/src/logger.ts b/src/logger.ts index 94b399877..57c9cf4bb 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable no-console */ import moment from 'moment-mini'; export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; From 8ca91d6303cc2a9a16bebf94411a9fd563fd766a Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" <registrations@ashleycaroline.com> Date: Fri, 9 Sep 2022 18:32:26 -0700 Subject: [PATCH 068/115] add eslint-disable no-console for file --- src/docs.mts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/docs.mts b/src/docs.mts index dfd6a761f..dc7ec29e3 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,3 +1,5 @@ +/* eslint-disable no-console */ + /** * @file Transform documentation source files into files suitable for publishing and optionally copy * the transformed files from the source directory to the directory used for the final, published From fc9d22562ba9a62de770ab50a0c4cf0c591a6421 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Sat, 10 Sep 2022 15:53:50 +0200 Subject: [PATCH 069/115] Creating detectors and moving out diagram specific code from the diagramAPI --- cypress/platform/knsv.html | 24 +- docs/Setup.md | 31 +- package.json | 2 +- src/diagram-api/detectType.ts | 37 +-- src/diagram-api/diagram-orchestration.ts | 300 +++++++++++++++++- src/diagram-api/diagramAPI.ts | 212 +------------ src/diagrams/c4/c4Detector.ts | 5 + src/diagrams/class/classDetector-V2.ts | 9 + src/diagrams/class/classDetector.ts | 8 + src/diagrams/er/erDetector.ts | 5 + src/diagrams/flowchart/flowDetector-v2.ts | 8 + src/diagrams/flowchart/flowDetector.ts | 8 + src/diagrams/gantt/ganttDetector.ts | 5 + src/diagrams/info/infoDetector.ts | 5 + src/diagrams/pie/pieDetector.ts | 5 + .../requirement/requirementDetector.ts | 5 + src/diagrams/sequence/sequenceDetector.ts | 5 + src/diagrams/state/stateDetector-V2.ts | 8 + src/diagrams/state/stateDetector.ts | 8 + src/diagrams/user-journey/journeyDetector.ts | 5 + src/docs/Setup.md | 31 +- 21 files changed, 442 insertions(+), 284 deletions(-) create mode 100644 src/diagrams/c4/c4Detector.ts create mode 100644 src/diagrams/class/classDetector-V2.ts create mode 100644 src/diagrams/class/classDetector.ts create mode 100644 src/diagrams/er/erDetector.ts create mode 100644 src/diagrams/flowchart/flowDetector-v2.ts create mode 100644 src/diagrams/flowchart/flowDetector.ts create mode 100644 src/diagrams/gantt/ganttDetector.ts create mode 100644 src/diagrams/info/infoDetector.ts create mode 100644 src/diagrams/pie/pieDetector.ts create mode 100644 src/diagrams/requirement/requirementDetector.ts create mode 100644 src/diagrams/sequence/sequenceDetector.ts create mode 100644 src/diagrams/state/stateDetector-V2.ts create mode 100644 src/diagrams/state/stateDetector.ts create mode 100644 src/diagrams/user-journey/journeyDetector.ts diff --git a/cypress/platform/knsv.html b/cypress/platform/knsv.html index c98ce70c8..6ce545082 100644 --- a/cypress/platform/knsv.html +++ b/cypress/platform/knsv.html @@ -38,7 +38,7 @@ </style> </head> <body> - <pre class="mermaid2" style="width: 50%"> + <pre class="mermaid" style="width: 50%"> flowchart LR classDef aPID stroke:#4e4403,fill:#fdde29,color:#4e4403,rx:5px,ry:5px; classDef crm stroke:#333333,fill:#DCDCDC,color:#333333,rx:5px,ry:5px; @@ -99,7 +99,7 @@ flowchart TD class A someclass; class C someclass; </pre> - <pre class="mermaid2" style="width: 50%"> + <pre class="mermaid" style="width: 50%"> sequenceDiagram title: My Sequence Diagram Title accTitle: My Acc Sequence Diagram @@ -109,14 +109,14 @@ flowchart TD John-->>Alice: Great! Alice-)John: See you later! </pre> - <pre class="mermaid2" style="width: 50%"> + <pre class="mermaid" style="width: 50%"> graph TD A -->|000| B B -->|111| C linkStyle 1 stroke:#ff3,stroke-width:4px,color:red; </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> journey accTitle: My User Journey Diagram accDescr: My User Journey Diagram Description @@ -130,10 +130,10 @@ graph TD Go downstairs: 5: Me Sit down: 5: Me </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> info </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> requirementDiagram accTitle: My req Diagram accDescr: My req Diagram Description @@ -174,7 +174,7 @@ requirementDiagram test_req - contains -> test_req3 test_req <- copies - test_entity2 </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> gantt dateFormat YYYY-MM-DD title Adding GANTT diagram functionality to mermaid @@ -206,7 +206,7 @@ gantt Add gantt diagram to demo page :20h Add another diagram to demo page :48h </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> stateDiagram state Active { Idle @@ -234,7 +234,7 @@ stateDiagram end B ->> A: Return </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> classDiagram accTitle: My class diagram accDescr: My class diagram Description @@ -259,7 +259,7 @@ class Class10 { A->>Bob: Hola Bob-->A: Pasten ! </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> gitGraph commit id: "ZERO" branch develop @@ -288,7 +288,7 @@ flowchart TD C -->|Two| E[iPhone] C -->|Three| F[fa:fa-car Car] </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> classDiagram Animal "1" <|-- Duck Animal <|-- Fish @@ -311,7 +311,7 @@ flowchart TD +run() } </pre> - <pre class="mermaid2" style="width: 100%"> + <pre class="mermaid" style="width: 100%"> erDiagram CAR ||--o{ NAMED-DRIVER : allows CAR { diff --git a/docs/Setup.md b/docs/Setup.md index 1f948ee01..2ef56e1d8 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -1407,6 +1407,15 @@ This sets the auto-wrap padding for the diagram (sides only) **Notes:** Default value: 0. +## parse + +### Parameters + +- `text` **[string][5]** +- `parseError` **[Function][6]?** + +Returns **[boolean][7]** + ## setSiteConfig ## setSiteConfig @@ -1424,7 +1433,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## getSiteConfig @@ -1436,7 +1445,7 @@ Returns **[object][5]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## setConfig @@ -1475,10 +1484,10 @@ $(function () { ### Parameters -- `id` **[string][6]** The id of the element to be rendered -- `text` **[string][6]** The graph definition -- `cb` **function (svgCode: [string][6], bindFunctions: function (element: [Element][7]): void): void** -- `container` **[Element][7]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][5]** The id of the element to be rendered +- `text` **[string][5]** The graph definition +- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** +- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1517,7 +1526,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][5]** The directive to push in +- `directive` **[object][8]** The directive to push in ## reset @@ -1615,6 +1624,8 @@ Returns **void** [2]: Setup.md?id=render [3]: 8.6.0_docs.md [4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[7]: https://developer.mozilla.org/docs/Web/API/Element +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[9]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/package.json b/package.json index a791f0574..fa3b69dda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "9.1.6", + "version": "9.2.0-rc1", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", "main": "dist/mermaid.min.js", "module": "dist/mermaid.esm.min.mjs", diff --git a/src/diagram-api/detectType.ts b/src/diagram-api/detectType.ts index 87b681767..817de5149 100644 --- a/src/diagram-api/detectType.ts +++ b/src/diagram-api/detectType.ts @@ -1,26 +1,12 @@ import { MermaidConfig } from '../config.type'; -export type DiagramDetector = (text: string) => boolean; +export type DiagramDetector = (text: string, config?: MermaidConfig) => boolean; const directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi; const anyComment = /\s*%%.*\n/gm; const detectors: Record<string, DiagramDetector> = {}; -const diagramMatchers: Record<string, RegExp> = { - c4: /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/, - sequence: /^\s*sequenceDiagram/, - gantt: /^\s*gantt/, - classDiagram: /^\s*classDiagram-v2/, - stateDiagram: /^\s*stateDiagram-v2/, - 'flowchart-v2': /^\s*flowchart/, // Might need to add |graph to fix #3391 - info: /^\s*info/, - pie: /^\s*pie/, - er: /^\s*erDiagram/, - journey: /^\s*journey/, - // gitGraph: /^\s*gitGraph/, - requirement: /^\s*requirement(Diagram)?/, -}; /** * @function detectType Detects the type of the graph text. Takes into consideration the possible @@ -47,28 +33,9 @@ const diagramMatchers: Record<string, RegExp> = { */ export const detectType = function (text: string, config?: MermaidConfig): string { text = text.replace(directive, '').replace(anyComment, '\n'); - for (const [diagram, matcher] of Object.entries(diagramMatchers)) { - if (text.match(matcher)) { - return diagram; - } - } - - if (text.match(/^\s*classDiagram/)) { - if (config?.class?.defaultRenderer === 'dagre-wrapper') return 'classDiagram'; - return 'class'; - } - - if (text.match(/^\s*stateDiagram/)) { - if (config?.state?.defaultRenderer === 'dagre-wrapper') return 'stateDiagram'; - return 'state'; - } - - if (config?.flowchart?.defaultRenderer === 'dagre-wrapper') { - return 'flowchart-v2'; - } for (const [key, detector] of Object.entries(detectors)) { - if (detector(text)) { + if (detector(text, config)) { return key; } } diff --git a/src/diagram-api/diagram-orchestration.ts b/src/diagram-api/diagram-orchestration.ts index ea0c76ffa..b9b0520c9 100644 --- a/src/diagram-api/diagram-orchestration.ts +++ b/src/diagram-api/diagram-orchestration.ts @@ -1,20 +1,310 @@ import { registerDiagram } from './diagramAPI'; -import * as mindmapDb from '../diagrams/mindmap/mindmapDb'; -import mindmapRenderer from '../diagrams/mindmap/mindmapRenderer'; + // @ts-ignore: TODO Fix ts errors import mindmapParser from '../diagrams/mindmap/parser/mindmap'; +import * as mindmapDb from '../diagrams/mindmap/mindmapDb'; import { mindmapDetector } from '../diagrams/mindmap/mindmapDetector'; +import mindmapRenderer from '../diagrams/mindmap/mindmapRenderer'; import mindmapStyles from '../diagrams/mindmap/styles'; -import gitGraphDb from '../diagrams/git/gitGraphAst'; -import gitGraphRenderer from '../diagrams/git/gitGraphRenderer'; // @ts-ignore: TODO Fix ts errors import gitGraphParser from '../diagrams/git/parser/gitGraph'; import { gitGraphDetector } from '../diagrams/git/gitGraphDetector'; +import gitGraphDb from '../diagrams/git/gitGraphAst'; +import gitGraphRenderer from '../diagrams/git/gitGraphRenderer'; import gitGraphStyles from '../diagrams/git/styles'; +// @ts-ignore: TODO Fix ts errors +import c4Parser from '../diagrams/c4/parser/c4Diagram'; +import { c4Detector } from '../diagrams/c4/c4Detector'; +import c4Db from '../diagrams/c4/c4Db'; +import c4Renderer from '../diagrams/c4/c4Renderer'; +import c4Styles from '../diagrams/c4/styles'; + +// @ts-ignore: TODO Fix ts errors +import classParser from '../diagrams/class/parser/classDiagram'; +import { classDetector } from '../diagrams/class/classDetector'; +import { classDetectorV2 } from '../diagrams/class/classDetector-V2'; +import classDb from '../diagrams/class/classDb'; +import classRenderer from '../diagrams/class/classRenderer'; +import classRendererV2 from '../diagrams/class/classRenderer-v2'; +import classStyles from '../diagrams/class/styles'; + +// @ts-ignore: TODO Fix ts errors +import erParser from '../diagrams/er/parser/erDiagram'; +import { erDetector } from '../diagrams/er/erDetector'; +import erDb from '../diagrams/er/erDb'; +import erRenderer from '../diagrams/er/erRenderer'; +import erStyles from '../diagrams/er/styles'; + +// @ts-ignore: TODO Fix ts errors +import flowParser from '../diagrams/flowchart/parser/flow'; +import { flowDetector } from '../diagrams/flowchart/flowDetector'; +import { flowDetectorV2 } from '../diagrams/flowchart/flowDetector-v2'; +import flowDb from '../diagrams/flowchart/flowDb'; +import flowRenderer from '../diagrams/flowchart/flowRenderer'; +import flowRendererV2 from '../diagrams/flowchart/flowRenderer-v2'; +import flowStyles from '../diagrams/flowchart/styles'; + +// @ts-ignore: TODO Fix ts errors +import ganttParser from '../diagrams/gantt/parser/gantt'; +import { ganttDetector } from '../diagrams/gantt/ganttDetector'; +import ganttDb from '../diagrams/gantt/ganttDb'; +import ganttRenderer from '../diagrams/gantt/ganttRenderer'; +import ganttStyles from '../diagrams/gantt/styles'; + +// @ts-ignore: TODO Fix ts errors +import infoParser from '../diagrams/info/parser/info'; +import infoDb from '../diagrams/info/infoDb'; +import infoRenderer from '../diagrams/info/infoRenderer'; +import { infoDetector } from '../diagrams/info/infoDetector'; +import infoStyles from '../diagrams/info/styles'; + +// @ts-ignore: TODO Fix ts errors +import pieParser from '../diagrams/pie/parser/pie'; +import { pieDetector } from '../diagrams/pie/pieDetector'; +import pieDb from '../diagrams/pie/pieDb'; +import pieRenderer from '../diagrams/pie/pieRenderer'; +import pieStyles from '../diagrams/pie/styles'; + +// @ts-ignore: TODO Fix ts errors +import requirementParser from '../diagrams/requirement/parser/requirementDiagram'; +import { requirementDetector } from '../diagrams/requirement/requirementDetector'; +import requirementDb from '../diagrams/requirement/requirementDb'; +import requirementRenderer from '../diagrams/requirement/requirementRenderer'; +import requirementStyles from '../diagrams/requirement/styles'; + +// @ts-ignore: TODO Fix ts errors +import sequenceParser from '../diagrams/sequence/parser/sequenceDiagram'; +import { sequenceDetector } from '../diagrams/sequence/sequenceDetector'; +import sequenceDb from '../diagrams/sequence/sequenceDb'; +import sequenceRenderer from '../diagrams/sequence/sequenceRenderer'; +import sequenceStyles from '../diagrams/sequence/styles'; + +// @ts-ignore: TODO Fix ts errors +import stateParser from '../diagrams/state/parser/stateDiagram'; +import { stateDetector } from '../diagrams/state/stateDetector'; +import { stateDetectorV2 } from '../diagrams/state/stateDetector-V2'; +import stateDb from '../diagrams/state/stateDb'; +import stateRenderer from '../diagrams/state/stateRenderer'; +import stateRendererV2 from '../diagrams/state/stateRenderer-v2'; +import stateStyles from '../diagrams/state/styles'; + +// @ts-ignore: TODO Fix ts errors +import journeyParser from '../diagrams/user-journey/parser/journey'; +import { journeyDetector } from '../diagrams/user-journey/journeyDetector'; +import journeyDb from '../diagrams/user-journey/journeyDb'; +import journeyRenderer from '../diagrams/user-journey/journeyRenderer'; +import journeyStyles from '../diagrams/user-journey/styles'; + export const addDiagrams = () => { - // Register mindmap and other built-in diagrams + registerDiagram( + 'c4', + { + parser: c4Parser, + db: c4Db, + renderer: c4Renderer, + styles: c4Styles, + init: (cnf) => { + c4Renderer.setConf(cnf.c4); + }, + }, + c4Detector + ); + registerDiagram( + 'class', + { + parser: classParser, + db: classDb, + renderer: classRenderer, + styles: classStyles, + init: (cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + classDb.clear(); + }, + }, + classDetector + ); + registerDiagram( + 'classDiagram', + { + parser: classParser, + db: classDb, + renderer: classRendererV2, + styles: classStyles, + init: (cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + classDb.clear(); + }, + }, + classDetectorV2 + ); + registerDiagram( + 'er', + { + parser: erParser, + db: erDb, + renderer: erRenderer, + styles: erStyles, + }, + erDetector + ); + registerDiagram( + 'gantt', + { + parser: ganttParser, + db: ganttDb, + renderer: ganttRenderer, + styles: ganttStyles, + }, + ganttDetector + ); + registerDiagram( + 'info', + { + parser: infoParser, + db: infoDb, + renderer: infoRenderer, + styles: infoStyles, + }, + infoDetector + ); + registerDiagram( + 'pie', + { + parser: pieParser, + db: pieDb, + renderer: pieRenderer, + styles: pieStyles, + }, + pieDetector + ); + registerDiagram( + 'requirement', + { + parser: requirementParser, + db: requirementDb, + renderer: requirementRenderer, + styles: requirementStyles, + }, + requirementDetector + ); + registerDiagram( + 'sequence', + { + parser: sequenceParser, + db: sequenceDb, + renderer: sequenceRenderer, + styles: sequenceStyles, + init: (cnf) => { + if (!cnf.sequence) { + cnf.sequence = {}; + } + cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + if ('sequenceDiagram' in cnf) { + throw new Error( + '`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.' + ); + } + sequenceDb.setWrap(cnf.wrap); + sequenceRenderer.setConf(cnf.sequence); + }, + }, + sequenceDetector + ); + registerDiagram( + 'state', + { + parser: stateParser, + db: stateDb, + renderer: stateRenderer, + styles: stateStyles, + init: (cnf) => { + if (!cnf.state) { + cnf.state = {}; + } + cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + stateDb.clear(); + }, + }, + stateDetector + ); + registerDiagram( + 'stateDiagram', + { + parser: stateParser, + db: stateDb, + renderer: stateRendererV2, + styles: stateStyles, + init: (cnf) => { + if (!cnf.state) { + cnf.state = {}; + } + cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + stateDb.clear(); + }, + }, + stateDetectorV2 + ); + registerDiagram( + 'journey', + { + parser: journeyParser, + db: journeyDb, + renderer: journeyRenderer, + styles: journeyStyles, + init: (cnf) => { + journeyRenderer.setConf(cnf.journey); + journeyDb.clear(); + }, + }, + journeyDetector + ); + + registerDiagram( + 'flowchart', + { + parser: flowParser, + db: flowDb, + renderer: flowRendererV2, + styles: flowStyles, + init: (cnf) => { + flowRenderer.setConf(cnf.flowchart); + if (!cnf.flowchart) { + cnf.flowchart = {}; + } + cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + flowDb.clear(); + flowDb.setGen('gen-1'); + }, + }, + flowDetector + ); + registerDiagram( + 'flowchart-v2', + { + parser: flowParser, + db: flowDb, + renderer: flowRendererV2, + styles: flowStyles, + init: (cnf) => { + flowRendererV2.setConf(cnf.flowchart); + if (!cnf.flowchart) { + cnf.flowchart = {}; + } + cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + flowDb.clear(); + flowDb.setGen('gen-2'); + }, + }, + flowDetectorV2 + ); registerDiagram( 'gitGraph', { parser: gitGraphParser, db: gitGraphDb, renderer: gitGraphRenderer, styles: gitGraphStyles }, diff --git a/src/diagram-api/diagramAPI.ts b/src/diagram-api/diagramAPI.ts index 652e66465..eab74a022 100644 --- a/src/diagram-api/diagramAPI.ts +++ b/src/diagram-api/diagramAPI.ts @@ -1,62 +1,3 @@ -import c4Db from '../diagrams/c4/c4Db'; -import c4Renderer from '../diagrams/c4/c4Renderer'; -import c4Styles from '../diagrams/c4/styles'; -// @ts-ignore: TODO Fix ts errors -import c4Parser from '../diagrams/c4/parser/c4Diagram'; -import classDb from '../diagrams/class/classDb'; -import classRenderer from '../diagrams/class/classRenderer'; -import classRendererV2 from '../diagrams/class/classRenderer-v2'; -import classStyles from '../diagrams/class/styles'; -// @ts-ignore: TODO Fix ts errors -import classParser from '../diagrams/class/parser/classDiagram'; -import erDb from '../diagrams/er/erDb'; -import erRenderer from '../diagrams/er/erRenderer'; -// @ts-ignore: TODO Fix ts errors -import erParser from '../diagrams/er/parser/erDiagram'; -import erStyles from '../diagrams/er/styles'; -import flowDb from '../diagrams/flowchart/flowDb'; -import flowRenderer from '../diagrams/flowchart/flowRenderer'; -import flowRendererV2 from '../diagrams/flowchart/flowRenderer-v2'; -import flowStyles from '../diagrams/flowchart/styles'; -// @ts-ignore: TODO Fix ts errors -import flowParser from '../diagrams/flowchart/parser/flow'; -import ganttDb from '../diagrams/gantt/ganttDb'; -import ganttRenderer from '../diagrams/gantt/ganttRenderer'; -// @ts-ignore: TODO Fix ts errors -import ganttParser from '../diagrams/gantt/parser/gantt'; -import ganttStyles from '../diagrams/gantt/styles'; - -import infoDb from '../diagrams/info/infoDb'; -import infoRenderer from '../diagrams/info/infoRenderer'; -// @ts-ignore: TODO Fix ts errors -import infoParser from '../diagrams/info/parser/info'; -import infoStyles from '../diagrams/info/styles'; -// @ts-ignore: TODO Fix ts errors -import pieParser from '../diagrams/pie/parser/pie'; -import pieDb from '../diagrams/pie/pieDb'; -import pieRenderer from '../diagrams/pie/pieRenderer'; -import pieStyles from '../diagrams/pie/styles'; -// @ts-ignore: TODO Fix ts errors -import requirementParser from '../diagrams/requirement/parser/requirementDiagram'; -import requirementDb from '../diagrams/requirement/requirementDb'; -import requirementRenderer from '../diagrams/requirement/requirementRenderer'; -import requirementStyles from '../diagrams/requirement/styles'; -// @ts-ignore: TODO Fix ts errors -import sequenceParser from '../diagrams/sequence/parser/sequenceDiagram'; -import sequenceDb from '../diagrams/sequence/sequenceDb'; -import sequenceRenderer from '../diagrams/sequence/sequenceRenderer'; -import sequenceStyles from '../diagrams/sequence/styles'; -// @ts-ignore: TODO Fix ts errors -import stateParser from '../diagrams/state/parser/stateDiagram'; -import stateDb from '../diagrams/state/stateDb'; -import stateRenderer from '../diagrams/state/stateRenderer'; -import stateRendererV2 from '../diagrams/state/stateRenderer-v2'; -import stateStyles from '../diagrams/state/styles'; -import journeyDb from '../diagrams/user-journey/journeyDb'; -import journeyRenderer from '../diagrams/user-journey/journeyRenderer'; -import journeyStyles from '../diagrams/user-journey/styles'; -// @ts-ignore: TODO Fix ts errors -import journeyParser from '../diagrams/user-journey/parser/journey'; import { addDetector, DiagramDetector } from './detectType'; import { log as _log } from '../logger'; import { getConfig as _getConfig } from '../config'; @@ -73,158 +14,7 @@ export interface DiagramDefinition { init?: (config: MermaidConfig) => void; } -const diagrams: Record<string, DiagramDefinition> = { - c4: { - db: c4Db, - renderer: c4Renderer, - parser: c4Parser, - init: (cnf) => { - c4Renderer.setConf(cnf.c4); - }, - styles: c4Styles, - }, - class: { - db: classDb, - renderer: classRenderer, - parser: classParser, - init: (cnf) => { - if (!cnf.class) { - cnf.class = {}; - } - cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; - classDb.clear(); - }, - styles: classStyles, - }, - classDiagram: { - db: classDb, - renderer: classRendererV2, - parser: classParser, - init: (cnf) => { - if (!cnf.class) { - cnf.class = {}; - } - cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; - classDb.clear(); - }, - styles: classStyles, - }, - er: { - db: erDb, - renderer: erRenderer, - parser: erParser, - styles: erStyles, - }, - flowchart: { - db: flowDb, - renderer: flowRenderer, - parser: flowParser, - init: (cnf) => { - flowRenderer.setConf(cnf.flowchart); - if (!cnf.flowchart) { - cnf.flowchart = {}; - } - cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; - flowDb.clear(); - flowDb.setGen('gen-1'); - }, - styles: flowStyles, - }, - 'flowchart-v2': { - db: flowDb, - renderer: flowRendererV2, - parser: flowParser, - init: (cnf) => { - flowRendererV2.setConf(cnf.flowchart); - if (!cnf.flowchart) { - cnf.flowchart = {}; - } - cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; - flowDb.clear(); - flowDb.setGen('gen-2'); - }, - styles: flowStyles, - }, - gantt: { - db: ganttDb, - renderer: ganttRenderer, - parser: ganttParser, - styles: ganttStyles, - }, - info: { - db: infoDb, - renderer: infoRenderer, - parser: infoParser, - styles: infoStyles, - }, - pie: { - db: pieDb, - renderer: pieRenderer, - parser: pieParser, - styles: pieStyles, - }, - requirement: { - db: requirementDb, - renderer: requirementRenderer, - parser: requirementParser, - styles: requirementStyles, - }, - sequence: { - db: sequenceDb, - renderer: sequenceRenderer, - parser: sequenceParser, - init: (cnf) => { - if (!cnf.sequence) { - cnf.sequence = {}; - } - cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; - if ('sequenceDiagram' in cnf) { - throw new Error( - '`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.' - ); - } - sequenceDb.setWrap(cnf.wrap); - sequenceRenderer.setConf(cnf.sequence); - }, - styles: sequenceStyles, - }, - state: { - db: stateDb, - renderer: stateRenderer, - parser: stateParser, - init: (cnf) => { - if (!cnf.state) { - cnf.state = {}; - } - cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; - stateDb.clear(); - }, - styles: stateStyles, - }, - stateDiagram: { - db: stateDb, - renderer: stateRendererV2, - parser: stateParser, - init: (cnf) => { - if (!cnf.state) { - cnf.state = {}; - } - cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; - stateDb.clear(); - }, - styles: stateStyles, - }, - journey: { - db: journeyDb, - renderer: journeyRenderer, - parser: journeyParser, - init: (cnf) => { - journeyRenderer.setConf(cnf.journey); - journeyDb.clear(); - }, - styles: journeyStyles, - }, -}; +const diagrams: Record<string, DiagramDefinition> = {}; export const registerDiagram = ( id: string, diff --git a/src/diagrams/c4/c4Detector.ts b/src/diagrams/c4/c4Detector.ts new file mode 100644 index 000000000..2be62bff1 --- /dev/null +++ b/src/diagrams/c4/c4Detector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const c4Detector: DiagramDetector = (txt) => { + return txt.match(/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/) !== null; +}; diff --git a/src/diagrams/class/classDetector-V2.ts b/src/diagrams/class/classDetector-V2.ts new file mode 100644 index 000000000..a0e270100 --- /dev/null +++ b/src/diagrams/class/classDetector-V2.ts @@ -0,0 +1,9 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const classDetectorV2: DiagramDetector = (txt, config) => { + // If we have confgured to use dagre-wrapper then we should return true in this function for classDiagram code thus making it use the new class diagram + if (txt.match(/^\s*classDiagram/) !== null && config?.class?.defaultRenderer === 'dagre-wrapper') + return true; + // We have not opted to use the new renderer so we should return true if we detect a class diagram + return txt.match(/^\s*classDiagram-v2/) !== null; +}; diff --git a/src/diagrams/class/classDetector.ts b/src/diagrams/class/classDetector.ts new file mode 100644 index 000000000..19d8bd2f5 --- /dev/null +++ b/src/diagrams/class/classDetector.ts @@ -0,0 +1,8 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const classDetector: DiagramDetector = (txt, config) => { + // If we have confgured to use dagre-wrapper then we should never return true in this function + if (config?.class?.defaultRenderer === 'dagre-wrapper') return false; + // We have not opted to use the new renderer so we should return true if we detect a class diagram + return txt.match(/^\s*classDiagram/) !== null; +}; diff --git a/src/diagrams/er/erDetector.ts b/src/diagrams/er/erDetector.ts new file mode 100644 index 000000000..a17eafb81 --- /dev/null +++ b/src/diagrams/er/erDetector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const erDetector: DiagramDetector = (txt) => { + return txt.match(/^\s*erDiagram/) !== null; +}; diff --git a/src/diagrams/flowchart/flowDetector-v2.ts b/src/diagrams/flowchart/flowDetector-v2.ts new file mode 100644 index 000000000..f73748c79 --- /dev/null +++ b/src/diagrams/flowchart/flowDetector-v2.ts @@ -0,0 +1,8 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const flowDetectorV2: DiagramDetector = (txt, config) => { + // If we have confgured to use dagre-wrapper then we should return true in this function for graph code thus making it use the new flowchart diagram + if (config?.flowchart?.defaultRenderer === 'dagre-wrapper' && txt.match(/^\s*graph/) !== null) + return true; + return txt.match(/^\s*flowchart/) !== null; +}; diff --git a/src/diagrams/flowchart/flowDetector.ts b/src/diagrams/flowchart/flowDetector.ts new file mode 100644 index 000000000..edc9096c0 --- /dev/null +++ b/src/diagrams/flowchart/flowDetector.ts @@ -0,0 +1,8 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const flowDetector: DiagramDetector = (txt, config) => { + // If we have confired to only use new flow charts this function shohuld always return false + // as in not signalling true for a legacy flowchart + if (config?.flowchart?.defaultRenderer === 'dagre-wrapper') return false; + return txt.match(/^\s*graph/) !== null; +}; diff --git a/src/diagrams/gantt/ganttDetector.ts b/src/diagrams/gantt/ganttDetector.ts new file mode 100644 index 000000000..926792dcf --- /dev/null +++ b/src/diagrams/gantt/ganttDetector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const ganttDetector: DiagramDetector = (txt) => { + return txt.match(/^\s*gantt/) !== null; +}; diff --git a/src/diagrams/info/infoDetector.ts b/src/diagrams/info/infoDetector.ts new file mode 100644 index 000000000..68f2ac794 --- /dev/null +++ b/src/diagrams/info/infoDetector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const infoDetector: DiagramDetector = (txt) => { + return txt.match(/^\s*info/) !== null; +}; diff --git a/src/diagrams/pie/pieDetector.ts b/src/diagrams/pie/pieDetector.ts new file mode 100644 index 000000000..1e122b0e0 --- /dev/null +++ b/src/diagrams/pie/pieDetector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const pieDetector: DiagramDetector = (txt) => { + return txt.match(/^\s*pie/) !== null; +}; diff --git a/src/diagrams/requirement/requirementDetector.ts b/src/diagrams/requirement/requirementDetector.ts new file mode 100644 index 000000000..2e1aa93ae --- /dev/null +++ b/src/diagrams/requirement/requirementDetector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const requirementDetector: DiagramDetector = (txt) => { + return txt.match(/^\s*requirement(Diagram)?/) !== null; +}; diff --git a/src/diagrams/sequence/sequenceDetector.ts b/src/diagrams/sequence/sequenceDetector.ts new file mode 100644 index 000000000..e68433255 --- /dev/null +++ b/src/diagrams/sequence/sequenceDetector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const sequenceDetector: DiagramDetector = (txt) => { + return txt.match(/^\s*sequenceDiagram/) !== null; +}; diff --git a/src/diagrams/state/stateDetector-V2.ts b/src/diagrams/state/stateDetector-V2.ts new file mode 100644 index 000000000..8082a47bd --- /dev/null +++ b/src/diagrams/state/stateDetector-V2.ts @@ -0,0 +1,8 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const stateDetectorV2: DiagramDetector = (text, config) => { + if (text.match(/^\s*stateDiagram-v2/) !== null) return true; + if (text.match(/^\s*stateDiagram/) && config?.state?.defaultRenderer === 'dagre-wrapper') + return true; + return false; +}; diff --git a/src/diagrams/state/stateDetector.ts b/src/diagrams/state/stateDetector.ts new file mode 100644 index 000000000..79dd6586b --- /dev/null +++ b/src/diagrams/state/stateDetector.ts @@ -0,0 +1,8 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const stateDetector: DiagramDetector = (txt, config) => { + // If we have confired to only use new state diagrams this function should always return false + // as in not signalling true for a legacy state diagram + if (config?.state?.defaultRenderer === 'dagre-wrapper') return false; + return txt.match(/^\s*stateDiagram/) !== null; +}; diff --git a/src/diagrams/user-journey/journeyDetector.ts b/src/diagrams/user-journey/journeyDetector.ts new file mode 100644 index 000000000..77c8688ae --- /dev/null +++ b/src/diagrams/user-journey/journeyDetector.ts @@ -0,0 +1,5 @@ +import type { DiagramDetector } from '../../diagram-api/detectType'; + +export const journeyDetector: DiagramDetector = (txt) => { + return txt.match(/^\s*journey/) !== null; +}; diff --git a/src/docs/Setup.md b/src/docs/Setup.md index a9d8e87e2..41e706825 100644 --- a/src/docs/Setup.md +++ b/src/docs/Setup.md @@ -1405,6 +1405,15 @@ This sets the auto-wrap padding for the diagram (sides only) **Notes:** Default value: 0. +## parse + +### Parameters + +- `text` **[string][5]** +- `parseError` **[Function][6]?** + +Returns **[boolean][7]** + ## setSiteConfig ## setSiteConfig @@ -1422,7 +1431,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## getSiteConfig @@ -1434,7 +1443,7 @@ Returns **[object][5]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## setConfig @@ -1473,10 +1482,10 @@ $(function () { ### Parameters -- `id` **[string][6]** The id of the element to be rendered -- `text` **[string][6]** The graph definition -- `cb` **function (svgCode: [string][6], bindFunctions: function (element: [Element][7]): void): void** -- `container` **[Element][7]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][5]** The id of the element to be rendered +- `text` **[string][5]** The graph definition +- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** +- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1515,7 +1524,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][5]** The directive to push in +- `directive` **[object][8]** The directive to push in ## reset @@ -1613,6 +1622,8 @@ Returns **void** [2]: Setup.md?id=render [3]: 8.6.0_docs.md [4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[7]: https://developer.mozilla.org/docs/Web/API/Element +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[9]: https://developer.mozilla.org/docs/Web/API/Element From 6ad9208119969a7952ecbf4ae5f7c0780383edb0 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" <ashley.engelund@gmail.com> Date: Sun, 11 Sep 2022 11:37:23 -0700 Subject: [PATCH 070/115] eslint fixes --- src/docs.mts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index dc7ec29e3..6fcea6e60 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -36,10 +36,9 @@ import { globby } from 'globby'; import { JSDOM } from 'jsdom'; import type { Code, Root } from 'mdast'; import { join, dirname } from 'path'; -// @ts-ignore import prettier from 'prettier'; import { remark } from 'remark'; -// @ts-ignore +// @ts-ignore No typescript declaration file import flatmap from 'unist-util-flatmap'; const SOURCE_DOCS_DIR = 'src/docs'; @@ -90,9 +89,8 @@ const changeToFinalDocDir = (file: string): string => { * @param {boolean} wasCopied Whether or not the file was copied */ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => { - let changeMsg: string; + const changeMsg = wasCopied ? LOGMSG_TRANSFORMED : LOGMSG_TO_BE_TRANSFORMED; let logMsg: string; - changeMsg = wasCopied ? LOGMSG_TRANSFORMED : LOGMSG_TO_BE_TRANSFORMED; logMsg = ` File ${changeMsg}: ${filename}`; if (wasCopied) { logMsg += LOGMSG_COPIED; @@ -106,15 +104,11 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => { * messages to the console. * * @param {string} filename Name of the file that will be verified - * @param {string} [transformedContent] New contents for the file * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final * documentation directory. Default is `false` + * @param {string} [transformedContent] New contents for the file */ -const copyTransformedContents = ( - filename: string, - doCopy: boolean = false, - transformedContent?: string -) => { +const copyTransformedContents = (filename: string, doCopy = false, transformedContent?: string) => { const fileInFinalDocDir = changeToFinalDocDir(filename); const existingBuffer = existsSync(fileInFinalDocDir) ? readFileSync(fileInFinalDocDir) From 48a899f7a90db8d2e9d5443dd8aa8b08613a4c12 Mon Sep 17 00:00:00 2001 From: Alois Klink <alois@aloisklink.com> Date: Sat, 10 Sep 2022 02:22:03 +0100 Subject: [PATCH 071/115] build: remove main function from `.jison` files When converting a `.jison` file into a CommonJS module, jison by default adds a main() function that calls `require("fs");` Even though the main function is never used in the browser, because `fs` is a Node.JS only module, this causes some esbuild issues. To disable this, we can just set an empty main to the jison generator. --- .esbuild/util.cjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 6b462ff4e..f22186fc2 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -61,7 +61,9 @@ const jisonPlugin = { build.onLoad({ filter: /\.jison$/ }, async (args) => { // Load the file from the file system const source = await fs.promises.readFile(args.path, 'utf8'); - const contents = new Generator(source, { 'token-stack': true }).generate(); + const contents = new Generator(source, { 'token-stack': true }).generate({ + moduleMain: '() => {}', // disable moduleMain (default one requires Node.JS modules) + }); return { contents, warnings: [] }; }); }, From 37aaca009086d85cdb0d9c6fb46994c5a8eedc9b Mon Sep 17 00:00:00 2001 From: Alois Klink <alois@aloisklink.com> Date: Sun, 11 Sep 2022 20:55:03 +0100 Subject: [PATCH 072/115] build: convert core build to unbundled ESM The `mermaid.core.js` build was previously a UMD build that did not have `node_modules` bundled. This was designed for users to add `mermaid` to their own apps, then bundle with Webpack/ESBuild. Hence the bundle test in `cypress/platform/bundle-test.js`. As ESBuild does not support UMD, I've switched the `mermaid.core.js` to instead use ESM, as Mermaid now requires ESM (due to d3 requiring ESM). All modern bundlers also support ESM. --- .esbuild/esbuild.cjs | 7 +++---- .esbuild/util.cjs | 45 +++++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs index affd08ef9..e38951bdb 100644 --- a/.esbuild/esbuild.cjs +++ b/.esbuild/esbuild.cjs @@ -1,4 +1,4 @@ -const { esmBuild, iifeBuild } = require('./util.cjs'); +const { esmBuild, esmCoreBuild, iifeBuild } = require('./util.cjs'); const { build } = require('esbuild'); const handler = (e) => { @@ -12,10 +12,9 @@ build(iifeBuild({ minify: false, watch })).catch(handler); // mermaid.esm.mjs build(esmBuild({ minify: false, watch })).catch(handler); -// mermaid.core.js -build(iifeBuild({ minify: false, core: true })).catch(handler); - // mermaid.min.js build(esmBuild()).catch(handler); // mermaid.esm.min.mjs build(iifeBuild()).catch(handler); +// mermaid.core.mjs (node_modules unbundled) +build(esmCoreBuild()).catch(handler); diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index f22186fc2..10832474f 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -1,5 +1,6 @@ const { Generator } = require('jison'); const fs = require('fs'); +const { dependencies } = require('../package.json'); /** @typedef {import('esbuild').BuildOptions} Options */ @@ -27,8 +28,12 @@ const buildOptions = (override = {}) => { }; /** - * @param {Options} override - * @returns {Options} + * Build options for mermaid.esm.* build. + * + * For ESM browser use. + * + * @param {Options} override - Override options. + * @returns {Options} ESBuild build options. */ exports.esmBuild = (override = { minify: true }) => { return buildOptions({ @@ -39,17 +44,35 @@ exports.esmBuild = (override = { minify: true }) => { }; /** - * @param {Options & { core?: boolean }} override - * @returns {Options} + * Build options for mermaid.core.* build. + * + * This build does not bundle `./node_modules/`, as it is designed to be used + * with Webpack/ESBuild to merge webpack into a website. + * + * @param {Options} override - Override options. + * @returns {Options} ESBuild build options. */ -exports.iifeBuild = (override = { minify: true, core: false }) => { - const core = override.core; - if (core && override.minify) { - throw new Error('Cannot minify core build'); - } - delete override.core; +exports.esmCoreBuild = (override) => { return buildOptions({ - outfile: `dist/mermaid${override.minify ? '.min' : core ? '.core' : ''}.js`, + format: 'esm', + outfile: `dist/mermaid.core.mjs`, + external: ['require', 'fs', 'path', ...Object.keys(dependencies)], + platform: 'neutral', + ...override, + }); +}; + +/** + * Build options for mermaid.js build. + * + * For IIFE browser use (where ESM is not yet supported). + * + * @param {Options} override - Override options. + * @returns {Options} ESBuild build options. + */ +exports.iifeBuild = (override = { minify: true }) => { + return buildOptions({ + outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`, format: 'iife', ...override, }); From 5554725f634edeb8a66ae3411ad28805fa16892a Mon Sep 17 00:00:00 2001 From: Alois Klink <alois@aloisklink.com> Date: Sun, 11 Sep 2022 21:26:41 +0100 Subject: [PATCH 073/115] build: change package export to mermaid.core.mjs `mermaid.core.mjs` should be the default export. This is because it does not bundle `node_modules/`, allowing users of mermaid to bundle dependencies themselves, using Webpack/ESBuild/others. --- cypress/platform/bundle-test.js | 2 +- package.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/platform/bundle-test.js b/cypress/platform/bundle-test.js index 22f4fe93c..b4ce798b2 100644 --- a/cypress/platform/bundle-test.js +++ b/cypress/platform/bundle-test.js @@ -1,4 +1,4 @@ -import mermaid from '../../dist/mermaid'; +import mermaid from '../../dist/mermaid.core.mjs'; let code = `flowchart LR Power_Supply --> Transmitter_A diff --git a/package.json b/package.json index e1709730e..a94626597 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,13 @@ "name": "mermaid", "version": "9.1.6", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", - "main": "dist/mermaid.min.js", - "module": "dist/mermaid.esm.min.mjs", + "main": "dist/mermaid.core.mjs", + "module": "dist/mermaid.core.mjs", "types": "dist/mermaid.d.ts", "exports": { ".": { "require": "./dist/mermaid.min.js", - "import": "./dist/mermaid.esm.min.mjs", + "import": "./dist/mermaid.core.mjs", "types": "./dist/mermaid.d.ts" }, "./*": "./*" From 9cc7da09fcf259abd634bcd9d2ce9c8e5ed9716a Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" <ashley.engelund@gmail.com> Date: Sun, 11 Sep 2022 14:10:34 -0700 Subject: [PATCH 074/115] formatting --- src/docs.mts | 72 ++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/src/docs.mts b/src/docs.mts index 6fcea6e60..318f03de0 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -1,10 +1,11 @@ /* eslint-disable no-console */ /** - * @file Transform documentation source files into files suitable for publishing and optionally copy - * the transformed files from the source directory to the directory used for the final, published - * documentation directory. The list of files transformed and copied to final documentation - * directory are logged to the console. If a file in the source directory has the same contents in + * @file Transform documentation source files into files suitable for publishing + * and optionally copy the transformed files from the source directory to the + * directory used for the final, published documentation directory. The list + * of files transformed and copied to final documentation directory are logged + * to the console. If a file in the source directory has the same contents in * the final directory, nothing is done (the final directory is up-to-date). * @example * docs @@ -23,12 +24,12 @@ * If the --git option is used, the command `git add docs` will be run after all transformations (and/or verifications) have completed successfully * If not files were transformed, the git command is not run. * - * @todo Ensure that the documentation source and final paths are correct by using process.cwd() to - * get their absolute paths. Ensures that the location of those 2 directories is not dependent on - * where this file resides. + * @todo Ensure that the documentation source and final paths are correct by + * using process.cwd() to get their absolute paths. Ensures that the location + * of those 2 directories is not dependent on where this file resides. * - * @todo Write a test file for this. (Will need to be able to deal .mts file. Jest has trouble with - * it.) + * @todo Write a test file for this. (Will need to be able to deal .mts file. + * Jest has trouble with it.) */ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; import { exec } from 'child_process'; @@ -67,13 +68,14 @@ const prettierConfig: prettier.Config = { let filesWereTransformed = false; /** - * Given a source file name and path, return the documentation destination full path and file name - * Create the destination path if it does not already exist. + * Given a source file name and path, return the documentation destination full + * path and file name Create the destination path if it does not already exist. * * @param {string} file - Name of the file (including full path) - * @returns {string} Name of the file with the path changed from the source directory to final - * documentation directory - * @todo Possible Improvement: combine with lint-staged to only copy files that have changed + * @returns {string} Name of the file with the path changed from the source + * directory to final documentation directory + * @todo Possible Improvement: combine with lint-staged to only copy files that + * have changed */ const changeToFinalDocDir = (file: string): string => { const newDir = file.replace(SOURCE_DOCS_DIR, FINAL_DOCS_DIR); @@ -82,8 +84,8 @@ const changeToFinalDocDir = (file: string): string => { }; /** - * Log messages to the console showing if the transformed file copied to the final documentation - * directory or still needs to be copied. + * Log messages to the console showing if the transformed file copied to the + * final documentation directory or still needs to be copied. * * @param {string} filename Name of the file that was transformed * @param {boolean} wasCopied Whether or not the file was copied @@ -99,13 +101,14 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => { }; /** - * If the file contents were transformed, set the _filesWereTransformed_ flag to true and copy the - * transformed contents to the final documentation directory if the doCopy flag is true. Log - * messages to the console. + * If the file contents were transformed, set the _filesWereTransformed_ flag to + * true and copy the transformed contents to the final documentation directory + * if the doCopy flag is true. Log messages to the console. * * @param {string} filename Name of the file that will be verified - * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final - * documentation directory. Default is `false` + * @param {boolean} [doCopy=false] Whether we should copy that + * transformedContents to the final documentation directory. Default is + * `false`. Default is `false` * @param {string} [transformedContent] New contents for the file */ const copyTransformedContents = (filename: string, doCopy = false, transformedContent?: string) => { @@ -130,14 +133,15 @@ const readSyncedUTF8file = (filename: string): string => { }; /** - * Transform a markdown file and write the transformed file to the directory for published - * documentation + * Transform a markdown file and write the transformed file to the directory for + * published documentation * - * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one - * place where the documentation is published), this will show the code used for the mermaid - * diagram + * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the + * docsify site (one place where the documentation is published), this will + * show the code used for the mermaid diagram * 2. Add the text that says the file is automatically generated - * 3. Use prettier to format the file Verify that the file has been changed and write out the changes + * 3. Use prettier to format the file Verify that the file has been changed and + * write out the changes * * @param file {string} name of the file that will be verified */ @@ -164,17 +168,17 @@ const transformMarkdown = (file: string) => { }; /** - * Transform an HTML file and write the transformed file to the directory for published - * documentation + * Transform an HTML file and write the transformed file to the directory for + * published documentation * - * - Add the text that says the file is automatically generated Verify that the file has been changed - * and write out the changes + * - Add the text that says the file is automatically generated Verify that the + * file has been changed and write out the changes * * @param filename {string} name of the HTML file to transform */ const transformHtml = (filename: string) => { /** - * Insert the '...auto generated...' comment into an HTML file after the <html> element + * Insert the '...auto generated...' comment into an HTML file after the<html> element * * @param fileName {string} file name that should have the comment inserted * @returns {string} The contents of the file with the comment inserted @@ -204,7 +208,9 @@ const transformHtml = (filename: string) => { const includeFilesStartingWithDot = true; console.log('Transforming markdown files...'); - const mdFiles = await globby([join(sourceDirGlob, '*.md')], { dot: includeFilesStartingWithDot }); + const mdFiles = await globby([join(sourceDirGlob, '*.md')], { + dot: includeFilesStartingWithDot, + }); mdFiles.forEach(transformMarkdown); console.log('Transforming html files...'); From 152795666932cf92af33635d2f98dcbe93e911ba Mon Sep 17 00:00:00 2001 From: Alois Klink <alois@aloisklink.com> Date: Sun, 4 Sep 2022 01:56:43 +0100 Subject: [PATCH 075/115] fix(git): support unusual prefixes in branch name jison throws an error if a branch name starts with an unusual prefix. For example, a branch named `branch/test-branch` will throw a parse error, since jison thinks it's a `branch` command, and not a branch id. An easy fix is to use the `(?=\s|$)` regex to ensure that only 'branch ' or 'branch\n' will be parsed as the branch command. Fixes: https://github.com/mermaid-js/mermaid/issues/3362 --- src/diagrams/git/gitGraphParserV2.spec.js | 28 +++++++++++++++++++++++ src/diagrams/git/parser/gitGraph.jison | 10 ++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/diagrams/git/gitGraphParserV2.spec.js b/src/diagrams/git/gitGraphParserV2.spec.js index 9a33e288f..b69dd97ac 100644 --- a/src/diagrams/git/gitGraphParserV2.spec.js +++ b/src/diagrams/git/gitGraphParserV2.spec.js @@ -363,6 +363,34 @@ describe('when parsing a gitGraph', function () { expect(Object.keys(parser.yy.getBranches()).length).toBe(2); }); + it('should allow branch names starting with unusual prefixes', function () { + const str = `gitGraph: + commit + %% branch names starting with numbers are not recommended, but are supported by git + branch branch01 + branch checkout02 + branch cherry-pick03 + branch branch/example-branch + branch merge/test_merge + `; + + parser.parse(str); + const commits = parser.yy.getCommits(); + expect(Object.keys(commits).length).toBe(1); + expect(parser.yy.getCurrentBranch()).toBe('merge/test_merge'); + expect(parser.yy.getDirection()).toBe('LR'); + expect(Object.keys(parser.yy.getBranches()).length).toBe(6); + expect(Object.keys(parser.yy.getBranches())).toEqual( + expect.arrayContaining([ + 'branch01', + 'checkout02', + 'cherry-pick03', + 'branch/example-branch', + 'merge/test_merge', + ]) + ); + }); + it('should handle new branch checkout', function () { const str = `gitGraph: commit diff --git a/src/diagrams/git/parser/gitGraph.jison b/src/diagrams/git/parser/gitGraph.jison index 29edec808..15909a314 100644 --- a/src/diagrams/git/parser/gitGraph.jison +++ b/src/diagrams/git/parser/gitGraph.jison @@ -36,7 +36,7 @@ accDescr\s*"{"\s* { this.begin("ac \#[^\n]* /* skip comments */ \%%[^\n]* /* skip comments */ "gitGraph" return 'GG'; -"commit" return 'COMMIT'; +commit(?=\s|$) return 'COMMIT'; "id:" return 'COMMIT_ID'; "type:" return 'COMMIT_TYPE'; "msg:" return 'COMMIT_MSG'; @@ -44,12 +44,12 @@ accDescr\s*"{"\s* { this.begin("ac "REVERSE" return 'REVERSE'; "HIGHLIGHT" return 'HIGHLIGHT'; "tag:" return 'COMMIT_TAG'; -"branch" return 'BRANCH'; +branch(?=\s|$) return 'BRANCH'; "order:" return 'ORDER'; -"merge" return 'MERGE'; -"cherry-pick" return 'CHERRY_PICK'; +merge(?=\s|$) return 'MERGE'; +cherry-pick(?=\s|$) return 'CHERRY_PICK'; // "reset" return 'RESET'; -"checkout" return 'CHECKOUT'; +checkout(?=\s|$) return 'CHECKOUT'; "LR" return 'DIR'; "BT" return 'DIR'; ":" return ':'; From 3f76eb0ac24179fb80a264eeb0cf564a042c9920 Mon Sep 17 00:00:00 2001 From: Alois Klink <alois@aloisklink.com> Date: Mon, 12 Sep 2022 06:21:57 +0100 Subject: [PATCH 076/115] docs: update `mermaid.core.*` JSDoc Fix typo and add that `mermaid.core.*` is compatible with Vite. --- .esbuild/util.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 10832474f..8c1c37eb2 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -47,7 +47,7 @@ exports.esmBuild = (override = { minify: true }) => { * Build options for mermaid.core.* build. * * This build does not bundle `./node_modules/`, as it is designed to be used - * with Webpack/ESBuild to merge webpack into a website. + * with Webpack/ESBuild/Vite to use mermaid inside an app/website. * * @param {Options} override - Override options. * @returns {Options} ESBuild build options. From bfa69aa084783ae606769132fc21b9d8f697a319 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Mon, 12 Sep 2022 10:55:13 +0530 Subject: [PATCH 077/115] chore(docs): Remove edit this page --- docs/mindmap.md | 2 -- src/docs/mindmap.md | 2 -- 2 files changed, 4 deletions(-) diff --git a/docs/mindmap.md b/docs/mindmap.md index 6ab954f5b..8a7e21eb7 100644 --- a/docs/mindmap.md +++ b/docs/mindmap.md @@ -2,8 +2,6 @@ # Mindmap -**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/docs/mindmap.md) - > Mindmap: This is an experimental diagram for now. The syntax and properties can change in future releases. The syntax is stabel except for the icon integration which is the experimental part. "A mind map is a diagram used to visually organize information into a hierarchy, showing relationships among pieces of the whole. It is often created around a single concept, drawn as an image in the center of a blank page, to which associated representations of ideas such as images, words and parts of words are added. Major ideas are connected directly to the central concept, and other ideas branch out from those major ideas." Wikipedia diff --git a/src/docs/mindmap.md b/src/docs/mindmap.md index d7f1b4817..85a05e04b 100644 --- a/src/docs/mindmap.md +++ b/src/docs/mindmap.md @@ -1,7 +1,5 @@ # Mindmap -**Edit this Page** [![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/docs/mindmap.md) - > Mindmap: This is an experimental diagram for now. The syntax and properties can change in future releases. The syntax is stabel except for the icon integration which is the experimental part. "A mind map is a diagram used to visually organize information into a hierarchy, showing relationships among pieces of the whole. It is often created around a single concept, drawn as an image in the center of a blank page, to which associated representations of ideas such as images, words and parts of words are added. Major ideas are connected directly to the central concept, and other ideas branch out from those major ideas." Wikipedia From 213309f5e238c458a9560b355d218c95a69197ca Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Mon, 12 Sep 2022 07:41:56 +0200 Subject: [PATCH 078/115] Fix for broken tests --- src/diagram-api/diagramAPI.spec.ts | 3 +++ src/diagrams/sequence/sequenceDiagram.spec.js | 8 ++------ src/mermaid.spec.js | 3 +++ test.js | 8 -------- 4 files changed, 8 insertions(+), 14 deletions(-) delete mode 100644 test.js diff --git a/src/diagram-api/diagramAPI.spec.ts b/src/diagram-api/diagramAPI.spec.ts index f72384c11..e0c7a283d 100644 --- a/src/diagram-api/diagramAPI.spec.ts +++ b/src/diagram-api/diagramAPI.spec.ts @@ -1,5 +1,8 @@ import { detectType } from './detectType'; import { getDiagram, registerDiagram } from './diagramAPI'; +import { addDiagrams } from './diagram-orchestration'; + +addDiagrams(); describe('DiagramAPI', () => { it('should return default diagrams', () => { diff --git a/src/diagrams/sequence/sequenceDiagram.spec.js b/src/diagrams/sequence/sequenceDiagram.spec.js index 808eb567e..5479e49e4 100644 --- a/src/diagrams/sequence/sequenceDiagram.spec.js +++ b/src/diagrams/sequence/sequenceDiagram.spec.js @@ -1,12 +1,8 @@ -// import sequence from './parser/sequenceDiagram'; -// import sequenceDb from './sequenceDb'; import * as configApi from '../../config'; -// import renderer from './sequenceRenderer'; import mermaidAPI from '../../mermaidAPI'; -// import '../../diagram-api/diagramAPI'; import Diagram from '../../Diagram'; - -// console.log('sequenceDiagram', sequenceDb); +import { addDiagrams } from '../../diagram-api/diagram-orchestration'; +addDiagrams(); /** * @param conf * @param key diff --git a/src/mermaid.spec.js b/src/mermaid.spec.js index c6014dfff..ef870072e 100644 --- a/src/mermaid.spec.js +++ b/src/mermaid.spec.js @@ -4,6 +4,9 @@ import flowDb from './diagrams/flowchart/flowDb'; import flowParser from './diagrams/flowchart/parser/flow'; import flowRenderer from './diagrams/flowchart/flowRenderer'; import Diagram from './Diagram'; +import { addDiagrams } from './diagram-api/diagram-orchestration'; + +addDiagrams(); const spyOn = jest.spyOn; diff --git a/test.js b/test.js deleted file mode 100644 index fa728c6ed..000000000 --- a/test.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -function apa() { - // comment's - const a = 1; - return 'apa' + a; -} From e740325d84deda904218f0f67b02382de7fc3e9f Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Mon, 12 Sep 2022 11:41:26 +0530 Subject: [PATCH 079/115] Unify webpack build --- .webpack/webpack.config.babel.js | 72 +++++++++++++++----------------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/.webpack/webpack.config.babel.js b/.webpack/webpack.config.babel.js index 9dfd834b7..c7cc25ee4 100644 --- a/.webpack/webpack.config.babel.js +++ b/.webpack/webpack.config.babel.js @@ -3,43 +3,37 @@ import nodeExternals from 'webpack-node-externals'; import baseConfig from './webpack.config.base'; export default (_env, args) => { - switch (args.mode) { - case 'development': - return [ - baseConfig, - merge(baseConfig, { - externals: [nodeExternals()], - output: { - filename: '[name].core.js', - }, - }), - ]; - case 'production': - return [ - // umd - merge(baseConfig, { - output: { - filename: '[name].min.js', - }, - }), - // esm - mergeWithCustomize({ - customizeObject: customizeObject({ - 'output.library': 'replace', - }), - })(baseConfig, { - experiments: { - outputModule: true, - }, - output: { - library: { - type: 'module', - }, - filename: '[name].esm.min.mjs', - }, - }), - ]; - default: - throw new Error('No matching configuration was found!'); - } + return [ + // non-minified + baseConfig, + // core [To be used by webpack/esbuild/vite etc to bundle mermaid] + merge(baseConfig, { + externals: [nodeExternals()], + output: { + filename: '[name].core.js', + }, + }), + // umd + merge(baseConfig, { + output: { + filename: '[name].min.js', + }, + }), + // esm + mergeWithCustomize({ + customizeObject: customizeObject({ + 'output.library': 'replace', + }), + })(baseConfig, { + experiments: { + outputModule: true, + }, + output: { + library: { + type: 'module', + }, + filename: '[name].esm.min.mjs', + }, + }), + ]; }; From 681f4bb803f3351c7eb2777adde462b1db432748 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Mon, 12 Sep 2022 11:41:50 +0530 Subject: [PATCH 080/115] Keep webpack as default build option --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a94626597..94c94ab1a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly", "build:webpack": "webpack --mode production --progress --color", "build:watch": "yarn build:code --watch", - "build": "yarn clean; concurrently \"yarn build:code\" \"yarn build:types\"", + "build:new": "concurrently \"yarn build:code\" \"yarn build:types\"", + "build": "yarn clean; yarn build:webpack", "docs:build": "ts-node-esm src/docs.mts", "docs:verify": "ts-node-esm src/docs.mts --verify", "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md && prettier --write src/docs/Setup.md && yarn docs:build", From d8735060dcf8c4c8734c3771a88d46422e835f91 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Mon, 12 Sep 2022 11:55:40 +0530 Subject: [PATCH 081/115] Disable minimization on non `min` files. --- .webpack/webpack.config.babel.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.webpack/webpack.config.babel.js b/.webpack/webpack.config.babel.js index c7cc25ee4..15760b19b 100644 --- a/.webpack/webpack.config.babel.js +++ b/.webpack/webpack.config.babel.js @@ -5,13 +5,20 @@ import baseConfig from './webpack.config.base'; export default (_env, args) => { return [ // non-minified - baseConfig, + merge(baseConfig, { + optimization: { + minimize: false, + }, + }), // core [To be used by webpack/esbuild/vite etc to bundle mermaid] merge(baseConfig, { externals: [nodeExternals()], output: { filename: '[name].core.js', }, + optimization: { + minimize: false, + }, }), // umd merge(baseConfig, { From 9e5e7b31e948a99b0b781fc43e1946764ffa4579 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Mon, 12 Sep 2022 08:51:52 +0200 Subject: [PATCH 082/115] Limiting the interaction between the mermaid diagram and Mermaid to the diagramAPI --- src/diagram-api/diagramAPI.ts | 21 ++++++++++++++------- src/diagrams/mindmap/mindmap.spec.js | 2 +- src/diagrams/mindmap/mindmapDb.js | 3 +-- src/diagrams/mindmap/svgDraw.js | 2 -- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/diagram-api/diagramAPI.ts b/src/diagram-api/diagramAPI.ts index eab74a022..232933e0d 100644 --- a/src/diagram-api/diagramAPI.ts +++ b/src/diagram-api/diagramAPI.ts @@ -1,11 +1,23 @@ -import { addDetector, DiagramDetector } from './detectType'; -import { log as _log } from '../logger'; +import { addDetector, DiagramDetector as _DiagramDetector } from './detectType'; +import { log as _log, setLogLevel as _setLogLevel } from '../logger'; import { getConfig as _getConfig } from '../config'; import { sanitizeText as _sanitizeText } from '../diagrams/common/common'; import { MermaidConfig } from '../config.type'; import { setupGraphViewbox as _setupGraphViewbox } from '../setupGraphViewbox'; import { addStylesForDiagram } from '../styles'; +/* + Packaging and exposing resources for externa diagrams so that they can import + diagramAPI and have access to selct parts of mermaid common code reqiored to + create diagrams worling like the internal diagrams. +*/ +export const log = _log; +export const setLogLevel = _setLogLevel; +export type DiagramDetector = _DiagramDetector; +export const getConfig = _getConfig; +export const sanitizeText = (text: string) => _sanitizeText(text, getConfig()); +export const setupGraphViewbox = _setupGraphViewbox; + export interface DiagramDefinition { db: any; renderer: any; @@ -35,8 +47,3 @@ export const getDiagram = (name: string): DiagramDefinition => { } throw new Error(`Diagram ${name} not found.`); }; - -export const log = _log; -export const getConfig = _getConfig; -export const sanitizeText = (text: string) => _sanitizeText(text, getConfig()); -export const setupGraphViewbox = _setupGraphViewbox; diff --git a/src/diagrams/mindmap/mindmap.spec.js b/src/diagrams/mindmap/mindmap.spec.js index 155b566fb..e7909ef50 100644 --- a/src/diagrams/mindmap/mindmap.spec.js +++ b/src/diagrams/mindmap/mindmap.spec.js @@ -1,6 +1,6 @@ import { parser as mindmap } from './parser/mindmap'; import * as mindmapDB from './mindmapDb'; -import { setLogLevel } from '../../logger'; +import { setLogLevel } from '../../diagram-api/diagramAPI'; describe('when parsing a mindmap ', function () { beforeEach(function () { diff --git a/src/diagrams/mindmap/mindmapDb.js b/src/diagrams/mindmap/mindmapDb.js index 48b242c9e..68906c5fb 100644 --- a/src/diagrams/mindmap/mindmapDb.js +++ b/src/diagrams/mindmap/mindmapDb.js @@ -1,6 +1,5 @@ /** Created by knut on 15-01-14. */ -import { sanitizeText, getConfig } from '../../diagram-api/diagramAPI'; -import { log as _log } from '../../logger'; +import { sanitizeText, getConfig, log as _log } from '../../diagram-api/diagramAPI'; let nodes = []; let cnt = 0; diff --git a/src/diagrams/mindmap/svgDraw.js b/src/diagrams/mindmap/svgDraw.js index 511c46e20..0b5c5e264 100644 --- a/src/diagrams/mindmap/svgDraw.js +++ b/src/diagrams/mindmap/svgDraw.js @@ -1,4 +1,3 @@ -const lineBreakRegex = /<br\s*\/?>/gi; import { select } from 'd3'; import * as db from './mindmapDb'; @@ -15,7 +14,6 @@ function wrap(text, width) { .reverse(), word, line = [], - lineNumber = 0, lineHeight = 1.1, // ems y = text.attr('y'), dy = parseFloat(text.attr('dy')), From ca5fbb7fa8934428f636642f843224945279e3fa Mon Sep 17 00:00:00 2001 From: mmorel-35 <mmorel-35@users.noreply.github.com> Date: Mon, 12 Sep 2022 07:20:57 +0000 Subject: [PATCH 083/115] chore: update browsers list --- docs/Setup.md | 31 +++++++++++++++++++++---------- src/docs/Setup.md | 31 +++++++++++++++++++++---------- yarn.lock | 6 +++--- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/docs/Setup.md b/docs/Setup.md index 1f948ee01..2ef56e1d8 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -1407,6 +1407,15 @@ This sets the auto-wrap padding for the diagram (sides only) **Notes:** Default value: 0. +## parse + +### Parameters + +- `text` **[string][5]** +- `parseError` **[Function][6]?** + +Returns **[boolean][7]** + ## setSiteConfig ## setSiteConfig @@ -1424,7 +1433,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## getSiteConfig @@ -1436,7 +1445,7 @@ Returns **[object][5]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## setConfig @@ -1475,10 +1484,10 @@ $(function () { ### Parameters -- `id` **[string][6]** The id of the element to be rendered -- `text` **[string][6]** The graph definition -- `cb` **function (svgCode: [string][6], bindFunctions: function (element: [Element][7]): void): void** -- `container` **[Element][7]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][5]** The id of the element to be rendered +- `text` **[string][5]** The graph definition +- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** +- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1517,7 +1526,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][5]** The directive to push in +- `directive` **[object][8]** The directive to push in ## reset @@ -1615,6 +1624,8 @@ Returns **void** [2]: Setup.md?id=render [3]: 8.6.0_docs.md [4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[7]: https://developer.mozilla.org/docs/Web/API/Element +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[9]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/src/docs/Setup.md b/src/docs/Setup.md index a9d8e87e2..41e706825 100644 --- a/src/docs/Setup.md +++ b/src/docs/Setup.md @@ -1405,6 +1405,15 @@ This sets the auto-wrap padding for the diagram (sides only) **Notes:** Default value: 0. +## parse + +### Parameters + +- `text` **[string][5]** +- `parseError` **[Function][6]?** + +Returns **[boolean][7]** + ## setSiteConfig ## setSiteConfig @@ -1422,7 +1431,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## getSiteConfig @@ -1434,7 +1443,7 @@ Returns **[object][5]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## setConfig @@ -1473,10 +1482,10 @@ $(function () { ### Parameters -- `id` **[string][6]** The id of the element to be rendered -- `text` **[string][6]** The graph definition -- `cb` **function (svgCode: [string][6], bindFunctions: function (element: [Element][7]): void): void** -- `container` **[Element][7]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][5]** The id of the element to be rendered +- `text` **[string][5]** The graph definition +- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** +- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1515,7 +1524,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][5]** The directive to push in +- `directive` **[object][8]** The directive to push in ## reset @@ -1613,6 +1622,8 @@ Returns **void** [2]: Setup.md?id=render [3]: 8.6.0_docs.md [4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[7]: https://developer.mozilla.org/docs/Web/API/Element +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[9]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/yarn.lock b/yarn.lock index 58c3d2818..8b0ce83d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3937,9 +3937,9 @@ camelcase@^6.2.0: integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== caniuse-lite@^1.0.30001359: - version "1.0.30001390" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001390.tgz" - integrity sha512-sS4CaUM+/+vqQUlCvCJ2WtDlV81aWtHhqeEVkLokVJJa3ViN4zDxAGfq9R8i1m90uGHxo99cy10Od+lvn3hf0g== + version "1.0.30001397" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001397.tgz" + integrity sha512-SW9N2TbCdLf0eiNDRrrQXx2sOkaakNZbCjgNpPyMJJbiOrU5QzMIrXOVMRM1myBXTD5iTkdrtU/EguCrBocHlA== caseless@~0.12.0: version "0.12.0" From 885e69c809e3fb31f42e4df54f0aeb7603853bb7 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Mon, 12 Sep 2022 10:53:45 +0200 Subject: [PATCH 084/115] Fix for issue with setting the loglevel via numbers --- src/logger.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/logger.ts b/src/logger.ts index 57c9cf4bb..b01934e88 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -36,6 +36,8 @@ export const setLogLevel = function (level: keyof typeof LEVELS | number | strin if (level in LEVELS) { numericLevel = LEVELS[level as keyof typeof LEVELS]; } + } else if (typeof level === 'number') { + numericLevel = level; } log.trace = () => {}; log.debug = () => {}; From 06365faef32af6a266125e8e36aef51589877822 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Mon, 12 Sep 2022 11:24:58 +0200 Subject: [PATCH 085/115] Moving out tests from mermaid.spec.js --- src/diagram-api/diagramAPI.ts | 4 +- .../flowchart/flowRenderer.addEdges.spec.js | 154 ++++++++++++++++++ src/mermaid.spec.js | 148 ----------------- 3 files changed, 156 insertions(+), 150 deletions(-) create mode 100644 src/diagrams/flowchart/flowRenderer.addEdges.spec.js diff --git a/src/diagram-api/diagramAPI.ts b/src/diagram-api/diagramAPI.ts index 232933e0d..9a86c5b51 100644 --- a/src/diagram-api/diagramAPI.ts +++ b/src/diagram-api/diagramAPI.ts @@ -6,8 +6,8 @@ import { MermaidConfig } from '../config.type'; import { setupGraphViewbox as _setupGraphViewbox } from '../setupGraphViewbox'; import { addStylesForDiagram } from '../styles'; -/* - Packaging and exposing resources for externa diagrams so that they can import +/* + Packaging and exposing resources for externa diagrams so that they can import diagramAPI and have access to selct parts of mermaid common code reqiored to create diagrams worling like the internal diagrams. */ diff --git a/src/diagrams/flowchart/flowRenderer.addEdges.spec.js b/src/diagrams/flowchart/flowRenderer.addEdges.spec.js new file mode 100644 index 000000000..1bcb076f1 --- /dev/null +++ b/src/diagrams/flowchart/flowRenderer.addEdges.spec.js @@ -0,0 +1,154 @@ +import flowDb from './flowDb'; +import flowParser from './parser/flow'; +import flowRenderer from './flowRenderer'; +import Diagram from '../../Diagram'; +import { addDiagrams } from '../../diagram-api/diagram-orchestration'; +addDiagrams(); +afterEach(() => { + jest.restoreAllMocks(); +}); + +describe('when using mermaid and ', function () { + describe('when calling addEdges ', function () { + beforeEach(function () { + flowParser.parser.yy = flowDb; + flowDb.clear(); + flowDb.setGen('gen-2'); + }); + it('should handle edges with text', function () { + const diag = new Diagram('graph TD;A-->|text ex|B;'); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B-'); + expect(options.arrowhead).toBe('normal'); + expect(options.label.match('text ex')).toBeTruthy(); + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + + it('should handle edges without text', function () { + const diag = new Diagram('graph TD;A-->B;'); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B-'); + expect(options.arrowhead).toBe('normal'); + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + + it('should handle open-ended edges', function () { + const diag = new Diagram('graph TD;A---B;'); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B-'); + expect(options.arrowhead).toBe('none'); + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + + it('should handle edges with styles defined', function () { + const diag = new Diagram('graph TD;A---B; linkStyle 0 stroke:val1,stroke-width:val2;'); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B-'); + expect(options.arrowhead).toBe('none'); + expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:none;'); + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + it('should handle edges with interpolation defined', function () { + const diag = new Diagram('graph TD;A---B; linkStyle 0 interpolate basis'); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B-'); + expect(options.arrowhead).toBe('none'); + expect(options.curve).toBe('basis'); // mocked as string + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + it('should handle edges with text and styles defined', function () { + const diag = new Diagram( + 'graph TD;A---|the text|B; linkStyle 0 stroke:val1,stroke-width:val2;' + ); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B-'); + expect(options.arrowhead).toBe('none'); + expect(options.label.match('the text')).toBeTruthy(); + expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:none;'); + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + + it('should set fill to "none" by default when handling edges', function () { + const diag = new Diagram('graph TD;A---B; linkStyle 0 stroke:val1,stroke-width:val2;'); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B'); + expect(options.arrowhead).toBe('none'); + expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:none;'); + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + + it('should not set fill to none if fill is set in linkStyle', function () { + const diag = new Diagram( + 'graph TD;A---B; linkStyle 0 stroke:val1,stroke-width:val2,fill:blue;' + ); + diag.db.getVertices(); + const edges = diag.db.getEdges(); + const mockG = { + setEdge: function (start, end, options) { + expect(start).toContain('flowchart-A-'); + expect(end).toContain('flowchart-B-'); + expect(options.arrowhead).toBe('none'); + expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:blue;'); + }, + }; + + flowRenderer.addEdges(edges, mockG, diag); + }); + }); +}); diff --git a/src/mermaid.spec.js b/src/mermaid.spec.js index ef870072e..fcd83a61b 100644 --- a/src/mermaid.spec.js +++ b/src/mermaid.spec.js @@ -2,11 +2,6 @@ import mermaid from './mermaid'; import { mermaidAPI } from './mermaidAPI'; import flowDb from './diagrams/flowchart/flowDb'; import flowParser from './diagrams/flowchart/parser/flow'; -import flowRenderer from './diagrams/flowchart/flowRenderer'; -import Diagram from './Diagram'; -import { addDiagrams } from './diagram-api/diagram-orchestration'; - -addDiagrams(); const spyOn = jest.spyOn; @@ -61,149 +56,6 @@ describe('when using mermaid and ', function () { }); }); - describe('when calling addEdges ', function () { - beforeEach(function () { - flowParser.parser.yy = flowDb; - flowDb.clear(); - flowDb.setGen('gen-2'); - }); - it('should handle edges with text', function () { - const diag = new Diagram('graph TD;A-->|text ex|B;'); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B-'); - expect(options.arrowhead).toBe('normal'); - expect(options.label.match('text ex')).toBeTruthy(); - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - - it('should handle edges without text', function () { - const diag = new Diagram('graph TD;A-->B;'); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B-'); - expect(options.arrowhead).toBe('normal'); - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - - it('should handle open-ended edges', function () { - const diag = new Diagram('graph TD;A---B;'); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B-'); - expect(options.arrowhead).toBe('none'); - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - - it('should handle edges with styles defined', function () { - const diag = new Diagram('graph TD;A---B; linkStyle 0 stroke:val1,stroke-width:val2;'); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B-'); - expect(options.arrowhead).toBe('none'); - expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:none;'); - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - it('should handle edges with interpolation defined', function () { - const diag = new Diagram('graph TD;A---B; linkStyle 0 interpolate basis'); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B-'); - expect(options.arrowhead).toBe('none'); - expect(options.curve).toBe('basis'); // mocked as string - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - it('should handle edges with text and styles defined', function () { - const diag = new Diagram( - 'graph TD;A---|the text|B; linkStyle 0 stroke:val1,stroke-width:val2;' - ); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B-'); - expect(options.arrowhead).toBe('none'); - expect(options.label.match('the text')).toBeTruthy(); - expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:none;'); - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - - it('should set fill to "none" by default when handling edges', function () { - const diag = new Diagram('graph TD;A---B; linkStyle 0 stroke:val1,stroke-width:val2;'); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B'); - expect(options.arrowhead).toBe('none'); - expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:none;'); - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - - it('should not set fill to none if fill is set in linkStyle', function () { - const diag = new Diagram( - 'graph TD;A---B; linkStyle 0 stroke:val1,stroke-width:val2,fill:blue;' - ); - diag.db.getVertices(); - const edges = diag.db.getEdges(); - const mockG = { - setEdge: function (start, end, options) { - expect(start).toContain('flowchart-A-'); - expect(end).toContain('flowchart-B-'); - expect(options.arrowhead).toBe('none'); - expect(options.style).toBe('stroke:val1;stroke-width:val2;fill:blue;'); - }, - }; - - flowRenderer.addEdges(edges, mockG, diag); - }); - }); - describe('checking validity of input ', function () { beforeEach(function () { flowParser.parser.yy = flowDb; From 7f56112f8ed232472447521d1004746b665b2f96 Mon Sep 17 00:00:00 2001 From: Ashley Engelund <weedySeaDragon@users.noreply.github.com> Date: Mon, 12 Sep 2022 09:17:40 -0700 Subject: [PATCH 086/115] change wording of console log message (use comma) Co-authored-by: Sidharth Vinod <sidharthv96@gmail.com> --- src/docs.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs.mts b/src/docs.mts index 318f03de0..06a1f4bff 100644 --- a/src/docs.mts +++ b/src/docs.mts @@ -49,7 +49,7 @@ const AUTOGENERATED_TEXT = `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please const LOGMSG_TRANSFORMED = 'transformed'; const LOGMSG_TO_BE_TRANSFORMED = 'to be transformed'; -const LOGMSG_COPIED = ` ...and copied to ${FINAL_DOCS_DIR}`; +const LOGMSG_COPIED = `, and copied to ${FINAL_DOCS_DIR}`; const WARN_DOCSDIR_DOESNT_MATCH = `Changed files were transformed in ${SOURCE_DOCS_DIR} but do not match the files in ${FINAL_DOCS_DIR}. Please run yarn docs:build after making changes to ${SOURCE_DOCS_DIR} to update the ${FINAL_DOCS_DIR} directory with the transformed files.`; From 07638f5505fe50550723c59c907fc99466708637 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 19:27:45 +0200 Subject: [PATCH 087/115] chore(deps): bump actions/checkout from 2 to 3 (#3449) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c7015dbe7..396ff4e6e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,7 +14,7 @@ jobs: name: check tests if: github.repository_owner == 'mermaid-js' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: testomatio/check-tests@stable From 3d32280c49125c135cf08a3086e184971a1c6f85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 19:30:43 +0200 Subject: [PATCH 088/115] chore(deps-dev): bump typescript from 4.8.2 to 4.8.3 (#3446) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.2 to 4.8.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.8.2...v4.8.3) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c6c95ed41..9cd7b4271 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "ts-jest": "^28.0.8", "ts-loader": "^9.3.1", "ts-node": "^10.9.1", - "typescript": "^4.8.2", + "typescript": "^4.8.3", "unist-util-flatmap": "^1.0.0", "webpack": "^5.53.0", "webpack-cli": "^4.7.2", diff --git a/yarn.lock b/yarn.lock index 10b6ff7ad..cedce9129 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11735,10 +11735,10 @@ typedarray@^0.0.6, typedarray@~0.0.5: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^4.6.4, typescript@^4.8.2: - version "4.8.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" - integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== +typescript@^4.6.4, typescript@^4.8.3: + version "4.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz#d59344522c4bc464a65a730ac695007fdb66dd88" + integrity sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig== uglify-js@^3.1.4: version "3.14.4" From a87abc00c65de91ed417e25c5f81973673f21153 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Tue, 13 Sep 2022 11:25:14 +0530 Subject: [PATCH 089/115] Add diagramAPI to outfile --- .esbuild/util.cjs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 8c1c37eb2..0cddb7e45 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -19,14 +19,19 @@ const buildOptions = (override = {}) => { tsconfig: 'tsconfig.json', resolveExtensions: ['.ts', '.js', '.json', '.jison'], external: ['require', 'fs', 'path'], - entryPoints: ['src/mermaid.ts'], - outfile: 'dist/mermaid.min.js', + outdir: 'dist', plugins: [jisonPlugin], sourcemap: 'external', ...override, }; }; +const getOutFiles = (extension) => { + return { + [`mermaid${extension}`]: 'src/mermaid.ts', + [`diagramAPI${extension}`]: 'src/diagram-api/diagramAPI.ts', + }; +}; /** * Build options for mermaid.esm.* build. * @@ -38,7 +43,8 @@ const buildOptions = (override = {}) => { exports.esmBuild = (override = { minify: true }) => { return buildOptions({ format: 'esm', - outfile: `dist/mermaid.esm${override.minify ? '.min' : ''}.mjs`, + entryPoints: getOutFiles(`.esm${override.minify ? '.min' : ''}`), + outExtension: { '.js': '.mjs' }, ...override, }); }; @@ -46,8 +52,8 @@ exports.esmBuild = (override = { minify: true }) => { /** * Build options for mermaid.core.* build. * - * This build does not bundle `./node_modules/`, as it is designed to be used - * with Webpack/ESBuild/Vite to use mermaid inside an app/website. + * This build does not bundle `./node_modules/`, as it is designed to be used with + * Webpack/ESBuild/Vite to use mermaid inside an app/website. * * @param {Options} override - Override options. * @returns {Options} ESBuild build options. @@ -55,7 +61,8 @@ exports.esmBuild = (override = { minify: true }) => { exports.esmCoreBuild = (override) => { return buildOptions({ format: 'esm', - outfile: `dist/mermaid.core.mjs`, + entryPoints: getOutFiles(`.core`), + outExtension: { '.js': '.mjs' }, external: ['require', 'fs', 'path', ...Object.keys(dependencies)], platform: 'neutral', ...override, @@ -72,7 +79,7 @@ exports.esmCoreBuild = (override) => { */ exports.iifeBuild = (override = { minify: true }) => { return buildOptions({ - outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`, + entryPoints: getOutFiles(override.minify ? '.min' : ''), format: 'iife', ...override, }); From b5dcb4f34582f789b6ac4126d79f5bc7efe26835 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Tue, 13 Sep 2022 21:39:19 +0530 Subject: [PATCH 090/115] chore: Turn off eslint rules in spec, demos, etc. --- .eslintrc.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 0da42ae61..02753280c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -63,6 +63,13 @@ "rules": { "no-console": "off" } + }, + { + "files": ["./**/*.spec.{ts,js}", "./cypress/**", "./demos/**", "./**/docs/**"], + "rules": { + "jsdoc/require-jsdoc": "off", + "@typescript-eslint/no-unused-vars": "off" + } } ] } From 4fc4d71350d69ff6c029aa83e37dd155184c182a Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Tue, 13 Sep 2022 21:39:58 +0530 Subject: [PATCH 091/115] chore: fix eslint warnings --- src/dagre-wrapper/createLabel.js | 4 +-- src/dagre-wrapper/nodes.js | 6 ++-- src/diagrams/c4/c4Db.js | 7 ++-- src/diagrams/c4/c4Renderer.js | 6 ++-- src/diagrams/c4/svgDraw.js | 1 - src/diagrams/class/classRenderer-v2.js | 16 --------- src/diagrams/class/classRenderer.js | 7 +--- src/diagrams/er/erDb.js | 5 +-- src/diagrams/flowchart/flowRenderer.js | 2 -- src/diagrams/gantt/ganttDb.js | 12 ++----- src/diagrams/gantt/ganttRenderer.js | 1 - src/diagrams/git/gitGraphRenderer.js | 35 ++++--------------- src/diagrams/info/infoRenderer.js | 1 - src/diagrams/mindmap/mindmapRenderer.js | 7 ++-- src/diagrams/mindmap/styles.js | 2 +- src/diagrams/pie/pieDb.js | 3 -- src/diagrams/requirement/requirementDb.js | 6 +--- .../requirement/requirementRenderer.js | 1 - src/diagrams/sequence/sequenceDb.js | 3 -- src/diagrams/state/stateDb.js | 8 ----- src/diagrams/state/stateRenderer-v2.js | 1 - src/diagrams/user-journey/journeyDb.js | 7 ---- src/utils.ts | 16 --------- 23 files changed, 25 insertions(+), 132 deletions(-) diff --git a/src/dagre-wrapper/createLabel.js b/src/dagre-wrapper/createLabel.js index 631fb7645..ba0ce4a5d 100644 --- a/src/dagre-wrapper/createLabel.js +++ b/src/dagre-wrapper/createLabel.js @@ -1,11 +1,9 @@ import { select } from 'd3'; import { log } from '../logger'; import { getConfig } from '../config'; -import { sanitizeText, evaluate } from '../diagrams/common/common'; +import { evaluate } from '../diagrams/common/common'; import { decodeEntities } from '../mermaidAPI'; -const sanitizeTxt = (txt) => sanitizeText(txt, getConfig()); - /** * @param dom * @param styleFn diff --git a/src/dagre-wrapper/nodes.js b/src/dagre-wrapper/nodes.js index 344210e93..f25eb2e86 100644 --- a/src/dagre-wrapper/nodes.js +++ b/src/dagre-wrapper/nodes.js @@ -6,9 +6,7 @@ import intersect from './intersect/index.js'; import createLabel from './createLabel'; import note from './shapes/note'; import { parseMember } from '../diagrams/class/svgDraw'; -import { evaluate, sanitizeText as sanitize } from '../diagrams/common/common'; - -const sanitizeText = (txt) => sanitize(txt, getConfig()); +import { evaluate } from '../diagrams/common/common'; const question = (parent, node) => { const { shapeSvg, bbox } = labelHelper(parent, node, undefined, true); @@ -348,7 +346,7 @@ const rect = (parent, node) => { }; const labelRect = (parent, node) => { - const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'label', true); + const { shapeSvg } = labelHelper(parent, node, 'label', true); log.trace('Classes = ', node.classes); // add the rect diff --git a/src/diagrams/c4/c4Db.js b/src/diagrams/c4/c4Db.js index d53d6d31f..aa597a179 100644 --- a/src/diagrams/c4/c4Db.js +++ b/src/diagrams/c4/c4Db.js @@ -1,6 +1,5 @@ import mermaidAPI from '../../mermaidAPI'; import * as configApi from '../../config'; -import { log } from '../../logger'; import { sanitizeText } from '../common/common'; import { setAccTitle, getAccTitle, getAccDescription, setAccDescription } from '../../commonDb'; @@ -21,7 +20,6 @@ let boundarys = [ let rels = []; let title = ''; let wrapEnabled = false; -let description = ''; let c4ShapeInRow = 4; let c4BoundaryInRow = 2; var c4Type; @@ -636,13 +634,13 @@ export const updateLayoutConfig = function (typeC4Shape, c4ShapeInRowParam, c4Bo let c4BoundaryInRowValue = c4BoundaryInRow; if (typeof c4ShapeInRowParam === 'object') { - let [key, value] = Object.entries(c4ShapeInRowParam)[0]; + let [, value] = Object.entries(c4ShapeInRowParam)[0]; c4ShapeInRowValue = parseInt(value); } else { c4ShapeInRowValue = parseInt(c4ShapeInRowParam); } if (typeof c4BoundaryInRowParam === 'object') { - let [key, value] = Object.entries(c4BoundaryInRowParam)[0]; + let [, value] = Object.entries(c4BoundaryInRowParam)[0]; c4BoundaryInRowValue = parseInt(value); } else { c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam); @@ -721,7 +719,6 @@ export const clear = function () { boundaryParseStack = ['']; title = ''; wrapEnabled = false; - description = ''; c4ShapeInRow = 4; c4BoundaryInRow = 2; }; diff --git a/src/diagrams/c4/c4Renderer.js b/src/diagrams/c4/c4Renderer.js index 137b89b89..c3402d0b9 100644 --- a/src/diagrams/c4/c4Renderer.js +++ b/src/diagrams/c4/c4Renderer.js @@ -1,5 +1,5 @@ import { select } from 'd3'; -import svgDraw, { drawText, fixLifeLineHeights } from './svgDraw'; +import svgDraw from './svgDraw'; import { log } from '../../logger'; import { parser } from './parser/c4Diagram'; import common from '../common/common'; @@ -298,7 +298,7 @@ export const drawC4ShapeArray = function (currentBounds, diagram, c4ShapeArray, currentBounds.insert(c4Shape); - const height = svgDraw.drawC4Shape(diagram, c4Shape, conf); + svgDraw.drawC4Shape(diagram, c4Shape, conf); } currentBounds.bumpLastMargin(conf.c4ShapeMargin); @@ -616,7 +616,7 @@ export const draw = function (_text, id, _version, diagObj) { globalBoundaryMaxY = conf.diagramMarginY; const title = diagObj.db.getTitle(); - const c4type = diagObj.db.getC4Type(); + const c4type = diagObj.db.getC4Type(); // TODO: @knsv: remove this? let currentBoundarys = diagObj.db.getBoundarys(''); // switch (c4type) { // case 'C4Context': diff --git a/src/diagrams/c4/svgDraw.js b/src/diagrams/c4/svgDraw.js index c67fb2649..5666d9f84 100644 --- a/src/diagrams/c4/svgDraw.js +++ b/src/diagrams/c4/svgDraw.js @@ -1,5 +1,4 @@ import common from '../common/common'; -import { addFunction } from '../../interactionDb'; import { sanitizeUrl } from '@braintree/sanitize-url'; export const drawRect = function (elem, rectData) { diff --git a/src/diagrams/class/classRenderer-v2.js b/src/diagrams/class/classRenderer-v2.js index a211ab552..20722e6d0 100644 --- a/src/diagrams/class/classRenderer-v2.js +++ b/src/diagrams/class/classRenderer-v2.js @@ -3,7 +3,6 @@ import graphlib from 'graphlib'; import { log } from '../../logger'; import { getConfig } from '../../config'; import { render } from '../../dagre-wrapper/index.js'; -// import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js'; import { curveLinear } from 'd3'; import { interpolateToCurve, getStylesFromArray } from '../../utils'; import { setupGraphViewbox } from '../../setupGraphViewbox'; @@ -11,7 +10,6 @@ import common from '../common/common'; import addSVGAccessibilityFields from '../../accessibility'; let idCache = {}; -const padding = 20; const sanitizeText = (txt) => common.sanitizeText(txt, getConfig()); @@ -235,20 +233,6 @@ export const addRelations = function (relations, g) { }); }; -/** - * Gets the ID with the same label as in the cache - * - * @param {string} label The label to look for - * @returns {string} The resulting ID - */ -const getGraphId = function (label) { - const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label); - - if (foundEntry) { - return foundEntry[0]; - } -}; - /** * Merges the value of `conf` with the passed `cnf` * diff --git a/src/diagrams/class/classRenderer.js b/src/diagrams/class/classRenderer.js index 6536cb5a1..612a7d879 100644 --- a/src/diagrams/class/classRenderer.js +++ b/src/diagrams/class/classRenderer.js @@ -10,12 +10,6 @@ import addSVGAccessibilityFields from '../../accessibility'; let idCache = {}; const padding = 20; -const confa = { - dividerMargin: 10, - padding: 5, - textHeight: 10, -}; - /** * Gets the ID with the same label as in the cache * @@ -163,6 +157,7 @@ export const draw = function (text, id, _version, diagObj) { securityLevel === 'sandbox' ? select(sandboxElement.nodes()[0].contentDocument.body) : select('body'); + // TODO: @knsv doc is not used, bug? const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Fetch the default direction, use TD if none was found diff --git a/src/diagrams/er/erDb.js b/src/diagrams/er/erDb.js index 856d54979..ad3454f84 100644 --- a/src/diagrams/er/erDb.js +++ b/src/diagrams/er/erDb.js @@ -1,7 +1,7 @@ import { log } from '../../logger'; import mermaidAPI from '../../mermaidAPI'; import * as configApi from '../../config'; -import common from '../common/common'; + import { setAccTitle, getAccTitle, @@ -12,8 +12,6 @@ import { let entities = {}; let relationships = []; -let title = ''; -let description = ''; const Cardinality = { ZERO_OR_ONE: 'ZERO_OR_ONE', @@ -78,7 +76,6 @@ const getRelationships = () => relationships; const clear = function () { entities = {}; relationships = []; - title = ''; commonClear(); }; diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index 5b14330dd..0c3aa3623 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -29,8 +29,6 @@ export const setConf = function (cnf) { * @param diagObj */ export const addVertices = function (vert, g, svgId, root, _doc, diagObj) { - const securityLevel = getConfig().securityLevel; - const svg = !root ? select(`[id="${svgId}"]`) : root.select(`[id="${svgId}"]`); const doc = !_doc ? document : _doc; const keys = Object.keys(vert); diff --git a/src/diagrams/gantt/ganttDb.js b/src/diagrams/gantt/ganttDb.js index f6a526759..5d072b903 100644 --- a/src/diagrams/gantt/ganttDb.js +++ b/src/diagrams/gantt/ganttDb.js @@ -4,7 +4,7 @@ import { log } from '../../logger'; import * as configApi from '../../config'; import utils from '../../utils'; import mermaidAPI from '../../mermaidAPI'; -import common from '../common/common'; + import { setAccTitle, getAccTitle, @@ -21,8 +21,6 @@ let todayMarker = ''; let includes = []; let excludes = []; let links = {}; -let title = ''; -let accDescription = ''; let sections = []; let tasks = []; let currentSection = ''; @@ -34,10 +32,6 @@ let topAxis = false; // The serial order of the task in the script let lastOrder = 0; -const sanitizeText = function (txt) { - return common.sanitizeText(txt, configApi.getConfig()); -}; - export const parseDirective = function (statement, context, type) { mermaidAPI.parseDirective(this, statement, context, type); }; @@ -47,7 +41,6 @@ export const clear = function () { tasks = []; currentSection = ''; funs = []; - title = ''; taskCnt = 0; lastTask = undefined; lastTaskID = undefined; @@ -247,7 +240,8 @@ const getStartDate = function (prevTime, dateFormat, str) { * - `ms` for milliseconds * * @param {string} str - A string representing the duration. - * @returns {moment.Duration} A moment duration, including an invalid moment for invalid input string. + * @returns {moment.Duration} A moment duration, including an invalid moment for invalid input + * string. */ const parseDuration = function (str) { const statement = /^(\d+(?:\.\d+)?)([yMwdhms]|ms)$/.exec(str.trim()); diff --git a/src/diagrams/gantt/ganttRenderer.js b/src/diagrams/gantt/ganttRenderer.js index 5a24d6d3f..3b12bc191 100644 --- a/src/diagrams/gantt/ganttRenderer.js +++ b/src/diagrams/gantt/ganttRenderer.js @@ -391,7 +391,6 @@ export const draw = function (text, id, version, diagObj) { if (securityLevel === 'sandbox') { let sandboxElement; sandboxElement = select('#i' + id); - const root = select(sandboxElement.nodes()[0].contentDocument.body); const doc = sandboxElement.nodes()[0].contentDocument; rectangles diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js index 5a9036b88..2a538f791 100644 --- a/src/diagrams/git/gitGraphRenderer.js +++ b/src/diagrams/git/gitGraphRenderer.js @@ -5,7 +5,6 @@ import { getConfig } from '../../config'; import addSVGAccessibilityFields from '../../accessibility'; let allCommitsDict = {}; -let branchNum; const commitType = { NORMAL: 0, @@ -83,7 +82,7 @@ const drawCommits = (svg, commits, modifyGraph) => { const sortedKeys = keys.sort((a, b) => { return commits[a].seq - commits[b].seq; }); - sortedKeys.forEach((key, index) => { + sortedKeys.forEach((key) => { const commit = commits[key]; const y = branchPos[commit.branch].pos; @@ -290,18 +289,15 @@ const drawCommits = (svg, commits, modifyGraph) => { }; /** - * Detect if there are other commits between commit1's x-position and commit2's x-position on the same - * branch as commit2. + * Detect if there are other commits between commit1's x-position and commit2's x-position on the + * same branch as commit2. * * @param {any} commit1 * @param {any} commit2 * @param allCommits - * @returns {boolean} if there are commits between commit1's x-position and commit2's x-position + * @returns {boolean} If there are commits between commit1's x-position and commit2's x-position */ const hasOverlappingCommits = (commit1, commit2, allCommits) => { - const commit1Pos = commitPos[commit2.id]; - const commit2Pos = commitPos[commit1.id]; - // Find commits on the same branch as commit2 const keys = Object.keys(allCommits); const overlappingComits = keys.filter((key) => { @@ -322,7 +318,7 @@ const hasOverlappingCommits = (commit1, commit2, allCommits) => { * @param {any} y1 * @param {any} y2 * @param {any} _depth - * @returns {number} y value between y1 and y2 + * @returns {number} Y value between y1 and y2 */ const findLane = (y1, y2, _depth) => { const depth = _depth || 0; @@ -355,25 +351,11 @@ const findLane = (y1, y2, _depth) => { * @param {any} allCommits */ const drawArrow = (svg, commit1, commit2, allCommits) => { - const conf = getConfig(); - const p1 = commitPos[commit1.id]; const p2 = commitPos[commit2.id]; const overlappingCommits = hasOverlappingCommits(commit1, commit2, allCommits); // log.debug('drawArrow', p1, p2, overlappingCommits, commit1.id, commit2.id); - let url = ''; - if (conf.arrowMarkerAbsolute) { - url = - window.location.protocol + - '//' + - window.location.host + - window.location.pathname + - window.location.search; - url = url.replace(/\(/g, '\\('); - url = url.replace(/\)/g, '\\)'); - } - let arc = ''; let arc2 = ''; let radius = 0; @@ -431,7 +413,7 @@ const drawArrow = (svg, commit1, commit2, allCommits) => { } ${p2.y}`; } } - const arrow = svg + svg .append('path') .attr('d', lineDef) .attr('class', 'arrow arrow' + (colorClassNum % THEME_COLOR_LIMIT)); @@ -439,10 +421,7 @@ const drawArrow = (svg, commit1, commit2, allCommits) => { const drawArrows = (svg, commits) => { const gArrows = svg.append('g').attr('class', 'commit-arrows'); - let pos = 0; - - const k = Object.keys(commits); - k.forEach((key, index) => { + Object.keys(commits).forEach((key) => { const commit = commits[key]; if (commit.parents && commit.parents.length > 0) { commit.parents.forEach((parent) => { diff --git a/src/diagrams/info/infoRenderer.js b/src/diagrams/info/infoRenderer.js index 9e81b9ffb..b50178481 100644 --- a/src/diagrams/info/infoRenderer.js +++ b/src/diagrams/info/infoRenderer.js @@ -27,7 +27,6 @@ export const draw = (text, id, version, diagObj) => { securityLevel === 'sandbox' ? select(sandboxElement.nodes()[0].contentDocument.body) : select('body'); - const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Parse the graph definition // parser.parse(text); diff --git a/src/diagrams/mindmap/mindmapRenderer.js b/src/diagrams/mindmap/mindmapRenderer.js index caa8baedb..37cce58bf 100644 --- a/src/diagrams/mindmap/mindmapRenderer.js +++ b/src/diagrams/mindmap/mindmapRenderer.js @@ -2,7 +2,7 @@ import { select } from 'd3'; import { log, getConfig, setupGraphViewbox } from '../../diagram-api/diagramAPI'; import svgDraw from './svgDraw'; -import { BoundingBox, Layout, Tree } from 'non-layered-tidy-tree-layout'; +import { BoundingBox, Layout } from 'non-layered-tidy-tree-layout'; import clone from 'fast-clone'; import * as db from './mindmapDb'; @@ -193,6 +193,7 @@ function layoutMindmap(node, conf) { // Merge the trees into a single tree const result = mergeTrees(node, trees); + // TODO: @knsv The function is not called bug? eachNode; return node; } @@ -232,13 +233,11 @@ export const draw = (text, id, version, diagObj) => { securityLevel === 'sandbox' ? select(sandboxElement.nodes()[0].contentDocument.body) : select('body'); - const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; - // Parse the graph definition const svg = root.select('#' + id); - const g = svg.append('g'); + svg.append('g'); const mm = diagObj.db.getMindmap(); // Draw the graph and start with drawing the nodes without proper position diff --git a/src/diagrams/mindmap/styles.js b/src/diagrams/mindmap/styles.js index 76d6a9c1b..f6afaa612 100644 --- a/src/diagrams/mindmap/styles.js +++ b/src/diagrams/mindmap/styles.js @@ -1,4 +1,4 @@ -import { darken, lighten, adjust, invert, isDark } from 'khroma'; +import { darken, lighten, isDark } from 'khroma'; const genSections = (options) => { let sections = ''; diff --git a/src/diagrams/pie/pieDb.js b/src/diagrams/pie/pieDb.js index def0242a3..8ef4d9efc 100644 --- a/src/diagrams/pie/pieDb.js +++ b/src/diagrams/pie/pieDb.js @@ -13,8 +13,6 @@ import { } from '../../commonDb'; let sections = {}; -let title = ''; -let description = ''; let showData = false; export const parseDirective = function (statement, context, type) { @@ -49,7 +47,6 @@ const cleanupValue = function (value) { const clear = function () { sections = {}; - title = ''; showData = false; commonClear(); }; diff --git a/src/diagrams/requirement/requirementDb.js b/src/diagrams/requirement/requirementDb.js index f78bd5509..9d48f0b2d 100644 --- a/src/diagrams/requirement/requirementDb.js +++ b/src/diagrams/requirement/requirementDb.js @@ -1,7 +1,7 @@ import * as configApi from '../../config'; import { log } from '../../logger'; import mermaidAPI from '../../mermaidAPI'; -import common from '../common/common'; + import { setAccTitle, getAccTitle, @@ -15,10 +15,6 @@ let latestRequirement = {}; let requirements = {}; let latestElement = {}; let elements = {}; -let title = ''; -let accDescription = ''; - -const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig()); const RequirementType = { REQUIREMENT: 'Requirement', diff --git a/src/diagrams/requirement/requirementRenderer.js b/src/diagrams/requirement/requirementRenderer.js index 7a43edaee..d10c43066 100644 --- a/src/diagrams/requirement/requirementRenderer.js +++ b/src/diagrams/requirement/requirementRenderer.js @@ -320,7 +320,6 @@ export const draw = (text, id, _version, diagObj) => { securityLevel === 'sandbox' ? select(sandboxElement.nodes()[0].contentDocument.body) : select('body'); - const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; const svg = root.select(`[id='${id}']`); markers.insertLineEndings(svg, conf); diff --git a/src/diagrams/sequence/sequenceDb.js b/src/diagrams/sequence/sequenceDb.js index 7d0309127..6c863e204 100644 --- a/src/diagrams/sequence/sequenceDb.js +++ b/src/diagrams/sequence/sequenceDb.js @@ -16,8 +16,6 @@ let prevActor = undefined; let actors = {}; let messages = []; const notes = []; -let diagramTitle = ''; -let description = ''; let sequenceNumbersEnabled = false; let wrapEnabled; @@ -153,7 +151,6 @@ export const clear = function () { actors = {}; messages = []; sequenceNumbersEnabled = false; - diagramTitle = ''; commonClear(); }; diff --git a/src/diagrams/state/stateDb.js b/src/diagrams/state/stateDb.js index 7092cf1d6..96f92af8a 100644 --- a/src/diagrams/state/stateDb.js +++ b/src/diagrams/state/stateDb.js @@ -11,8 +11,6 @@ import { clear as commonClear, } from '../../commonDb'; -const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig()); - const clone = (o) => JSON.parse(JSON.stringify(o)); let rootDoc = []; @@ -121,10 +119,6 @@ let documents = { let currentDocument = documents.root; let startCnt = 0; -let endCnt = 0; // let stateCnt = 0; - -let title = 'State diagram'; -let description = ''; /** * Function called by parser when a node definition has been found. @@ -179,7 +173,6 @@ export const clear = function (saveCommon) { currentDocument = documents.root; startCnt = 0; - endCnt = 0; classes = []; if (!saveCommon) { commonClear(); @@ -211,7 +204,6 @@ export const addRelation = function (_id1, _id2, title) { type1 = 'start'; } if (_id2 === '[*]') { - endCnt++; id2 = 'end' + startCnt; type2 = 'end'; } diff --git a/src/diagrams/state/stateRenderer-v2.js b/src/diagrams/state/stateRenderer-v2.js index 4452f9491..13c474b5e 100644 --- a/src/diagrams/state/stateRenderer-v2.js +++ b/src/diagrams/state/stateRenderer-v2.js @@ -283,7 +283,6 @@ export const draw = function (text, id, _version, diag) { securityLevel === 'sandbox' ? select(sandboxElement.nodes()[0].contentDocument.body) : select('body'); - const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; const svg = root.select(`[id="${id}"]`); // Run the renderer. This is what draws the final graph. diff --git a/src/diagrams/user-journey/journeyDb.js b/src/diagrams/user-journey/journeyDb.js index d8f27b93c..0707636f5 100644 --- a/src/diagrams/user-journey/journeyDb.js +++ b/src/diagrams/user-journey/journeyDb.js @@ -1,6 +1,5 @@ import mermaidAPI from '../../mermaidAPI'; import * as configApi from '../../config'; -import common from '../common/common'; import { setAccTitle, getAccTitle, @@ -11,10 +10,6 @@ import { clear as commonClear, } from '../../commonDb'; -const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig()); - -let title = ''; -let description = ''; let currentSection = ''; const sections = []; @@ -29,8 +24,6 @@ export const clear = function () { sections.length = 0; tasks.length = 0; currentSection = ''; - title = ''; - description = ''; rawTasks.length = 0; commonClear(); }; diff --git a/src/utils.ts b/src/utils.ts index 9caad7edd..8861e7d09 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -39,7 +39,6 @@ const directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi; const directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi; -const anyComment = /\s*%%.*\n/gm; /** * @function detectInit Detects the init config object from the text @@ -329,7 +328,6 @@ const calcLabelPosition = (points) => { const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => { let prevPoint; - let totalDistance = 0; log.info('our points', points); if (points[0] !== initialPosition) { points = points.reverse(); @@ -389,7 +387,6 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => { // Todo looking to faster cloning method let points = JSON.parse(JSON.stringify(_points)); let prevPoint; - let totalDistance = 0; log.info('our points', points); if (position !== 'start_left' && position !== 'start_right') { points = points.reverse(); @@ -728,19 +725,6 @@ export const calculateTextDimensions = memoize( (text, config) => `${text}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}` ); -/** - * Applys d3 attributes - * - * @param {any} d3Elem D3 Element to apply the attributes onto - * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of - * attributes - */ -const d3Attrs = function (d3Elem, attrs) { - for (const attr of attrs) { - d3Elem.attr(attr[0], attr[1]); - } -}; - export const initIdGenerator = class iterator { constructor(deterministic, seed) { this.deterministic = deterministic; From 50da58afe012089ace25d037faf775561238c65c Mon Sep 17 00:00:00 2001 From: ashishj <ashishjain0512@gmail.com> Date: Tue, 13 Sep 2022 19:18:12 +0200 Subject: [PATCH 092/115] Fix for broken rendering test --- src/diagrams/git/gitGraphRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js index 6eb542ce8..88404a7c2 100644 --- a/src/diagrams/git/gitGraphRenderer.js +++ b/src/diagrams/git/gitGraphRenderer.js @@ -92,7 +92,7 @@ const drawCommits = (svg, commits, modifyGraph) => { if (modifyGraph) { let typeClass; let commitSymbolType = - typeof commit.customType !== 'undefined' ? commit.customType : commit.type; + typeof commit.customType !== 'undefined' && commit.customType !=='' ? commit.customType : commit.type; switch (commitSymbolType) { case commitType.NORMAL: typeClass = 'commit-normal'; From 0c0468123fa1ca08baf69716eeca0b8872075b5e Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knut.sveidqvist@ipiccolo.com> Date: Tue, 13 Sep 2022 19:55:34 +0200 Subject: [PATCH 093/115] Release 9.1.7 --- docs/index.html | 2 +- src/diagrams/git/gitGraphRenderer.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index 02c01d954..b2adfb335 100644 --- a/docs/index.html +++ b/docs/index.html @@ -18,7 +18,7 @@ <!-- <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css"> --> <link rel="stylesheet" href="theme.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css"> - <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.6/dist/mermaid.min.js"></script> + <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> <!-- <script src="http://localhost:9000/mermaid.js"></script> --> <script> // prettier-ignore diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js index 88404a7c2..5bd5bd7e3 100644 --- a/src/diagrams/git/gitGraphRenderer.js +++ b/src/diagrams/git/gitGraphRenderer.js @@ -92,7 +92,9 @@ const drawCommits = (svg, commits, modifyGraph) => { if (modifyGraph) { let typeClass; let commitSymbolType = - typeof commit.customType !== 'undefined' && commit.customType !=='' ? commit.customType : commit.type; + typeof commit.customType !== 'undefined' && commit.customType !== '' + ? commit.customType + : commit.type; switch (commitSymbolType) { case commitType.NORMAL: typeClass = 'commit-normal'; From 39081b6bfb69104a31b35646be918a1339746f39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 07:03:17 +0000 Subject: [PATCH 094/115] chore(deps-dev): bump eslint from 8.23.0 to 8.23.1 Bumps [eslint](https://github.com/eslint/eslint) from 8.23.0 to 8.23.1. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.23.0...v8.23.1) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> --- package.json | 2 +- yarn.lock | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 9cd7b4271..c86558cfd 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "cypress": "9.7.0", "cypress-image-snapshot": "^4.0.1", "documentation": "13.2.0", - "eslint": "^8.23.0", + "eslint": "^8.23.1", "eslint-config-prettier": "^8.5.0", "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-html": "^7.1.0", diff --git a/yarn.lock b/yarn.lock index cedce9129..a930e05b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1740,10 +1740,10 @@ esquery "^1.4.0" jsdoc-type-pratt-parser "~3.1.0" -"@eslint/eslintrc@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.1.tgz#de0807bfeffc37b964a7d0400e0c348ce5a2543d" - integrity sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ== +"@eslint/eslintrc@^1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.2.tgz#58b69582f3b7271d8fa67fe5251767a5b38ea356" + integrity sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -5706,12 +5706,12 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@^8.23.0: - version "8.23.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.23.0.tgz#a184918d288820179c6041bb3ddcc99ce6eea040" - integrity sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA== +eslint@^8.23.1: + version "8.23.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.23.1.tgz#cfd7b3f7fdd07db8d16b4ac0516a29c8d8dca5dc" + integrity sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg== dependencies: - "@eslint/eslintrc" "^1.3.1" + "@eslint/eslintrc" "^1.3.2" "@humanwhocodes/config-array" "^0.10.4" "@humanwhocodes/gitignore-to-minimatch" "^1.0.2" "@humanwhocodes/module-importer" "^1.0.1" @@ -5730,7 +5730,6 @@ eslint@^8.23.0: fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" find-up "^5.0.0" - functional-red-black-tree "^1.0.1" glob-parent "^6.0.1" globals "^13.15.0" globby "^11.1.0" @@ -5739,6 +5738,7 @@ eslint@^8.23.0: import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" + js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" @@ -8015,6 +8015,11 @@ js-base64@3.7.2: resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.2.tgz#816d11d81a8aff241603d19ce5761e13e41d7745" integrity sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ== +js-sdsl@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.1.4.tgz#78793c90f80e8430b7d8dc94515b6c77d98a26a6" + integrity sha512-Y2/yD55y5jteOAmY50JbUZYwk3CP3wnLPEZnlR1w9oKhITrBEtAxwuWKebFf8hMrPMgbYwFoWK/lH2sBkErELw== + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" From 0c0d37efb296a4e183de75f875c580cefb3c7630 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 19:17:49 +0100 Subject: [PATCH 095/115] chore(deps-dev): bump babel-jest from 29.0.2 to 29.0.3 (#3448) Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 29.0.2 to 29.0.3. - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/jest/commits/v29.0.3/packages/babel-jest) --- updated-dependencies: - dependency-name: babel-jest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> --- package.json | 2 +- yarn.lock | 70 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index c86558cfd..1cd73c72f 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "@types/stylis": "^4.0.2", "@typescript-eslint/eslint-plugin": "^5.36.1", "@typescript-eslint/parser": "^5.36.1", - "babel-jest": "^29.0.2", + "babel-jest": "^29.0.3", "babel-loader": "^8.2.2", "concurrently": "^7.0.0", "css-to-string-loader": "^0.1.3", diff --git a/yarn.lock b/yarn.lock index a930e05b8..08946cb6b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2022,22 +2022,22 @@ slash "^3.0.0" write-file-atomic "^4.0.1" -"@jest/transform@^29.0.2": - version "29.0.2" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.0.2.tgz#eef90ebd939b68bf2c2508d9e914377871869146" - integrity sha512-lajVQx2AnsR+Pa17q2zR7eikz2PkPs1+g/qPbZkqQATeS/s6eT55H+yHcsLfuI/0YQ/4VSBepSu3bOX+44q0aA== +"@jest/transform@^29.0.3": + version "29.0.3" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.0.3.tgz#9eb1fed2072a0354f190569807d1250572fb0970" + integrity sha512-C5ihFTRYaGDbi/xbRQRdbo5ddGtI4VSpmL6AIcZxdhwLbXMa7PcXxxqyI91vGOFHnn5aVM3WYnYKCHEqmLVGzg== dependencies: "@babel/core" "^7.11.6" - "@jest/types" "^29.0.2" + "@jest/types" "^29.0.3" "@jridgewell/trace-mapping" "^0.3.15" babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" - jest-haste-map "^29.0.2" + jest-haste-map "^29.0.3" jest-regex-util "^29.0.0" - jest-util "^29.0.2" + jest-util "^29.0.3" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" @@ -2067,6 +2067,18 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" +"@jest/types@^29.0.3": + version "29.0.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.0.3.tgz#0be78fdddb1a35aeb2041074e55b860561c8ef63" + integrity sha512-coBJmOQvurXjN1Hh5PzF7cmsod0zLIOXpP8KD161mqNlroMhLcwpODiEzi7ZsRl5Z/AIuxpeNm8DCl43F4kz8A== + dependencies: + "@jest/schemas" "^29.0.0" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + "@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" @@ -3516,12 +3528,12 @@ babel-jest@^28.1.3: graceful-fs "^4.2.9" slash "^3.0.0" -babel-jest@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.0.2.tgz#7efde496c07607949e9be499bf277aa1543ded95" - integrity sha512-yTu4/WSi/HzarjQtrJSwV+/0maoNt+iP0DmpvFJdv9yY+5BuNle8TbheHzzcSWj5gIHfuhpbLYHWRDYhWKyeKQ== +babel-jest@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.0.3.tgz#64e156a47a77588db6a669a88dedff27ed6e260f" + integrity sha512-ApPyHSOhS/sVzwUOQIWJmdvDhBsMG01HX9z7ogtkp1TToHGGUWFlnXJUIzCgKPSfiYLn3ibipCYzsKSURHEwLg== dependencies: - "@jest/transform" "^29.0.2" + "@jest/transform" "^29.0.3" "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.1.1" babel-preset-jest "^29.0.2" @@ -7665,20 +7677,20 @@ jest-haste-map@^28.1.3: optionalDependencies: fsevents "^2.3.2" -jest-haste-map@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.0.2.tgz#cac403a595e6e43982c9776b5c4dae63e38b22c5" - integrity sha512-SOorh2ysQ0fe8gsF4gaUDhoMIWAvi2hXOkwThEO48qT3JqA8GLAUieQcIvdSEd6M0scRDe1PVmKc5tXR3Z0U0A== +jest-haste-map@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.0.3.tgz#d7f3f7180f558d760eacc5184aac5a67f20ef939" + integrity sha512-uMqR99+GuBHo0RjRhOE4iA6LmsxEwRdgiIAQgMU/wdT2XebsLDz5obIwLZm/Psj+GwSEQhw9AfAVKGYbh2G55A== dependencies: - "@jest/types" "^29.0.2" + "@jest/types" "^29.0.3" "@types/graceful-fs" "^4.1.3" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.9" jest-regex-util "^29.0.0" - jest-util "^29.0.2" - jest-worker "^29.0.2" + jest-util "^29.0.3" + jest-worker "^29.0.3" micromatch "^4.0.4" walker "^1.0.8" optionalDependencies: @@ -7909,6 +7921,18 @@ jest-util@^29.0.2: graceful-fs "^4.2.9" picomatch "^2.2.3" +jest-util@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.0.3.tgz#06d1d77f9a1bea380f121897d78695902959fbc0" + integrity sha512-Q0xaG3YRG8QiTC4R6fHjHQPaPpz9pJBEi0AeOE4mQh/FuWOijFjGXMMOfQEaU9i3z76cNR7FobZZUQnL6IyfdQ== + dependencies: + "@jest/types" "^29.0.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + jest-validate@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-28.1.3.tgz#e322267fd5e7c64cea4629612c357bbda96229df" @@ -7953,10 +7977,10 @@ jest-worker@^28.1.3: merge-stream "^2.0.0" supports-color "^8.0.0" -jest-worker@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.0.2.tgz#46c9f2cb9a19663d22babbacf998e4b5d7c46574" - integrity sha512-EyvBlYcvd2pg28yg5A3OODQnqK9LI1kitnGUZUG5/NYIeaRgewtYBKB5wlr7oXj8zPCkzev7EmnTCsrXK7V+Xw== +jest-worker@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.0.3.tgz#c2ba0aa7e41eec9eb0be8e8a322ae6518df72647" + integrity sha512-Tl/YWUugQOjoTYwjKdfJWkSOfhufJHO5LhXTSZC3TRoQKO+fuXnZAdoXXBlpLXKGODBL3OvdUasfDD4PcMe6ng== dependencies: "@types/node" "*" merge-stream "^2.0.0" From ff971c8300422156b1b9a3b0b388beb1ebbadd2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 19:19:54 +0100 Subject: [PATCH 096/115] chore(deps-dev): bump jest-environment-jsdom from 29.0.2 to 29.0.3 (#3441) Bumps [jest-environment-jsdom](https://github.com/facebook/jest/tree/HEAD/packages/jest-environment-jsdom) from 29.0.2 to 29.0.3. - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/jest/commits/v29.0.3/packages/jest-environment-jsdom) --- updated-dependencies: - dependency-name: jest-environment-jsdom dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 96 ++++++++++++++++++++++++++-------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index 1cd73c72f..58763341b 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "husky": "^8.0.0", "identity-obj-proxy": "^3.0.0", "jest": "^28.0.3", - "jest-environment-jsdom": "^29.0.2", + "jest-environment-jsdom": "^29.0.3", "jison": "^0.4.18", "js-base64": "3.7.2", "lint-staged": "^13.0.0", diff --git a/yarn.lock b/yarn.lock index 08946cb6b..eaef9a640 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1869,15 +1869,15 @@ "@types/node" "*" jest-mock "^28.1.3" -"@jest/environment@^29.0.2": - version "29.0.2" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.0.2.tgz#9e4b6d4c9bce5bfced6f63945d8c8e571394f572" - integrity sha512-Yf+EYaLOrVCgts/aTS5nGznU4prZUPa5k9S63Yct8YSOKj2jkdS17hHSUKhk5jxDFMyCy1PXknypDw7vfgc/mA== +"@jest/environment@^29.0.3": + version "29.0.3" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.0.3.tgz#7745ec30a954e828e8cc6df6a13280d3b51d8f35" + integrity sha512-iKl272NKxYNQNqXMQandAIwjhQaGw5uJfGXduu8dS9llHi8jV2ChWrtOAVPnMbaaoDhnI3wgUGNDvZgHeEJQCA== dependencies: - "@jest/fake-timers" "^29.0.2" - "@jest/types" "^29.0.2" + "@jest/fake-timers" "^29.0.3" + "@jest/types" "^29.0.3" "@types/node" "*" - jest-mock "^29.0.2" + jest-mock "^29.0.3" "@jest/expect-utils@^28.1.3": version "28.1.3" @@ -1906,17 +1906,17 @@ jest-mock "^28.1.3" jest-util "^28.1.3" -"@jest/fake-timers@^29.0.2": - version "29.0.2" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.0.2.tgz#6f15f4d8eb1089d445e3f73473ddc434faa2f798" - integrity sha512-2JhQeWU28fvmM5r33lxg6BxxkTKaVXs6KMaJ6eXSM8ml/MaWkt2BvbIO8G9KWAJFMdBXWbn+2h9OK1/s5urKZA== +"@jest/fake-timers@^29.0.3": + version "29.0.3" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.0.3.tgz#ad5432639b715d45a86a75c47fd75019bc36b22c" + integrity sha512-tmbUIo03x0TdtcZCESQ0oQSakPCpo7+s6+9mU19dd71MptkP4zCwoeZqna23//pgbhtT1Wq02VmA9Z9cNtvtCQ== dependencies: - "@jest/types" "^29.0.2" + "@jest/types" "^29.0.3" "@sinonjs/fake-timers" "^9.1.2" "@types/node" "*" - jest-message-util "^29.0.2" - jest-mock "^29.0.2" - jest-util "^29.0.2" + jest-message-util "^29.0.3" + jest-mock "^29.0.3" + jest-util "^29.0.3" "@jest/globals@^28.1.3": version "28.1.3" @@ -2055,10 +2055,10 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" -"@jest/types@^29.0.2": - version "29.0.2" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.0.2.tgz#5a5391fa7f7f41bf4b201d6d2da30e874f95b6c1" - integrity sha512-5WNMesBLmlkt1+fVkoCjHa0X3i3q8zc4QLTDkdHgCa2gyPZc7rdlZBWgVLqwS1860ZW5xJuCDwAzqbGaXIr/ew== +"@jest/types@^29.0.2", "@jest/types@^29.0.3": + version "29.0.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.0.3.tgz#0be78fdddb1a35aeb2041074e55b860561c8ef63" + integrity sha512-coBJmOQvurXjN1Hh5PzF7cmsod0zLIOXpP8KD161mqNlroMhLcwpODiEzi7ZsRl5Z/AIuxpeNm8DCl43F4kz8A== dependencies: "@jest/schemas" "^29.0.0" "@types/istanbul-lib-coverage" "^2.0.0" @@ -7627,18 +7627,18 @@ jest-each@^28.1.3: jest-util "^28.1.3" pretty-format "^28.1.3" -jest-environment-jsdom@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.0.2.tgz#d616a19416d0dda5155b854d301197fb6092dff0" - integrity sha512-hWqC9FQI5yT04lTd4VJnzT5QObxq0xrSrqpGkqsYfxPeJYjyhriI7W2oJC5HZ1UbhnvA+8GS1nzgPsstvRpdVw== +jest-environment-jsdom@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.0.3.tgz#0c6ee841133dd6acbe957bceaceea93b7ec60ca9" + integrity sha512-KIGvpm12c71hoYTjL4wC2c8K6KfhOHJqJtaHc1IApu5rG047YWZoEP13BlbucWfzGISBrmli8KFqdhdQEa8Wnw== dependencies: - "@jest/environment" "^29.0.2" - "@jest/fake-timers" "^29.0.2" - "@jest/types" "^29.0.2" + "@jest/environment" "^29.0.3" + "@jest/fake-timers" "^29.0.3" + "@jest/types" "^29.0.3" "@types/jsdom" "^20.0.0" "@types/node" "*" - jest-mock "^29.0.2" - jest-util "^29.0.2" + jest-mock "^29.0.3" + jest-util "^29.0.3" jsdom "^20.0.0" jest-environment-node@^28.1.3: @@ -7744,18 +7744,18 @@ jest-message-util@^28.1.3: slash "^3.0.0" stack-utils "^2.0.3" -jest-message-util@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.0.2.tgz#b2781dfb6a2d1c63830d9684c5148ae3155c6154" - integrity sha512-kcJAgms3ckJV0wUoLsAM40xAhY+pb9FVSZwicjFU9PFkaTNmqh9xd99/CzKse48wPM1ANUQKmp03/DpkY+lGrA== +jest-message-util@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.0.3.tgz#f0254e1ffad21890c78355726202cc91d0a40ea8" + integrity sha512-7T8JiUTtDfppojosORAflABfLsLKMLkBHSWkjNQrjIltGoDzNGn7wEPOSfjqYAGTYME65esQzMJxGDjuLBKdOg== dependencies: "@babel/code-frame" "^7.12.13" - "@jest/types" "^29.0.2" + "@jest/types" "^29.0.3" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.9" micromatch "^4.0.4" - pretty-format "^29.0.2" + pretty-format "^29.0.3" slash "^3.0.0" stack-utils "^2.0.3" @@ -7767,12 +7767,12 @@ jest-mock@^28.1.3: "@jest/types" "^28.1.3" "@types/node" "*" -jest-mock@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.0.2.tgz#d7810966a6338aca6a440c3cd9f19276477840ad" - integrity sha512-giWXOIT23UCxHCN2VUfUJ0Q7SmiqQwfSFXlCaIhW5anITpNQ+3vuLPQdKt5wkuwM37GrbFyHIClce8AAK9ft9g== +jest-mock@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.0.3.tgz#4f0093f6a9cb2ffdb9c44a07a3912f0c098c8de9" + integrity sha512-ort9pYowltbcrCVR43wdlqfAiFJXBx8l4uJDsD8U72LgBcetvEp+Qxj1W9ZYgMRoeAo+ov5cnAGF2B6+Oth+ww== dependencies: - "@jest/types" "^29.0.2" + "@jest/types" "^29.0.3" "@types/node" "*" jest-pnp-resolver@^1.2.2: @@ -7909,12 +7909,12 @@ jest-util@^28.0.0, jest-util@^28.1.3: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-util@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.0.2.tgz#c75c5cab7f3b410782f9570a60c5558b5dfb6e3a" - integrity sha512-ozk8ruEEEACxqpz0hN9UOgtPZS0aN+NffwQduR5dVlhN+eN47vxurtvgZkYZYMpYrsmlAEx1XabkB3BnN0GfKQ== +jest-util@^29.0.2, jest-util@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.0.3.tgz#06d1d77f9a1bea380f121897d78695902959fbc0" + integrity sha512-Q0xaG3YRG8QiTC4R6fHjHQPaPpz9pJBEi0AeOE4mQh/FuWOijFjGXMMOfQEaU9i3z76cNR7FobZZUQnL6IyfdQ== dependencies: - "@jest/types" "^29.0.2" + "@jest/types" "^29.0.3" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" @@ -9873,10 +9873,10 @@ pretty-format@^28.0.0, pretty-format@^28.1.3: ansi-styles "^5.0.0" react-is "^18.0.0" -pretty-format@^29.0.2: - version "29.0.2" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.0.2.tgz#7f7666a7bf05ba2bcacde61be81c6db64f6f3be6" - integrity sha512-wp3CdtUa3cSJVFn3Miu5a1+pxc1iPIQTenOAn+x5erXeN1+ryTcLesV5pbK/rlW5EKwp27x38MoYfNGaNXDDhg== +pretty-format@^29.0.3: + version "29.0.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.0.3.tgz#23d5f8cabc9cbf209a77d49409d093d61166a811" + integrity sha512-cHudsvQr1K5vNVLbvYF/nv3Qy/F/BcEKxGuIeMiVMRHxPOO1RxXooP8g/ZrwAp7Dx+KdMZoOc7NxLHhMrP2f9Q== dependencies: "@jest/schemas" "^29.0.0" ansi-styles "^5.0.0" From c636b873e92d17ce0cdb449e08a8937d63eee879 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 18:42:54 +0000 Subject: [PATCH 097/115] chore(deps-dev): bump @babel/core from 7.18.13 to 7.19.0 (#3447) --- package.json | 2 +- yarn.lock | 139 ++++++++++++++++++++++++--------------------------- 2 files changed, 65 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 58763341b..f418d5558 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ }, "devDependencies": { "@applitools/eyes-cypress": "^3.25.7", - "@babel/core": "^7.14.6", + "@babel/core": "^7.19.0", "@babel/eslint-parser": "^7.14.7", "@babel/preset-env": "^7.14.7", "@babel/register": "^7.14.5", diff --git a/yarn.lock b/yarn.lock index eaef9a640..0ecfbd61a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -244,6 +244,11 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.18.8.tgz#2483f565faca607b8535590e84e7de323f27764d" integrity sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ== +"@babel/compat-data@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.0.tgz#2a592fd89bacb1fcde68de31bee4f2f2dacb0e86" + integrity sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw== + "@babel/core@7.12.3": version "7.12.3" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.3.tgz#1b436884e1e3bff6fb1328dc02b208759de92ad8" @@ -266,21 +271,21 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.14.6": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.13.tgz#9be8c44512751b05094a4d3ab05fc53a47ce00ac" - integrity sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A== +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.0.tgz#d2f5f4f2033c00de8096be3c9f45772563e150c3" + integrity sha512-reM4+U7B9ss148rh2n1Qs9ASS+w94irYXga7c2jaQv9RVzpS7Mv1a9rnYYwuDa45G+DkORt9g6An2k/V4d9LbQ== dependencies: "@ampproject/remapping" "^2.1.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.13" - "@babel/helper-compilation-targets" "^7.18.9" - "@babel/helper-module-transforms" "^7.18.9" - "@babel/helpers" "^7.18.9" - "@babel/parser" "^7.18.13" + "@babel/generator" "^7.19.0" + "@babel/helper-compilation-targets" "^7.19.0" + "@babel/helper-module-transforms" "^7.19.0" + "@babel/helpers" "^7.19.0" + "@babel/parser" "^7.19.0" "@babel/template" "^7.18.10" - "@babel/traverse" "^7.18.13" - "@babel/types" "^7.18.13" + "@babel/traverse" "^7.19.0" + "@babel/types" "^7.19.0" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" @@ -305,12 +310,12 @@ jsesc "^2.5.1" source-map "^0.5.0" -"@babel/generator@^7.12.1", "@babel/generator@^7.18.13", "@babel/generator@^7.7.2": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.13.tgz#59550cbb9ae79b8def15587bdfbaa388c4abf212" - integrity sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ== +"@babel/generator@^7.12.1", "@babel/generator@^7.19.0", "@babel/generator@^7.7.2": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.0.tgz#785596c06425e59334df2ccee63ab166b738419a" + integrity sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg== dependencies: - "@babel/types" "^7.18.13" + "@babel/types" "^7.19.0" "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" @@ -336,12 +341,12 @@ "@babel/helper-explode-assignable-expression" "^7.18.6" "@babel/types" "^7.18.6" -"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz#69e64f57b524cde3e5ff6cc5a9f4a387ee5563bf" - integrity sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg== +"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.0.tgz#537ec8339d53e806ed422f1e06c8f17d55b96bb0" + integrity sha512-Ai5bNWXIvwDvWM7njqsG3feMlL9hCVQsPYXodsZyLwshYkZVJt59Gftau4VrE8S9IT9asd2uSP1hG6wCNw+sXA== dependencies: - "@babel/compat-data" "^7.18.8" + "@babel/compat-data" "^7.19.0" "@babel/helper-validator-option" "^7.18.6" browserslist "^4.20.2" semver "^6.3.0" @@ -438,6 +443,14 @@ "@babel/template" "^7.18.6" "@babel/types" "^7.18.9" +"@babel/helper-function-name@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" + integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== + dependencies: + "@babel/template" "^7.18.10" + "@babel/types" "^7.19.0" + "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" @@ -480,19 +493,19 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz#5a1079c005135ed627442df31a42887e80fcb712" - integrity sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g== +"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.18.9", "@babel/helper-module-transforms@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz#309b230f04e22c58c6a2c0c0c7e50b216d350c30" + integrity sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ== dependencies: "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-module-imports" "^7.18.6" "@babel/helper-simple-access" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-validator-identifier" "^7.18.6" - "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.9" - "@babel/types" "^7.18.9" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.19.0" + "@babel/types" "^7.19.0" "@babel/helper-optimise-call-expression@^7.16.7": version "7.16.7" @@ -639,14 +652,14 @@ "@babel/traverse" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/helpers@^7.12.1", "@babel/helpers@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.9.tgz#4bef3b893f253a1eced04516824ede94dcfe7ff9" - integrity sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ== +"@babel/helpers@^7.12.1", "@babel/helpers@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.19.0.tgz#f30534657faf246ae96551d88dd31e9d1fa1fc18" + integrity sha512-DRBCKGwIEdqY3+rPJgG/dKfQy9+08rHIAJx8q2p+HSWP87s2HCrQmaAMMyMll2kIXKCW0cO1RdQskx15Xakftg== dependencies: - "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.9" - "@babel/types" "^7.18.9" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.19.0" + "@babel/types" "^7.19.0" "@babel/highlight@^7.18.6": version "7.18.6" @@ -662,10 +675,10 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd" integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw== -"@babel/parser@^7.1.0", "@babel/parser@^7.10.5", "@babel/parser@^7.12.3", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.18.13": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.13.tgz#5b2dd21cae4a2c5145f1fbd8ca103f9313d3b7e4" - integrity sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg== +"@babel/parser@^7.1.0", "@babel/parser@^7.10.5", "@babel/parser@^7.12.3", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.0.tgz#497fcafb1d5b61376959c1c338745ef0577aa02c" + integrity sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" @@ -1497,26 +1510,26 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/traverse@^7.10.5", "@babel/traverse@^7.12.1", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.18.10", "@babel/traverse@^7.18.13", "@babel/traverse@^7.18.6", "@babel/traverse@^7.18.9", "@babel/traverse@^7.7.2": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.13.tgz#5ab59ef51a997b3f10c4587d648b9696b6cb1a68" - integrity sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA== +"@babel/traverse@^7.10.5", "@babel/traverse@^7.12.1", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.18.10", "@babel/traverse@^7.18.6", "@babel/traverse@^7.18.9", "@babel/traverse@^7.19.0", "@babel/traverse@^7.7.2": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.0.tgz#eb9c561c7360005c592cc645abafe0c3c4548eed" + integrity sha512-4pKpFRDh+utd2mbRC8JLnlsMUii3PMHjpL6a0SZ4NMZy7YFP9aXORxEhdMVOc9CpWtDF09IkciQLEhK7Ml7gRA== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.13" + "@babel/generator" "^7.19.0" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.18.13" - "@babel/types" "^7.18.13" + "@babel/parser" "^7.19.0" + "@babel/types" "^7.19.0" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.18.10", "@babel/types@^7.18.13", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.13.tgz#30aeb9e514f4100f7c1cb6e5ba472b30e48f519a" - integrity sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ== +"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.0.tgz#75f21d73d73dc0351f3368d28db73465f4814600" + integrity sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA== dependencies: "@babel/helper-string-parser" "^7.18.10" "@babel/helper-validator-identifier" "^7.18.6" @@ -2055,18 +2068,6 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" -"@jest/types@^29.0.2", "@jest/types@^29.0.3": - version "29.0.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.0.3.tgz#0be78fdddb1a35aeb2041074e55b860561c8ef63" - integrity sha512-coBJmOQvurXjN1Hh5PzF7cmsod0zLIOXpP8KD161mqNlroMhLcwpODiEzi7ZsRl5Z/AIuxpeNm8DCl43F4kz8A== - dependencies: - "@jest/schemas" "^29.0.0" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - "@jest/types@^29.0.3": version "29.0.3" resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.0.3.tgz#0be78fdddb1a35aeb2041074e55b860561c8ef63" @@ -7909,18 +7910,6 @@ jest-util@^28.0.0, jest-util@^28.1.3: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-util@^29.0.2, jest-util@^29.0.3: - version "29.0.3" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.0.3.tgz#06d1d77f9a1bea380f121897d78695902959fbc0" - integrity sha512-Q0xaG3YRG8QiTC4R6fHjHQPaPpz9pJBEi0AeOE4mQh/FuWOijFjGXMMOfQEaU9i3z76cNR7FobZZUQnL6IyfdQ== - dependencies: - "@jest/types" "^29.0.3" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - jest-util@^29.0.3: version "29.0.3" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.0.3.tgz#06d1d77f9a1bea380f121897d78695902959fbc0" From 6312eb9dcf5860b392563e401424efdc2de650d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 21:39:53 +0100 Subject: [PATCH 098/115] chore(deps-dev): bump @typescript-eslint/parser from 5.36.1 to 5.37.0 (#3451) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.36.1 to 5.37.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.37.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 48 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index f418d5558..ab79f0a75 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "@types/jest": "^28.1.7", "@types/stylis": "^4.0.2", "@typescript-eslint/eslint-plugin": "^5.36.1", - "@typescript-eslint/parser": "^5.36.1", + "@typescript-eslint/parser": "^5.37.0", "babel-jest": "^29.0.3", "babel-loader": "^8.2.2", "concurrently": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index 0ecfbd61a..954d510a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2818,14 +2818,14 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@^5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.36.1.tgz#931c22c7bacefd17e29734628cdec8b2acdcf1ce" - integrity sha512-/IsgNGOkBi7CuDfUbwt1eOqUXF9WGVBW9dwEe1pi+L32XrTsZIgmDFIi2RxjzsvB/8i+MIf5JIoTEH8LOZ368A== +"@typescript-eslint/parser@^5.37.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.37.0.tgz#c382077973f3a4ede7453fb14cadcad3970cbf3b" + integrity sha512-01VzI/ipYKuaG5PkE5+qyJ6m02fVALmMPY3Qq5BHflDx3y4VobbLdHQkSMg9VPRS4KdNt4oYTMaomFoHonBGAw== dependencies: - "@typescript-eslint/scope-manager" "5.36.1" - "@typescript-eslint/types" "5.36.1" - "@typescript-eslint/typescript-estree" "5.36.1" + "@typescript-eslint/scope-manager" "5.37.0" + "@typescript-eslint/types" "5.37.0" + "@typescript-eslint/typescript-estree" "5.37.0" debug "^4.3.4" "@typescript-eslint/scope-manager@5.10.1": @@ -2844,6 +2844,14 @@ "@typescript-eslint/types" "5.36.1" "@typescript-eslint/visitor-keys" "5.36.1" +"@typescript-eslint/scope-manager@5.37.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.37.0.tgz#044980e4f1516a774a418dafe701a483a6c9f9ca" + integrity sha512-F67MqrmSXGd/eZnujjtkPgBQzgespu/iCZ+54Ok9X5tALb9L2v3G+QBSoWkXG0p3lcTJsL+iXz5eLUEdSiJU9Q== + dependencies: + "@typescript-eslint/types" "5.37.0" + "@typescript-eslint/visitor-keys" "5.37.0" + "@typescript-eslint/type-utils@5.36.1": version "5.36.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.36.1.tgz#016fc2bff6679f54c0b2df848a493f0ca3d4f625" @@ -2864,6 +2872,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.36.1.tgz#1cf0e28aed1cb3ee676917966eb23c2f8334ce2c" integrity sha512-jd93ShpsIk1KgBTx9E+hCSEuLCUFwi9V/urhjOWnOaksGZFbTOxAT47OH2d4NLJnLhkVD+wDbB48BuaycZPLBg== +"@typescript-eslint/types@5.37.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.37.0.tgz#09e4870a5f3af7af3f84e08d792644a87d232261" + integrity sha512-3frIJiTa5+tCb2iqR/bf7XwU20lnU05r/sgPJnRpwvfZaqCJBrl8Q/mw9vr3NrNdB/XtVyMA0eppRMMBqdJ1bA== + "@typescript-eslint/typescript-estree@5.10.1": version "5.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.1.tgz#b268e67be0553f8790ba3fe87113282977adda15" @@ -2890,6 +2903,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.37.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.37.0.tgz#956dcf5c98363bcb97bdd5463a0a86072ff79355" + integrity sha512-JkFoFIt/cx59iqEDSgIGnQpCTRv96MQnXCYvJi7QhBC24uyuzbD8wVbajMB1b9x4I0octYFJ3OwjAwNqk1AjDA== + dependencies: + "@typescript-eslint/types" "5.37.0" + "@typescript-eslint/visitor-keys" "5.37.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/utils@5.36.1": version "5.36.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.36.1.tgz#136d5208cc7a3314b11c646957f8f0b5c01e07ad" @@ -2930,6 +2956,14 @@ "@typescript-eslint/types" "5.36.1" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@5.37.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.37.0.tgz#7b72dd343295ea11e89b624995abc7103c554eee" + integrity sha512-Hp7rT4cENBPIzMwrlehLW/28EVCOcE9U1Z1BQTc8EA8v5qpr7GRGuG+U58V5tTY48zvUOA3KHvw3rA8tY9fbdA== + dependencies: + "@typescript-eslint/types" "5.37.0" + eslint-visitor-keys "^3.3.0" + "@wdio/config@7.16.11": version "7.16.11" resolved "https://registry.yarnpkg.com/@wdio/config/-/config-7.16.11.tgz#c35a0efb9c7ec6c80e3324e9818f636010087e97" From 9394abce229cbc4d49c70de8e49abe0031b629f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 21:45:25 +0100 Subject: [PATCH 099/115] chore(deps-dev): bump @babel/preset-env from 7.18.10 to 7.19.0 (#3442) Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.18.10 to 7.19.0. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.19.0/packages/babel-preset-env) --- updated-dependencies: - dependency-name: "@babel/preset-env" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 118 ++++++++++++++++++++++++++------------------------- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/package.json b/package.json index ab79f0a75..97ba17367 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@applitools/eyes-cypress": "^3.25.7", "@babel/core": "^7.19.0", "@babel/eslint-parser": "^7.14.7", - "@babel/preset-env": "^7.14.7", + "@babel/preset-env": "^7.19.0", "@babel/register": "^7.14.5", "@commitlint/cli": "^17.1.2", "@commitlint/config-conventional": "^17.0.0", diff --git a/yarn.lock b/yarn.lock index 954d510a9..a079e10b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -239,12 +239,7 @@ dependencies: "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.18.8.tgz#2483f565faca607b8535590e84e7de323f27764d" - integrity sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ== - -"@babel/compat-data@^7.19.0": +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.19.0": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.0.tgz#2a592fd89bacb1fcde68de31bee4f2f2dacb0e86" integrity sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw== @@ -385,6 +380,14 @@ "@babel/helper-annotate-as-pure" "^7.18.6" regexpu-core "^5.1.0" +"@babel/helper-create-regexp-features-plugin@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz#7976aca61c0984202baca73d84e2337a5424a41b" + integrity sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.18.6" + regexpu-core "^5.1.0" + "@babel/helper-define-polyfill-provider@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.2.tgz#bd10d0aca18e8ce012755395b05a79f45eca5073" @@ -493,7 +496,7 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.18.9", "@babel/helper-module-transforms@^7.19.0": +"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.0": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz#309b230f04e22c58c6a2c0c0c7e50b216d350c30" integrity sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ== @@ -521,10 +524,10 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz#4b8aea3b069d8cb8a72cdfe28ddf5ceca695ef2f" - integrity sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w== +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz#4796bb14961521f0f8715990bee2fb6e51ce21bf" + integrity sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw== "@babel/helper-remap-async-to-generator@^7.18.6": version "7.18.6" @@ -696,13 +699,13 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" "@babel/plugin-proposal-optional-chaining" "^7.18.9" -"@babel/plugin-proposal-async-generator-functions@^7.18.10": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.18.10.tgz#85ea478c98b0095c3e4102bff3b67d306ed24952" - integrity sha512-1mFuY2TOsR1hxbjCo4QL+qlIjV07p4H4EUYw2J/WCqsvFV6V9X9z9YhXbWndc/4fw+hYGlDT7egYxliMp5O6Ew== +"@babel/plugin-proposal-async-generator-functions@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.0.tgz#cf5740194f170467df20581712400487efc79ff1" + integrity sha512-nhEByMUTx3uZueJ/QkJuSlCfN4FGg+xy+vRsfGQGzSauq5ks2Deid2+05Q3KhfaUjvec1IGhw/Zm3cFm8JigTQ== dependencies: "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-syntax-async-generators" "^7.8.4" @@ -1102,16 +1105,17 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-classes@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.18.9.tgz#90818efc5b9746879b869d5ce83eb2aa48bbc3da" - integrity sha512-EkRQxsxoytpTlKJmSPYrsOMjCILacAjtSVkd4gChEe2kXjFCun3yohhW5I7plXJhCemM0gKsaGMcO8tinvCA5g== +"@babel/plugin-transform-classes@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz#0e61ec257fba409c41372175e7c1e606dc79bb20" + integrity sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-compilation-targets" "^7.19.0" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-replace-supers" "^7.18.9" "@babel/helper-split-export-declaration" "^7.18.6" globals "^11.1.0" @@ -1123,10 +1127,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-destructuring@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.9.tgz#68906549c021cb231bee1db21d3b5b095f8ee292" - integrity sha512-p5VCYNddPLkZTq4XymQIaIfZNJwT9YsjkPOhkVEqt6QIpQFZVM9IltqqYpOEkJoN1DPznmxUDyZ5CTZs/ZCuHA== +"@babel/plugin-transform-destructuring@^7.18.13": + version "7.18.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz#9e03bc4a94475d62b7f4114938e6c5c33372cbf5" + integrity sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow== dependencies: "@babel/helper-plugin-utils" "^7.18.9" @@ -1210,14 +1214,14 @@ "@babel/helper-simple-access" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-systemjs@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.18.9.tgz#545df284a7ac6a05125e3e405e536c5853099a06" - integrity sha512-zY/VSIbbqtoRoJKo2cDTewL364jSlZGvn0LKOf9ntbfxOvjfmyrdtEEOAdswOswhZEb8UH3jDkCKHd1sPgsS0A== +"@babel/plugin-transform-modules-systemjs@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz#5f20b471284430f02d9c5059d9b9a16d4b085a1f" + integrity sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A== dependencies: "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-module-transforms" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-module-transforms" "^7.19.0" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-validator-identifier" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" @@ -1229,13 +1233,13 @@ "@babel/helper-module-transforms" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-named-capturing-groups-regex@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.18.6.tgz#c89bfbc7cc6805d692f3a49bc5fc1b630007246d" - integrity sha512-UmEOGF8XgaIqD74bC8g7iV3RYj8lMf0Bw7NJzvnS9qQhM4mg+1WHKotUIdjxgD2RGrgFLZZPCFPFj3P/kVDYhg== +"@babel/plugin-transform-named-capturing-groups-regex@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.19.0.tgz#58c52422e4f91a381727faed7d513c89d7f41ada" + integrity sha512-HDSuqOQzkU//kfGdiHBt71/hkDTApw4U/cMVgKgX7PqfB3LOaK+2GtCEsBu1dL9CkswDm0Gwehht1dCr421ULQ== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-create-regexp-features-plugin" "^7.19.0" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-transform-new-target@^7.18.6": version "7.18.6" @@ -1321,12 +1325,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-spread@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.18.9.tgz#6ea7a6297740f381c540ac56caf75b05b74fb664" - integrity sha512-39Q814wyoOPtIB/qGopNIL9xDChOE1pNU0ZY5dO0owhiVt/5kFm4li+/bBtwc7QotG0u5EPzqhZdjMtmqBqyQA== +"@babel/plugin-transform-spread@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.19.0.tgz#dd60b4620c2fec806d60cfaae364ec2188d593b6" + integrity sha512-RsuMk7j6n+r752EtzyScnWkQyuJdli6LdO5Klv8Yx0OfPVTcQkIUfS8clx5e9yHXzlnhOZF3CbQ8C2uP5j074w== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" "@babel/plugin-transform-sticky-regex@^7.18.6": @@ -1365,18 +1369,18 @@ "@babel/helper-create-regexp-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/preset-env@^7.12.1", "@babel/preset-env@^7.14.7": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.18.10.tgz#83b8dfe70d7eea1aae5a10635ab0a5fe60dfc0f4" - integrity sha512-wVxs1yjFdW3Z/XkNfXKoblxoHgbtUF7/l3PvvP4m02Qz9TZ6uZGxRVYjSQeR87oQmHco9zWitW5J82DJ7sCjvA== +"@babel/preset-env@^7.12.1", "@babel/preset-env@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.19.0.tgz#fd18caf499a67d6411b9ded68dc70d01ed1e5da7" + integrity sha512-1YUju1TAFuzjIQqNM9WsF4U6VbD/8t3wEAlw3LFYuuEr+ywqLRcSXxFKz4DCEj+sN94l/XTDiUXYRrsvMpz9WQ== dependencies: - "@babel/compat-data" "^7.18.8" - "@babel/helper-compilation-targets" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/compat-data" "^7.19.0" + "@babel/helper-compilation-targets" "^7.19.0" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/helper-validator-option" "^7.18.6" "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.18.6" "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.18.9" - "@babel/plugin-proposal-async-generator-functions" "^7.18.10" + "@babel/plugin-proposal-async-generator-functions" "^7.19.0" "@babel/plugin-proposal-class-properties" "^7.18.6" "@babel/plugin-proposal-class-static-block" "^7.18.6" "@babel/plugin-proposal-dynamic-import" "^7.18.6" @@ -1410,9 +1414,9 @@ "@babel/plugin-transform-async-to-generator" "^7.18.6" "@babel/plugin-transform-block-scoped-functions" "^7.18.6" "@babel/plugin-transform-block-scoping" "^7.18.9" - "@babel/plugin-transform-classes" "^7.18.9" + "@babel/plugin-transform-classes" "^7.19.0" "@babel/plugin-transform-computed-properties" "^7.18.9" - "@babel/plugin-transform-destructuring" "^7.18.9" + "@babel/plugin-transform-destructuring" "^7.18.13" "@babel/plugin-transform-dotall-regex" "^7.18.6" "@babel/plugin-transform-duplicate-keys" "^7.18.9" "@babel/plugin-transform-exponentiation-operator" "^7.18.6" @@ -1422,9 +1426,9 @@ "@babel/plugin-transform-member-expression-literals" "^7.18.6" "@babel/plugin-transform-modules-amd" "^7.18.6" "@babel/plugin-transform-modules-commonjs" "^7.18.6" - "@babel/plugin-transform-modules-systemjs" "^7.18.9" + "@babel/plugin-transform-modules-systemjs" "^7.19.0" "@babel/plugin-transform-modules-umd" "^7.18.6" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.18.6" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.19.0" "@babel/plugin-transform-new-target" "^7.18.6" "@babel/plugin-transform-object-super" "^7.18.6" "@babel/plugin-transform-parameters" "^7.18.8" @@ -1432,14 +1436,14 @@ "@babel/plugin-transform-regenerator" "^7.18.6" "@babel/plugin-transform-reserved-words" "^7.18.6" "@babel/plugin-transform-shorthand-properties" "^7.18.6" - "@babel/plugin-transform-spread" "^7.18.9" + "@babel/plugin-transform-spread" "^7.19.0" "@babel/plugin-transform-sticky-regex" "^7.18.6" "@babel/plugin-transform-template-literals" "^7.18.9" "@babel/plugin-transform-typeof-symbol" "^7.18.9" "@babel/plugin-transform-unicode-escapes" "^7.18.10" "@babel/plugin-transform-unicode-regex" "^7.18.6" "@babel/preset-modules" "^0.1.5" - "@babel/types" "^7.18.10" + "@babel/types" "^7.19.0" babel-plugin-polyfill-corejs2 "^0.3.2" babel-plugin-polyfill-corejs3 "^0.5.3" babel-plugin-polyfill-regenerator "^0.4.0" From 3cc898ca4cf371e0e488ae545eb18f0035034983 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 20:49:43 +0000 Subject: [PATCH 100/115] chore(deps-dev): bump concurrently from 7.3.0 to 7.4.0 (#3445) --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 97ba17367..6ef7aaaee 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "@typescript-eslint/parser": "^5.37.0", "babel-jest": "^29.0.3", "babel-loader": "^8.2.2", - "concurrently": "^7.0.0", + "concurrently": "^7.4.0", "css-to-string-loader": "^0.1.3", "cypress": "9.7.0", "cypress-image-snapshot": "^4.0.1", diff --git a/yarn.lock b/yarn.lock index a079e10b5..ebed78cdd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4408,13 +4408,13 @@ concat-stream@~1.5.0: readable-stream "~2.0.0" typedarray "~0.0.5" -concurrently@^7.0.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.3.0.tgz#eb45cdbc8df43da195f619aba218a980cae49184" - integrity sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA== +concurrently@^7.4.0: + version "7.4.0" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.4.0.tgz#bb0e344964bc172673577c420db21e963f2f7368" + integrity sha512-M6AfrueDt/GEna/Vg9BqQ+93yuvzkSKmoTixnwEJkH0LlcGrRC2eCmjeG1tLLHIYfpYJABokqSGyMcXjm96AFA== dependencies: chalk "^4.1.0" - date-fns "^2.16.1" + date-fns "^2.29.1" lodash "^4.17.21" rxjs "^7.0.0" shell-quote "^1.7.3" @@ -5078,10 +5078,10 @@ data-urls@^3.0.1, data-urls@^3.0.2: whatwg-mimetype "^3.0.0" whatwg-url "^11.0.0" -date-fns@^2.16.1: - version "2.27.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.27.0.tgz#e1ff3c3ddbbab8a2eaadbb6106be2929a5a2d92b" - integrity sha512-sj+J0Mo2p2X1e306MHq282WS4/A8Pz/95GIFcsPNMPMZVI3EUrAdSv90al1k+p74WGLCruMXk23bfEDZa71X9Q== +date-fns@^2.29.1: + version "2.29.3" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8" + integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA== dateformat@^3.0.0: version "3.0.3" From 13809b50251845475e6dca65cc395761be38fbd2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 20:51:35 +0000 Subject: [PATCH 101/115] chore(deps-dev): bump @typescript-eslint/eslint-plugin (#3457) --- package.json | 2 +- yarn.lock | 124 +++++++++------------------------------------------ 2 files changed, 23 insertions(+), 103 deletions(-) diff --git a/package.json b/package.json index 6ef7aaaee..96523bc22 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "@types/dompurify": "^2.3.4", "@types/jest": "^28.1.7", "@types/stylis": "^4.0.2", - "@typescript-eslint/eslint-plugin": "^5.36.1", + "@typescript-eslint/eslint-plugin": "^5.37.0", "@typescript-eslint/parser": "^5.37.0", "babel-jest": "^29.0.3", "babel-loader": "^8.2.2", diff --git a/yarn.lock b/yarn.lock index ebed78cdd..a78af620d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2807,14 +2807,14 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@^5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.1.tgz#471f64dc53600025e470dad2ca4a9f2864139019" - integrity sha512-iC40UK8q1tMepSDwiLbTbMXKDxzNy+4TfPWgIL661Ym0sD42vRcQU93IsZIrmi+x292DBr60UI/gSwfdVYexCA== +"@typescript-eslint/eslint-plugin@^5.37.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.37.0.tgz#5ccdd5d9004120f28fc6e717fb4b5c9bddcfbc04" + integrity sha512-Fde6W0IafXktz1UlnhGkrrmnnGpAo1kyX7dnyHHVrmwJOn72Oqm3eYtddrpOwwel2W8PAK9F3pIL5S+lfoM0og== dependencies: - "@typescript-eslint/scope-manager" "5.36.1" - "@typescript-eslint/type-utils" "5.36.1" - "@typescript-eslint/utils" "5.36.1" + "@typescript-eslint/scope-manager" "5.37.0" + "@typescript-eslint/type-utils" "5.37.0" + "@typescript-eslint/utils" "5.37.0" debug "^4.3.4" functional-red-black-tree "^1.0.1" ignore "^5.2.0" @@ -2832,22 +2832,6 @@ "@typescript-eslint/typescript-estree" "5.37.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.10.1.tgz#f0539c73804d2423506db2475352a4dec36cd809" - integrity sha512-Lyvi559Gvpn94k7+ElXNMEnXu/iundV5uFmCUNnftbFrUbAJ1WBoaGgkbOBm07jVZa682oaBU37ao/NGGX4ZDg== - dependencies: - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/visitor-keys" "5.10.1" - -"@typescript-eslint/scope-manager@5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.36.1.tgz#23c49b7ddbcffbe09082e6694c2524950766513f" - integrity sha512-pGC2SH3/tXdu9IH3ItoqciD3f3RRGCh7hb9zPdN2Drsr341zgd6VbhP5OHQO/reUqihNltfPpMpTNihFMarP2w== - dependencies: - "@typescript-eslint/types" "5.36.1" - "@typescript-eslint/visitor-keys" "5.36.1" - "@typescript-eslint/scope-manager@5.37.0": version "5.37.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.37.0.tgz#044980e4f1516a774a418dafe701a483a6c9f9ca" @@ -2856,57 +2840,21 @@ "@typescript-eslint/types" "5.37.0" "@typescript-eslint/visitor-keys" "5.37.0" -"@typescript-eslint/type-utils@5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.36.1.tgz#016fc2bff6679f54c0b2df848a493f0ca3d4f625" - integrity sha512-xfZhfmoQT6m3lmlqDvDzv9TiCYdw22cdj06xY0obSznBsT///GK5IEZQdGliXpAOaRL34o8phEvXzEo/VJx13Q== +"@typescript-eslint/type-utils@5.37.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.37.0.tgz#43ed2f567ada49d7e33a6e4b6f9babd060445fe5" + integrity sha512-BSx/O0Z0SXOF5tY0bNTBcDEKz2Ec20GVYvq/H/XNKiUorUFilH7NPbFUuiiyzWaSdN3PA8JV0OvYx0gH/5aFAQ== dependencies: - "@typescript-eslint/typescript-estree" "5.36.1" - "@typescript-eslint/utils" "5.36.1" + "@typescript-eslint/typescript-estree" "5.37.0" + "@typescript-eslint/utils" "5.37.0" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.10.1.tgz#dca9bd4cb8c067fc85304a31f38ec4766ba2d1ea" - integrity sha512-ZvxQ2QMy49bIIBpTqFiOenucqUyjTQ0WNLhBM6X1fh1NNlYAC6Kxsx8bRTY3jdYsYg44a0Z/uEgQkohbR0H87Q== - -"@typescript-eslint/types@5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.36.1.tgz#1cf0e28aed1cb3ee676917966eb23c2f8334ce2c" - integrity sha512-jd93ShpsIk1KgBTx9E+hCSEuLCUFwi9V/urhjOWnOaksGZFbTOxAT47OH2d4NLJnLhkVD+wDbB48BuaycZPLBg== - "@typescript-eslint/types@5.37.0": version "5.37.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.37.0.tgz#09e4870a5f3af7af3f84e08d792644a87d232261" integrity sha512-3frIJiTa5+tCb2iqR/bf7XwU20lnU05r/sgPJnRpwvfZaqCJBrl8Q/mw9vr3NrNdB/XtVyMA0eppRMMBqdJ1bA== -"@typescript-eslint/typescript-estree@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.1.tgz#b268e67be0553f8790ba3fe87113282977adda15" - integrity sha512-PwIGnH7jIueXv4opcwEbVGDATjGPO1dx9RkUl5LlHDSe+FXxPwFL5W/qYd5/NHr7f6lo/vvTrAzd0KlQtRusJQ== - dependencies: - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/visitor-keys" "5.10.1" - debug "^4.3.2" - globby "^11.0.4" - is-glob "^4.0.3" - semver "^7.3.5" - tsutils "^3.21.0" - -"@typescript-eslint/typescript-estree@5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.1.tgz#b857f38d6200f7f3f4c65cd0a5afd5ae723f2adb" - integrity sha512-ih7V52zvHdiX6WcPjsOdmADhYMDN15SylWRZrT2OMy80wzKbc79n8wFW0xpWpU0x3VpBz/oDgTm2xwDAnFTl+g== - dependencies: - "@typescript-eslint/types" "5.36.1" - "@typescript-eslint/visitor-keys" "5.36.1" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - "@typescript-eslint/typescript-estree@5.37.0": version "5.37.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.37.0.tgz#956dcf5c98363bcb97bdd5463a0a86072ff79355" @@ -2920,46 +2868,18 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.36.1.tgz#136d5208cc7a3314b11c646957f8f0b5c01e07ad" - integrity sha512-lNj4FtTiXm5c+u0pUehozaUWhh7UYKnwryku0nxJlYUEWetyG92uw2pr+2Iy4M/u0ONMKzfrx7AsGBTCzORmIg== +"@typescript-eslint/utils@5.37.0", "@typescript-eslint/utils@^5.10.0": + version "5.37.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.37.0.tgz#7784cb8e91390c4f90ccaffd24a0cf9874df81b2" + integrity sha512-jUEJoQrWbZhmikbcWSMDuUSxEE7ID2W/QCV/uz10WtQqfOuKZUqFGjqLJ+qhDd17rjgp+QJPqTdPIBWwoob2NQ== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.36.1" - "@typescript-eslint/types" "5.36.1" - "@typescript-eslint/typescript-estree" "5.36.1" + "@typescript-eslint/scope-manager" "5.37.0" + "@typescript-eslint/types" "5.37.0" + "@typescript-eslint/typescript-estree" "5.37.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/utils@^5.10.0": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.10.1.tgz#fa682a33af47080ba2c4368ee0ad2128213a1196" - integrity sha512-RRmlITiUbLuTRtn/gcPRi4202niF+q7ylFLCKu4c+O/PcpRvZ/nAUwQ2G00bZgpWkhrNLNnvhZLbDn8Ml0qsQw== - dependencies: - "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.10.1" - "@typescript-eslint/types" "5.10.1" - "@typescript-eslint/typescript-estree" "5.10.1" - eslint-scope "^5.1.1" - eslint-utils "^3.0.0" - -"@typescript-eslint/visitor-keys@5.10.1": - version "5.10.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.1.tgz#29102de692f59d7d34ecc457ed59ab5fc558010b" - integrity sha512-NjQ0Xinhy9IL979tpoTRuLKxMc0zJC7QVSdeerXs2/QvOy2yRkzX5dRb10X5woNUdJgU8G3nYRDlI33sq1K4YQ== - dependencies: - "@typescript-eslint/types" "5.10.1" - eslint-visitor-keys "^3.0.0" - -"@typescript-eslint/visitor-keys@5.36.1": - version "5.36.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.1.tgz#7731175312d65738e501780f923896d200ad1615" - integrity sha512-ojB9aRyRFzVMN3b5joSYni6FAS10BBSCAfKJhjJAV08t/a95aM6tAhz+O1jF+EtgxktuSO3wJysp2R+Def/IWQ== - dependencies: - "@typescript-eslint/types" "5.36.1" - eslint-visitor-keys "^3.3.0" - "@typescript-eslint/visitor-keys@5.37.0": version "5.37.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.37.0.tgz#7b72dd343295ea11e89b624995abc7103c554eee" @@ -5752,7 +5672,7 @@ eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0: +eslint-visitor-keys@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== @@ -6658,7 +6578,7 @@ globals@^13.15.0: dependencies: type-fest "^0.20.2" -globby@^11.0.4, globby@^11.1.0: +globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== From 5c51ce13938a96e877015ff4b6bc64406d87e92a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 20:59:12 +0000 Subject: [PATCH 102/115] chore(deps-dev): bump eslint-plugin-jest from 27.0.1 to 27.0.4 (#3458) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 96523bc22..44c913827 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-html": "^7.1.0", - "eslint-plugin-jest": "^27.0.1", + "eslint-plugin-jest": "^27.0.4", "eslint-plugin-jsdoc": "^39.3.6", "eslint-plugin-json": "^3.1.0", "eslint-plugin-markdown": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index a78af620d..71a505d78 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5609,10 +5609,10 @@ eslint-plugin-html@^7.1.0: dependencies: htmlparser2 "^8.0.1" -eslint-plugin-jest@^27.0.1: - version "27.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.0.1.tgz#3e67ee2051411540988c62075e8788702a1064da" - integrity sha512-LosUsrkwVSs/8Z/I8Hqn5vWgTEsHrfIquDEKOsV8/cl+gbFR4tiRCE1AimEotsHjSC0Rx1tYm6vPhw8C3ktmmg== +eslint-plugin-jest@^27.0.4: + version "27.0.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.0.4.tgz#ab9c7b3f48bfade4762c24c415a5d9bbc0174a61" + integrity sha512-BuvY78pHMpMJ6Cio7sKg6jrqEcnRYPUc4Nlihku4vKx3FjlmMINSX4vcYokZIe+8TKcyr1aI5Kq7vYwgJNdQSA== dependencies: "@typescript-eslint/utils" "^5.10.0" From 3dff5a90f1644a5de58bae8aed0a266e9063a526 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Wed, 14 Sep 2022 09:02:34 +0530 Subject: [PATCH 103/115] Apply suggestions from code review Co-authored-by: Alois Klink <alois@aloisklink.com> --- src/diagrams/c4/c4Db.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diagrams/c4/c4Db.js b/src/diagrams/c4/c4Db.js index aa597a179..79028a0c5 100644 --- a/src/diagrams/c4/c4Db.js +++ b/src/diagrams/c4/c4Db.js @@ -634,13 +634,13 @@ export const updateLayoutConfig = function (typeC4Shape, c4ShapeInRowParam, c4Bo let c4BoundaryInRowValue = c4BoundaryInRow; if (typeof c4ShapeInRowParam === 'object') { - let [, value] = Object.entries(c4ShapeInRowParam)[0]; + const value = Object.values(c4ShapeInRowParam)[0]; c4ShapeInRowValue = parseInt(value); } else { c4ShapeInRowValue = parseInt(c4ShapeInRowParam); } if (typeof c4BoundaryInRowParam === 'object') { - let [, value] = Object.entries(c4BoundaryInRowParam)[0]; + const value = Object.values(c4BoundaryInRowParam)[0]; c4BoundaryInRowValue = parseInt(value); } else { c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam); From a7fa40ecdac19c2fccb77c1a4a0692ceb7033553 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Wed, 14 Sep 2022 11:35:49 +0530 Subject: [PATCH 104/115] Remove extension --- cypress/platform/bundle-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/platform/bundle-test.js b/cypress/platform/bundle-test.js index b4ce798b2..373f8741a 100644 --- a/cypress/platform/bundle-test.js +++ b/cypress/platform/bundle-test.js @@ -1,4 +1,4 @@ -import mermaid from '../../dist/mermaid.core.mjs'; +import mermaid from '../../dist/mermaid.core'; let code = `flowchart LR Power_Supply --> Transmitter_A From 9acdc0bc2e58b3b084b756a78f0a1d7991fa752a Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Wed, 14 Sep 2022 10:58:59 +0200 Subject: [PATCH 105/115] Cleanup fixing som lingering issues --- src/diagrams/c4/c4Renderer.js | 1 - src/diagrams/class/classRenderer.js | 2 -- src/diagrams/mindmap/mindmapRenderer.js | 4 +--- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/diagrams/c4/c4Renderer.js b/src/diagrams/c4/c4Renderer.js index c3402d0b9..dceca2887 100644 --- a/src/diagrams/c4/c4Renderer.js +++ b/src/diagrams/c4/c4Renderer.js @@ -616,7 +616,6 @@ export const draw = function (_text, id, _version, diagObj) { globalBoundaryMaxY = conf.diagramMarginY; const title = diagObj.db.getTitle(); - const c4type = diagObj.db.getC4Type(); // TODO: @knsv: remove this? let currentBoundarys = diagObj.db.getBoundarys(''); // switch (c4type) { // case 'C4Context': diff --git a/src/diagrams/class/classRenderer.js b/src/diagrams/class/classRenderer.js index 612a7d879..c1236afea 100644 --- a/src/diagrams/class/classRenderer.js +++ b/src/diagrams/class/classRenderer.js @@ -157,8 +157,6 @@ export const draw = function (text, id, _version, diagObj) { securityLevel === 'sandbox' ? select(sandboxElement.nodes()[0].contentDocument.body) : select('body'); - // TODO: @knsv doc is not used, bug? - const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Fetch the default direction, use TD if none was found const diagram = root.select(`[id='${id}']`); diff --git a/src/diagrams/mindmap/mindmapRenderer.js b/src/diagrams/mindmap/mindmapRenderer.js index 37cce58bf..1519dc406 100644 --- a/src/diagrams/mindmap/mindmapRenderer.js +++ b/src/diagrams/mindmap/mindmapRenderer.js @@ -192,9 +192,7 @@ function layoutMindmap(node, conf) { }); // Merge the trees into a single tree - const result = mergeTrees(node, trees); - // TODO: @knsv The function is not called bug? - eachNode; + mergeTrees(node, trees); return node; } /** From 0ec7e006ecb479effb18782e32c3f1d5abe1a32e Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Wed, 14 Sep 2022 11:11:51 +0200 Subject: [PATCH 106/115] Cleanup unused variables and some commented out code --- src/diagrams/mindmap/mindmapRenderer.js | 3 +- src/diagrams/mindmap/svgDraw.js | 58 +++++++------------------ src/utils.ts | 1 - 3 files changed, 16 insertions(+), 46 deletions(-) diff --git a/src/diagrams/mindmap/mindmapRenderer.js b/src/diagrams/mindmap/mindmapRenderer.js index 1519dc406..2f2b06292 100644 --- a/src/diagrams/mindmap/mindmapRenderer.js +++ b/src/diagrams/mindmap/mindmapRenderer.js @@ -85,9 +85,8 @@ function rightToLeft(mindmap) { /** * @param mindmap * @param dir - * @param conf */ -function layout(mindmap, dir, conf) { +function layout(mindmap, dir) { const bb = new BoundingBox(30, 60); const layout = new Layout(bb); diff --git a/src/diagrams/mindmap/svgDraw.js b/src/diagrams/mindmap/svgDraw.js index 0b5c5e264..7d6804f24 100644 --- a/src/diagrams/mindmap/svgDraw.js +++ b/src/diagrams/mindmap/svgDraw.js @@ -47,9 +47,9 @@ function wrap(text, width) { }); } -const defaultBkg = function (elem, node, section, conf) { +const defaultBkg = function (elem, node, section) { const rd = 5; - const r = elem + elem .append('path') .attr('id', 'node-' + node.id) .attr('class', 'node-bkg node-' + db.type2Str(node.type)) @@ -68,25 +68,22 @@ const defaultBkg = function (elem, node, section, conf) { .attr('x2', node.width) .attr('y2', node.height); }; -const rectBkg = function (elem, node, section, conf) { - const r = elem +const rectBkg = function (elem, node) { + elem .append('rect') .attr('id', 'node-' + node.id) .attr('class', 'node-bkg node-' + db.type2Str(node.type)) .attr('height', node.height) .attr('width', node.width); }; -const cloudBkg = function (elem, node, section, conf) { - const rd = 5; - const r = elem; +const cloudBkg = function (elem, node) { const w = node.width; const h = node.height; - const r0 = 0.1 * w; const r1 = 0.15 * w; const r2 = 0.25 * w; const r3 = 0.35 * w; const r4 = 0.2 * w; - const p = elem + elem .append('path') .attr('id', 'node-' + node.id) .attr('class', 'node-bkg node-' + db.type2Str(node.type)) @@ -109,12 +106,11 @@ const cloudBkg = function (elem, node, section, conf) { H0 V0 Z` ); }; -const bangBkg = function (elem, node, section, conf) { - const rd = 5; +const bangBkg = function (elem, node) { const w = node.width; const h = node.height; const r = 0.15 * w; - const p = elem + elem .append('path') .attr('id', 'node-' + node.id) .attr('class', 'node-bkg node-' + db.type2Str(node.type)) @@ -141,16 +137,15 @@ const bangBkg = function (elem, node, section, conf) { H0 V0 Z` ); }; -const circleBkg = function (elem, node, section, conf) { - const r = elem +const circleBkg = function (elem, node) { + elem .append('circle') .attr('id', 'node-' + node.id) .attr('class', 'node-bkg node-' + db.type2Str(node.type)) .attr('r', node.width / 2); - // .attr('width', node.width); }; -const roundedRectBkg = function (elem, node, section, conf) { - const r = elem +const roundedRectBkg = function (elem, node) { + elem .append('rect') .attr('id', 'node-' + node.id) .attr('class', 'node-bkg node-' + db.type2Str(node.type)) @@ -183,7 +178,6 @@ export const drawNode = function (elem, node, section, conf) { .append('text') .text(node.descr) .attr('dy', '1em') - // .attr('dy', '0') .attr('alignment-baseline', 'middle') .attr('dominant-baseline', 'middle') .attr('text-anchor', 'middle') @@ -195,18 +189,12 @@ export const drawNode = function (elem, node, section, conf) { if (node.icon) { if (node.type === db.nodeType.CIRCLE) { node.height += 50; - const orgWidth = node.width; node.width += 50; - // node.width = Math.max(orgWidth, 100); - const widthDiff = Math.abs(node.width - orgWidth); const icon = nodeElem .append('foreignObject') .attr('height', '50px') .attr('width', node.width) .attr('style', 'text-align: center;'); - // .attr('x', 0) - // .attr('y', 0) - // .attr('class', 'node-icon ' + node.icon); icon .append('div') .attr('class', 'icon-container') @@ -226,9 +214,7 @@ export const drawNode = function (elem, node, section, conf) { .attr('width', '60px') .attr('height', node.height) .attr('style', 'text-align: center;margin-top:' + heightDiff / 2 + 'px;'); - // .attr('x', 0) - // .attr('y', 0) - // .attr('class', 'node-icon ' + node.icon); + icon .append('div') .attr('class', 'icon-container') @@ -258,15 +244,11 @@ export const drawNode = function (elem, node, section, conf) { circleBkg(bkgElem, node, section, conf); break; case db.nodeType.CLOUD: - // bkgElem.attr('transform', 'translate(' + node.width / 2 + ', ' + +node.height / 2 + ')'); cloudBkg(bkgElem, node, section, conf); break; case db.nodeType.BANG: - // bkgElem.attr('transform', 'translate(' + node.width / 2 + ', ' + +node.height / 2 + ')'); bangBkg(bkgElem, node, section, conf); break; - default: - // defaultBkg(bkgElem, node, section, conf); } // Position the node to its coordinate @@ -277,17 +259,7 @@ export const drawNode = function (elem, node, section, conf) { return node.height; }; -export const drawEdge = function drawEdge(edgesElem, mindmap, parent, depth, section, conf) { - // edgesElem - // .append('line') - // .attr('x1', parent.x + parent.width / 2) - // .attr('y1', parent.y + parent.height / 2) - // .attr('x2', mindmap.x + mindmap.width / 2) - // .attr('y2', mindmap.y + mindmap.height / 2) - // .attr('class', 'edge section-edge-' + section + ' edge-depth-' + depth); - - //<path d="M100,250 Q250,100 400,250 T700,250" /> - +export const drawEdge = function drawEdge(edgesElem, mindmap, parent, depth, section) { const sx = parent.x + parent.width / 2; const sy = parent.y + parent.height / 2; const ex = mindmap.x + mindmap.width / 2; @@ -308,7 +280,7 @@ export const drawEdge = function drawEdge(edgesElem, mindmap, parent, depth, sec .attr('class', 'edge section-edge-' + section + ' edge-depth-' + depth); }; -export const positionNode = function (node, conf) { +export const positionNode = function (node) { const nodeElem = db.getElementById(node.id); const x = node.x || 0; diff --git a/src/utils.ts b/src/utils.ts index 8861e7d09..b7f517db4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -43,7 +43,6 @@ const directiveWithoutOpen = /** * @function detectInit Detects the init config object from the text * @param config - * @param config * * ```mermaid * From 59c69600e8f14912cd5a39e9fbce4e90c4eb44b8 Mon Sep 17 00:00:00 2001 From: Alois Klink <alois@aloisklink.com> Date: Thu, 15 Sep 2022 01:05:11 +0100 Subject: [PATCH 107/115] fix(git): support single character branch names In gitGraph, add support branch names that only have a single character. The branch regex is checking for a starting character, and an ending character, so it currently needs at least two characters. I've wrapped everything except the first character in a `()?` to fix this. There are some really complicated regexes that do match what valid git branches are (see https://stackoverflow.com/a/12093994), but I'm reluctant to add them in, since it will be a pain to test all the different edgecases. Hopefully https://github.com/mermaid-js/mermaid/pull/3432 might be used in the future to make a better gitgraph parser! --- src/diagrams/git/gitGraphParserV2.spec.js | 7 +++++-- src/diagrams/git/parser/gitGraph.jison | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/diagrams/git/gitGraphParserV2.spec.js b/src/diagrams/git/gitGraphParserV2.spec.js index fcf965d71..b6c9c2459 100644 --- a/src/diagrams/git/gitGraphParserV2.spec.js +++ b/src/diagrams/git/gitGraphParserV2.spec.js @@ -372,14 +372,16 @@ describe('when parsing a gitGraph', function () { branch cherry-pick03 branch branch/example-branch branch merge/test_merge + %% single character branch name + branch A `; parser.parse(str); const commits = parser.yy.getCommits(); expect(Object.keys(commits).length).toBe(1); - expect(parser.yy.getCurrentBranch()).toBe('merge/test_merge'); + expect(parser.yy.getCurrentBranch()).toBe('A'); expect(parser.yy.getDirection()).toBe('LR'); - expect(Object.keys(parser.yy.getBranches()).length).toBe(6); + expect(Object.keys(parser.yy.getBranches()).length).toBe(7); expect(Object.keys(parser.yy.getBranches())).toEqual( expect.arrayContaining([ 'branch01', @@ -387,6 +389,7 @@ describe('when parsing a gitGraph', function () { 'cherry-pick03', 'branch/example-branch', 'merge/test_merge', + 'A', ]) ); }); diff --git a/src/diagrams/git/parser/gitGraph.jison b/src/diagrams/git/parser/gitGraph.jison index 15909a314..f35dbcde3 100644 --- a/src/diagrams/git/parser/gitGraph.jison +++ b/src/diagrams/git/parser/gitGraph.jison @@ -61,7 +61,7 @@ checkout(?=\s|$) return 'CHECKOUT'; <string>["] this.popState(); <string>[^"]* return 'STR'; [0-9]+(?=\s|$) return 'NUM'; -\w[-\./\w]*[-\w] return 'ID'; // only a subset of https://git-scm.com/docs/git-check-ref-format +\w([-\./\w]*[-\w])? return 'ID'; // only a subset of https://git-scm.com/docs/git-check-ref-format <<EOF>> return 'EOF'; \s+ /* skip all whitespace */ // lowest priority so we can use lookaheads in earlier regex From e9239f83e9164bd9488547d295962b1a9a968eb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Sep 2022 01:55:27 +0100 Subject: [PATCH 108/115] chore(deps-dev): bump webpack-dev-server from 4.10.1 to 4.11.0 (#3450) Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 4.10.1 to 4.11.0. - [Release notes](https://github.com/webpack/webpack-dev-server/releases) - [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-dev-server/compare/v4.10.1...v4.11.0) --- updated-dependencies: - dependency-name: webpack-dev-server dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Tested-by: Alois Klink <19716675+aloisklink@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 44c913827..c111a9806 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "unist-util-flatmap": "^1.0.0", "webpack": "^5.53.0", "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.10.1", + "webpack-dev-server": "^4.11.0", "webpack-merge": "^5.8.0", "webpack-node-externals": "^3.0.0" }, diff --git a/yarn.lock b/yarn.lock index 71a505d78..ed24ef744 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12299,10 +12299,10 @@ webpack-dev-middleware@^5.3.1: range-parser "^1.2.1" schema-utils "^4.0.0" -webpack-dev-server@^4.10.1: - version "4.10.1" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.10.1.tgz#124ac9ac261e75303d74d95ab6712b4aec3e12ed" - integrity sha512-FIzMq3jbBarz3ld9l7rbM7m6Rj1lOsgq/DyLGMX/fPEB1UBUPtf5iL/4eNfhx8YYJTRlzfv107UfWSWcBK5Odw== +webpack-dev-server@^4.11.0: + version "4.11.0" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.11.0.tgz#290ee594765cd8260adfe83b2d18115ea04484e7" + integrity sha512-L5S4Q2zT57SK7tazgzjMiSMBdsw+rGYIX27MgPgx7LDhWO0lViPrHKoLS7jo5In06PWYAhlYu3PbyoC6yAThbw== dependencies: "@types/bonjour" "^3.5.9" "@types/connect-history-api-fallback" "^1.3.5" From 6340c157e8cb125bc0edc56ec61b5dad13757b60 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Sep 2022 07:42:13 +0200 Subject: [PATCH 109/115] chore(deps): bump stylis from 4.1.1 to 4.1.2 (#3439) Bumps [stylis](https://github.com/thysultan/stylis.js) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/thysultan/stylis.js/releases) - [Commits](https://github.com/thysultan/stylis.js/compare/v4.1.1...v4.1.2) --- updated-dependencies: - dependency-name: stylis dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c111a9806..997cafd53 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "khroma": "^2.0.0", "moment-mini": "^2.24.0", "non-layered-tidy-tree-layout": "^2.0.2", - "stylis": "^4.0.10" + "stylis": "^4.1.2" }, "devDependencies": { "@applitools/eyes-cypress": "^3.25.7", diff --git a/yarn.lock b/yarn.lock index ed24ef744..624f5ea00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11270,10 +11270,10 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -stylis@^4.0.10: - version "4.1.1" - resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.1.1.tgz#e46c6a9bbf7c58db1e65bb730be157311ae1fe12" - integrity sha512-lVrM/bNdhVX2OgBFNa2YJ9Lxj7kPzylieHd3TNjuGE0Re9JB7joL5VUKOVH1kdNNJTgGPpT8hmwIAPLaSyEVFQ== +stylis@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.1.2.tgz#870b3c1c2275f51b702bb3da9e94eedad87bba41" + integrity sha512-Nn2CCrG2ZaFziDxaZPN43CXqn+j7tcdjPFCkRBkFue8QYXC2HdEwnw5TCBo4yQZ2WxKYeSi0fdoOrtEqgDrXbA== subarg@^1.0.0: version "1.0.0" From 064c3134e5a3c67c005f5ac69d2c8bea3c41184a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Sep 2022 07:42:28 +0200 Subject: [PATCH 110/115] chore(deps): bump dompurify from 2.3.10 to 2.4.0 (#3444) Bumps [dompurify](https://github.com/cure53/DOMPurify) from 2.3.10 to 2.4.0. - [Release notes](https://github.com/cure53/DOMPurify/releases) - [Commits](https://github.com/cure53/DOMPurify/compare/2.3.10...2.4.0) --- updated-dependencies: - dependency-name: dompurify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 997cafd53..2174df185 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "d3": "^7.0.0", "dagre": "^0.8.5", "dagre-d3": "^0.6.4", - "dompurify": "2.3.10", + "dompurify": "2.4.0", "fast-clone": "^1.5.13", "graphlib": "^2.1.8", "khroma": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 624f5ea00..c8ba00606 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5370,10 +5370,10 @@ domhandler@^5.0.1, domhandler@^5.0.2: dependencies: domelementtype "^2.3.0" -dompurify@2.3.10: - version "2.3.10" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.3.10.tgz#901f7390ffe16a91a5a556b94043314cd4850385" - integrity sha512-o7Fg/AgC7p/XpKjf/+RC3Ok6k4St5F7Q6q6+Nnm3p2zGWioAY6dh0CbbuwOhH2UcSzKsdniE/YnE2/92JcsA+g== +dompurify@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.4.0.tgz#c9c88390f024c2823332615c9e20a453cf3825dd" + integrity sha512-Be9tbQMZds4a3C6xTmz68NlMfeONA//4dOavl/1rNw50E+/QO0KVpbcU0PcaW0nsQxurXls9ZocqFxk8R2mWEA== domutils@^3.0.1: version "3.0.1" From 5c2a45cd4d7a88b02c468256433574a1da13a62d Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Thu, 15 Sep 2022 17:48:00 +0530 Subject: [PATCH 111/115] Replace GoogleAnalytics with Plausible --- docs/index.html | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/docs/index.html b/docs/index.html index 8d291f8e5..bad517a5f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -23,20 +23,11 @@ /> <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.6/dist/mermaid.min.js"></script> <!-- <script src="http://localhost:9000/mermaid.js"></script> --> - <script> - // prettier-ignore - (function (i, s, o, g, r, a, m) { - i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { - (i[r].q = i[r].q || []).push(arguments) - }, i[r].l = 1 * new Date(); a = s.createElement(o), - m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) - })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); - - ga('create', 'UA-153180559-1', 'auto'); - if (location) { - ga('send', 'pageview', location.hash); - } - </script> + <script + defer + data-domain="mermaid-js.github.io" + src="https://plausible.io/js/plausible.js" + ></script> <script> var require = { paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs' }, From 9c88c785cb76231522287654e166f9d0f7011067 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist <knsv@sveido.com> Date: Fri, 16 Sep 2022 14:05:15 +0200 Subject: [PATCH 112/115] Fix for issues in errorhandling and class diagrams after refactoring --- cypress/platform/knsv2.html | 15 ++++++++++++--- src/dagre-wrapper/markers.js | 2 +- src/defaultConfig.ts | 10 ++++++---- src/diagram-api/diagram-orchestration.ts | 6 +++++- src/diagrams/error/errorRenderer.ts | 3 ++- src/mermaidAPI.ts | 2 +- src/utils.ts | 5 ++--- 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html index 94b99602a..3be7bfb73 100644 --- a/cypress/platform/knsv2.html +++ b/cypress/platform/knsv2.html @@ -47,9 +47,17 @@ <div>Security check</div> <div class="flex"> <pre id="diagram" class="mermaid"> -sequenceDiagram - Nothing:Valid; - </pre> + flowchart TD + A[myClass1] --> B[default] & C[default] + B[default] & C[default] --> D[myClass2] + classDef default stroke-width:2px,fill:none,stroke:silver + classDef node color:red + classDef myClass1 color:#0000ff + classDef myClass2 stroke:#0000ff,fill:#ccccff + class A myClass1 + class D myClass2 + </pre + > <div id="res" class=""></div> </div> <script src="./mermaid.js"></script> @@ -59,6 +67,7 @@ sequenceDiagram }; mermaid.initialize({ startOnLoad: false, + logLevel: 0, // themeVariables: {relationLabelColor: 'red'} }); function callback() { diff --git a/src/dagre-wrapper/markers.js b/src/dagre-wrapper/markers.js index b28be4119..fa229d231 100644 --- a/src/dagre-wrapper/markers.js +++ b/src/dagre-wrapper/markers.js @@ -119,7 +119,7 @@ const dependency = (elem, type) => { .append('path') .attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z'); }; -const lollipop = (elem, type, id) => { +const lollipop = (elem, type) => { elem .append('defs') .append('marker') diff --git a/src/defaultConfig.ts b/src/defaultConfig.ts index 60d867437..681fda60c 100644 --- a/src/defaultConfig.ts +++ b/src/defaultConfig.ts @@ -228,9 +228,9 @@ const config: Partial<MermaidConfig> = { * Decides which rendering engine that is to be used for the rendering. Legal values are: * dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid * - * Default value: 'dagre-d3' + * Default value: 'dagre-wrapper' */ - defaultRenderer: 'dagre-d3', + defaultRenderer: 'dagre-wrapper', }, /** The object containing configurations specific for sequence diagrams */ @@ -387,7 +387,8 @@ const config: Partial<MermaidConfig> = { * * **Notes:** * - * This will display arrows that start and begin at the same node as right angles, rather than a curve + * This will display arrows that start and begin at the same node as right angles, rather than a + * curve * * Default value: false */ @@ -802,7 +803,8 @@ const config: Partial<MermaidConfig> = { * * **Notes:** * - * This will display arrows that start and begin at the same node as right angles, rather than a curves + * This will display arrows that start and begin at the same node as right angles, rather than a + * curves * * Default value: false */ diff --git a/src/diagram-api/diagram-orchestration.ts b/src/diagram-api/diagram-orchestration.ts index cc902a107..e5b5f3cc0 100644 --- a/src/diagram-api/diagram-orchestration.ts +++ b/src/diagram-api/diagram-orchestration.ts @@ -105,7 +105,11 @@ export const addDiagrams = () => { 'error', // Special diagram with error messages but setup as a regular diagram { - db: {}, + db: { + clear: () => { + // Quite ok, clear needs to be there for error to work as a regular diagram + }, + }, styles: errorStyles, renderer: errorRenderer, parser: { diff --git a/src/diagrams/error/errorRenderer.ts b/src/diagrams/error/errorRenderer.ts index 9dbdf5508..df9ce2c6e 100644 --- a/src/diagrams/error/errorRenderer.ts +++ b/src/diagrams/error/errorRenderer.ts @@ -17,10 +17,11 @@ export const setConf = function (cnf: any) { /** * Draws a an info picture in the tag with id: id based on the graph definition in text. * + * @param text * @param {string} id The text for the error * @param {string} mermaidVersion The version */ -export const draw = (id: string, mermaidVersion: string) => { +export const draw = (text: string, id: string, mermaidVersion: string) => { try { log.debug('Renering svg for syntax error\n'); diff --git a/src/mermaidAPI.ts b/src/mermaidAPI.ts index c8d51941a..cbb9aa071 100644 --- a/src/mermaidAPI.ts +++ b/src/mermaidAPI.ts @@ -312,7 +312,7 @@ const render = function ( try { diag.renderer.draw(text, id, pkg.version, diag); } catch (e) { - errorRenderer.draw(id, pkg.version); + errorRenderer.draw(text, id, pkg.version); throw e; } diff --git a/src/utils.ts b/src/utils.ts index b7f517db4..b8bf91634 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -71,7 +71,7 @@ const directiveWithoutOpen = * g-->h * ``` * @param {string} text The text defining the graph - * @param {any} cnf + * @param {any} config * @returns {object} The json object representing the init passed to mermaid.initialize() */ export const detectInit = function (text: string, config?: MermaidConfig): MermaidConfig { @@ -392,7 +392,6 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => { } points.forEach((point) => { - totalDistance += distance(point, prevPoint); prevPoint = point; }); @@ -746,7 +745,7 @@ let decoder; * Decodes HTML, source: {@link https://github.com/shrpne/entity-decode/blob/v2.0.1/browser.js} * * @param {string} html HTML as a string - * @returns Unescaped HTML + * @returns {string} Unescaped HTML */ export const entityDecode = function (html) { decoder = decoder || document.createElement('div'); From 2693c9b02486901201288c68b0261f8dd57d7fdb Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 16 Sep 2022 18:09:24 +0530 Subject: [PATCH 113/115] Fix coverage --- docs/Setup.md | 46 +++--- jest.config.js | 3 +- package.json | 2 +- src/assignWithDepth.js | 1 + src/docs/Setup.md | 46 +++--- src/mermaid.ts | 1 + src/mermaidAPI.spec.js | 1 + src/mermaidAPI.ts | 3 - yarn.lock | 341 ++++++++++++++++++++++++++++++++++++++--- 9 files changed, 370 insertions(+), 74 deletions(-) diff --git a/docs/Setup.md b/docs/Setup.md index 8e428c14c..e437b619b 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -4,13 +4,10 @@ ## mermaidAPI -Edit this -Page[\[N|Solid\](img/GitHub-Mark-32px.png)][1] - This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js. -The core of this api is the [**render**][2] function which, given a graph +The core of this api is the [**render**][1] function which, given a graph definition as text, renders the graph/diagram and returns an svg element for the graph. It is then up to the user of the API to make use of the svg, either insert it somewhere in the @@ -21,7 +18,7 @@ In addition to the render function, a number of behavioral configuration options ## Configuration **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more\[[click -here][3]].** +here][2]].** ## **What follows are config instructions for older versions** @@ -36,7 +33,7 @@ htmlLabels:true, curve:'cardinal', }, }; mermaid.initialize(config); </script> </pre> -A summary of all options and their defaults is found [here][4]. +A summary of all options and their defaults is found [here][3]. A description of each option follows below. ## theme @@ -1411,10 +1408,10 @@ This sets the auto-wrap padding for the diagram (sides only) ### Parameters -- `text` **[string][5]** -- `parseError` **[Function][6]?** +- `text` **[string][4]** +- `parseError` **[Function][5]?** -Returns **[boolean][7]** +Returns **[boolean][6]** ## setSiteConfig @@ -1433,7 +1430,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## getSiteConfig @@ -1445,7 +1442,7 @@ Returns **[object][8]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## setConfig @@ -1484,10 +1481,10 @@ $(function () { ### Parameters -- `id` **[string][5]** The id of the element to be rendered -- `text` **[string][5]** The graph definition -- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** -- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][4]** The id of the element to be rendered +- `text` **[string][4]** The graph definition +- `cb` **function (svgCode: [string][4], bindFunctions: function (element: [Element][8]): void): void** +- `container` **[Element][8]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1526,7 +1523,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][8]** The directive to push in +- `directive` **[object][7]** The directive to push in ## reset @@ -1620,12 +1617,11 @@ Returns **void** </script> ``` -[1]: https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js -[2]: Setup.md?id=render -[3]: 8.6.0_docs.md -[4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function -[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean -[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[9]: https://developer.mozilla.org/docs/Web/API/Element +[1]: Setup.md?id=render +[2]: 8.6.0_docs.md +[3]: #mermaidapi-configuration-defaults +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[8]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/jest.config.js b/jest.config.js index 33618cf12..5b43d379d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,8 +5,7 @@ module.exports = { testEnvironment: 'jsdom', preset: 'ts-jest', transform: { - '^.+\\.tsx?$': ['jest-esbuild', { banner: '"use strict";' }], - '^.+\\.jsx?$': ['jest-esbuild', { banner: '"use strict";' }], + '^.+\\.[jt]sx?$': 'esbuild-jest', '^.+\\.jison$': [ path.resolve(__dirname, './src/jison/transformer.js'), { 'token-stack': true }, diff --git a/package.json b/package.json index 4d37acbca..04c78ccaa 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "cypress-image-snapshot": "^4.0.1", "documentation": "13.2.0", "esbuild": "^0.15.6", + "esbuild-jest": "^0.5.0", "esbuild-loader": "^2.19.0", "eslint": "^8.23.1", "eslint-config-prettier": "^8.5.0", @@ -116,7 +117,6 @@ "identity-obj-proxy": "^3.0.0", "jest": "^28.0.3", "jest-environment-jsdom": "^29.0.3", - "jest-esbuild": "^0.2.9", "jison": "^0.4.18", "js-base64": "3.7.2", "lint-staged": "^13.0.0", diff --git a/src/assignWithDepth.js b/src/assignWithDepth.js index 9f44b01ee..eff568d3e 100644 --- a/src/assignWithDepth.js +++ b/src/assignWithDepth.js @@ -1,3 +1,4 @@ +'use strict'; /** * @function assignWithDepth Extends the functionality of {@link ObjectConstructor.assign} with the * ability to merge arbitrary-depth objects For each key in src with path `k` (recursively) diff --git a/src/docs/Setup.md b/src/docs/Setup.md index 41e706825..01dab44a6 100644 --- a/src/docs/Setup.md +++ b/src/docs/Setup.md @@ -2,13 +2,10 @@ ## mermaidAPI -Edit this -Page[\[N|Solid\](img/GitHub-Mark-32px.png)][1] - This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js. -The core of this api is the [**render**][2] function which, given a graph +The core of this api is the [**render**][1] function which, given a graph definition as text, renders the graph/diagram and returns an svg element for the graph. It is then up to the user of the API to make use of the svg, either insert it somewhere in the @@ -19,7 +16,7 @@ In addition to the render function, a number of behavioral configuration options ## Configuration **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more\[[click -here][3]].** +here][2]].** ## **What follows are config instructions for older versions** @@ -34,7 +31,7 @@ htmlLabels:true, curve:'cardinal', }, }; mermaid.initialize(config); </script> </pre> -A summary of all options and their defaults is found [here][4]. +A summary of all options and their defaults is found [here][3]. A description of each option follows below. ## theme @@ -1409,10 +1406,10 @@ This sets the auto-wrap padding for the diagram (sides only) ### Parameters -- `text` **[string][5]** -- `parseError` **[Function][6]?** +- `text` **[string][4]** +- `parseError` **[Function][5]?** -Returns **[boolean][7]** +Returns **[boolean][6]** ## setSiteConfig @@ -1431,7 +1428,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## getSiteConfig @@ -1443,7 +1440,7 @@ Returns **[object][8]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## setConfig @@ -1482,10 +1479,10 @@ $(function () { ### Parameters -- `id` **[string][5]** The id of the element to be rendered -- `text` **[string][5]** The graph definition -- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** -- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][4]** The id of the element to be rendered +- `text` **[string][4]** The graph definition +- `cb` **function (svgCode: [string][4], bindFunctions: function (element: [Element][8]): void): void** +- `container` **[Element][8]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1524,7 +1521,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][8]** The directive to push in +- `directive` **[object][7]** The directive to push in ## reset @@ -1618,12 +1615,11 @@ Returns **void** </script> ``` -[1]: https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js -[2]: Setup.md?id=render -[3]: 8.6.0_docs.md -[4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function -[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean -[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[9]: https://developer.mozilla.org/docs/Web/API/Element +[1]: Setup.md?id=render +[2]: 8.6.0_docs.md +[3]: #mermaidapi-configuration-defaults +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[8]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/src/mermaid.ts b/src/mermaid.ts index 809387f60..6eec7ea66 100644 --- a/src/mermaid.ts +++ b/src/mermaid.ts @@ -1,3 +1,4 @@ +'use strict'; /** * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid * functionality and to render the diagrams to svg code. diff --git a/src/mermaidAPI.spec.js b/src/mermaidAPI.spec.js index 3c4a28ca9..241b5ec86 100644 --- a/src/mermaidAPI.spec.js +++ b/src/mermaidAPI.spec.js @@ -1,3 +1,4 @@ +'use strict'; import mermaid from './mermaid'; import mermaidAPI from './mermaidAPI'; import assignWithDepth from './assignWithDepth'; diff --git a/src/mermaidAPI.ts b/src/mermaidAPI.ts index c8d51941a..64bfbeff7 100644 --- a/src/mermaidAPI.ts +++ b/src/mermaidAPI.ts @@ -1,7 +1,4 @@ /** - * Edit this - * Page[[N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js) - * * This is the API to be used when optionally handling the integration with the web page, instead of * using the default integration provided by mermaid.js. * diff --git a/yarn.lock b/yarn.lock index 934aff293..940dd18e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -244,6 +244,11 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.0.tgz#2a592fd89bacb1fcde68de31bee4f2f2dacb0e86" integrity sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw== +"@babel/compat-data@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.1.tgz#72d647b4ff6a4f82878d184613353af1dd0290f9" + integrity sha512-72a9ghR0gnESIa7jBN53U32FOVCEoztyIlKaNoU05zRhEecduGK9L9c3ww7Mp06JiR+0ls0GBPFJQwwtjn9ksg== + "@babel/core@7.12.3": version "7.12.3" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.3.tgz#1b436884e1e3bff6fb1328dc02b208759de92ad8" @@ -266,6 +271,27 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/core@^7.1.0", "@babel/core@^7.12.17": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.1.tgz#c8fa615c5e88e272564ace3d42fbc8b17bfeb22b" + integrity sha512-1H8VgqXme4UXCRv7/Wa1bq7RVymKOzC7znjyFM8KiEzwFqcKUKYNoQef4GhdklgNvoBXyW4gYhuBNCM5o1zImw== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.19.0" + "@babel/helper-compilation-targets" "^7.19.1" + "@babel/helper-module-transforms" "^7.19.0" + "@babel/helpers" "^7.19.0" + "@babel/parser" "^7.19.1" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.19.1" + "@babel/types" "^7.19.0" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.19.0": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.0.tgz#d2f5f4f2033c00de8096be3c9f45772563e150c3" @@ -346,6 +372,16 @@ browserslist "^4.20.2" semver "^6.3.0" +"@babel/helper-compilation-targets@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.1.tgz#7f630911d83b408b76fe584831c98e5395d7a17c" + integrity sha512-LlLkkqhCMyz2lkQPvJNdIYU7O5YjWRgC2R4omjCTpZd8u8KMQzZvX4qce+/BluN1rcQiV7BoGUpmQ0LeHerbhg== + dependencies: + "@babel/compat-data" "^7.19.1" + "@babel/helper-validator-option" "^7.18.6" + browserslist "^4.21.3" + semver "^6.3.0" + "@babel/helper-create-class-features-plugin@^7.16.0": version "7.18.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.0.tgz#fac430912606331cb075ea8d82f9a4c145a4da19" @@ -683,6 +719,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.0.tgz#497fcafb1d5b61376959c1c338745ef0577aa02c" integrity sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw== +"@babel/parser@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.1.tgz#6f6d6c2e621aad19a92544cc217ed13f1aac5b4c" + integrity sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -1204,7 +1245,7 @@ "@babel/helper-plugin-utils" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.18.6": +"@babel/plugin-transform-modules-commonjs@^7.12.13", "@babel/plugin-transform-modules-commonjs@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz#afd243afba166cca69892e24a8fd8c9f2ca87883" integrity sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q== @@ -1530,6 +1571,22 @@ debug "^4.1.0" globals "^11.1.0" +"@babel/traverse@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.1.tgz#0fafe100a8c2a603b4718b1d9bf2568d1d193347" + integrity sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.19.0" + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.19.1" + "@babel/types" "^7.19.0" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.0.tgz#75f21d73d73dc0351f3368d28db73465f4814600" @@ -1549,6 +1606,14 @@ resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.0.tgz#fe364f025ba74f6de6c837a84ef44bdb1d61e68f" integrity sha512-mgmE7XBYY/21erpzhexk4Cj1cyTQ9LzvnTxtzM17BJ7ERMNE6W72mQRo0I1Ud8eFJ+RVVIcBNhLFZ3GX4XFz5w== +"@cnakazawa/watch@^1.0.3": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" + integrity sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + "@commitlint/cli@^17.1.2": version "17.1.2" resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-17.1.2.tgz#38240f84936df5216f749f06f838dc50cc85a43d" @@ -2028,6 +2093,27 @@ jest-haste-map "^28.1.3" slash "^3.0.0" +"@jest/transform@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b" + integrity sha512-E9JjhUgNzvuQ+vVAL21vlyfy12gP0GhazGgJC4h6qUt1jSdUXGWJ1wfu/X7Sd8etSgxV4ovT1pb9v5D6QW4XgA== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^26.6.2" + babel-plugin-istanbul "^6.0.0" + chalk "^4.0.0" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.2.4" + jest-haste-map "^26.6.2" + jest-regex-util "^26.0.0" + jest-util "^26.6.2" + micromatch "^4.0.2" + pirates "^4.0.1" + slash "^3.0.0" + source-map "^0.6.1" + write-file-atomic "^3.0.0" + "@jest/transform@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-28.1.3.tgz#59d8098e50ab07950e0f2fc0fc7ec462371281b0" @@ -2070,6 +2156,17 @@ slash "^3.0.0" write-file-atomic "^4.0.1" +"@jest/types@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" + integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + chalk "^4.0.0" + "@jest/types@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.3.tgz#b05de80996ff12512bc5ceb1d208285a7d11748b" @@ -2246,6 +2343,17 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== +"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": + version "7.1.19" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.19.tgz#7b497495b7d1b4812bdb9d02804d0576f43ee460" + integrity sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + "@types/babel__core@^7.1.14": version "7.1.17" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.17.tgz#f50ac9d20d64153b510578d84f9643f9a3afbe64" @@ -2588,7 +2696,7 @@ resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.10.tgz#6dfbf5ea17142f7f9a043809f1cd4c448cb68249" integrity sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA== -"@types/graceful-fs@^4.1.3": +"@types/graceful-fs@^4.1.2", "@types/graceful-fs@^4.1.3": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== @@ -2808,6 +2916,13 @@ resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw== +"@types/yargs@^15.0.0": + version "15.0.14" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.14.tgz#26d821ddb89e70492160b66d10a0eb6df8f6fb06" + integrity sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ== + dependencies: + "@types/yargs-parser" "*" + "@types/yargs@^17.0.8": version "17.0.10" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a" @@ -3327,6 +3442,14 @@ ansi-styles@~1.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178" integrity sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg= +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" @@ -3489,6 +3612,20 @@ axios@^0.21.1: dependencies: follow-redirects "^1.14.0" +babel-jest@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.6.3.tgz#d87d25cb0037577a0c89f82e5755c5d293c01056" + integrity sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA== + dependencies: + "@jest/transform" "^26.6.2" + "@jest/types" "^26.6.2" + "@types/babel__core" "^7.1.7" + babel-plugin-istanbul "^6.0.0" + babel-preset-jest "^26.6.2" + chalk "^4.0.0" + graceful-fs "^4.2.4" + slash "^3.0.0" + babel-jest@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-28.1.3.tgz#c1187258197c099072156a0a121c11ee1e3917d5" @@ -3532,7 +3669,7 @@ babel-plugin-dynamic-import-node@^2.3.3: dependencies: object.assign "^4.1.0" -babel-plugin-istanbul@^6.1.1: +babel-plugin-istanbul@^6.0.0, babel-plugin-istanbul@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== @@ -3543,6 +3680,16 @@ babel-plugin-istanbul@^6.1.1: istanbul-lib-instrument "^5.0.4" test-exclude "^6.0.0" +babel-plugin-jest-hoist@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.6.2.tgz#8185bd030348d254c6d7dd974355e6a28b21e62d" + integrity sha512-PO9t0697lNTmcEHH69mdtYiOIkkOlj9fySqfO3K1eCcdISevLAE0xY59VLLUj0SoiPiTX/JU2CYFpILydUa5Lw== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.0.0" + "@types/babel__traverse" "^7.0.6" + babel-plugin-jest-hoist@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-28.1.3.tgz#1952c4d0ea50f2d6d794353762278d1d8cca3fbe" @@ -3605,6 +3752,14 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" +babel-preset-jest@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.6.2.tgz#747872b1171df032252426586881d62d31798fee" + integrity sha512-YvdtlVm9t3k777c5NPQIv6cxFFFapys25HiUmuSgHwIZhfifweR5c5Sf5nwE3MAbfu327CYSvps8Yx6ANLyleQ== + dependencies: + babel-plugin-jest-hoist "^26.6.2" + babel-preset-current-node-syntax "^1.0.0" + babel-preset-jest@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-28.1.3.tgz#5dfc20b99abed5db994406c2b9ab94c73aaa419d" @@ -3790,6 +3945,16 @@ browserslist@^4.14.5, browserslist@^4.20.2, browserslist@^4.21.0: node-releases "^2.0.5" update-browserslist-db "^1.0.4" +browserslist@^4.21.3: + version "4.21.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" + integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== + dependencies: + caniuse-lite "^1.0.30001400" + electron-to-chromium "^1.4.251" + node-releases "^2.0.6" + update-browserslist-db "^1.0.9" + bs-logger@0.x: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -3927,6 +4092,18 @@ caniuse-lite@^1.0.30001359: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001397.tgz" integrity sha512-SW9N2TbCdLf0eiNDRrrQXx2sOkaakNZbCjgNpPyMJJbiOrU5QzMIrXOVMRM1myBXTD5iTkdrtU/EguCrBocHlA== +caniuse-lite@^1.0.30001400: + version "1.0.30001402" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001402.tgz#aa29e1f47f5055b0d0c07696a67b8b08023d14c8" + integrity sha512-Mx4MlhXO5NwuvXGgVb+hg65HZ+bhUYsz8QtDGDo2QmaJS2GBX47Xfi2koL86lc8K+l+htXeTEB/Aeqvezoo6Ew== + +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== + dependencies: + rsvp "^4.8.4" + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -4037,6 +4214,11 @@ chrome-trace-event@^1.0.2: resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + ci-info@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.0.tgz#b4ed1fb6818dea4803a55c623041f9165d2066b2" @@ -5459,6 +5641,11 @@ electron-to-chromium@^1.4.172: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.177.tgz#b6a4436eb788ca732556cd69f384b8a3c82118c5" integrity sha512-FYPir3NSBEGexSZUEeht81oVhHfLFl6mhUKSkjHN/iB/TwEIt/WHQrqVGfTLN5gQxwJCQkIJBe05eOXjI7omgg== +electron-to-chromium@^1.4.251: + version "1.4.253" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.253.tgz#3402fd2159530fc6d94237f1b9535fa7bebaf399" + integrity sha512-1pezJ2E1UyBTGbA7fUlHdPSXQw1k+82VhTFLG5G0AUqLGvsZqFzleOblceqegZzxYX4kC7hGEEdzIQI9RZ1Cuw== + emittery@^0.10.2: version "0.10.2" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933" @@ -5605,6 +5792,15 @@ esbuild-freebsd-arm64@0.15.6: resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.6.tgz#70c8a2a30bf6bb9d547a0d8dc93aa015ec4f77f9" integrity sha512-KtQkQOhnNciXm2yrTYZMD3MOm2zBiiwFSU+dkwNbcfDumzzUprr1x70ClTdGuZwieBS1BM/k0KajRQX7r504Xw== +esbuild-jest@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/esbuild-jest/-/esbuild-jest-0.5.0.tgz#7a9964bfdecafca3b675a8aeb08193bcdba8b9d7" + integrity sha512-AMZZCdEpXfNVOIDvURlqYyHwC8qC1/BFjgsrOiSL1eyiIArVtHL8YAC83Shhn16cYYoAWEW17yZn0W/RJKJKHQ== + dependencies: + "@babel/core" "^7.12.17" + "@babel/plugin-transform-modules-commonjs" "^7.12.13" + babel-jest "^26.6.3" + esbuild-linux-32@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" @@ -5757,7 +5953,7 @@ esbuild-windows-arm64@0.15.6: resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.6.tgz#e18a778d354fc2ca2306688f3fedad8a3e57819e" integrity sha512-DB3G2x9OvFEa00jV+OkDBYpufq5x/K7a6VW6E2iM896DG4ZnAvJKQksOsCPiM1DUaa+DrijXAQ/ZOcKAqf/3Hg== -esbuild@^0.14.39, esbuild@^0.14.48: +esbuild@^0.14.39: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== @@ -6099,6 +6295,11 @@ events@^3.2.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== +exec-sh@^0.3.2: + version "0.3.6" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.6.tgz#ff264f9e325519a60cb5e273692943483cca63bc" + integrity sha512-nQn+hI3yp+oD0huYhKwvYI32+JFeq+XkNcD1GAo3Y/MjxsfVGmrrzrnzjWiNY6f+pUCP440fThsFh5gZrRAU/w== + execa@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" @@ -6595,7 +6796,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^2.3.2, fsevents@~2.3.2: +fsevents@^2.1.2, fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== @@ -7424,6 +7625,13 @@ is-buffer@^2.0.0: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + is-ci@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.1.tgz#db6ecbed1bd659c43dac0f45661e7674103d1867" @@ -7629,7 +7837,7 @@ is-text-path@^1.0.1: dependencies: text-extensions "^1.0.0" -is-typedarray@~1.0.0: +is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= @@ -7893,19 +8101,32 @@ jest-environment-node@^28.1.3: jest-mock "^28.1.3" jest-util "^28.1.3" -jest-esbuild@^0.2.9: - version "0.2.9" - resolved "https://registry.yarnpkg.com/jest-esbuild/-/jest-esbuild-0.2.9.tgz#c4c103e510400ad8a080753fd990dfe5a2a76025" - integrity sha512-GfcQgHf8XPwUydEurYTRdrhrDblVFXtgOsKmE/7KADxbsC0c5xpxQBarak4X7K0wl5XXfTmw7Qtat2V0/ssreg== - dependencies: - debug "^4.3.4" - esbuild "^0.14.48" - jest-get-type@^28.0.2: version "28.0.2" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== +jest-haste-map@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa" + integrity sha512-easWIJXIw71B2RdR8kgqpjQrbMRWQBgiBwXYEhtGUTaX+doCjBheluShdDMeR8IMfJiTqH4+zfhtg29apJf/8w== + dependencies: + "@jest/types" "^26.6.2" + "@types/graceful-fs" "^4.1.2" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.4" + jest-regex-util "^26.0.0" + jest-serializer "^26.6.2" + jest-util "^26.6.2" + jest-worker "^26.6.2" + micromatch "^4.0.2" + sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^2.1.2" + jest-haste-map@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-28.1.3.tgz#abd5451129a38d9841049644f34b034308944e2b" @@ -8028,6 +8249,11 @@ jest-pnp-resolver@^1.2.2: resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== +jest-regex-util@^26.0.0: + version "26.0.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" + integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== + jest-regex-util@^28.0.2: version "28.0.2" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead" @@ -8116,6 +8342,14 @@ jest-runtime@^28.1.3: slash "^3.0.0" strip-bom "^4.0.0" +jest-serializer@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.6.2.tgz#d139aafd46957d3a448f3a6cdabe2919ba0742d1" + integrity sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g== + dependencies: + "@types/node" "*" + graceful-fs "^4.2.4" + jest-snapshot@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-28.1.3.tgz#17467b3ab8ddb81e2f605db05583d69388fc0668" @@ -8145,6 +8379,18 @@ jest-snapshot@^28.1.3: pretty-format "^28.1.3" semver "^7.3.5" +jest-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" + integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== + dependencies: + "@jest/types" "^26.6.2" + "@types/node" "*" + chalk "^4.0.0" + graceful-fs "^4.2.4" + is-ci "^2.0.0" + micromatch "^4.0.2" + jest-util@^28.0.0, jest-util@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.3.tgz#f4f932aa0074f0679943220ff9cbba7e497028b0" @@ -8195,6 +8441,15 @@ jest-watcher@^28.1.3: jest-util "^28.1.3" string-length "^4.0.1" +jest-worker@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" + integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^7.0.0" + jest-worker@^27.4.5: version "27.5.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.0.tgz#99ee77e4d06168107c27328bd7f54e74c3a48d59" @@ -9201,7 +9456,7 @@ micromark@~2.11.0: debug "^4.0.0" parse-entities "^2.0.0" -micromatch@^3.1.5: +micromatch@^3.1.4, micromatch@^3.1.5: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -9296,7 +9551,7 @@ minimist-options@4.1.0: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.5, minimist@^1.2.6: +minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== @@ -9445,6 +9700,11 @@ node-releases@^2.0.5: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.5.tgz#280ed5bc3eba0d96ce44897d8aee478bfb3d9666" integrity sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q== +node-releases@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" + integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== + nomnom@1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.5.2.tgz#f4345448a853cfbd5c0d26320f2477ab0526fe2f" @@ -10016,7 +10276,7 @@ pify@^5.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== -pirates@^4.0.4, pirates@^4.0.5: +pirates@^4.0.1, pirates@^4.0.4, pirates@^4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== @@ -10809,6 +11069,11 @@ robust-predicates@^3.0.0: resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.1.tgz#ecde075044f7f30118682bd9fb3f123109577f9a" integrity sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g== +rsvp@^4.8.4: + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -10862,6 +11127,21 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +sane@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== + dependencies: + "@cnakazawa/watch" "^1.0.3" + anymatch "^2.0.0" + capture-exit "^2.0.0" + exec-sh "^0.3.2" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" @@ -12005,6 +12285,13 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -12239,6 +12526,14 @@ update-browserslist-db@^1.0.4: escalade "^3.1.1" picocolors "^1.0.0" +update-browserslist-db@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz#2924d3927367a38d5c555413a7ce138fc95fcb18" + integrity sha512-/xsqn21EGVdXI3EXSum1Yckj3ZVZugqyOZQ/CxYPBD/R+ko9NSUScf8tFF4dOKY+2pvSSJA/S+5B8s4Zr4kyvg== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -12522,7 +12817,7 @@ wait-on@6.0.0: minimist "^1.2.5" rxjs "^7.1.0" -walker@^1.0.8: +walker@^1.0.7, walker@^1.0.8, walker@~1.0.5: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== @@ -12801,6 +13096,16 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +write-file-atomic@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" + integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== + dependencies: + imurmurhash "^0.1.4" + is-typedarray "^1.0.0" + signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" + write-file-atomic@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.1.tgz#9faa33a964c1c85ff6f849b80b42a88c2c537c8f" From 0605bce8877630da9f8ca8b47e3eba5739cb1dca Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 16 Sep 2022 18:12:52 +0530 Subject: [PATCH 114/115] Fix docs --- docs/Setup.md | 8 +++++--- docs/index.html | 2 +- src/docs/Setup.md | 8 +++++--- src/docs/index.html | 21 ++++++--------------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/docs/Setup.md b/docs/Setup.md index 8e428c14c..d667a81f4 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -224,7 +224,7 @@ Default value: true Decides which rendering engine that is to be used for the rendering. Legal values are: dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid -Default value: 'dagre-d3' +Default value: 'dagre-wrapper' ## sequence @@ -367,7 +367,8 @@ Default value: true **Notes:** -This will display arrows that start and begin at the same node as right angles, rather than a curve +This will display arrows that start and begin at the same node as right angles, rather than a +curve Default value: false @@ -719,7 +720,8 @@ Default value: true **Notes:** -This will display arrows that start and begin at the same node as right angles, rather than a curves +This will display arrows that start and begin at the same node as right angles, rather than a +curves Default value: false diff --git a/docs/index.html b/docs/index.html index 19abd782a..0a41b516c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,7 +24,7 @@ <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> <!-- <script src="http://localhost:9000/mermaid.js"></script> --> <script - defer + defer="" data-domain="mermaid-js.github.io" src="https://plausible.io/js/plausible.js" ></script> diff --git a/src/docs/Setup.md b/src/docs/Setup.md index 41e706825..caefd1b80 100644 --- a/src/docs/Setup.md +++ b/src/docs/Setup.md @@ -222,7 +222,7 @@ Default value: true Decides which rendering engine that is to be used for the rendering. Legal values are: dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid -Default value: 'dagre-d3' +Default value: 'dagre-wrapper' ## sequence @@ -365,7 +365,8 @@ Default value: true **Notes:** -This will display arrows that start and begin at the same node as right angles, rather than a curve +This will display arrows that start and begin at the same node as right angles, rather than a +curve Default value: false @@ -717,7 +718,8 @@ Default value: true **Notes:** -This will display arrows that start and begin at the same node as right angles, rather than a curves +This will display arrows that start and begin at the same node as right angles, rather than a +curves Default value: false diff --git a/src/docs/index.html b/src/docs/index.html index 39d454533..ea3969c77 100644 --- a/src/docs/index.html +++ b/src/docs/index.html @@ -21,22 +21,13 @@ rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" /> - <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.6/dist/mermaid.min.js"></script> + <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> <!-- <script src="http://localhost:9000/mermaid.js"></script> --> - <script> - // prettier-ignore - (function (i, s, o, g, r, a, m) { - i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { - (i[r].q = i[r].q || []).push(arguments) - }, i[r].l = 1 * new Date(); a = s.createElement(o), - m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) - })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); - - ga('create', 'UA-153180559-1', 'auto'); - if (location) { - ga('send', 'pageview', location.hash); - } - </script> + <script + defer + data-domain="mermaid-js.github.io" + src="https://plausible.io/js/plausible.js" + ></script> <script> var require = { paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs' }, From bb413d555e331db108f20ababe30e035d49ace41 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod <sidharthv96@gmail.com> Date: Fri, 16 Sep 2022 18:22:46 +0530 Subject: [PATCH 115/115] cleanup --- src/utils.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index f7182d44b..d6b317034 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -167,8 +167,6 @@ export const detectDirective = function (text, type = null) { }; /** - * > > > > > > > Develop - * * @function isSubstringInArray Detects whether a substring in present in a given array * @param {string} str The substring to detect * @param {Array} arr The array to search