diff --git a/esbuild.cjs b/esbuild.cjs new file mode 100644 index 0000000000..614032432c --- /dev/null +++ b/esbuild.cjs @@ -0,0 +1,31 @@ +let jisonPlugin = { + name: 'jison', + setup(build) { + const { Generator } = require('jison'); + let fs = require('fs'); + + build.onLoad({ filter: /\.jison$/ }, async args => { + // Load the file from the file system + let source = await fs.promises.readFile(args.path, 'utf8'); + + try { + let contents = new Generator(source, {}).generate(); + return { contents, warnings: [] }; + } catch (e) { + return { errors: [] }; + } + }); + } +}; + +const { build } = require('esbuild'); +build({ + bundle: true, + minify: false, + keepNames: true, + globalName: 'mermaid', + platform: 'browser', + entryPoints: ['src/mermaid.js'], + outfile: 'dist/mermaid.js', + plugins: [jisonPlugin] +}).catch(() => process.exit(1)); diff --git a/package.json b/package.json index 17c601a7d3..ac483bafe5 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "dev": "webpack serve --config webpack.config.e2e.js", "test": "yarn lint && jest src/.*", "test:watch": "jest --watch src", - "prepublishOnly": "yarn build && yarn test", - "prepare": "yarn build" + "prepublishOnly": "yarn build && yarn test" }, "repository": { "type": "git", @@ -71,6 +70,8 @@ "css-to-string-loader": "^0.1.3", "cypress": "8.1.0", "documentation": "13.2.0", + "esbuild": "^0.12.28", + "esbuild-loader": "^2.15.1", "eslint": "^7.30.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^3.4.0", @@ -80,6 +81,7 @@ "jison": "^0.4.18", "js-base64": "3.6.1", "moment": "^2.23.0", + "path-browserify": "^1.0.1", "prettier": "^2.3.2", "start-server-and-test": "^1.12.6", "terser-webpack-plugin": "^4.2.3", @@ -99,5 +101,9 @@ "hooks": { "pre-push": "yarn test" } + }, + "browser": { + "path": "path-browserify", + "fs": false } } diff --git a/src/diagrams/class/classDiagram-styles.spec.js b/src/diagrams/class/classDiagram-styles.spec.js index b34e618fa6..9adc01022f 100644 --- a/src/diagrams/class/classDiagram-styles.spec.js +++ b/src/diagrams/class/classDiagram-styles.spec.js @@ -1,5 +1,5 @@ /* eslint-env jasmine */ -import { parser } from './parser/classDiagram'; +import { parser } from './parser/classDiagram.jison'; import classDb from './classDb'; describe('class diagram, ', function() { @@ -17,7 +17,7 @@ describe('class diagram, ', function() { expect(parser.yy.getClass('Class01').cssClasses[0]).toBe('exClass'); }); - it('should be possible to apply a css class to a class directly with struct', function () { + it('should be possible to apply a css class to a class directly with struct', function() { const str = 'classDiagram\n' + 'class Class1:::exClass {\n' + @@ -49,7 +49,8 @@ describe('class diagram, ', function() { }); it('should be possible to apply a cssClass to a comma separated list of classes', function() { - const str = 'classDiagram\n' + 'class Class01\n class Class02\n cssClass "Class01,Class02" exClass'; + const str = + 'classDiagram\n' + 'class Class01\n class Class02\n cssClass "Class01,Class02" exClass'; parser.parse(str); diff --git a/src/diagrams/class/classDiagram.spec.js b/src/diagrams/class/classDiagram.spec.js index 230ee0a244..0100228443 100644 --- a/src/diagrams/class/classDiagram.spec.js +++ b/src/diagrams/class/classDiagram.spec.js @@ -1,5 +1,5 @@ /* eslint-env jasmine */ -import { parser } from './parser/classDiagram'; +import { parser } from './parser/classDiagram.jison'; import classDb from './classDb'; const spyOn = jest.spyOn; @@ -11,14 +11,12 @@ describe('class diagram, ', function () { }); it('should handle backquoted class names', function() { - const str = - 'classDiagram\n' + - 'class `Car`'; + const str = 'classDiagram\n' + 'class `Car`'; parser.parse(str); }); - it('should handle relation definitions', function () { + it('should handle relation definitions', function() { const str = 'classDiagram\n' + 'Class01 <|-- Class02\n' + @@ -30,7 +28,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle backquoted relation definitions', function () { + it('should handle backquoted relation definitions', function() { const str = 'classDiagram\n' + '`Class01` <|-- Class02\n' + @@ -42,7 +40,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle relation definition of different types and directions', function () { + it('should handle relation definition of different types and directions', function() { const str = 'classDiagram\n' + 'Class11 <|.. Class12\n' + @@ -54,7 +52,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle cardinality and labels', function () { + it('should handle cardinality and labels', function() { const str = 'classDiagram\n' + 'Class01 "1" *-- "many" Class02 : contains\n' + @@ -113,10 +111,10 @@ describe('class diagram, ', function () { ' flightNumber : Integer\n' + ' departureTime : Date\n' + '}'; - let testPased =false; - try{ + let testPased = false; + try { parser.parse(str); - }catch (error){ + } catch (error) { console.log(error.name); testPased = true; } @@ -132,10 +130,10 @@ describe('class diagram, ', function () { '}\n' + '\n' + 'class Dummy_Class {\n'; - let testPased =false; - try{ + let testPased = false; + try { parser.parse(str); - }catch (error){ + } catch (error) { console.log(error.name); testPased = true; } @@ -155,7 +153,7 @@ describe('class diagram, ', function () { ' departureTime : Date\n' + '}'; - parser.parse(str); + parser.parse(str); }); it('should handle generic class with brackets and a literal name', function() { @@ -171,7 +169,7 @@ describe('class diagram, ', function () { ' departureTime : Date\n' + '}'; - parser.parse(str); + parser.parse(str); }); it('should handle class definitions', function() { @@ -185,7 +183,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle method statements', function () { + it('should handle method statements', function() { const str = 'classDiagram\n' + 'Object <|-- ArrayList\n' + @@ -196,7 +194,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle parsing of method statements grouped by brackets', function () { + it('should handle parsing of method statements grouped by brackets', function() { const str = 'classDiagram\n' + 'class Dummy_Class {\n' + @@ -212,7 +210,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle return types on methods', function () { + it('should handle return types on methods', function() { const str = 'classDiagram\n' + 'Object <|-- ArrayList\n' + @@ -225,7 +223,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle return types on methods grouped by brackets', function () { + it('should handle return types on methods grouped by brackets', function() { const str = 'classDiagram\n' + 'class Dummy_Class {\n' + @@ -242,7 +240,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle parsing of separators', function () { + it('should handle parsing of separators', function() { const str = 'classDiagram\n' + 'class Foo1 {\n' + @@ -275,7 +273,7 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle a comment', function () { + it('should handle a comment', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -289,9 +287,8 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle comments at the start', function () { - const str = - `%% Comment + it('should handle comments at the start', function() { + const str = `%% Comment classDiagram class Class1 { int : test @@ -302,9 +299,8 @@ describe('class diagram, ', function () { parser.parse(str); }); - it('should handle comments at the end', function () { - const str = - `classDiagram + it('should handle comments at the end', function() { + const str = `classDiagram class Class1 { int : test string : foo @@ -318,9 +314,8 @@ foo() parser.parse(str); }); - it('should handle comments at the end no trailing newline', function () { - const str = - `classDiagram + it('should handle comments at the end no trailing newline', function() { + const str = `classDiagram class Class1 { int : test string : foo @@ -332,9 +327,8 @@ foo() parser.parse(str); }); - it('should handle a comment with multiple line feeds', function () { - const str = - `classDiagram + it('should handle a comment with multiple line feeds', function() { + const str = `classDiagram %% Comment @@ -349,9 +343,8 @@ foo() parser.parse(str); }); - it('should handle a comment with mermaid class diagram code in them', function () { - const str = - `classDiagram + it('should handle a comment with mermaid class diagram code in them', function() { + const str = `classDiagram %% Comment Class01 <|-- Class02 class Class1 { int : test @@ -363,7 +356,7 @@ foo() parser.parse(str); }); - it('should handle a comment inside brackets', function () { + it('should handle a comment inside brackets', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -377,7 +370,7 @@ foo() parser.parse(str); }); - it('should handle click statement with link', function () { + it('should handle click statement with link', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -392,22 +385,22 @@ foo() parser.parse(str); }); - it('should handle click statement with click and href link', function () { - const str = - 'classDiagram\n' + - 'class Class1 {\n' + - '%% Comment Class01 <|-- Class02\n' + - 'int : test\n' + - 'string : foo\n' + - 'test()\n' + - 'foo()\n' + - '}\n' + - 'click Class01 href "google.com" '; + it('should handle click statement with click and href link', function() { + const str = + 'classDiagram\n' + + 'class Class1 {\n' + + '%% Comment Class01 <|-- Class02\n' + + 'int : test\n' + + 'string : foo\n' + + 'test()\n' + + 'foo()\n' + + '}\n' + + 'click Class01 href "google.com" '; - parser.parse(str); - }); + parser.parse(str); + }); - it('should handle click statement with link and tooltip', function () { + it('should handle click statement with link and tooltip', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -422,23 +415,22 @@ foo() parser.parse(str); }); + it('should handle click statement with click and href link and tooltip', function() { + const str = + 'classDiagram\n' + + 'class Class1 {\n' + + '%% Comment Class01 <|-- Class02\n' + + 'int : test\n' + + 'string : foo\n' + + 'test()\n' + + 'foo()\n' + + '}\n' + + 'click Class01 href "google.com" "A Tooltip" '; - it('should handle click statement with click and href link and tooltip', function () { - const str = - 'classDiagram\n' + - 'class Class1 {\n' + - '%% Comment Class01 <|-- Class02\n' + - 'int : test\n' + - 'string : foo\n' + - 'test()\n' + - 'foo()\n' + - '}\n' + - 'click Class01 href "google.com" "A Tooltip" '; - - parser.parse(str); - }); + parser.parse(str); + }); - it('should handle click statement with callback', function () { + it('should handle click statement with callback', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -453,22 +445,22 @@ foo() parser.parse(str); }); - it('should handle click statement with click and call callback', function () { - const str = - 'classDiagram\n' + - 'class Class1 {\n' + - '%% Comment Class01 <|-- Class02\n' + - 'int : test\n' + - 'string : foo\n' + - 'test()\n' + - 'foo()\n' + - '}\n' + - 'click Class01 call functionCall() '; + it('should handle click statement with click and call callback', function() { + const str = + 'classDiagram\n' + + 'class Class1 {\n' + + '%% Comment Class01 <|-- Class02\n' + + 'int : test\n' + + 'string : foo\n' + + 'test()\n' + + 'foo()\n' + + '}\n' + + 'click Class01 call functionCall() '; - parser.parse(str); - }); + parser.parse(str); + }); - it('should handle click statement with callback and tooltip', function () { + it('should handle click statement with callback and tooltip', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -483,22 +475,22 @@ foo() parser.parse(str); }); - it('should handle click statement with click and call callback and tooltip', function () { - const str = - 'classDiagram\n' + - 'class Class1 {\n' + - '%% Comment Class01 <|-- Class02\n' + - 'int : test\n' + - 'string : foo\n' + - 'test()\n' + - 'foo()\n' + - '}\n' + - 'click Class01 call functionCall() "A Tooltip" '; + it('should handle click statement with click and call callback and tooltip', function() { + const str = + 'classDiagram\n' + + 'class Class1 {\n' + + '%% Comment Class01 <|-- Class02\n' + + 'int : test\n' + + 'string : foo\n' + + 'test()\n' + + 'foo()\n' + + '}\n' + + 'click Class01 call functionCall() "A Tooltip" '; - parser.parse(str); - }); + parser.parse(str); + }); - it('should handle dashed relation definition of different types and directions', function () { + it('should handle dashed relation definition of different types and directions', function() { const str = 'classDiagram\n' + 'Class11 <|.. Class12\n' + @@ -509,7 +501,7 @@ foo() parser.parse(str); }); - it('should handle generic types in members', function () { + it('should handle generic types in members', function() { const str = 'classDiagram\n' + 'class Car~T~\n' + @@ -520,25 +512,25 @@ foo() parser.parse(str); }); - it('should handle generic types in members in class with brackets', function () { + it('should handle generic types in members in class with brackets', function() { const str = - 'classDiagram\n' + - 'class Car {\n' + - 'List~Wheel~ wheels\n' + + 'classDiagram\n' + + 'class Car {\n' + + 'List~Wheel~ wheels\n' + 'setWheels(List~Wheel~ wheels)\n' + '+getWheels() List~Wheel~\n' + - '}'; + '}'; parser.parse(str); }); }); - describe('when fetching data from a classDiagram graph it', function () { - beforeEach(function () { + describe('when fetching data from a classDiagram graph it', function() { + beforeEach(function() { parser.yy = classDb; parser.yy.clear(); }); - it('should handle relation definitions EXTENSION', function () { + it('should handle relation definitions EXTENSION', function() { const str = 'classDiagram\n' + 'Class01 <|-- Class02'; parser.parse(str); @@ -552,7 +544,7 @@ foo() expect(relations[0].relation.lineType).toBe(classDb.lineType.LINE); }); - it('should handle relation definitions AGGREGATION and dotted line', function () { + it('should handle relation definitions AGGREGATION and dotted line', function() { const str = 'classDiagram\n' + 'Class01 o.. Class02'; parser.parse(str); @@ -566,7 +558,7 @@ foo() expect(relations[0].relation.lineType).toBe(classDb.lineType.DOTTED_LINE); }); - it('should handle relation definitions COMPOSITION on both sides', function () { + it('should handle relation definitions COMPOSITION on both sides', function() { const str = 'classDiagram\n' + 'Class01 *--* Class02'; parser.parse(str); @@ -580,7 +572,7 @@ foo() expect(relations[0].relation.lineType).toBe(classDb.lineType.LINE); }); - it('should handle relation definitions no types', function () { + it('should handle relation definitions no types', function() { const str = 'classDiagram\n' + 'Class01 -- Class02'; parser.parse(str); @@ -594,7 +586,7 @@ foo() expect(relations[0].relation.lineType).toBe(classDb.lineType.LINE); }); - it('should handle relation definitions with type only on right side', function () { + it('should handle relation definitions with type only on right side', function() { const str = 'classDiagram\n' + 'Class01 --|> Class02'; parser.parse(str); @@ -608,7 +600,7 @@ foo() expect(relations[0].relation.lineType).toBe(classDb.lineType.LINE); }); - it('should handle multiple classes and relation definitions', function () { + it('should handle multiple classes and relation definitions', function() { const str = 'classDiagram\n' + 'Class01 <|-- Class02\n' + @@ -634,7 +626,7 @@ foo() expect(relations[3].relation.lineType).toBe(classDb.lineType.DOTTED_LINE); }); - it('should handle generic class with relation definitions', function () { + it('should handle generic class with relation definitions', function() { const str = 'classDiagram\n' + 'Class01~T~ <|-- Class02'; parser.parse(str); @@ -649,7 +641,7 @@ foo() expect(relations[0].relation.lineType).toBe(classDb.lineType.LINE); }); - it('should handle class annotations', function () { + it('should handle class annotations', function() { const str = 'classDiagram\n' + 'class Class1\n' + '<> Class1'; parser.parse(str); @@ -660,7 +652,7 @@ foo() expect(testClass.annotations[0]).toBe('interface'); }); - it('should handle class annotations with members and methods', function () { + it('should handle class annotations with members and methods', function() { const str = 'classDiagram\n' + 'class Class1\n' + @@ -676,7 +668,7 @@ foo() expect(testClass.annotations[0]).toBe('interface'); }); - it('should handle class annotations in brackets', function () { + it('should handle class annotations in brackets', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + '<>\n' + '}'; parser.parse(str); @@ -687,7 +679,7 @@ foo() expect(testClass.annotations[0]).toBe('interface'); }); - it('should handle class annotations in brackets with members and methods', function () { + it('should handle class annotations in brackets with members and methods', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -704,7 +696,7 @@ foo() expect(testClass.annotations[0]).toBe('interface'); }); - it('should add bracket members in right order', function () { + it('should add bracket members in right order', function() { const str = 'classDiagram\n' + 'class Class1 {\n' + @@ -724,7 +716,7 @@ foo() expect(testClass.methods[1]).toBe('foo()'); }); - it('should handle abstract methods', function () { + it('should handle abstract methods', function() { const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()*'; parser.parse(str); @@ -735,7 +727,7 @@ foo() expect(testClass.methods[0]).toBe('someMethod()*'); }); - it('should handle static methods', function () { + it('should handle static methods', function() { const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()$'; parser.parse(str); @@ -746,113 +738,164 @@ foo() expect(testClass.methods[0]).toBe('someMethod()$'); }); - it('should associate link and css appropriately', function () { - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'link Class1 "google.com"'; - parser.parse(str); + it('should associate link and css appropriately', function() { + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'link Class1 "google.com"'; + parser.parse(str); - const testClass = parser.yy.getClass('Class1'); - expect(testClass.link).toBe('about:blank');//('google.com'); security needs to be set to 'loose' for this to work right - expect(testClass.cssClasses.length).toBe(1); - expect(testClass.cssClasses[0]).toBe('clickable'); - }); + const testClass = parser.yy.getClass('Class1'); + expect(testClass.link).toBe('about:blank'); //('google.com'); security needs to be set to 'loose' for this to work right + expect(testClass.cssClasses.length).toBe(1); + expect(testClass.cssClasses[0]).toBe('clickable'); + }); - it('should associate click and href link and css appropriately', function () { - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 href "google.com"'; + it('should associate click and href link and css appropriately', function() { + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 href "google.com"'; parser.parse(str); const testClass = parser.yy.getClass('Class1'); - expect(testClass.link).toBe('about:blank');//('google.com'); security needs to be set to 'loose' for this to work right + expect(testClass.link).toBe('about:blank'); //('google.com'); security needs to be set to 'loose' for this to work right expect(testClass.cssClasses.length).toBe(1); expect(testClass.cssClasses[0]).toBe('clickable'); }); - it('should associate link with tooltip', function () { - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'link Class1 "google.com" "A tooltip"'; + it('should associate link with tooltip', function() { + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'link Class1 "google.com" "A tooltip"'; parser.parse(str); const testClass = parser.yy.getClass('Class1'); - expect(testClass.link).toBe('about:blank');//('google.com'); security needs to be set to 'loose' for this to work right + expect(testClass.link).toBe('about:blank'); //('google.com'); security needs to be set to 'loose' for this to work right expect(testClass.tooltip).toBe('A tooltip'); expect(testClass.cssClasses.length).toBe(1); expect(testClass.cssClasses[0]).toBe('clickable'); }); - it('should associate click and href link with tooltip', function () { - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 href "google.com" "A tooltip"'; - parser.parse(str); + it('should associate click and href link with tooltip', function() { + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 href "google.com" "A tooltip"'; + parser.parse(str); - const testClass = parser.yy.getClass('Class1'); - expect(testClass.link).toBe('about:blank');//('google.com'); security needs to be set to 'loose' for this to work right - expect(testClass.tooltip).toBe('A tooltip'); - expect(testClass.cssClasses.length).toBe(1); - expect(testClass.cssClasses[0]).toBe('clickable'); - }); + const testClass = parser.yy.getClass('Class1'); + expect(testClass.link).toBe('about:blank'); //('google.com'); security needs to be set to 'loose' for this to work right + expect(testClass.tooltip).toBe('A tooltip'); + expect(testClass.cssClasses.length).toBe(1); + expect(testClass.cssClasses[0]).toBe('clickable'); + }); - it('should associate click and href link with tooltip and target appropriately', function () { + it('should associate click and href link with tooltip and target appropriately', function() { spyOn(classDb, 'setLink'); spyOn(classDb, 'setTooltip'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 href "google.com" "A tooltip" _self'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 href "google.com" "A tooltip" _self'; parser.parse(str); expect(classDb.setLink).toHaveBeenCalledWith('Class1', 'google.com', '_self'); expect(classDb.setTooltip).toHaveBeenCalledWith('Class1', 'A tooltip'); }); - it('should associate click and href link appropriately', function () { + it('should associate click and href link appropriately', function() { spyOn(classDb, 'setLink'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 href "google.com"'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 href "google.com"'; parser.parse(str); expect(classDb.setLink).toHaveBeenCalledWith('Class1', 'google.com'); }); - it('should associate click and href link with target appropriately', function () { + it('should associate click and href link with target appropriately', function() { spyOn(classDb, 'setLink'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 href "google.com" _self'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 href "google.com" _self'; parser.parse(str); expect(classDb.setLink).toHaveBeenCalledWith('Class1', 'google.com', '_self'); }); - it('should associate link appropriately', function () { + it('should associate link appropriately', function() { spyOn(classDb, 'setLink'); spyOn(classDb, 'setTooltip'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'link Class1 "google.com" "A tooltip" _self'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'link Class1 "google.com" "A tooltip" _self'; parser.parse(str); expect(classDb.setLink).toHaveBeenCalledWith('Class1', 'google.com', '_self'); expect(classDb.setTooltip).toHaveBeenCalledWith('Class1', 'A tooltip'); }); - it('should associate callback appropriately', function () { + it('should associate callback appropriately', function() { spyOn(classDb, 'setClickEvent'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'callback Class1 "functionCall"'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'callback Class1 "functionCall"'; parser.parse(str); expect(classDb.setClickEvent).toHaveBeenCalledWith('Class1', 'functionCall'); }); - - it('should associate click and call callback appropriately', function () { + it('should associate click and call callback appropriately', function() { spyOn(classDb, 'setClickEvent'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 call functionCall()'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 call functionCall()'; parser.parse(str); expect(classDb.setClickEvent).toHaveBeenCalledWith('Class1', 'functionCall'); }); - it('should associate callback appropriately with an arbitrary number of args', function () { + it('should associate callback appropriately with an arbitrary number of args', function() { spyOn(classDb, 'setClickEvent'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 call functionCall("test0", test1, test2)'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 call functionCall("test0", test1, test2)'; parser.parse(str); - expect(classDb.setClickEvent).toHaveBeenCalledWith('Class1', 'functionCall','"test0", test1, test2'); + expect(classDb.setClickEvent).toHaveBeenCalledWith( + 'Class1', + 'functionCall', + '"test0", test1, test2' + ); }); - it('should associate callback with tooltip', function () { + it('should associate callback with tooltip', function() { spyOn(classDb, 'setClickEvent'); spyOn(classDb, 'setTooltip'); - const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()\n' + 'click Class1 call functionCall() "A tooltip"'; + const str = + 'classDiagram\n' + + 'class Class1\n' + + 'Class1 : someMethod()\n' + + 'click Class1 call functionCall() "A tooltip"'; parser.parse(str); expect(classDb.setClickEvent).toHaveBeenCalledWith('Class1', 'functionCall'); diff --git a/src/diagrams/class/classRenderer-v2.js b/src/diagrams/class/classRenderer-v2.js index 610981cc2d..95da2ee765 100644 --- a/src/diagrams/class/classRenderer-v2.js +++ b/src/diagrams/class/classRenderer-v2.js @@ -3,7 +3,7 @@ import dagre from 'dagre'; import graphlib from 'graphlib'; import { log } from '../../logger'; import classDb, { lookUpDomId } from './classDb'; -import { parser } from './parser/classDiagram'; +import { parser } from './parser/classDiagram.jison'; import svgDraw from './svgDraw'; import { getConfig } from '../../config'; import { render } from '../../dagre-wrapper/index.js'; diff --git a/src/diagrams/class/classRenderer.js b/src/diagrams/class/classRenderer.js index d250fe9cbf..712458ecc8 100644 --- a/src/diagrams/class/classRenderer.js +++ b/src/diagrams/class/classRenderer.js @@ -3,7 +3,7 @@ import dagre from 'dagre'; import graphlib from 'graphlib'; import { log } from '../../logger'; import classDb, { lookUpDomId } from './classDb'; -import { parser } from './parser/classDiagram'; +import { parser } from './parser/classDiagram.jison'; import svgDraw from './svgDraw'; import { configureSvgSize } from '../../utils'; diff --git a/src/diagrams/er/erRenderer.js b/src/diagrams/er/erRenderer.js index 27b1258283..db4293365e 100644 --- a/src/diagrams/er/erRenderer.js +++ b/src/diagrams/er/erRenderer.js @@ -1,7 +1,7 @@ import graphlib from 'graphlib'; import { line, curveBasis, select } from 'd3'; import erDb from './erDb'; -import erParser from './parser/erDiagram'; +import erParser from './parser/erDiagram.jison'; import dagre from 'dagre'; import { getConfig } from '../../config'; import { log } from '../../logger'; diff --git a/src/diagrams/flowchart/flowRenderer-v2.js b/src/diagrams/flowchart/flowRenderer-v2.js index fdfd70bd11..62f43c2836 100644 --- a/src/diagrams/flowchart/flowRenderer-v2.js +++ b/src/diagrams/flowchart/flowRenderer-v2.js @@ -2,7 +2,7 @@ import graphlib from 'graphlib'; import { select, curveLinear, selectAll } from 'd3'; import flowDb from './flowDb'; -import flow from './parser/flow'; +import flow from './parser/flow.jison'; import { getConfig } from '../../config'; import { render } from '../../dagre-wrapper/index.js'; diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index 9c405fe42a..e4298cb010 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -2,7 +2,7 @@ import graphlib from 'graphlib'; import { select, curveLinear, selectAll } from 'd3'; import flowDb from './flowDb'; -import flow from './parser/flow'; +import flow from './parser/flow.jison'; import { getConfig } from '../../config'; import dagreD3 from 'dagre-d3'; diff --git a/src/diagrams/gantt/ganttRenderer.js b/src/diagrams/gantt/ganttRenderer.js index 8be331a56e..0211236910 100644 --- a/src/diagrams/gantt/ganttRenderer.js +++ b/src/diagrams/gantt/ganttRenderer.js @@ -7,23 +7,23 @@ import { interpolateHcl, axisBottom, axisTop, - timeFormat, + timeFormat } from 'd3'; -import { parser } from './parser/gantt'; +import { parser } from './parser/gantt.jison'; import common from '../common/common'; import ganttDb from './ganttDb'; import { getConfig } from '../../config'; import { configureSvgSize } from '../../utils'; parser.yy = ganttDb; -export const setConf = function () { +export const setConf = function() { // const keys = Object.keys(cnf); // keys.forEach(function(key) { // conf[key] = cnf[key]; // }); }; let w; -export const draw = function (text, id) { +export const draw = function(text, id) { const conf = getConfig().gantt; parser.yy.clear(); parser.parse(text); @@ -51,12 +51,12 @@ export const draw = function (text, id) { // Set timescale const timeScale = scaleTime() .domain([ - min(taskArray, function (d) { + min(taskArray, function(d) { return d.startTime; }), - max(taskArray, function (d) { + max(taskArray, function(d) { return d.endTime; - }), + }) ]) .rangeRound([0, w - conf.leftPadding - conf.rightPadding]); @@ -123,16 +123,16 @@ export const draw = function (text, id) { .enter() .append('rect') .attr('x', 0) - .attr('y', function (d, i) { + .attr('y', function(d, i) { // Ignore the incoming i value and use our order instead i = d.order; return i * theGap + theTopPad - 2; }) - .attr('width', function () { + .attr('width', function() { return w - conf.rightPadding / 2; }) .attr('height', theGap) - .attr('class', function (d) { + .attr('class', function(d) { for (let i = 0; i < categories.length; i++) { if (d.type === categories[i]) { return 'section section' + (i % conf.numberSectionStyles); @@ -142,16 +142,20 @@ export const draw = function (text, id) { }); // Draw the rects representing the tasks - const rectangles = svg.append('g').selectAll('rect').data(theArray).enter(); + const rectangles = svg + .append('g') + .selectAll('rect') + .data(theArray) + .enter(); rectangles .append('rect') - .attr('id', function (d) { + .attr('id', function(d) { return d.id; }) .attr('rx', 3) .attr('ry', 3) - .attr('x', function (d) { + .attr('x', function(d) { if (d.milestone) { return ( timeScale(d.startTime) + @@ -162,19 +166,19 @@ export const draw = function (text, id) { } return timeScale(d.startTime) + theSidePad; }) - .attr('y', function (d, i) { + .attr('y', function(d, i) { // Ignore the incoming i value and use our order instead i = d.order; return i * theGap + theTopPad; }) - .attr('width', function (d) { + .attr('width', function(d) { if (d.milestone) { return theBarHeight; } return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime); }) .attr('height', theBarHeight) - .attr('transform-origin', function (d, i) { + .attr('transform-origin', function(d, i) { // Ignore the incoming i value and use our order instead i = d.order; @@ -189,7 +193,7 @@ export const draw = function (text, id) { 'px' ); }) - .attr('class', function (d) { + .attr('class', function(d) { const res = 'task'; let classStr = ''; @@ -241,14 +245,14 @@ export const draw = function (text, id) { // Append task labels rectangles .append('text') - .attr('id', function (d) { + .attr('id', function(d) { return d.id + '-text'; }) - .text(function (d) { + .text(function(d) { return d.task; }) .attr('font-size', conf.fontSize) - .attr('x', function (d) { + .attr('x', function(d) { let startX = timeScale(d.startTime); let endX = timeScale(d.renderEndTime || d.endTime); if (d.milestone) { @@ -270,13 +274,13 @@ export const draw = function (text, id) { return (endX - startX) / 2 + startX + theSidePad; } }) - .attr('y', function (d, i) { + .attr('y', function(d, i) { // Ignore the incoming i value and use our order instead i = d.order; return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad; }) .attr('text-height', theBarHeight) - .attr('class', function (d) { + .attr('class', function(d) { const startX = timeScale(d.startTime); let endX = timeScale(d.endTime); if (d.milestone) { @@ -391,7 +395,7 @@ export const draw = function (text, id) { .selectAll('text') .data(numOccurances) .enter() - .append(function (d) { + .append(function(d) { const rows = d[0].split(common.lineBreakRegex); const dy = -(rows.length - 1) / 2; @@ -409,7 +413,7 @@ export const draw = function (text, id) { return svgLabel; }) .attr('x', 10) - .attr('y', function (d, i) { + .attr('y', function(d, i) { if (i > 0) { for (let j = 0; j < i; j++) { prevGap += numOccurances[i - 1][1]; @@ -421,7 +425,7 @@ export const draw = function (text, id) { }) .attr('font-size', conf.sectionFontSize) .attr('font-size', conf.sectionFontSize) - .attr('class', function (d) { + .attr('class', function(d) { for (let i = 0; i < categories.length; i++) { if (d[0] === categories[i]) { return 'sectionTitle sectionTitle' + (i % conf.numberSectionStyles); @@ -458,7 +462,8 @@ export const draw = function (text, id) { const hash = {}; const result = []; for (let i = 0, l = arr.length; i < l; ++i) { - if (!hash.hasOwnProperty(arr[i])) { // eslint-disable-line + if (!hash.hasOwnProperty(arr[i])) { + // eslint-disable-line // it works with objects! in FF, at least hash[arr[i]] = true; result.push(arr[i]); @@ -485,5 +490,5 @@ export const draw = function (text, id) { export default { setConf, - draw, + draw }; diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js index 78b60d2af7..18e345c98e 100644 --- a/src/diagrams/git/gitGraphRenderer.js +++ b/src/diagrams/git/gitGraphRenderer.js @@ -1,7 +1,7 @@ import { curveBasis, line, select } from 'd3'; import db from './gitGraphAst'; -import gitGraphParser from './parser/gitGraph'; +import gitGraphParser from './parser/gitGraph.jison'; import { log } from '../../logger'; import { interpolateToCurve } from '../../utils'; diff --git a/src/diagrams/info/info.spec.js b/src/diagrams/info/info.spec.js index 502e4bdf84..a63d8ed765 100644 --- a/src/diagrams/info/info.spec.js +++ b/src/diagrams/info/info.spec.js @@ -2,7 +2,7 @@ describe('when parsing an info graph it', function() { var ex; beforeEach(function() { - ex = require('./parser/info').parser; + ex = require('./parser/info.jison').parser; ex.yy = require('./infoDb'); }); diff --git a/src/diagrams/info/infoRenderer.js b/src/diagrams/info/infoRenderer.js index d8fd38ba48..c3c26d510a 100644 --- a/src/diagrams/info/infoRenderer.js +++ b/src/diagrams/info/infoRenderer.js @@ -3,7 +3,7 @@ */ import { select } from 'd3'; import db from './infoDb'; -import infoParser from './parser/info'; +import infoParser from './parser/info.jison'; import { log } from '../../logger'; const conf = {}; diff --git a/src/diagrams/pie/pieRenderer.js b/src/diagrams/pie/pieRenderer.js index 4532cce50e..becf797d86 100644 --- a/src/diagrams/pie/pieRenderer.js +++ b/src/diagrams/pie/pieRenderer.js @@ -3,7 +3,7 @@ */ import { select, scaleOrdinal, pie as d3pie, arc } from 'd3'; import pieData from './pieDb'; -import pieParser from './parser/pie'; +import pieParser from './parser/pie.jison'; import { log } from '../../logger'; import { configureSvgSize } from '../../utils'; import * as configApi from '../../config'; diff --git a/src/diagrams/requirement/requirementRenderer.js b/src/diagrams/requirement/requirementRenderer.js index 5ba75d464e..8d14fc4ce6 100644 --- a/src/diagrams/requirement/requirementRenderer.js +++ b/src/diagrams/requirement/requirementRenderer.js @@ -5,7 +5,7 @@ import graphlib from 'graphlib'; import { log } from '../../logger'; import { configureSvgSize } from '../../utils'; import common from '../common/common'; -import { parser } from './parser/requirementDiagram'; +import { parser } from './parser/requirementDiagram.jison'; import requirementDb from './requirementDb'; import markers from './requirementMarkers'; diff --git a/src/diagrams/sequence/sequenceDiagram.spec.js b/src/diagrams/sequence/sequenceDiagram.spec.js index 0ff81b3d29..b278f2c1e2 100644 --- a/src/diagrams/sequence/sequenceDiagram.spec.js +++ b/src/diagrams/sequence/sequenceDiagram.spec.js @@ -1,5 +1,5 @@ /* eslint-env jasmine */ -import { parser } from './parser/sequenceDiagram'; +import { parser } from './parser/sequenceDiagram.jison'; import sequenceDb from './sequenceDb'; import * as configApi from '../../config'; import renderer from './sequenceRenderer'; @@ -102,7 +102,7 @@ Bob-->Alice-in-Wonderland:I am good thanks!`; mermaidAPI.parse(str); const actors = parser.yy.getActors(); - expect(actors["Alice-in-Wonderland"].description).toBe('Alice-in-Wonderland'); + expect(actors['Alice-in-Wonderland'].description).toBe('Alice-in-Wonderland'); actors.Bob.description = 'Bob'; const messages = parser.yy.getMessages(); @@ -521,7 +521,7 @@ note right of 1: multiline
text expect(messages[6].message).toBe('multiline
text'); expect(messages[7].message).toBe('multiline
text'); }); - it('it should handle notes and messages without wrap specified', function () { + it('it should handle notes and messages without wrap specified', function() { const str = ` sequenceDiagram participant 1 @@ -559,8 +559,8 @@ note right of 1:nowrap: multiline
text expect(messages[5].wrap).toBe(false); expect(messages[6].wrap).toBe(false); expect(messages[7].wrap).toBe(false); - }) - it('it should handle notes and messages with wrap specified', function () { + }); + it('it should handle notes and messages with wrap specified', function() { const str = ` sequenceDiagram participant 1 @@ -584,8 +584,8 @@ note right of 3:wrap: multiline
text expect(messages[1].wrap).toBe(true); expect(messages[2].wrap).toBe(true); expect(messages[3].wrap).toBe(true); - }) - it('it should handle notes and messages with nowrap or line breaks', function () { + }); + it('it should handle notes and messages with nowrap or line breaks', function() { const str = ` sequenceDiagram participant 1 @@ -601,7 +601,7 @@ note right of 2: single-line text expect(messages[1].message).toBe('single-line text'); expect(messages[0].wrap).toBe(false); expect(messages[1].wrap).toBe(false); - }) + }); it('it should handle notes over a single actor', function() { const str = ` sequenceDiagram @@ -1025,7 +1025,6 @@ describe('when checking the bounds in a sequenceDiagram', function() { conf = parser.yy.getConfig(); }); it('it should handle a simple bound call', function() { - renderer.bounds.insert(100, 100, 200, 200); const { bounds } = renderer.bounds.getBounds(); @@ -1035,7 +1034,6 @@ describe('when checking the bounds in a sequenceDiagram', function() { expect(bounds.stopy).toBe(200); }); it('it should handle an expanding bound', function() { - renderer.bounds.insert(100, 100, 200, 200); renderer.bounds.insert(25, 50, 300, 400); @@ -1046,7 +1044,6 @@ describe('when checking the bounds in a sequenceDiagram', function() { expect(bounds.stopy).toBe(400); }); it('it should handle inserts within the bound without changing the outer bounds', function() { - renderer.bounds.insert(100, 100, 200, 200); renderer.bounds.insert(25, 50, 300, 400); renderer.bounds.insert(125, 150, 150, 200); @@ -1058,7 +1055,6 @@ describe('when checking the bounds in a sequenceDiagram', function() { expect(bounds.stopy).toBe(400); }); it('it should handle a loop without expanding the area', function() { - renderer.bounds.insert(25, 50, 300, 400); renderer.bounds.verticalPos = 150; renderer.bounds.newLoop(); @@ -1080,7 +1076,6 @@ describe('when checking the bounds in a sequenceDiagram', function() { expect(bounds.stopy).toBe(400); }); it('it should handle multiple loops withtout expanding the bounds', function() { - renderer.bounds.insert(100, 100, 1000, 1000); renderer.bounds.verticalPos = 200; renderer.bounds.newLoop(); @@ -1112,7 +1107,6 @@ describe('when checking the bounds in a sequenceDiagram', function() { expect(bounds.stopy).toBe(1000); }); it('it should handle a loop that expands the area', function() { - renderer.bounds.insert(100, 100, 200, 200); renderer.bounds.verticalPos = 200; renderer.bounds.newLoop(); @@ -1182,7 +1176,7 @@ it should handle one actor, when textPlacement is ${textPlacement}`, function() sequenceDiagram participant Alice`; - mermaidAPI.reinitialize({sequence: { textPlacement: textPlacement}}); + mermaidAPI.reinitialize({ sequence: { textPlacement: textPlacement } }); mermaidAPI.parse(str); // renderer.setConf(mermaidAPI.getConfig().sequence); renderer.draw(str, 'tst'); @@ -1309,7 +1303,6 @@ Alice->Bob: Hello Bob, how are you?`; expect(bounds.stopx).toBe(conf.width * 2 + conf.actorMargin); expect(bounds.stopy).toBe(models.lastMessage().stopy + 10); expect(msgs.every(v => v.wrap)).toBe(true); - }); it('it should handle two actors and two centered shared notes', function() { const str = ` @@ -1504,7 +1497,6 @@ end`; }); }); - describe('when rendering a sequenceDiagram with actor mirror activated', function() { beforeAll(() => { let conf = { diff --git a/src/diagrams/sequence/sequenceRenderer.js b/src/diagrams/sequence/sequenceRenderer.js index c41e699b50..68c93acc85 100644 --- a/src/diagrams/sequence/sequenceRenderer.js +++ b/src/diagrams/sequence/sequenceRenderer.js @@ -1,7 +1,7 @@ import { select, selectAll } from 'd3'; import svgDraw, { drawText, fixLifeLineHeights } from './svgDraw'; import { log } from '../../logger'; -import { parser } from './parser/sequenceDiagram'; +import { parser } from './parser/sequenceDiagram.jison'; import common from '../common/common'; import sequenceDb from './sequenceDb'; import * as configApi from '../../config'; diff --git a/src/diagrams/state/stateDiagram.spec.js b/src/diagrams/state/stateDiagram.spec.js index 9a691c5367..407760fe6d 100644 --- a/src/diagrams/state/stateDiagram.spec.js +++ b/src/diagrams/state/stateDiagram.spec.js @@ -1,5 +1,5 @@ /* eslint-env jasmine */ -import { parser } from './parser/stateDiagram'; +import { parser } from './parser/stateDiagram.jison'; import stateDb from './stateDb'; describe('state diagram, ', function() { @@ -349,7 +349,6 @@ describe('state diagram, ', function() { }); }); describe('when parsing an ignored info graph it', function() { - xit('should handle if statements', function() { const str = `stateDiagram\n [*] --> "Order Submitted" diff --git a/src/diagrams/state/stateRenderer-v2.js b/src/diagrams/state/stateRenderer-v2.js index 70822b1753..3d057377f8 100644 --- a/src/diagrams/state/stateRenderer-v2.js +++ b/src/diagrams/state/stateRenderer-v2.js @@ -1,7 +1,7 @@ import graphlib from 'graphlib'; import { select } from 'd3'; import stateDb from './stateDb'; -import state from './parser/stateDiagram'; +import state from './parser/stateDiagram.jison'; import { getConfig } from '../../config'; // import { evaluate } from '../common/common'; import { render } from '../../dagre-wrapper/index.js'; diff --git a/src/diagrams/state/stateRenderer.js b/src/diagrams/state/stateRenderer.js index bd48c96d00..3814dbcbf8 100644 --- a/src/diagrams/state/stateRenderer.js +++ b/src/diagrams/state/stateRenderer.js @@ -4,7 +4,7 @@ import graphlib from 'graphlib'; import { log } from '../../logger'; import stateDb from './stateDb'; import common from '../common/common'; -import { parser } from './parser/stateDiagram'; +import { parser } from './parser/stateDiagram.jison'; // import idCache from './id-cache'; import { drawState, addTitleAndBox, drawEdge } from './shapes'; import { getConfig } from '../../config'; diff --git a/src/diagrams/user-journey/journeyRenderer.js b/src/diagrams/user-journey/journeyRenderer.js index a67f43a79c..8b1b81710e 100644 --- a/src/diagrams/user-journey/journeyRenderer.js +++ b/src/diagrams/user-journey/journeyRenderer.js @@ -1,5 +1,5 @@ import { select } from 'd3'; -import { parser } from './parser/journey'; +import { parser } from './parser/journey.jison'; import journeyDb from './journeyDb'; import svgDraw from './svgDraw'; import { getConfig } from '../../config'; diff --git a/src/mermaid.spec.js b/src/mermaid.spec.js index bd4cd6dc66..da29107b70 100644 --- a/src/mermaid.spec.js +++ b/src/mermaid.spec.js @@ -1,7 +1,7 @@ /* eslint-env jasmine */ import mermaid from './mermaid'; import flowDb from './diagrams/flowchart/flowDb'; -import flowParser from './diagrams/flowchart/parser/flow'; +import flowParser from './diagrams/flowchart/parser/flow.jison'; import flowRenderer from './diagrams/flowchart/flowRenderer'; const spyOn = jest.spyOn; diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index a8a95f2c9a..5be1fa4c77 100755 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -20,39 +20,39 @@ import * as configApi from './config'; import classDb from './diagrams/class/classDb'; import classRenderer from './diagrams/class/classRenderer'; import classRendererV2 from './diagrams/class/classRenderer-v2'; -import classParser from './diagrams/class/parser/classDiagram'; +import classParser from './diagrams/class/parser/classDiagram.jison'; import erDb from './diagrams/er/erDb'; import erRenderer from './diagrams/er/erRenderer'; -import erParser from './diagrams/er/parser/erDiagram'; +import erParser from './diagrams/er/parser/erDiagram.jison'; import flowDb from './diagrams/flowchart/flowDb'; import flowRenderer from './diagrams/flowchart/flowRenderer'; import flowRendererV2 from './diagrams/flowchart/flowRenderer-v2'; -import flowParser from './diagrams/flowchart/parser/flow'; +import flowParser from './diagrams/flowchart/parser/flow.jison'; import ganttDb from './diagrams/gantt/ganttDb'; import ganttRenderer from './diagrams/gantt/ganttRenderer'; -import ganttParser from './diagrams/gantt/parser/gantt'; +import ganttParser from './diagrams/gantt/parser/gantt.jison'; import gitGraphAst from './diagrams/git/gitGraphAst'; import gitGraphRenderer from './diagrams/git/gitGraphRenderer'; -import gitGraphParser from './diagrams/git/parser/gitGraph'; +import gitGraphParser from './diagrams/git/parser/gitGraph.jison'; import infoDb from './diagrams/info/infoDb'; import infoRenderer from './diagrams/info/infoRenderer'; -import infoParser from './diagrams/info/parser/info'; -import pieParser from './diagrams/pie/parser/pie'; +import infoParser from './diagrams/info/parser/info.jison'; +import pieParser from './diagrams/pie/parser/pie.jison'; import pieDb from './diagrams/pie/pieDb'; import pieRenderer from './diagrams/pie/pieRenderer'; -import requirementParser from './diagrams/requirement/parser/requirementDiagram'; +import requirementParser from './diagrams/requirement/parser/requirementDiagram.jison'; import requirementDb from './diagrams/requirement/requirementDb'; import requirementRenderer from './diagrams/requirement/requirementRenderer'; -import sequenceParser from './diagrams/sequence/parser/sequenceDiagram'; +import sequenceParser from './diagrams/sequence/parser/sequenceDiagram.jison'; import sequenceDb from './diagrams/sequence/sequenceDb'; import sequenceRenderer from './diagrams/sequence/sequenceRenderer'; -import stateParser from './diagrams/state/parser/stateDiagram'; +import stateParser from './diagrams/state/parser/stateDiagram.jison'; import stateDb from './diagrams/state/stateDb'; import stateRenderer from './diagrams/state/stateRenderer'; import stateRendererV2 from './diagrams/state/stateRenderer-v2'; import journeyDb from './diagrams/user-journey/journeyDb'; import journeyRenderer from './diagrams/user-journey/journeyRenderer'; -import journeyParser from './diagrams/user-journey/parser/journey'; +import journeyParser from './diagrams/user-journey/parser/journey.jison'; import errorRenderer from './errorRenderer'; // import * as configApi from './config'; diff --git a/yarn.lock b/yarn.lock index 503fe5deb7..921976e17f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2824,7 +2824,15 @@ browserify-des@^1.0.0: inherits "^2.0.1" safe-buffer "^5.1.2" -browserify-rsa@^4.0.0, browserify-rsa@^4.0.1: +browserify-rsa@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" + integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= + dependencies: + bn.js "^4.1.0" + randombytes "^2.0.1" + +browserify-rsa@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d" integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog== @@ -4947,6 +4955,24 @@ error@^7.0.0: dependencies: string-template "~0.2.1" +esbuild-loader@^2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-2.15.1.tgz#5a3940f5d20317f1a35720efa33e933f97c923e9" + integrity sha512-JRBL6uTeWplMbylNBt9gxLKMjD8wKnqGq786QV/cm/nPBSNA9/kC7/vNwCXTDPfYqHoWsjyfH7ub9ekN0kdAYQ== + dependencies: + esbuild "^0.12.21" + joycon "^3.0.1" + json5 "^2.2.0" + loader-utils "^2.0.0" + tapable "^2.2.0" + type-fest "^1.4.0" + webpack-sources "^2.2.0" + +esbuild@^0.12.21, esbuild@^0.12.28: + version "0.12.28" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.28.tgz#84da0d2a0d0dee181281545271e0d65cf6fab1ef" + integrity sha512-pZ0FrWZXlvQOATlp14lRSk1N9GkeJ3vLIwOcUoo3ICQn9WNR4rWoNi81pbn6sC1iYUy7QPqNzI3+AEzokwyVcA== + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -5720,7 +5746,12 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: +gensync@^1.0.0-beta.1: + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" + integrity sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg== + +gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== @@ -7344,6 +7375,11 @@ joi@^17.4.0: "@sideway/formula" "^3.0.0" "@sideway/pinpoint" "^2.0.0" +joycon@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf" + integrity sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA== + js-base64@3.6.1: version "3.6.1" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.6.1.tgz#555aae398b74694b4037af1f8a5a6209d170efbe" @@ -7462,7 +7498,7 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" -json5@^2.1.2: +json5@^2.1.2, json5@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== @@ -7662,6 +7698,15 @@ loader-utils@^1.2.3, loader-utils@^1.4.0: emojis-list "^3.0.0" json5 "^1.0.1" +loader-utils@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0" + integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ== + dependencies: + big.js "^5.2.2" + emojis-list "^3.0.0" + json5 "^2.1.2" + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -8805,6 +8850,11 @@ path-browserify@0.0.1: resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" @@ -10099,7 +10149,7 @@ sockjs@^0.3.21: uuid "^3.4.0" websocket-driver "^0.7.4" -source-list-map@^2.0.0: +source-list-map@^2.0.0, source-list-map@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== @@ -10602,6 +10652,11 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== +tapable@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + tar@^6.0.2: version "6.1.0" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.0.tgz#d1724e9bcc04b977b18d5c573b333a2207229a83" @@ -10967,6 +11022,11 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type-fest@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" + integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== + type-is@~1.6.17, type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -11573,6 +11633,14 @@ webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3: source-list-map "^2.0.0" source-map "~0.6.1" +webpack-sources@^2.2.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.1.tgz#570de0af163949fe272233c2cefe1b56f74511fd" + integrity sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA== + dependencies: + source-list-map "^2.0.1" + source-map "^0.6.1" + webpack@^4.41.2: version "4.46.0" resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.46.0.tgz#bf9b4404ea20a073605e0a011d188d77cb6ad542" @@ -11774,9 +11842,9 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1: integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== y18n@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" - integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== y18n@^5.0.5: version "5.0.8"