Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merge master to develop #3780

Merged
merged 111 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
960ea45
fix: Dirty fix for sync render.
sidharthv96 Oct 10, 2022
ba436cc
fix: Tests
sidharthv96 Oct 10, 2022
60e4585
Revert "fix: use async in render-after-error"
sidharthv96 Oct 10, 2022
23e590e
Revert "fix(test): Rerender"
sidharthv96 Oct 10, 2022
c20b8a0
Merge pull request #3633 from mermaid-js/sidv/dirtyFixSync
knsv Oct 11, 2022
bc5ef5f
Fix for async issue in parse, adding parseAsync
knsv Oct 11, 2022
00ce0fc
Merge branch 'release_9.2.0_buggfixes' into release/9.2.0
knsv Oct 11, 2022
cc2f4f7
feat: Add initializeAsync
sidharthv96 Oct 11, 2022
50f44c5
Merge branch 'release/9.2.0' of https://github.com/mermaid-js/mermaid…
sidharthv96 Oct 11, 2022
3240f8a
feat: loadExternalDiagramsAtStartup
sidharthv96 Oct 12, 2022
2460578
chore: Update lockfile
sidharthv96 Oct 12, 2022
ebef4a1
chore: add `auto-install-peers` to `.npmrc`
sidharthv96 Oct 11, 2022
d348f28
Merge branch 'release_9.2.0_buggfixes' into release/9.2.0
knsv Oct 12, 2022
cc10e62
Merge branch 'release_9.2.0_buggfixes' into release/9.2.0
knsv Oct 14, 2022
fc8db95
Release 9.20 fixes of docsify
knsv Oct 14, 2022
7881d1e
Merge branch 'release_9.2.0_buggfixes' into release/9.2.0
knsv Oct 14, 2022
957e64f
Docs with lazy loading using rc bundles
knsv Oct 14, 2022
b486177
fix: Diagram load issue
sidharthv96 Oct 14, 2022
775fb80
Merge branch 'release_9.2.0_buggfixes' into release/9.2.0
sidharthv96 Oct 15, 2022
d115fbc
Merge branch 'release_9.2.0_buggfixes' into release/9.2.0
knsv Oct 19, 2022
8230c8f
Merge remote-tracking branch 'origin/release/9.2.0' into release/9.2.0
knsv Oct 19, 2022
ea314cd
Setting version to rc7
knsv Oct 19, 2022
125312c
chore: Add CORS to vite dev
sidharthv96 Oct 17, 2022
1388e20
Adding queue for async calls in mermaidts and fixing icon color
knsv Oct 19, 2022
4c311ea
fix: TS errors
sidharthv96 Oct 19, 2022
d17aa6e
Merge branch 'release_9.2.0_buggfixes' into release/9.2.0
sidharthv96 Oct 19, 2022
56a8068
fix: Error handling
sidharthv96 Oct 19, 2022
8ad8d39
Versions for latest rcs
knsv Oct 20, 2022
4601c90
fix: load lazyLoadedDiagrams in initThrowsErrors
aloisklink Oct 20, 2022
895a5eb
docs(mermaid): document initThrowsErrors
aloisklink Oct 20, 2022
3a2669e
fix(mermaid): error if lazyLoadedDiagrams fails
aloisklink Oct 20, 2022
41249fd
fix(mermaid): fix DiagramDefinition types
aloisklink Oct 23, 2022
89d3d29
refactor(mermaid): remove registerDiagram cb func
aloisklink Oct 23, 2022
f41e34e
feat: add `mermaidAPI.registerDiagram()`
aloisklink Oct 23, 2022
e793aae
Merge pull request #3702 from aloisklink/fix/initThrowErrors-support-…
knsv Oct 24, 2022
1a0309f
Merge branch 'release_9.2.0_buggfixes'
knsv Oct 24, 2022
81924f7
Revert "Merge branch 'release_9.2.0_buggfixes'"
aloisklink Oct 27, 2022
327fcbf
fix: lazy load diagrams in initThrowsErrorsAsync
aloisklink Oct 27, 2022
13110c4
docs(mermaid): document initThrowsErrorsAsync
aloisklink Oct 20, 2022
e62dd25
feat: expose initThrowsErrorsAsync publicly
aloisklink Oct 27, 2022
48b1f48
fix(mermaid): error if lazyLoadedDiagrams fails
aloisklink Oct 27, 2022
120940f
Merge pull request #3731 from aloisklink/fix/load-lazy-loaded-diagram…
knsv Oct 28, 2022
d4c19ff
Merge branch 'release/9.2.0' of github.com:mermaid-js/mermaid into re…
knsv Oct 28, 2022
e78ac9b
Updated version
knsv Nov 1, 2022
c8635c0
Merge branch 'release/9.2.0'
knsv Nov 1, 2022
3f6613e
Updated mermaid version for the docs
knsv Nov 1, 2022
21304a9
Create config.yml
Andre601 Feb 16, 2022
b9daa35
Switch to bug_report.yml
Andre601 Feb 16, 2022
4f5228a
Create diagram_proposal.yml
Andre601 Feb 16, 2022
6ef3e7f
Create theme_proposal.yml
Andre601 Feb 16, 2022
312e5f3
Create syntaxt_proposal.yml
Andre601 Feb 16, 2022
41f21d4
Delete question.md
Andre601 Feb 16, 2022
0b83448
Update bug_report.yml
Andre601 Feb 16, 2022
099a269
Update diagram_proposal.yml
Andre601 Feb 16, 2022
bab5937
Update syntaxt_proposal.yml
Andre601 Feb 16, 2022
5d83ec6
Update theme_proposal.yml
Andre601 Feb 16, 2022
1117a80
make setup not required
Andre601 Sep 14, 2022
c8f6994
Make colors required
Andre601 Sep 14, 2022
638b9d9
Discussions are now available
Andre601 Sep 14, 2022
17adec3
chore: lint
sidharthv96 Oct 29, 2022
361dd6a
Add Security Policy
sidharthv96 Nov 3, 2022
c86d46e
Add Security Policy
sidharthv96 Nov 3, 2022
97a7f1f
Merge pull request #2739 from Andre601/feature/issue-templates
sidharthv96 Nov 3, 2022
1e41783
Basic webpack
sidharthv96 Nov 4, 2022
da6bb94
fix(mermaid): fix mermaid.render types
aloisklink Nov 6, 2022
1a5e731
fix(mermaid): default mermaid back to CommonJS
aloisklink Nov 6, 2022
41dbf0f
Merge pull request #3768 from aloisklink/fix/fix-mermaid.render-types
sidharthv96 Nov 7, 2022
2243af1
Merge pull request #3767 from aloisklink/fix/convert-package-back-to-…
sidharthv96 Nov 7, 2022
75d276e
Merge branch 'release_9.2.1_bugfixes' into sidv/webpackTest
sidharthv96 Nov 7, 2022
166dca4
webpack test
sidharthv96 Nov 8, 2022
aab8f92
Merge branch 'feat/3701-expose-registerDiagram' into sidv/fixLL
sidharthv96 Nov 8, 2022
7ca5256
fix #3757 : Remove dynamic imports for lazy load.
sidharthv96 Nov 8, 2022
20b4358
fix: Make options in registerExternalDiagrams optional
sidharthv96 Nov 8, 2022
6d2552e
fix: Filenames
sidharthv96 Nov 8, 2022
605f288
fix Lint
sidharthv96 Nov 8, 2022
e64e98f
Bump pnpm
sidharthv96 Nov 8, 2022
745abb8
Fix pnpm
sidharthv96 Nov 8, 2022
ba7f830
Fixing applitools batches
knsv Nov 4, 2022
1b2dce9
Merge branch 'release/9.2.1' of https://github.com/mermaid-js/mermaid…
sidharthv96 Nov 8, 2022
5b53cee
Fix pnpm-lock
sidharthv96 Nov 8, 2022
d2511f6
fix pnpm lock
sidharthv96 Nov 8, 2022
b03ac38
Restore package and lock from master
sidharthv96 Nov 8, 2022
8e63a07
Cleanup package.json
sidharthv96 Nov 8, 2022
c7f7ff3
fix: Import path in viewer.js
sidharthv96 Nov 8, 2022
89da6ea
Apply suggestions from code review
sidharthv96 Nov 9, 2022
649ab17
feat: Add config validator MVP
sidharthv96 Nov 9, 2022
f52df30
fix versions
sidharthv96 Nov 9, 2022
c309e3e
Merge branch 'sidv/fixLL' of https://github.com/mermaid-js/mermaid in…
sidharthv96 Nov 9, 2022
ecc51d7
fix: Remove registerDiagram export
sidharthv96 Nov 9, 2022
2f9d6e0
Merge pull request #3774 from mermaid-js/sidv/fixLL
knsv Nov 9, 2022
9bb0ed2
Added registerExternalDiagram for Mindmap
pbrolin47 Nov 9, 2022
fb8149b
Increased package version to 9.2.2
pbrolin47 Nov 9, 2022
5261135
Updated release
pbrolin47 Nov 9, 2022
0b9b2cf
Updated URL
pbrolin47 Nov 9, 2022
ccfaea8
Updated README-files
pbrolin47 Nov 9, 2022
dd5d99e
Merge branch 'release/9.2.2'
pbrolin47 Nov 9, 2022
0af36f1
feat: Switch CDN
sidharthv96 Nov 9, 2022
a83f88b
chore: Merge master to develop
sidharthv96 Nov 10, 2022
dcab2c5
Merge pull request #3777 from mermaid-js/sidv/fixCDN
knsv Nov 10, 2022
ab92b5c
chore: Cleanup pakage.json, fix jisonLint
sidharthv96 Nov 10, 2022
1f68ea4
Hacky fix for pnpm issue
sidharthv96 Nov 10, 2022
88d3fdf
fix: `use-inline-specifiers-lockfile-format` to pnpm
sidharthv96 Nov 11, 2022
292cbd7
Merge pull request #3783 from mermaid-js/sidv/cleanupPackage.json
knsv Nov 11, 2022
2d9bded
Merge branch 'develop' into sidv/mergeMaster
sidharthv96 Nov 14, 2022
77a326d
Merge Master
sidharthv96 Nov 14, 2022
c354d9e
Merge remote-tracking branch 'origin/master' into sidv/mergeMaster
sidharthv96 Nov 14, 2022
9144fa3
cleanup
sidharthv96 Nov 14, 2022
4decaf0
chore: Fix tsdoc
sidharthv96 Nov 14, 2022
051b427
Cleanup docs
sidharthv96 Nov 14, 2022
eae88c5
Cleanup
sidharthv96 Nov 14, 2022
ad6eba4
Merge branch 'develop' into sidv/mergeMaster
sidharthv96 Nov 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ cypress/snapshots/
.eslintcache
.tsbuildinfo
tsconfig.tsbuildinfo

knsv*.html
local*.html
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
auto-install-peers=true
auto-install-peers=true
strict-peer-dependencies=false
use-inline-specifiers-lockfile-format=true
37 changes: 16 additions & 21 deletions .vite/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { build, InlineConfig } from 'vite';
import { resolve } from 'path';
import { fileURLToPath } from 'url';
import jisonPlugin from './jisonPlugin.js';
import pkg from '../package.json' assert { type: 'json' };
import { readFileSync } from 'fs';

const { dependencies } = pkg;
const watch = process.argv.includes('--watch');
const mermaidOnly = process.argv.includes('--mermaid');
const __dirname = fileURLToPath(new URL('.', import.meta.url));

type OutputOptions = Exclude<
Expand All @@ -22,23 +22,13 @@ const packageOptions = {
'mermaid-mindmap': {
name: 'mermaid-mindmap',
packageName: 'mermaid-mindmap',
file: 'diagram-definition.ts',
},
'mermaid-mindmap-detector': {
name: 'mermaid-mindmap-detector',
packageName: 'mermaid-mindmap',
file: 'detector.ts',
},
'mermaid-example-diagram': {
name: 'mermaid-example-diagram',
packageName: 'mermaid-example-diagram',
file: 'diagram-definition.ts',
},
'mermaid-example-diagram-detector': {
name: 'mermaid-example-diagram-detector',
packageName: 'mermaid-example-diagram',
file: 'detector.ts',
},
// 'mermaid-example-diagram-detector': {
// name: 'mermaid-example-diagram-detector',
// packageName: 'mermaid-example-diagram',
// file: 'detector.ts',
// },
};

interface BuildOptions {
Expand Down Expand Up @@ -68,6 +58,9 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
];

if (core) {
const { dependencies } = JSON.parse(
readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8')
);
// Core build is used to generate file without bundled dependencies.
// This is used by downstream projects to bundle dependencies themselves.
external.push(...Object.keys(dependencies));
Expand Down Expand Up @@ -110,7 +103,7 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
include: [
'packages/mermaid-mindmap/src/**',
'packages/mermaid/src/**',
'packages/mermaid-example-diagram/src/**',
// 'packages/mermaid-example-diagram/src/**',
],
};
}
Expand All @@ -134,9 +127,11 @@ const main = async () => {
};

if (watch) {
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid' }));
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-mindmap' }));
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
build(getBuildConfig({ minify: false, watch, core: true, entryName: 'mermaid' }));
if (!mermaidOnly) {
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-mindmap' }));
// build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
}
} else {
void main();
}
6 changes: 0 additions & 6 deletions .vite/tsconfig.json

This file was deleted.

13 changes: 13 additions & 0 deletions cypress/integration/other/external-diagrams.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
describe('mermaid', () => {
describe('registerDiagram', () => {
it('should work on @mermaid-js/mermaid-mindmap and mermaid-example-diagram', () => {
const url = 'http://localhost:9000/external-diagrams-mindmap.html';
cy.visit(url);

cy.get('svg', {
// may be a bit slower than normal, since vite might need to re-compile mermaid/mermaid-mindmap/mermaid-example-diagram
timeout: 10000,
}).matchImageSnapshot();
});
});
});
49 changes: 49 additions & 0 deletions cypress/platform/external-diagrams-mindmap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<html>
<body>
<h1>Should correctly load a third-party diagram using registerDiagram</h1>
<pre id="diagram" class="mermaid">
mindmap
root
A
B
C
D
E
A2
B2
C2
D2
E2
child1((Circle))
grandchild 1
grandchild 2
child2(Round rectangle)
grandchild 3
grandchild 4
child3[Square]
grandchild 5
::icon(mdi mdi-fire)
gc6((grand<br/>child 6))
::icon(mdi mdi-fire)
gc7((grand<br/>grand<br/>child 8))
</pre>
<!-- <pre id="diagram" class="mermaid2">
example-diagram
</pre> -->

<!-- <div id="cy"></div> -->
<!-- <script src="http://localhost:9000/packages/mermaid-mindmap/dist/mermaid-mindmap-detector.js"></script> -->
<!-- <script src="./mermaid-example-diagram-detector.js"></script> -->
<!-- <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> -->
<!-- <script type="module" src="./external-diagrams-mindmap.mjs" /> -->
<script type="module">
import mindmap from '../../packages/mermaid-mindmap/src/detector';
// import example from '../../packages/mermaid-example-diagram/src/detector';
import mermaid from '../../packages/mermaid/src/mermaid';

await mermaid.registerExternalDiagrams([mindmap]);
await mermaid.initialize({ logLevel: 0 });
await mermaid.initThrowsErrorsAsync();
</script>
</body>
</html>
31 changes: 13 additions & 18 deletions cypress/platform/knsv2.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,19 @@
</pre>
<pre id="diagram" class="mermaid">
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Popularisation
::icon(fa fa-book)
British popular psychology author Tony Buzan
Research
::icon(fa fa-book)
On effectivness<br/>and features
On Automatic creation
Uses
Creative techniques
Strategic planning
Argument mapping
Tools
Pen and paper
Mermaid
root
child1((Circle))
grandchild 1
grandchild 2
child2(Round rectangle)
grandchild 3
grandchild 4
child3[Square]
grandchild 5
::icon(mdi mdi-fire)
gc6((grand<br/>child 6))
::icon(mdi mdi-fire)
gc7((grand<br/>grand<br/>child 8))
</pre>
<pre id="diagram" class="mermaid">
gantt
Expand Down
16 changes: 7 additions & 9 deletions cypress/platform/render-after-error.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
mermaid.init({ startOnLoad: false });

mermaid.mermaidAPI.initialize({ securityLevel: 'strict' });
(async () => {
try {
console.log('rendering');
await mermaid.mermaidAPI.render('graphDiv', `>`);
} catch (e) {}
try {
console.log('rendering');
mermaid.mermaidAPI.render('graphDiv', `>`);
} catch (e) {}

await mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
document.getElementById('graph').innerHTML = html;
});
})();
mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
document.getElementById('graph').innerHTML = html;
});
</script>
</body>
</html>
7 changes: 3 additions & 4 deletions cypress/platform/rerender.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
function rerender(text) {
const graphText = `graph TD
A[${text}] -->|Get money| B(Go shopping)`;
mermaid.mermaidAPI.render('id', graphText).then((svg) => {
console.log('\x1b[35m%s\x1b[0m', '>> graph', svg);
document.getElementById('graph').innerHTML = svg;
});
const graph = mermaid.mermaidAPI.render('id', graphText);
console.log('\x1b[35m%s\x1b[0m', '>> graph', graph);
document.getElementById('graph').innerHTML = graph;
}
</script>
<button id="rerender" onclick="rerender('Saturday')">Rerender</button>
Expand Down
6 changes: 3 additions & 3 deletions cypress/platform/viewer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mermaid2 from '../../packages/mermaid/src/mermaid';
import mindmap from '../../packages/mermaid-mindmap/src/detector';

function b64ToUtf8(str) {
return decodeURIComponent(escape(window.atob(str)));
Expand All @@ -9,7 +10,7 @@ function b64ToUtf8(str) {
* configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the
* page.
*/
const contentLoaded = function () {
const contentLoaded = async function () {
let pos = document.location.href.indexOf('?graph=');
if (pos > 0) {
pos = pos + 7;
Expand All @@ -36,8 +37,7 @@ const contentLoaded = function () {
document.getElementsByTagName('body')[0].appendChild(div);
}

graphObj.mermaid.lazyLoadedDiagrams = ['/mermaid-mindmap-detector.esm.mjs'];

await mermaid2.registerExternalDiagrams([mindmap]);
mermaid2.initialize(graphObj.mermaid);
mermaid2.init();
}
Expand Down
18 changes: 9 additions & 9 deletions docs/config/setup/modules/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pushes in a directive to the configuration

#### Defined in

[config.ts:191](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L191)
[config.ts:193](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L193)

---

Expand All @@ -60,7 +60,7 @@ The currentConfig

#### Defined in

[config.ts:136](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L136)
[config.ts:138](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L138)

---

Expand All @@ -84,7 +84,7 @@ The siteConfig

#### Defined in

[config.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L96)
[config.ts:97](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L97)

---

Expand Down Expand Up @@ -118,7 +118,7 @@ The siteConfig

#### Defined in

[config.ts:223](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L223)
[config.ts:225](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L225)

---

Expand Down Expand Up @@ -147,7 +147,7 @@ options in-place

#### Defined in

[config.ts:151](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L151)
[config.ts:153](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L153)

---

Expand All @@ -167,7 +167,7 @@ options in-place

#### Defined in

[config.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L75)
[config.ts:76](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L76)

---

Expand Down Expand Up @@ -199,7 +199,7 @@ The currentConfig merged with the sanitized conf

#### Defined in

[config.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L113)
[config.ts:114](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L114)

---

Expand Down Expand Up @@ -232,7 +232,7 @@ The new siteConfig

#### Defined in

[config.ts:61](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L61)
[config.ts:62](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L62)

---

Expand Down Expand Up @@ -273,4 +273,4 @@ The new siteConfig

#### Defined in

[config.ts:79](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L79)
[config.ts:80](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L80)
2 changes: 1 addition & 1 deletion docs/config/setup/modules/defaultConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#### Defined in

[defaultConfig.ts:1882](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L1882)
[defaultConfig.ts:1881](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L1881)

---

Expand Down