Skip to content

Commit

Permalink
Merge branch 'release/8.13.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Dec 17, 2021
2 parents 1385acc + 295b428 commit a349fd3
Show file tree
Hide file tree
Showing 84 changed files with 2,869 additions and 160,485 deletions.
5 changes: 5 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@commitlint/config-conventional"
]
}
20 changes: 15 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
},
"sourceType": "module"
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended", "plugin:prettier/recommended"],
"plugins": ["jest", "jsdoc", "prettier"],
"extends": ["eslint:recommended", "plugin:jsdoc/recommended", "plugin:markdown/recommended", "plugin:prettier/recommended"],
"plugins": ["html", "jest", "jsdoc", "prettier"],
"rules": {
"no-prototype-builtins": 0,
"no-unused-vars": 0,
Expand All @@ -23,6 +23,16 @@
"jsdoc/check-line-alignment": 0,
"jsdoc/multiline-blocks": 0,
"jsdoc/newline-after-description": 0,
"jsdoc/tag-lines": 0
}
}
"jsdoc/tag-lines": 0,
"no-empty": ["error", { "allowEmptyCatch": true }]
},
"overrides": [
{
"files": "./**/*.html",
"rules": {
"no-undef": "off",
"jsdoc/require-jsdoc": "off"
}
}
]
}
16 changes: 16 additions & 0 deletions .github/workflows/update-browserlist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Update Browserslist
on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npx browserslist@latest --update-db
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
author_name: ${{ github.actor }}
author_email: ${{ github.actor }}@users.noreply.github.com
message: 'Update Browserslist'
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ node_modules/
coverage/
.idea/

dist/*.js
dist/*.map
dist

yarn-error.log
.npmrc
token

package-lock.json

dist/classTest.html

dist/sequenceTest.html

.vscode/
cypress/platform/current.html
cypress/platform/experimental.html
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn dlx lint-staged
yarn pre-commit
4 changes: 2 additions & 2 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*": [
"*.{js,html,md}": [
"yarn lint:fix"
]
}
}
15 changes: 14 additions & 1 deletion jison/loader.js → .webpack/loaders/jison.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
const { Generator } = require('jison');
const validate = require('schema-utils');
const schema = require('./parser-options-schema.json');

const schema = {
title: 'Jison Parser options',
type: 'object',
properties: {
'token-stack': {
type: 'boolean',
},
debug: {
type: 'boolean',
},
},
additionalProperties: false,
};

module.exports = function jisonLoader(source) {
const options = this.getOptions();
Expand Down
45 changes: 45 additions & 0 deletions .webpack/webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { merge, mergeWithCustomize, customizeObject } from 'webpack-merge';
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!');
}
};
54 changes: 54 additions & 0 deletions .webpack/webpack.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import path from 'path';

export const resolveRoot = (...relativePath) => path.resolve(__dirname, '..', ...relativePath);

export default {
amd: false, // https://github.com/lodash/lodash/issues/3052
target: 'web',
entry: {
mermaid: './src/mermaid.js',
},
resolve: {
extensions: ['.wasm', '.mjs', '.js', '.json', '.jison'],
fallback: {
fs: false, // jison generated code requires 'fs'
path: require.resolve('path-browserify'),
},
},
output: {
path: resolveRoot('./dist'),
filename: '[name].js',
library: {
name: 'mermaid',
type: 'umd',
export: 'default',
},
globalObject: 'typeof self !== "undefined" ? self : this',
},
module: {
rules: [
{
test: /\.js$/,
include: [resolveRoot('./src'), resolveRoot('./node_modules/dagre-d3-renderer/lib')],
use: {
loader: 'babel-loader',
},
},
{
// load scss to string
test: /\.scss$/,
use: ['css-to-string-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.jison$/,
use: {
loader: path.resolve(__dirname, './loaders/jison.js'),
options: {
'token-stack': true,
},
},
},
],
},
devtool: 'source-map',
};
37 changes: 37 additions & 0 deletions .webpack/webpack.config.e2e.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import baseConfig, { resolveRoot } from './webpack.config.base';
import { merge } from 'webpack-merge';

export default merge(baseConfig, {
mode: 'development',
entry: {
mermaid: './src/mermaid.js',
e2e: './cypress/platform/viewer.js',
'bundle-test': './cypress/platform/bundle-test.js',
},
output: {
globalObject: 'window',
},
devServer: {
compress: true,
port: 9000,
static: [
{ directory: resolveRoot('cypress', 'platform') },
{ directory: resolveRoot('dist') },
{ directory: resolveRoot('demos') },
],
},
externals: {
mermaid: 'mermaid',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
],
},
});
3 changes: 0 additions & 3 deletions Renfay.md

This file was deleted.

13 changes: 12 additions & 1 deletion cypress/integration/rendering/flowchart-v2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ flowchart RL
imgSnapshotTest(
`flowchart TB
a{{"Lorem 'ipsum' dolor 'sit' amet, 'consectetur' adipiscing 'elit'."}}
--> b{{"Lorem #quot;ipsum#quot; dolor #quot;sit#quot; amet,#quot;consectetur#quot; adipiscing #quot;elit#quot;."}}
--> b{{"Lorem #quot;ipsum#quot; dolor #quot;sit#quot; amet,#quot;consectetur#quot; adipiscing #quot;elit#quot;."}}
`,
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
);
Expand Down Expand Up @@ -638,4 +638,15 @@ flowchart RL
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
);
});

it('2388: handling default in the node name', () => {
imgSnapshotTest(
`
flowchart LR
default-index.js --> dot.template.js
index.js --> module-utl.js
`,
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
);
});
});
25 changes: 25 additions & 0 deletions cypress/integration/rendering/theme.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
import { imgSnapshotTest } from '../../helpers/util.js';

describe('themeCSS balancing, it', () => {
it('should not allow unbalanced CSS definitions', () => {
imgSnapshotTest(
`
%%{init: { 'themeCSS': '} * { background: red }' } }%%
flowchart TD
a --> b
`,
{}
);
cy.get('svg');
});
it('should not allow unbalanced CSS definitions 2', () => {
imgSnapshotTest(
`
%%{init: { 'themeCSS': '\u007D * { background: red }' } }%%
flowchart TD
a2 --> b2
`,
{}
);
cy.get('svg');
});
});

describe('Pie Chart', () => {
// beforeEach(()=>{
// cy.clock((new Date('2014-06-09')).getTime());
Expand Down
12 changes: 7 additions & 5 deletions cypress/platform/class.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ <h1>info below</h1>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'default',
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
flowchart: { curve: 'linear', "htmlLabels": true },
flowchart: { curve: 'linear', htmlLabels: true },
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorMargin: 50, showSequenceNumbers: true },
// sequenceDiagram: { actorMargin: 300 } // deprecated
Expand All @@ -131,9 +131,11 @@ <h1>info below</h1>
// fontFamily: '"arial", sans-serif',
// },
curve: 'linear',
securityLevel: 'loose'
securityLevel: 'loose',
});
function callback(){alert('It worked');}
function callback() {
alert('It worked');
}
</script>
</body>
</html>
Loading

0 comments on commit a349fd3

Please sign in to comment.