From fc2f31e49403c0bf6f09501b3ce5f408e2f441f3 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Mon, 22 Aug 2022 04:59:33 +0100 Subject: [PATCH] fix: support mermaid v9.1.6 Simplifies the code by calling the new mermaid-cli Node.JS API directly, which was introduced in Mermaid v9.1.6. In the future, it should be possible to optimise the plugin by reusing the same browser instance too. --- .eslintrc.js | 3 + CHANGELOG.md | 13 +++ index.js | 121 ++++----------------- jest.config.js | 4 + mermaid_hook.js | 61 ----------- package-lock.json | 264 +++++++++++++++++++--------------------------- package.json | 5 +- 7 files changed, 151 insertions(+), 320 deletions(-) delete mode 100644 mermaid_hook.js diff --git a/.eslintrc.js b/.eslintrc.js index 68a491c..84cdbda 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,6 @@ module.exports = { extends: ["plugin:prettier/recommended", "plugin:node/recommended"], + parserOptions: { + ecmaVersion: 2020, + }, }; diff --git a/CHANGELOG.md b/CHANGELOG.md index 5316b38..299d6a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed support for mermaid-cli `^9.1.6` + +### Dependencies + +- Updated `mermaid-cli` version to `^9.1.6` + - This increases the minimum version of `mermaid` to `^9.1.6`, see + https://github.com/mermaid-js/mermaid/releases/tag/9.1.6 +- Removed unneeded dependency on `memfs` +- Added dependency on puppeteer `^16.0.0` + - puppeteer was previously a transitive dependency from `mermaid-cli` + ## [2.0.1] - 2022-07-21 ### Fixed diff --git a/index.js b/index.js index afe7a55..7424732 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,12 @@ -const { Volume } = require("memfs"); -const childProcess = require("child_process"); -const path = require("path"); +const { readFile } = require("fs/promises"); +const puppeteer = require("puppeteer"); const visit = require("unist-util-visit"); -const mmdc = require.resolve("@mermaid-js/mermaid-cli/index.bundle.js"); const { setSvgBbox, validSVG } = require("./src/svg.js"); const PLUGIN_NAME = "remark-mermaid-dataurl"; -const createVolume = () => { - const volume = new Volume(); - volume.mkdirSync(process.cwd(), { recursive: true }); - return volume; -}; - /** * Calls mmdc (mermaid-cli) with the given keyword args. * @@ -29,104 +21,35 @@ const createVolume = () => { * @throws {Error} If mmdc fails in anyways. * @returns {Promise} Returns the rendered mermaid code as an SVG. */ -function renderMermaidFile(kwargs, input) { - const volume = createVolume(); - const cwd = process.cwd(); - const outputPath = path.join(cwd, "output.svg"); - const inputPath = path.join(cwd, "input"); - volume.writeFileSync(inputPath, input, "utf8"); - - if (kwargs.configFile && typeof kwargs.configFile === "object") { - const configFilePath = path.join(cwd, "config.json"); - volume.writeFileSync( - configFilePath, - JSON.stringify(kwargs.configFile), - "utf8" +async function renderMermaidFile(kwargs, input) { + let configFile = kwargs.configFile ?? {}; + if (kwargs.configFile && typeof kwargs.configFile !== "object") { + configFile = JSON.parse( + await readFile(kwargs.configFile, { encoding: "utf8" }) ); - kwargs = { ...kwargs, configFile: configFilePath }; } + let puppeteerConfigFile = kwargs.puppeteerConfigFile ?? {}; if ( kwargs.puppeteerConfigFile && - typeof kwargs.puppeteerConfigFile === "object" + typeof kwargs.puppeteerConfigFile !== "object" ) { - const puppeteerConfigFilePath = path.join(cwd, "puppeteerConfigFile.json"); - volume.writeFileSync( - puppeteerConfigFilePath, - JSON.stringify(kwargs.puppeteerConfigFile), - "utf8" + puppeteerConfigFile = JSON.parse( + await readFile(kwargs.puppeteerConfigFile, { encoding: "utf8" }) ); - kwargs = { ...kwargs, puppeteerConfigFile: puppeteerConfigFilePath }; } - // Array.flatMap() was only added in NodeJS v11 - const args = [].concat( - ...Object.entries({ - ...kwargs, - input: inputPath, - output: outputPath, - }).map(([key, value]) => [`--${key}`, value]) - ); - const child_process = childProcess.fork( - require.resolve("./mermaid_hook"), - args, - { - // store stderr for errors, and ipc for piping memfs info - stdio: ["ignore", "ignore", "pipe", "ipc"], - } - ); - - const stderrChunks = []; - child_process.send(volume.toJSON()); - - child_process.stderr.on("data", (chunk) => stderrChunks.push(chunk)); - - return new Promise((resolve, reject) => { - let exited = false; // stream may error AND exit - child_process.on("message", (message) => { - exited = true; - child_process.kill(); - volume.fromJSON(message); - resolve(volume.promises.readFile(outputPath, { encoding: "utf8" })); - }); - child_process.on("error", (error) => { - exited = true; - reject(error); - }); - child_process.on("exit", (code, signal) => { - if (exited) { - return; // already resolved Promise - } - if (code) { - reject( - new Error( - `${mmdc} with kwargs ${JSON.stringify( - kwargs - )} failed with error code: ${code} and stderr: ${Buffer.concat( - stderrChunks - ).toString("utf-8")}` - ) - ); - } else if (signal) { - reject( - new Error( - `${mmdc} with kwargs ${JSON.stringify( - kwargs - )} recieved signal ${signal}` - ) - ); - } else { - // Mermaid-CLI throws unhandledRejection warnings - // which sometimes return exit code 0 - reject( - new Error( - `${mmdc} with kwargs ${JSON.stringify( - kwargs - )} exited without returning created SVG.` - ) - ); - } + // eslint-disable-next-line node/no-unsupported-features/es-syntax, node/no-missing-import + const { parseMMD } = await import("@mermaid-js/mermaid-cli"); + const browser = await puppeteer.launch(puppeteerConfigFile); + try { + const outputSvg = await parseMMD(browser, input, "svg", { + mermaidConfig: configFile, + viewport: { width: 800, height: 600 }, }); - }); + return outputSvg.toString("utf8"); + } finally { + await browser.close(); + } } /** Converts a string to a base64 string */ diff --git a/jest.config.js b/jest.config.js index 77c19f9..3756cdd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,4 +11,8 @@ module.exports = { ], // work around for https://github.com/nodejs/node/issues/35889#issuecomment-1129293091 runner: "jest-light-runner", + // from https://github.com/chalk/chalk/issues/532 + "moduleNameMapper": { + "#(.*)": "/node_modules/$1" + }, }; diff --git a/mermaid_hook.js b/mermaid_hook.js deleted file mode 100644 index 18a63c4..0000000 --- a/mermaid_hook.js +++ /dev/null @@ -1,61 +0,0 @@ -const { Volume } = require("memfs"); -const fs = require("fs"); -const { callbackify } = require("util"); - -const mermaid_cli = require.resolve("@mermaid-js/mermaid-cli/index.bundle.js"); - -const patch_fs = (fs, volume, methods = []) => { - const bkup = {}; - methods.forEach((method) => { - bkup[method] = fs[method]; - fs[method] = volume[method].bind(volume); - }); - return () => { - Object.keys(bkup).forEach((method) => { - fs[method] = bkup[method]; - }); - }; -}; - -process.once("message", function (volumeJSON) { - const virtualVolume = Volume.fromJSON(volumeJSON); - virtualVolume.mkdirSync(process.cwd(), { recursive: true }); - - // bind these functions to the original unpatched fs - const existsSync = fs.existsSync.bind(fs); - const readFile = fs.readFile.bind(fs); - const readFileSync = fs.readFileSync.bind(fs); - - patch_fs( - fs, - { - writeFileSync: (...args) => { - virtualVolume.writeFileSync(...args); - process.send(virtualVolume.toJSON()); - }, - writeFile: callbackify((...args) => { - virtualVolume.writeFileSync(...args); - process.send(virtualVolume.toJSON()); - return Promise.resolve(); - }), - existsSync: (path) => { - return existsSync(path) || virtualVolume.existsSync(path); - }, - readFile: (path, opts, cb) => { - if (virtualVolume.existsSync(path)) { - return virtualVolume.readFile(path, opts, cb); - } - readFile(path, opts, cb); - }, - readFileSync: (path, opts) => { - if (virtualVolume.existsSync(path)) { - return virtualVolume.readFileSync(path, opts); - } - return readFileSync(path, opts); - }, - }, - ["writeFileSync", "existsSync", "readFile", "writeFile", "readFileSync"] - ); - - require(mermaid_cli); -}); diff --git a/package-lock.json b/package-lock.json index 7b4abb2..b3407fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,9 @@ "version": "2.0.1", "license": "MIT", "dependencies": { - "@mermaid-js/mermaid-cli": "^9.1.4", + "@mermaid-js/mermaid-cli": "^9.1.6", "@svgdotjs/svg.js": "^3.1.2", - "memfs": "^3.2.0", + "puppeteer": "^16.0.0", "svgdom": "^0.1.10", "unist-util-visit": "^2.0.3" }, @@ -26,7 +26,6 @@ "jest-light-runner": "^0.3.0", "lint-staged": "^13.0.3", "prettier": "^2.2.1", - "puppeteer": "^16.0.0", "rehype-document": "^6.0.1", "rehype-stringify": "^9.0.3", "remark": "^14.0.0", @@ -959,23 +958,30 @@ } }, "node_modules/@mermaid-js/mermaid-cli": { - "version": "9.1.5", - "resolved": "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-9.1.5.tgz", - "integrity": "sha512-A3IjnREoB1+4klqTyUfZ7b7KSztmlJsNlXKmrgrpGCI1GAfFUrrE2ToaMAAZU1P0WeWXtd+wlcx3mPI8/sEL1w==", + "version": "9.1.6", + "resolved": "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-9.1.6.tgz", + "integrity": "sha512-pE81Zfvni1qMAhqW4RkpwJ2L7Y5OFs+svSWq6cW5IQHWR8Dd8BBZL4p93GgqiVoLPTJ2heGVBKZFsgA2RPR6ng==", "dependencies": { - "chalk": "^4.1.0", + "chalk": "^5.0.1", "commander": "^9.0.0", "puppeteer": "^16.1.0" }, "bin": { - "mmdc": "index.bundle.js" + "mmdc": "src/cli.js" + }, + "engines": { + "node": ">=14.1.0" } }, - "node_modules/@mermaid-js/mermaid-cli/node_modules/commander": { - "version": "9.3.0", - "license": "MIT", + "node_modules/@mermaid-js/mermaid-cli/node_modules/chalk": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", + "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==", "engines": { - "node": "^12.20.0 || >=14" + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/@nodelib/fs.scandir": { @@ -1285,6 +1291,7 @@ }, "node_modules/ansi-styles": { "version": "4.3.0", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -1616,6 +1623,7 @@ }, "node_modules/chalk": { "version": "4.1.2", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -1793,6 +1801,7 @@ }, "node_modules/color-convert": { "version": "2.0.1", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -1803,6 +1812,7 @@ }, "node_modules/color-name": { "version": "1.1.4", + "dev": true, "license": "MIT" }, "node_modules/colorette": { @@ -1820,6 +1830,14 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/commander": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz", + "integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==", + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/concat-map": { "version": "0.0.1", "license": "MIT" @@ -2136,9 +2154,9 @@ } }, "node_modules/eslint": { - "version": "8.22.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.22.0.tgz", - "integrity": "sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA==", + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.21.0.tgz", + "integrity": "sha512-/XJ1+Qurf1T9G2M5IHrsjp+xrGT73RZf23xA1z5wB1ZzzEAWSZKvRwhWxTFp1rvkvCfwcvAUNAP31bhKTTGfDA==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.3.0", @@ -2769,28 +2787,10 @@ "version": "1.0.0", "license": "MIT" }, - "node_modules/fs-monkey": { - "version": "1.0.3", - "license": "Unlicense" - }, "node_modules/fs.realpath": { "version": "1.0.0", "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "license": "MIT" @@ -2924,9 +2924,10 @@ } }, "node_modules/globals": { - "version": "13.16.0", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, - "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -3003,6 +3004,7 @@ }, "node_modules/has-flag": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -4498,25 +4500,6 @@ "node": ">= 0.8.0" } }, - "node_modules/levn/node_modules/prelude-ls": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/levn/node_modules/type-check": { - "version": "0.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/lilconfig": { "version": "2.0.5", "dev": true, @@ -4559,14 +4542,6 @@ "url": "https://opencollective.com/lint-staged" } }, - "node_modules/lint-staged/node_modules/commander": { - "version": "9.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || >=14" - } - }, "node_modules/listr2": { "version": "4.0.5", "dev": true, @@ -4944,16 +4919,6 @@ "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, - "node_modules/memfs": { - "version": "3.4.7", - "license": "Unlicense", - "dependencies": { - "fs-monkey": "^1.0.3" - }, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/merge-stream": { "version": "2.0.0", "dev": true, @@ -5665,25 +5630,6 @@ "node": ">= 0.8.0" } }, - "node_modules/optionator/node_modules/prelude-ls": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/optionator/node_modules/type-check": { - "version": "0.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/p-limit": { "version": "2.3.0", "license": "MIT", @@ -5889,6 +5835,15 @@ "node": ">=4.0.0" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/prettier": { "version": "2.7.1", "dev": true, @@ -5998,9 +5953,9 @@ } }, "node_modules/puppeteer": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-16.1.1.tgz", - "integrity": "sha512-lBneizsNF0zi1/iog9c0ogVnvDHJG4IWpkdIAgE2oiDKhr0MJRV8JeM2xbhUwCwhDJXjjVS2TNCZdLsMp9Ojdg==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-16.1.0.tgz", + "integrity": "sha512-lhykJLbH2bbBaP3NfYI2Vj0T4ctrdfVdEVf8glZITPnLfqrJ0nfUzAYuIz5YcA79k5lmFKANIhEXex+jQChU3g==", "hasInstallScript": true, "dependencies": { "cross-fetch": "3.1.5", @@ -6623,6 +6578,7 @@ }, "node_modules/supports-color": { "version": "7.2.0", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -6793,6 +6749,18 @@ "version": "2.4.0", "license": "0BSD" }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "dev": true, @@ -7913,17 +7881,19 @@ } }, "@mermaid-js/mermaid-cli": { - "version": "9.1.5", - "resolved": "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-9.1.5.tgz", - "integrity": "sha512-A3IjnREoB1+4klqTyUfZ7b7KSztmlJsNlXKmrgrpGCI1GAfFUrrE2ToaMAAZU1P0WeWXtd+wlcx3mPI8/sEL1w==", + "version": "9.1.6", + "resolved": "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-9.1.6.tgz", + "integrity": "sha512-pE81Zfvni1qMAhqW4RkpwJ2L7Y5OFs+svSWq6cW5IQHWR8Dd8BBZL4p93GgqiVoLPTJ2heGVBKZFsgA2RPR6ng==", "requires": { - "chalk": "^4.1.0", + "chalk": "^5.0.1", "commander": "^9.0.0", "puppeteer": "^16.1.0" }, "dependencies": { - "commander": { - "version": "9.3.0" + "chalk": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", + "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==" } } }, @@ -8162,6 +8132,7 @@ }, "ansi-styles": { "version": "4.3.0", + "dev": true, "requires": { "color-convert": "^2.0.1" } @@ -8349,6 +8320,7 @@ }, "chalk": { "version": "4.1.2", + "dev": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8454,12 +8426,14 @@ }, "color-convert": { "version": "2.0.1", + "dev": true, "requires": { "color-name": "~1.1.4" } }, "color-name": { - "version": "1.1.4" + "version": "1.1.4", + "dev": true }, "colorette": { "version": "2.0.19", @@ -8471,6 +8445,11 @@ "integrity": "sha512-G5yTt3KQN4Yn7Yk4ed73hlZ1evrFKXeUW3086p3PRFNp7m2vIjI6Pg+Kgb+oyzhd9F2qdcoj67+y3SdxL5XWsg==", "dev": true }, + "commander": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz", + "integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==" + }, "concat-map": { "version": "0.0.1" }, @@ -8689,9 +8668,9 @@ "dev": true }, "eslint": { - "version": "8.22.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.22.0.tgz", - "integrity": "sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA==", + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.21.0.tgz", + "integrity": "sha512-/XJ1+Qurf1T9G2M5IHrsjp+xrGT73RZf23xA1z5wB1ZzzEAWSZKvRwhWxTFp1rvkvCfwcvAUNAP31bhKTTGfDA==", "dev": true, "requires": { "@eslint/eslintrc": "^1.3.0", @@ -9094,19 +9073,9 @@ "fs-constants": { "version": "1.0.0" }, - "fs-monkey": { - "version": "1.0.3" - }, "fs.realpath": { "version": "1.0.0" }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, "function-bind": { "version": "1.1.1" }, @@ -9182,7 +9151,9 @@ } }, "globals": { - "version": "13.16.0", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -9233,7 +9204,8 @@ "version": "1.0.2" }, "has-flag": { - "version": "4.0.0" + "version": "4.0.0", + "dev": true }, "has-property-descriptors": { "version": "1.0.0", @@ -10177,19 +10149,6 @@ "requires": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" - }, - "dependencies": { - "prelude-ls": { - "version": "1.2.1", - "dev": true - }, - "type-check": { - "version": "0.4.0", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - } } }, "lilconfig": { @@ -10217,12 +10176,6 @@ "pidtree": "^0.6.0", "string-argv": "^0.3.1", "yaml": "^2.1.1" - }, - "dependencies": { - "commander": { - "version": "9.3.0", - "dev": true - } } }, "listr2": { @@ -10493,12 +10446,6 @@ "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "dev": true }, - "memfs": { - "version": "3.4.7", - "requires": { - "fs-monkey": "^1.0.3" - } - }, "merge-stream": { "version": "2.0.0", "dev": true @@ -10903,19 +10850,6 @@ "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.3" - }, - "dependencies": { - "prelude-ls": { - "version": "1.2.1", - "dev": true - }, - "type-check": { - "version": "0.4.0", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - } } }, "p-limit": { @@ -11034,6 +10968,12 @@ "version": "3.4.0", "dev": true }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, "prettier": { "version": "2.7.1", "dev": true @@ -11099,9 +11039,9 @@ "dev": true }, "puppeteer": { - "version": "16.1.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-16.1.1.tgz", - "integrity": "sha512-lBneizsNF0zi1/iog9c0ogVnvDHJG4IWpkdIAgE2oiDKhr0MJRV8JeM2xbhUwCwhDJXjjVS2TNCZdLsMp9Ojdg==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-16.1.0.tgz", + "integrity": "sha512-lhykJLbH2bbBaP3NfYI2Vj0T4ctrdfVdEVf8glZITPnLfqrJ0nfUzAYuIz5YcA79k5lmFKANIhEXex+jQChU3g==", "requires": { "cross-fetch": "3.1.5", "debug": "4.3.4", @@ -11485,6 +11425,7 @@ }, "supports-color": { "version": "7.2.0", + "dev": true, "requires": { "has-flag": "^4.0.0" } @@ -11595,6 +11536,15 @@ "tslib": { "version": "2.4.0" }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, "type-detect": { "version": "4.0.8", "dev": true diff --git a/package.json b/package.json index 97d0484..7748ea8 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,9 @@ }, "homepage": "https://github.com/aloisklink/remark-mermaid-dataurl#readme", "dependencies": { - "@mermaid-js/mermaid-cli": "^9.1.4", + "@mermaid-js/mermaid-cli": "^9.1.6", "@svgdotjs/svg.js": "^3.1.2", - "memfs": "^3.2.0", + "puppeteer": "^16.0.0", "svgdom": "^0.1.10", "unist-util-visit": "^2.0.3" }, @@ -48,7 +48,6 @@ "jest-light-runner": "^0.3.0", "lint-staged": "^13.0.3", "prettier": "^2.2.1", - "puppeteer": "^16.0.0", "rehype-document": "^6.0.1", "rehype-stringify": "^9.0.3", "remark": "^14.0.0",