@ohos-ports/mermaid-js-mermaid-cli 11.16.0-beta.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017-2020 Tyler Long
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,229 @@
1
+ # mermaid-cli
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@mermaid-js/mermaid-cli)](https://www.npmjs.com/package/@mermaid-js/mermaid-cli)
4
+ [![node-lts (scoped)](https://img.shields.io/node/v-lts/@mermaid-js/mermaid-cli)](https://www.npmjs.com/package/@mermaid-js/mermaid-cli)
5
+ [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/minlag/mermaid-cli?label=Dockerhub)](https://hub.docker.com/r/minlag/mermaid-cli)
6
+ [![Build, test and deploy mermaid-cli Docker image](https://github.com/mermaid-js/mermaid-cli/actions/workflows/compile-mermaid.yml/badge.svg)](https://github.com/mermaid-js/mermaid-cli/actions/workflows/compile-mermaid.yml)
7
+ [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/Mermaid/mermaid-cli)
8
+ [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
9
+
10
+ This is a command-line interface (CLI) for [mermaid](https://mermaid.js.org/). It takes a mermaid definition file as input and generates an SVG/PNG/PDF file as output.
11
+
12
+ ## Installation
13
+
14
+ ```sh
15
+ npm install -g @mermaid-js/mermaid-cli
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ Convert Mermaid mmd Diagram File To SVG
21
+
22
+ ```sh
23
+ mmdc -i input.mmd -o output.svg
24
+ ```
25
+
26
+ > **Note**
27
+ >
28
+ > See [Alternative installations](#alternative-installations) if you don't want to install the package globally.
29
+ >
30
+ > Locate how to call the mmdc executable for your preferred method
31
+ > i.e. Docker, Yarn, NPM, local install, etc.
32
+
33
+ ## Examples
34
+
35
+ ### Create A PNG With A Dark Theme And Transparent Background
36
+
37
+ ```sh
38
+ mmdc -i input.mmd -o output.png -t dark -b transparent
39
+ ```
40
+
41
+ ### Animating an SVG file with custom CSS
42
+
43
+ The `--cssFile` option can be used to inline some custom CSS.
44
+
45
+ Please see [./test-positive/flowchart1.css](test-positive/flowchart1.css) for an example of a CSS file that has animations.
46
+
47
+ **Warning**: If you want to override `mermaid`'s [`themeCSS`](https://mermaid.js.org/config/schema-docs/config.html#themecss), we recommend instead adding `{"themeCSS": "..."})` to your mermaid `--configFile`. You may also need to use [`!important`](https://developer.mozilla.org/en-US/docs/Web/CSS/important) to override mermaid's `themeCSS`.
48
+
49
+ **Warning**: Inline CSS files may be blocked by your browser, depending on the [HTTP Content-Security-Policy header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) of the website that hosts your SVG.
50
+
51
+ ```sh
52
+ mmdc --input test-positive/flowchart1.mmd --cssFile test-positive/flowchart1.css -o docs/animated-flowchart.svg
53
+ ```
54
+
55
+ <details>
56
+ <summary>Example output: docs/animated-flowchart.svg</summary>
57
+
58
+ ![docs/animated-flowchart.svg](docs/animated-flowchart.svg)
59
+
60
+ </details>
61
+
62
+ ### Transform a markdown file with mermaid diagrams
63
+
64
+ ```sh
65
+ mmdc -i readme.template.md -o readme.md
66
+ ```
67
+
68
+ This command transforms a markdown file itself. The mermaid-cli will find the mermaid diagrams, create SVG files from them and refer to those in the markdown output.
69
+
70
+ This:
71
+
72
+ ````md
73
+ ### Some markdown
74
+
75
+ ```mermaid
76
+ graph
77
+ [....]
78
+ ```
79
+
80
+ ### Some more markdown
81
+
82
+ ```mermaid
83
+ sequenceDiagram
84
+ [....]
85
+ ```
86
+
87
+ ### Mermaid with custom title/desc
88
+
89
+ ```mermaid
90
+ graph
91
+ accTitle: My title here
92
+ accDescr: My description here
93
+ A-->B
94
+ ```
95
+ ````
96
+
97
+ Becomes:
98
+
99
+ ```md
100
+ ### Some markdown
101
+
102
+ ![diagram](./readme-1.svg)
103
+
104
+ ### Some more markdown
105
+
106
+ ![diagram](./readme-2.svg)
107
+
108
+ ### Mermaid with custom title/desc
109
+
110
+ ![My description here](./readme-3.svg "My title here")
111
+ ```
112
+
113
+ ### Piping from stdin
114
+
115
+ You can easily pipe input from stdin. This example shows how to use a heredoc to
116
+ send a diagram as stdin to mermaid-cli (mmdc).
117
+
118
+ ```sh
119
+ cat << EOF | mmdc --input -
120
+ graph TD
121
+ A[Client] --> B[Load Balancer]
122
+ EOF
123
+ ```
124
+
125
+ ### See All Available Options
126
+
127
+ ```sh
128
+ mmdc -h
129
+ ```
130
+
131
+ # Alternative installations
132
+
133
+ ## Use Docker/Podman:
134
+
135
+ ```sh
136
+ docker pull minlag/mermaid-cli
137
+ ```
138
+
139
+ or pull from Github Container Registry
140
+
141
+ ```sh
142
+ docker pull ghcr.io/mermaid-js/mermaid-cli/mermaid-cli
143
+ ```
144
+
145
+ or e.g. version 8.8.0
146
+
147
+ ```sh
148
+ docker pull minlag/mermaid-cli:8.8.0
149
+ ```
150
+
151
+ The container looks for input files in `/data`. So for example, if you have a
152
+ diagram defined on your system in `/path/to/diagrams/diagram.mmd`, you can use
153
+ the container to generate an SVG file as follows:
154
+
155
+ ```sh
156
+ docker run --rm -u `id -u`:`id -g` -v /path/to/diagrams:/data minlag/mermaid-cli -i diagram.mmd
157
+ ```
158
+
159
+ Or, if using [Podman](https://podman.io/), instead do:
160
+
161
+ ```sh
162
+ podman run --userns keep-id --user ${UID} --rm -v /path/to/diagrams:/data:z ghcr.io/mermaid-js/mermaid-cli/mermaid-cli -i diagram.mmd
163
+ ```
164
+
165
+ The key differences in the podman command versus the docker command are:
166
+
167
+ - The addition of the `--userns keep-id` argument. This allows the container to keep the same UID as the current user's UID in the container namespace instead of mapping to a subuid. To learn more, see the [`userns=mode` documentation](https://docs.podman.io/en/v4.4/markdown/options/userns.container.html).
168
+ - The addition of `:z` to the end of the volume mapping. This instructs podman to relabel the files in the volume with the SELinux label `container_file_t`, which allows processes in the container to access the files. See the "Labeling Volume Mounts" section of [podman-run (1)](https://docs.podman.io/en/latest/markdown/podman-run.1.html#volume-v-source-volume-host-dir-container-dir-options) for more info.
169
+
170
+ In previous version, the input files were mounted in `/home/mermaidcli`. You can
171
+ restore this behaviour with the `--workdir` option:
172
+
173
+ ```sh
174
+ docker run [...] --workdir=/home/mermaidcli minlag/mermaid-cli [...]
175
+ ```
176
+
177
+ ## Use Node.JS API
178
+
179
+ It's possible to call `mermaid-cli` via a Node.JS API.
180
+ Please be aware that **the NodeJS API is not covered by semver**, as `mermaid-cli` follows
181
+ `mermaid`'s versioning.
182
+
183
+ ```js
184
+ import { run } from "@mermaid-js/mermaid-cli";
185
+
186
+ await run(
187
+ "input.mmd",
188
+ "output.svg", // {optional options},
189
+ );
190
+ ```
191
+
192
+ ## Install locally
193
+
194
+ Some people are [having issues](https://github.com/mermaidjs/mermaid.cli/issues/15)
195
+ installing this tool globally. Installing it locally is an alternative solution:
196
+
197
+ ```
198
+ npm install @mermaid-js/mermaid-cli
199
+ ./node_modules/.bin/mmdc -h
200
+ ```
201
+
202
+ ### Run with npx
203
+
204
+ [`npx`](https://www.npmjs.com/package/npx) is installed by default with NPM. It
205
+ downloads and runs commands at the same time. To use Mermaid CLI with npx, you
206
+ need to use the `-p` flag because the package name is different than the command
207
+ it installs (`mmdc`). `npx -p @mermaid-js/mermaid-cli mmdc -h`
208
+
209
+ ## Install with [brew](https://brew.sh)
210
+
211
+ > **Warning**
212
+ >
213
+ > This method of installation is no longer supported.
214
+ > For more details, see the [discussion](https://github.com/mermaid-js/mermaid-cli/issues/288).
215
+ > An old version of mermaid-cli can be installed with brew.
216
+ >
217
+ > ```sh
218
+ > brew install mermaid-cli
219
+ > ```
220
+
221
+ ## Known issues
222
+
223
+ 1. [Linux sandbox issue](docs/linux-sandbox-issue.md)
224
+ 2. [Docker permission denied issue](docs/docker-permission-denied.md)
225
+ 3. [How to setup up mermaid to use already installed chromium?](docs/already-installed-chromium.md)
226
+
227
+ ## For contributors
228
+
229
+ Contributions are welcome. See the [contribution guide](CONTRIBUTING.md).
@@ -0,0 +1,6 @@
1
+ <!doctype html>
2
+ <html>
3
+ <body>
4
+ <div id="container"></div>
5
+ </body>
6
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.js"],"names":[],"mappings":""}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Options to pass to {@link parseMMD}
3
+ */
4
+ export type ParseMDDOptions = {
5
+ /**
6
+ * - Puppeteer viewport (e.g. `width`, `height`, `deviceScaleFactor`)
7
+ */
8
+ viewport?: import("puppeteer-core").Viewport | undefined;
9
+ /**
10
+ * - Background color.
11
+ */
12
+ backgroundColor?: string | undefined;
13
+ /**
14
+ * - Mermaid config.
15
+ */
16
+ mermaidConfig?: import("mermaid").MermaidConfig | undefined;
17
+ /**
18
+ * - Optional CSS text.
19
+ */
20
+ myCSS?: string | undefined;
21
+ /**
22
+ * - If set, scale PDF to fit chart.
23
+ */
24
+ pdfFit?: boolean | undefined;
25
+ /**
26
+ * - The id attribute for the SVG element to be rendered.
27
+ */
28
+ svgId?: string | undefined;
29
+ /**
30
+ * - Icon packages to use.
31
+ */
32
+ iconPacks?: string[] | undefined;
33
+ /**
34
+ * - IconPack Json file name and url to use.
35
+ *
36
+ * /**
37
+ * Render a mermaid diagram.
38
+ */
39
+ iconPacksNamesAndUrls?: string[] | undefined;
40
+ };
41
+ /**
42
+ * Markdown image properties
43
+ * Used to create a markdown image that looks like `![alt](url "title")`
44
+ */
45
+ export type MarkdownImageProps = {
46
+ /**
47
+ * - Path to image.
48
+ */
49
+ url: string;
50
+ /**
51
+ * - Image alt text, required.
52
+ */
53
+ alt: string;
54
+ /**
55
+ * - Optional image title text.
56
+ */
57
+ title?: string | null | undefined;
58
+ };
59
+ /**
60
+ * - Adapted from `p-limit` package.
61
+ */
62
+ export type Limiter = <Arguments extends unknown[], ReturnType>(function_: (...arguments_: Arguments) => Promise<ReturnType>, ...arguments_: Arguments) => Promise<ReturnType>;
63
+ /**
64
+ * @typedef {<Arguments extends unknown[], ReturnType>(
65
+ * function_: (...arguments_: Arguments) => Promise<ReturnType>,
66
+ * ...arguments_: Arguments
67
+ * ) => Promise<ReturnType>} Limiter - Adapted from `p-limit` package.
68
+ */
69
+ /**
70
+ * Renders a mermaid diagram or mermaid markdown file.
71
+ *
72
+ * @param {`${string}.${"md" | "markdown"}` | string | undefined} input - If this ends with `.md`/`.markdown`,
73
+ * path to a markdown file containing mermaid.
74
+ * If this is a string, loads the mermaid definition from the given file.
75
+ * If this is `undefined`, loads the mermaid definition from stdin.
76
+ * @param {`${string}.${"md" | "markdown" | "svg" | "png" | "pdf"}` | "/dev/stdout"} output - Path to the output file.
77
+ * @param {Object} [opts] - Options
78
+ * @param {import("puppeteer").LaunchOptions} [opts.puppeteerConfig] - Puppeteer launch options.
79
+ * @param {boolean} [opts.quiet] - If set, suppress log output.
80
+ * @param {"svg" | "png" | "pdf"} [opts.outputFormat] - Mermaid output format.
81
+ * @param {string} [opts.artefacts] - Path to the artefacts directory.
82
+ * Defaults to `output` extension. Overrides `output` extension if set.
83
+ * @param {import("puppeteer").Browser} [opts.browser] - If set, reuses the given puppeteer browser instance instead of creating a new one.
84
+ * This may leak cookies/cache between runs.
85
+ * @param {Limiter} [opts.limiter] - If set, limiter function to avoid rendering too many diagrams in parallel.
86
+ * @param {ParseMDDOptions} [opts.parseMMDOptions] - Options to pass to {@link parseMMDOptions}.
87
+ */
88
+ export function run(input: `${string}.${"md" | "markdown"}` | string | undefined, output: `${string}.${"md" | "markdown" | "svg" | "png" | "pdf"}` | "/dev/stdout", { browser: userPassedBrowser, puppeteerConfig, quiet, outputFormat, parseMMDOptions, limiter, artefacts, }?: {
89
+ puppeteerConfig?: import("puppeteer-core").LaunchOptions | undefined;
90
+ quiet?: boolean | undefined;
91
+ outputFormat?: "svg" | "png" | "pdf" | undefined;
92
+ artefacts?: string | undefined;
93
+ browser?: import("puppeteer-core").Browser | undefined;
94
+ limiter?: Limiter | undefined;
95
+ parseMMDOptions?: ParseMDDOptions | undefined;
96
+ }): Promise<void>;
97
+ /**
98
+ * @typedef {Object} ParseMDDOptions Options to pass to {@link parseMMD}
99
+ * @property {import("puppeteer").Viewport} [viewport] - Puppeteer viewport (e.g. `width`, `height`, `deviceScaleFactor`)
100
+ * @property {string | "transparent"} [backgroundColor] - Background color.
101
+ * @property {Parameters<import("mermaid")["default"]["initialize"]>[0]} [mermaidConfig] - Mermaid config.
102
+ * @property {CSSStyleDeclaration["cssText"]} [myCSS] - Optional CSS text.
103
+ * @property {boolean} [pdfFit] - If set, scale PDF to fit chart.
104
+ * @property {string} [svgId] - The id attribute for the SVG element to be rendered.
105
+ * @property {string[]} [iconPacks] - Icon packages to use.
106
+ * @property {string[]} [iconPacksNamesAndUrls] - IconPack Json file name and url to use.
107
+
108
+ /**
109
+ * Render a mermaid diagram.
110
+ *
111
+ * @param {import("puppeteer").Browser | import("puppeteer").BrowserContext} browser - Puppeteer Browser
112
+ * @param {string} definition - Mermaid diagram definition
113
+ * @param {"svg" | "png" | "pdf"} outputFormat - Mermaid output format.
114
+ * @param {ParseMDDOptions} [opt] - Options, see {@link ParseMDDOptions} for details.
115
+ * @returns {Promise<{title: string | null, desc: string | null, data: Uint8Array}>} The output file in bytes,
116
+ * with optional metadata.
117
+ */
118
+ export function renderMermaid(browser: import("puppeteer").Browser | import("puppeteer").BrowserContext, definition: string, outputFormat: "svg" | "png" | "pdf", { viewport, backgroundColor, mermaidConfig, myCSS, pdfFit, svgId, iconPacks, iconPacksNamesAndUrls, }?: ParseMDDOptions): Promise<{
119
+ title: string | null;
120
+ desc: string | null;
121
+ data: Uint8Array;
122
+ }>;
123
+ export function cli(): Promise<void>;
124
+ /**
125
+ * Prints an error to stderr, then closes with exit code 1
126
+ *
127
+ * @param {string} message - The message to print to `stderr`.
128
+ * @returns {never} Quits Node.JS, so never returns.
129
+ */
130
+ export function error(message: string): never;
131
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAgqBc,MAAM;;;;SACN,MAAM;;;;;;;;;sBAsBP,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,UAAU,EACjD,SAAS,EAAE,CAAC,GAAG,UAAU,EAAE,SAAS,KAAK,OAAO,CAAC,UAAU,CAAC,EAC/D,GAAQ,UAAU,EAAE,SAAS,KACtB,OAAO,CAAC,UAAU,CAAC;AAJ3B;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,2BAhBW,GAAG,MAAM,IAAI,IAAI,GAAG,UAAU,EAAE,GAAG,MAAM,GAAG,SAAS,UAIrD,GAAG,MAAM,IAAI,IAAI,GAAG,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,EAAE,GAAG,aAAa,+GAEhF;IAAiD,eAAe;IACzC,KAAK;IACS,YAAY;IAC3B,SAAS;IAEY,OAAO;IAE3B,OAAO;IACC,eAAe;CAChD,iBAiKA;AAxeD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uCAPW,OAAO,WAAW,EAAE,OAAO,GAAG,OAAO,WAAW,EAAE,cAAc,cAChE,MAAM,gBACN,KAAK,GAAG,KAAK,GAAG,KAAK,0GACrB,eAAe,GACb,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAC,CAAC,CAiQlF;AAhfD,qCA2NC;AA/TD;;;;;GAKG;AACH,+BAHW,MAAM,GACJ,KAAK,CAKjB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Puppeteer doesn't allow importing ESM modules from `file://` URLs.
3
+ * We don't want to create a dummy http server to serve ESM modules
4
+ * (since that would cause issues with ports/firewalls), so this module
5
+ * instead intercepts dummy `https://mermaid-cli-intercept.invalid` requests.
6
+ */
7
+ export class Interceptor {
8
+ /**
9
+ * @param {URL | `file://${string}`} fileUrl - File URL
10
+ * @param {Object} [options] - Optional options.
11
+ * @param {number} [options.allowParentDirectoryLevel] - Number of parent directory levels to allow access to.
12
+ */
13
+ fileUrlToInterceptUrl(fileUrl: URL | `file://${string}`, { allowParentDirectoryLevel }?: {
14
+ allowParentDirectoryLevel?: number | undefined;
15
+ }): Promise<string>;
16
+ /**
17
+ *
18
+ * @param {URL | string} interceptUrl
19
+ * @throws {Error} If the URL is not a valid intercept URL
20
+ */
21
+ interceptUrlToFileUrl(interceptUrl: URL | string): Promise<URL>;
22
+ /**
23
+ * Intercepts requests to `https://mermaid-cli-intercept.invalid`
24
+ * and serves the corresponding file content.
25
+ *
26
+ * @return {import('puppeteer').Handler<import('puppeteer').HTTPRequest>}
27
+ */
28
+ get interceptRequestHandler(): import("puppeteer").Handler<import("puppeteer").HTTPRequest>;
29
+ #private;
30
+ }
31
+ //# sourceMappingURL=puppeteerIntercept.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puppeteerIntercept.d.ts","sourceRoot":"","sources":["../../src/puppeteerIntercept.js"],"names":[],"mappings":"AAgCA;;;;;GAKG;AACH;IAcE;;;;OAIG;IACH,+BAJW,GAAG,GAAG,UAAU,MAAM,EAAE,kCAEhC;QAAyB,yBAAyB;KACpD,mBAYA;IAED;;;;OAIG;IACH,oCAHW,GAAG,GAAG,MAAM,gBAuBtB;IAiCD;;;;;OAKG;IACH,+BAFY,OAAO,WAAW,EAAE,OAAO,CAAC,OAAO,WAAW,EAAE,WAAW,CAAC,CAIvE;;CACF"}
@@ -0,0 +1,2 @@
1
+ export const version: "11.16.0";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.js"],"names":[],"mappings":"AAAA,sBAAuB,SAAS,CAAC"}
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@ohos-ports/mermaid-js-mermaid-cli",
3
+ "version": "11.16.0-beta.0",
4
+ "description": "Command-line interface for mermaid",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ohos-ports/ohos-ports.git",
9
+ "directory": "ports/mermaid-cli/11.16.0"
10
+ },
11
+ "type": "module",
12
+ "author": "Tyler Long <tyler4long@gmail.com>",
13
+ "bin": {
14
+ "mmdc": "./src/cli.js"
15
+ },
16
+ "engines": {
17
+ "node": "^18.19 || >=20.0"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist-types/src/index.d.ts",
22
+ "default": "./src/index.js"
23
+ }
24
+ },
25
+ "types": "./dist-types/src/index.d.ts",
26
+ "scripts": {
27
+ "test": "cross-env-shell NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest",
28
+ "test:cli": "bash run-tests.sh test-positive",
29
+ "version": "node scripts/version.js",
30
+ "lint": "prettier --check . && eslint .",
31
+ "lint-fix": "prettier --write . && eslint --fix ."
32
+ },
33
+ "dependencies": {
34
+ "@fortawesome/fontawesome-free": "^6.0.0 || ^7.0.1",
35
+ "@mermaid-js/layout-elk": "^0.1.5 || ^0.2.0",
36
+ "@mermaid-js/mermaid-zenuml": "^0.2.0",
37
+ "chalk": "^5.0.1",
38
+ "commander": "^13.1.0",
39
+ "import-meta-resolve": "^4.1.0",
40
+ "katex": "^0.16.25",
41
+ "mermaid": "^11.14.0",
42
+ "p-limit": "^6.2.0"
43
+ },
44
+ "optionalDependencies": {
45
+ "@mermaid-js/layout-tidy-tree": "^0.2.1"
46
+ },
47
+ "peerDependencies": {
48
+ "@ohos-ports/puppeteer": "^25.6.0-beta.0"
49
+ },
50
+ "devDependencies": {
51
+ "@eslint/js": "^9.0.0",
52
+ "@tsconfig/node18": "^18.2.4",
53
+ "@types/node": "~18.19.31",
54
+ "cross-env": "^7.0.3",
55
+ "eslint": "^9.0.0",
56
+ "globals": "^17.6.0",
57
+ "jest": "^30.0.5",
58
+ "prettier": "^3.8.3",
59
+ "puppeteer": "^25.0.0",
60
+ "typescript": "^6.0.3",
61
+ "typescript-eslint": "^8.59.3",
62
+ "vite": "^6.0.2",
63
+ "yarn-upgrade-all": "^0.8.1"
64
+ },
65
+ "files": [
66
+ "src/",
67
+ "dist/",
68
+ "dist-types/"
69
+ ],
70
+ "jest": {
71
+ "moduleNameMapper": {
72
+ "#(.*)": "<rootDir>/node_modules/$1"
73
+ }
74
+ },
75
+ "packageManager": "npm@10.8.1"
76
+ }
package/src/cli.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cli, error } from "./index.js";
4
+
5
+ process.title = "mmdc";
6
+ cli().catch((exception) =>
7
+ error(exception instanceof Error ? exception.stack : exception),
8
+ );