@mermaid-js/mermaid-cli 9.1.7 → 9.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/{fontawesome/webfonts/fa-brands-400.svg → dist/assets/fa-brands-400.ce2af7e2.svg} +0 -0
- package/{fontawesome/webfonts/fa-regular-400.svg → dist/assets/fa-regular-400.e519b693.svg} +0 -0
- package/{fontawesome/webfonts/fa-solid-900.svg → dist/assets/fa-solid-900.3e918c25.svg} +0 -0
- package/dist/index.html +1398 -0
- package/package.json +11 -10
- package/src/index.js +20 -5
- package/fontawesome/css/fa-brands.css +0 -9
- package/fontawesome/css/fa-regular.css +0 -10
- package/fontawesome/css/fa-solid.css +0 -11
- package/fontawesome/css/fontawesome.css +0 -3173
- package/fontawesome/webfonts/fa-brands-400.eot +0 -0
- package/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/fontawesome/webfonts/fa-regular-400.eot +0 -0
- package/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/fontawesome/webfonts/fa-solid-900.eot +0 -0
- package/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/fontawesome/webfonts/fa-solid-900.woff +0 -0
- package/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/index.html +0 -13
- package/mermaid.min.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mermaid-js/mermaid-cli",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.2",
|
|
4
4
|
"description": "Command-line interface for mermaid",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:mermaid-js/mermaid-cli.git",
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"exports": "./src/index.js",
|
|
16
16
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"prepack": "sh copy_modules.sh",
|
|
17
|
+
"prepare": "vite build",
|
|
18
|
+
"prepack": "vite build",
|
|
20
19
|
"test": "standard && yarn node --experimental-vm-modules $(yarn bin jest)",
|
|
21
20
|
"lint": "standard",
|
|
22
21
|
"lint-fix": "standard --fix"
|
|
@@ -24,20 +23,22 @@
|
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"chalk": "^5.0.1",
|
|
26
25
|
"commander": "^9.0.0",
|
|
27
|
-
"puppeteer": "^
|
|
26
|
+
"puppeteer": "^19.0.0"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@fortawesome/fontawesome-free-webfonts": "^1.0.9",
|
|
31
|
-
"mermaid": "^9.
|
|
30
|
+
"@mermaid-js/mermaid-mindmap": "^9.2.2",
|
|
31
|
+
"mermaid": "^9.2.2",
|
|
32
32
|
"jest": "^29.0.1",
|
|
33
33
|
"standard": "^17.0.0",
|
|
34
|
+
"vite": "^3.2.3",
|
|
35
|
+
"vite-plugin-singlefile": "^0.13.1",
|
|
36
|
+
"vite-svg-loader": "^3.6.0",
|
|
34
37
|
"yarn-upgrade-all": "^0.7.0"
|
|
35
38
|
},
|
|
36
39
|
"files": [
|
|
37
40
|
"src/",
|
|
38
|
-
"
|
|
39
|
-
"index.html",
|
|
40
|
-
"fontawesome/*"
|
|
41
|
+
"dist/"
|
|
41
42
|
],
|
|
42
43
|
"jest": {
|
|
43
44
|
"moduleNameMapper": {
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
},
|
|
47
48
|
"standard": {
|
|
48
49
|
"ignore": [
|
|
49
|
-
"
|
|
50
|
+
"/dist/"
|
|
50
51
|
]
|
|
51
52
|
}
|
|
52
53
|
}
|
package/src/index.js
CHANGED
|
@@ -98,7 +98,11 @@ async function cli () {
|
|
|
98
98
|
// if an input file is defined, it should take precedence, otherwise, input is
|
|
99
99
|
// coming from stdin and just name the file out.svg, if it hasn't been
|
|
100
100
|
// specified with the '-o' option
|
|
101
|
-
|
|
101
|
+
if (outputFormat) {
|
|
102
|
+
output = input ? (`${input}.${outputFormat}`) : `out.${outputFormat}`
|
|
103
|
+
} else {
|
|
104
|
+
output = input ? (`${input}.svg`) : 'out.svg'
|
|
105
|
+
}
|
|
102
106
|
}
|
|
103
107
|
if (!/\.(?:svg|png|pdf|md)$/.test(output)) {
|
|
104
108
|
error('Output file must end with ".md", ".svg", ".png" or ".pdf"')
|
|
@@ -185,21 +189,32 @@ async function parseMMD (...args) {
|
|
|
185
189
|
*/
|
|
186
190
|
async function renderMermaid (browser, definition, outputFormat, { viewport, backgroundColor = 'white', mermaidConfig = {}, myCSS, pdfFit } = {}) {
|
|
187
191
|
const page = await browser.newPage()
|
|
192
|
+
page.on('console', (msg) => {
|
|
193
|
+
console.log(msg.text())
|
|
194
|
+
})
|
|
188
195
|
try {
|
|
189
196
|
if (viewport) {
|
|
190
197
|
await page.setViewport(viewport)
|
|
191
198
|
}
|
|
192
|
-
const mermaidHTMLPath = path.join(__dirname, '..', 'index.html')
|
|
199
|
+
const mermaidHTMLPath = path.join(__dirname, '..', 'dist', 'index.html')
|
|
193
200
|
await page.goto(url.pathToFileURL(mermaidHTMLPath))
|
|
194
201
|
await page.$eval('body', (body, backgroundColor) => {
|
|
195
202
|
body.style.background = backgroundColor
|
|
196
203
|
}, backgroundColor)
|
|
197
|
-
const metadata = await page.$eval('#container', (container, definition, mermaidConfig, myCSS, backgroundColor) => {
|
|
204
|
+
const metadata = await page.$eval('#container', async (container, definition, mermaidConfig, myCSS, backgroundColor) => {
|
|
198
205
|
container.textContent = definition
|
|
199
|
-
|
|
206
|
+
|
|
207
|
+
/** @type {import("mermaid")} Already imported mermaid instance */
|
|
208
|
+
const mermaid = globalThis.mermaid
|
|
209
|
+
/** @type {import("@mermaid-js/mermaid-mindmap")} */
|
|
210
|
+
const mermaidMindmap = globalThis.mermaidMindmap
|
|
211
|
+
|
|
212
|
+
await mermaid.registerExternalDiagrams([mermaidMindmap])
|
|
213
|
+
|
|
214
|
+
mermaid.initialize(mermaidConfig)
|
|
200
215
|
// should throw an error if mmd diagram is invalid
|
|
201
216
|
try {
|
|
202
|
-
|
|
217
|
+
await mermaid.initThrowsErrorsAsync(undefined, container)
|
|
203
218
|
} catch (error) {
|
|
204
219
|
if (error instanceof Error) {
|
|
205
220
|
// mermaid-js doesn't currently throws JS Errors, but let's leave this
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: 'Font Awesome 5 Brands';
|
|
3
|
-
font-style: normal;
|
|
4
|
-
font-weight: normal;
|
|
5
|
-
src: url("../webfonts/fa-brands-400.eot");
|
|
6
|
-
src: url("../webfonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../webfonts/fa-brands-400.woff2") format("woff2"), url("../webfonts/fa-brands-400.woff") format("woff"), url("../webfonts/fa-brands-400.ttf") format("truetype"), url("../webfonts/fa-brands-400.svg#fontawesome") format("svg"); }
|
|
7
|
-
|
|
8
|
-
.fab {
|
|
9
|
-
font-family: 'Font Awesome 5 Brands'; }
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: 'Font Awesome 5 Free';
|
|
3
|
-
font-style: normal;
|
|
4
|
-
font-weight: 400;
|
|
5
|
-
src: url("../webfonts/fa-regular-400.eot");
|
|
6
|
-
src: url("../webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../webfonts/fa-regular-400.woff2") format("woff2"), url("../webfonts/fa-regular-400.woff") format("woff"), url("../webfonts/fa-regular-400.ttf") format("truetype"), url("../webfonts/fa-regular-400.svg#fontawesome") format("svg"); }
|
|
7
|
-
|
|
8
|
-
.far {
|
|
9
|
-
font-family: 'Font Awesome 5 Free';
|
|
10
|
-
font-weight: 400; }
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: 'Font Awesome 5 Free';
|
|
3
|
-
font-style: normal;
|
|
4
|
-
font-weight: 900;
|
|
5
|
-
src: url("../webfonts/fa-solid-900.eot");
|
|
6
|
-
src: url("../webfonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.woff") format("woff"), url("../webfonts/fa-solid-900.ttf") format("truetype"), url("../webfonts/fa-solid-900.svg#fontawesome") format("svg"); }
|
|
7
|
-
|
|
8
|
-
.fa,
|
|
9
|
-
.fas {
|
|
10
|
-
font-family: 'Font Awesome 5 Free';
|
|
11
|
-
font-weight: 900; }
|