10000 [WebProfilerBundle] Inline flowchart-only Mermaid version · symfony/symfony@32612e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 32612e7

Browse files
committed
[WebProfilerBundle] Inline flowchart-only Mermaid version
1 parent 9549cc2 commit 32612e7

File tree

5 files changed

+519
-2
lines changed

5 files changed

+519
-2
lines changed

src/Symfony/Bundle/WebProfilerBundle/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/phpunit.xml.dist export-ignore
33
/.gitattributes export-ignore
44
/.gitignore export-ignore
5+
/Resources/views/Script/Mermaid/Makefile export-ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor/
22
composer.lock
33
phpunit.xml
4+
/Resources/views/Script/Mermaid/repo-*

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/workflow.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@
132132
<p>There are no workflows configured.</p>
133133
</div>
134134
{% else %}
135-
<script type="module">
136-
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
135+
<script>
136+
{{ source('@WebProfiler/Script/Mermaid/mermaid-flowchart-v2.min.js') }}
137137
const isDarkMode = document.querySelector('body').classList.contains('theme-dark');
138138
mermaid.initialize({
139139
flowchart: { useMaxWidth: false },
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
define diagram-orchestration
2+
import { diagram as flowchartV2 } from '../diagrams/flowchart/flowDiagram-v2.js';
3+
import { registerDiagram } from './diagramAPI.js';
4+
5+
let hasLoadedDiagrams = false;
6+
export const addDiagrams = () => {
7+
if (hasLoadedDiagrams) {
8+
return;
9+
}
10+
h E84C asLoadedDiagrams = true;
11+
registerDiagram('flowchart-v2', flowchartV2, () => true);
12+
};
13+
endef
14+
15+
override tag := v10.9.0
16+
17+
.PHONY: mermaid-flowchart-v2.min.js
18+
mermaid-flowchart-v2.min.js: | repo-$(tag)/node_modules
19+
$(file >repo-$(tag)/packages/mermaid/src/diagram-api/diagram-orchestration.ts,$(diagram-orchestration))
20+
pnpm -C repo-$(tag) run build
21+
cp repo-$(tag)/packages/mermaid/dist/mermaid.min.js $@
22+
23+
repo-$(tag)/node_modules: | repo-$(tag)
24+
pnpm -C $(@D) install --ignore-scripts
25+
26+
.SECONDARY: repo-$(tag)
27+
repo-$(tag):
28+
curl -fL https://github.com/mermaid-js/mermaid/archive/refs/tags/$(tag).tar.gz | tar -xz --strip-components=1 --one-top-level=$@
29+
30+
.PHONY: clean
31+
clean:
32+
rm -rf ./repo-*

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Script/Mermaid/mermaid-flowchart-v2.min.js

Lines changed: 483 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0