From 4f0e18b088d7fa5836973139c2e61ed343a778f6 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 31 Aug 2022 23:16:57 +0530 Subject: [PATCH 01/33] Esbuild --- .webpack/webpack.config.base.js | 14 ++- .webpack/webpack.config.e2e.babel.js | 2 +- esbuild.cjs | 31 +++++ jisonLoader.js | 6 + jisonTransformer.js | 9 ++ package.json | 2 + yarn.lock | 169 ++++++++++++++++++++++++++- 7 files changed, 229 insertions(+), 4 deletions(-) create mode 100644 esbuild.cjs create mode 100644 jisonLoader.js create mode 100644 jisonTransformer.js diff --git a/.webpack/webpack.config.base.js b/.webpack/webpack.config.base.js index 055f59dfc9..16b46dc5a0 100644 --- a/.webpack/webpack.config.base.js +++ b/.webpack/webpack.config.base.js @@ -1,5 +1,5 @@ import path from 'path'; - +const { ESBuildMinifyPlugin } = require('esbuild-loader'); export const resolveRoot = (...relativePath) => path.resolve(__dirname, '..', ...relativePath); export default { @@ -31,7 +31,10 @@ export default { test: /\.js$/, include: [resolveRoot('./src'), resolveRoot('./node_modules/dagre-d3-renderer/lib')], use: { - loader: 'babel-loader', + loader: 'esbuild-loader', + options: { + target: 'es2015', + }, }, }, { @@ -51,4 +54,11 @@ export default { ], }, devtool: 'source-map', + optimization: { + minimizer: [ + new ESBuildMinifyPlugin({ + target: 'es2015', + }), + ], + }, }; diff --git a/.webpack/webpack.config.e2e.babel.js b/.webpack/webpack.config.e2e.babel.js index 3ec2bdcd78..719fb9304a 100644 --- a/.webpack/webpack.config.e2e.babel.js +++ b/.webpack/webpack.config.e2e.babel.js @@ -29,7 +29,7 @@ export default merge(baseConfig, { test: /\.js$/, exclude: /node_modules/, use: { - loader: 'babel-loader', + loader: 'esbuild-loader', }, }, ], diff --git a/esbuild.cjs b/esbuild.cjs new file mode 100644 index 0000000000..c0c40bee32 --- /dev/null +++ b/esbuild.cjs @@ -0,0 +1,31 @@ +let jisonPlugin = { + name: 'jison', + setup(build) { + const { Generator } = require('jison'); + let fs = require('fs'); + + build.onLoad({ filter: /\.jison$/ }, async (args) => { + // Load the file from the file system + let source = await fs.promises.readFile(args.path, 'utf8'); + + try { + let contents = new Generator(source, {}).generate(); + return { contents, warnings: [] }; + } catch (e) { + return { errors: [] }; + } + }); + }, +}; + +const { build } = require('esbuild'); +build({ + bundle: true, + minify: false, + keepNames: true, + globalName: 'mermaid', + platform: 'browser', + entryPoints: ['src/mermaid.js'], + outfile: 'dist/mermaid.js', + plugins: [jisonPlugin], +}).catch(() => process.exit(1)); diff --git a/jisonLoader.js b/jisonLoader.js new file mode 100644 index 0000000000..cd4b2053a6 --- /dev/null +++ b/jisonLoader.js @@ -0,0 +1,6 @@ +const { Generator } = require('jison'); +const { getOptions } = require('loader-utils'); + +module.exports = function jisonLoader(source) { + return new Generator(source, getOptions(this)).generate(); +}; diff --git a/jisonTransformer.js b/jisonTransformer.js new file mode 100644 index 0000000000..466445f084 --- /dev/null +++ b/jisonTransformer.js @@ -0,0 +1,9 @@ +const { Generator } = require('jison'); + +module.exports = { + process(source, filename, config, transformOptions) { + return new Generator(source, { + 'token-stack': true, + }).generate(); + }, +}; diff --git a/package.json b/package.json index a8e6221dc7..2358699db6 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,8 @@ "cypress": "9.7.0", "cypress-image-snapshot": "^4.0.1", "documentation": "13.2.0", + "esbuild": "^0.12.28", + "esbuild-loader": "^2.15.1", "eslint": "^8.4.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-cypress": "^2.12.1", diff --git a/yarn.lock b/yarn.lock index 69868563f9..9d8e4d53a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1732,6 +1732,11 @@ esquery "^1.4.0" jsdoc-type-pratt-parser "~3.1.0" +"@esbuild/linux-loong64@0.14.54": + version "0.14.54" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz#de2a4be678bd4d0d1ffbb86e6de779cde5999028" + integrity sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw== + "@eslint/eslintrc@^1.3.1": version "1.3.1" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.1.tgz#de0807bfeffc37b964a7d0400e0c348ce5a2543d" @@ -5196,6 +5201,150 @@ es-module-lexer@^0.9.0: resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19" integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ== +esbuild-android-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz#505f41832884313bbaffb27704b8bcaa2d8616be" + integrity sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ== + +esbuild-android-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz#8ce69d7caba49646e009968fe5754a21a9871771" + integrity sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg== + +esbuild-darwin-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz#24ba67b9a8cb890a3c08d9018f887cc221cdda25" + integrity sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug== + +esbuild-darwin-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz#3f7cdb78888ee05e488d250a2bdaab1fa671bf73" + integrity sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw== + +esbuild-freebsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz#09250f997a56ed4650f3e1979c905ffc40bbe94d" + integrity sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg== + +esbuild-freebsd-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz#bafb46ed04fc5f97cbdb016d86947a79579f8e48" + integrity sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q== + +esbuild-linux-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" + integrity sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw== + +esbuild-linux-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz#de5fdba1c95666cf72369f52b40b03be71226652" + integrity sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg== + +esbuild-linux-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz#dae4cd42ae9787468b6a5c158da4c84e83b0ce8b" + integrity sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig== + +esbuild-linux-arm@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz#a2c1dff6d0f21dbe8fc6998a122675533ddfcd59" + integrity sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw== + +esbuild-linux-mips64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz#d9918e9e4cb972f8d6dae8e8655bf9ee131eda34" + integrity sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw== + +esbuild-linux-ppc64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz#3f9a0f6d41073fb1a640680845c7de52995f137e" + integrity sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ== + +esbuild-linux-riscv64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz#618853c028178a61837bc799d2013d4695e451c8" + integrity sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg== + +esbuild-linux-s390x@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz#d1885c4c5a76bbb5a0fe182e2c8c60eb9e29f2a6" + integrity sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA== + +esbuild-loader@^2.15.1: + version "2.19.0" + resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-2.19.0.tgz#54f62d1da8262acfc3c5883c24da35af8324f116" + integrity sha512-urGNVE6Tl2rqx92ElKi/LiExXjGvcH6HfDBFzJ9Ppwqh4n6Jmx8x7RKAyMzSM78b6CAaJLhDncG5sPrL0ROh5Q== + dependencies: + esbuild "^0.14.39" + joycon "^3.0.1" + json5 "^2.2.0" + loader-utils "^2.0.0" + tapable "^2.2.0" + webpack-sources "^2.2.0" + +esbuild-netbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz#69ae917a2ff241b7df1dbf22baf04bd330349e81" + integrity sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w== + +esbuild-openbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz#db4c8495287a350a6790de22edea247a57c5d47b" + integrity sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw== + +esbuild-sunos-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz#54287ee3da73d3844b721c21bc80c1dc7e1bf7da" + integrity sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw== + +esbuild-windows-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz#f8aaf9a5667630b40f0fb3aa37bf01bbd340ce31" + integrity sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w== + +esbuild-windows-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz#bf54b51bd3e9b0f1886ffdb224a4176031ea0af4" + integrity sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ== + +esbuild-windows-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz#937d15675a15e4b0e4fafdbaa3a01a776a2be982" + integrity sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg== + +esbuild@^0.12.28: + version "0.12.29" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.29.tgz#be602db7c4dc78944a9dbde0d1ea19d36c1f882d" + integrity sha512-w/XuoBCSwepyiZtIRsKsetiLDUVGPVw1E/R3VTFSecIy8UR7Cq3SOtwKHJMFoVqqVG36aGkzh4e8BvpO1Fdc7g== + +esbuild@^0.14.39: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" + integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== + optionalDependencies: + "@esbuild/linux-loong64" "0.14.54" + esbuild-android-64 "0.14.54" + esbuild-android-arm64 "0.14.54" + esbuild-darwin-64 "0.14.54" + esbuild-darwin-arm64 "0.14.54" + esbuild-freebsd-64 "0.14.54" + esbuild-freebsd-arm64 "0.14.54" + esbuild-linux-32 "0.14.54" + esbuild-linux-64 "0.14.54" + esbuild-linux-arm "0.14.54" + esbuild-linux-arm64 "0.14.54" + esbuild-linux-mips64le "0.14.54" + esbuild-linux-ppc64le "0.14.54" + esbuild-linux-riscv64 "0.14.54" + esbuild-linux-s390x "0.14.54" + esbuild-netbsd-64 "0.14.54" + esbuild-openbsd-64 "0.14.54" + esbuild-sunos-64 "0.14.54" + esbuild-windows-32 "0.14.54" + esbuild-windows-64 "0.14.54" + esbuild-windows-arm64 "0.14.54" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -7655,6 +7804,11 @@ joi@^17.4.0: "@sideway/formula" "^3.0.0" "@sideway/pinpoint" "^2.0.0" +joycon@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.1.1.tgz#bce8596d6ae808f8b68168f5fc69280996894f03" + integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== + jpeg-js@0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.4.4.tgz#a9f1c6f1f9f0fa80cdb3484ed9635054d28936aa" @@ -7783,7 +7937,7 @@ json5@^0.5.0: resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= -json5@^2.1.2, json5@^2.2.1: +json5@^2.1.2, json5@^2.2.0, json5@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== @@ -10536,6 +10690,11 @@ socks@^2.3.3: ip "^1.1.5" smart-buffer "^4.2.0" +source-list-map@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" + integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== + source-map-resolve@^0.5.0: version "0.5.3" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" @@ -11907,6 +12066,14 @@ webpack-node-externals@^3.0.0: resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz#1a3407c158d547a9feb4229a9e3385b7b60c9917" integrity sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ== +webpack-sources@^2.2.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.1.tgz#570de0af163949fe272233c2cefe1b56f74511fd" + integrity sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA== + dependencies: + source-list-map "^2.0.1" + source-map "^0.6.1" + webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" From 965df4fdf4adeb040a3a0a03da6bcb23826feadd Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 31 Aug 2022 23:59:32 +0530 Subject: [PATCH 02/33] ESBuild --- esbuild.cjs | 8 +- package.json | 16 ++-- src/diagrams/c4/c4Renderer.js | 2 +- yarn.lock | 137 ++++++++++++++++++++++++++++++++-- 4 files changed, 149 insertions(+), 14 deletions(-) diff --git a/esbuild.cjs b/esbuild.cjs index c0c40bee32..54ec9c4f08 100644 --- a/esbuild.cjs +++ b/esbuild.cjs @@ -21,11 +21,15 @@ let jisonPlugin = { const { build } = require('esbuild'); build({ bundle: true, - minify: false, + minify: true, keepNames: true, globalName: 'mermaid', + format: 'esm', platform: 'browser', + resolveExtensions: ['.js', '.json', '.jison'], + external: ['require', 'fs', 'path'], entryPoints: ['src/mermaid.js'], - outfile: 'dist/mermaid.js', + outfile: 'dist/mermaid.min.js', plugins: [jisonPlugin], + sourcemap: 'external', }).catch(() => process.exit(1)); diff --git a/package.json b/package.json index 2358699db6..e0a837872e 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,12 @@ "name": "mermaid", "version": "9.1.5", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", - "main": "dist/mermaid.min.js", - "module": "dist/mermaid.esm.min.mjs", + "main": "./dist/mermaid.min.js", + "module": "./dist/mermaid.min.js", "exports": { ".": { "require": "./dist/mermaid.min.js", - "import": "./dist/mermaid.esm.min.mjs" + "import": "./dist/mermaid.min.js" }, "./*": "./*" }, @@ -21,6 +21,7 @@ "git graph" ], "scripts": { + "build:fast": "node esbuild.cjs", "build:development": "webpack --mode development --progress --color", "build:production": "webpack --mode production --progress --color", "build": "concurrently \"yarn build:development\" \"yarn build:production\"", @@ -84,8 +85,8 @@ "cypress": "9.7.0", "cypress-image-snapshot": "^4.0.1", "documentation": "13.2.0", - "esbuild": "^0.12.28", - "esbuild-loader": "^2.15.1", + "esbuild": "^0.15.6", + "esbuild-loader": "^2.19.0", "eslint": "^8.4.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-cypress": "^2.12.1", @@ -123,5 +124,8 @@ "sideEffects": [ "**/*.css", "**/*.scss" - ] + ], + "browser": { + "path": "path-browserify" + } } \ No newline at end of file diff --git a/src/diagrams/c4/c4Renderer.js b/src/diagrams/c4/c4Renderer.js index 6af59bb928..866ac03832 100644 --- a/src/diagrams/c4/c4Renderer.js +++ b/src/diagrams/c4/c4Renderer.js @@ -1,5 +1,5 @@ import { select } from 'd3'; -import svgDraw, { drawText, fixLifeLineHeights } from './svgDraw'; +import svgDraw from './svgDraw'; import { log } from '../../logger'; import { parser } from './parser/c4Diagram'; import common from '../common/common'; diff --git a/yarn.lock b/yarn.lock index 9d8e4d53a0..0b16af1365 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1737,6 +1737,11 @@ resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz#de2a4be678bd4d0d1ffbb86e6de779cde5999028" integrity sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw== +"@esbuild/linux-loong64@0.15.6": + version "0.15.6" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.15.6.tgz#45be4184f00e505411bc265a05e709764114acd8" + integrity sha512-hqmVU2mUjH6J2ZivHphJ/Pdse2ZD+uGCHK0uvsiLDk/JnSedEVj77CiVUnbMKuU4tih1TZZL8tG9DExQg/GZsw== + "@eslint/eslintrc@^1.3.1": version "1.3.1" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.1.tgz#de0807bfeffc37b964a7d0400e0c348ce5a2543d" @@ -5206,72 +5211,142 @@ esbuild-android-64@0.14.54: resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz#505f41832884313bbaffb27704b8bcaa2d8616be" integrity sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ== +esbuild-android-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.15.6.tgz#baaed943ca510c2ad546e116728132e76d1d2044" + integrity sha512-Z1CHSgB1crVQi2LKSBwSkpaGtaloVz0ZIYcRMsvHc3uSXcR/x5/bv9wcZspvH/25lIGTaViosciS/NS09ERmVA== + esbuild-android-arm64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz#8ce69d7caba49646e009968fe5754a21a9871771" integrity sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg== +esbuild-android-arm64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.15.6.tgz#1c33c73d4c074969e014e31958116460c8e75a7a" + integrity sha512-mvM+gqNxqKm2pCa3dnjdRzl7gIowuc4ga7P7c3yHzs58Im8v/Lfk1ixSgQ2USgIywT48QWaACRa3F4MG7djpSw== + esbuild-darwin-64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz#24ba67b9a8cb890a3c08d9018f887cc221cdda25" integrity sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug== +esbuild-darwin-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.15.6.tgz#388592ba61bf31993d79f6311f7452aa1ef255b9" + integrity sha512-BsfVt3usScAfGlXJiGtGamwVEOTM8AiYiw1zqDWhGv6BncLXCnTg1As+90mxWewdTZKq3iIy8s9g8CKkrrAXVw== + esbuild-darwin-arm64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz#3f7cdb78888ee05e488d250a2bdaab1fa671bf73" integrity sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw== +esbuild-darwin-arm64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.6.tgz#194e987849dc4688654008a1792f26e948f52e74" + integrity sha512-CnrAeJaEpPakUobhqO4wVSA4Zm6TPaI5UY4EsI62j9mTrjIyQPXA1n4Ju6Iu5TVZRnEqV6q8blodgYJ6CJuwCA== + esbuild-freebsd-64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz#09250f997a56ed4650f3e1979c905ffc40bbe94d" integrity sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg== +esbuild-freebsd-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.6.tgz#daa72faee585ec2ec27cc65e86a6ce0786373e66" + integrity sha512-+qFdmqi+jkAsxsNJkaWVrnxEUUI50nu6c3MBVarv3RCDCbz7ZS1a4ZrdkwEYFnKcVWu6UUE0Kkb1SQ1yGEG6sg== + esbuild-freebsd-arm64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz#bafb46ed04fc5f97cbdb016d86947a79579f8e48" integrity sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q== +esbuild-freebsd-arm64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.6.tgz#70c8a2a30bf6bb9d547a0d8dc93aa015ec4f77f9" + integrity sha512-KtQkQOhnNciXm2yrTYZMD3MOm2zBiiwFSU+dkwNbcfDumzzUprr1x70ClTdGuZwieBS1BM/k0KajRQX7r504Xw== + esbuild-linux-32@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" integrity sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw== +esbuild-linux-32@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.15.6.tgz#d69ed2335b2d68c00b3248254b432172077b7ced" + integrity sha512-IAkDNz3TpxwISTGVdQijwyHBZrbFgLlRi5YXcvaEHtgbmayLSDcJmH5nV1MFgo/x2QdKcHBkOYHdjhKxUAcPwg== + esbuild-linux-64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz#de5fdba1c95666cf72369f52b40b03be71226652" integrity sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg== +esbuild-linux-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.15.6.tgz#dca821e8f129cccde23ac947fd0d4bea3b333808" + integrity sha512-gQPksyrEYfA4LJwyfTQWAZaVZCx4wpaLrSzo2+Xc9QLC+i/sMWmX31jBjrn4nLJCd79KvwCinto36QC7BEIU/A== + esbuild-linux-arm64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz#dae4cd42ae9787468b6a5c158da4c84e83b0ce8b" integrity sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig== +esbuild-linux-arm64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.6.tgz#c9e8bc86f3c58a7c8ff1ded5880c6a39ade7621b" + integrity sha512-aovDkclFa6C9EdZVBuOXxqZx83fuoq8097xZKhEPSygwuy4Lxs8J4anHG7kojAsR+31lfUuxzOo2tHxv7EiNHA== + esbuild-linux-arm@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz#a2c1dff6d0f21dbe8fc6998a122675533ddfcd59" integrity sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw== +esbuild-linux-arm@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.15.6.tgz#354ecad0223f5b176995cf4462560eec2633de24" + integrity sha512-xZ0Bq2aivsthDjA/ytQZzxrxIZbG0ATJYMJxNeOIBc1zUjpbVpzBKgllOZMsTSXMHFHGrow6TnCcgwqY0+oEoQ== + esbuild-linux-mips64le@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz#d9918e9e4cb972f8d6dae8e8655bf9ee131eda34" integrity sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw== +esbuild-linux-mips64le@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.6.tgz#f4fb941a4ff0af437deed69a2e0712983c8fff3e" + integrity sha512-wVpW8wkWOGizsCqCwOR/G3SHwhaecpGy3fic9BF1r7vq4djLjUcA8KunDaBCjJ6TgLQFhJ98RjDuyEf8AGjAvw== + esbuild-linux-ppc64le@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz#3f9a0f6d41073fb1a640680845c7de52995f137e" integrity sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ== +esbuild-linux-ppc64le@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.6.tgz#19774a8b52c77173f2d4f171b8a8cf839b12e686" + integrity sha512-z6w6gsPH/Y77uchocluDC8tkCg9rfkcPTePzZKNr879bF4tu7j9t255wuNOCE396IYEGxY7y8u2HJ9i7kjCLVw== + esbuild-linux-riscv64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz#618853c028178a61837bc799d2013d4695e451c8" integrity sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg== +esbuild-linux-riscv64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.6.tgz#66bd83b065c4a1e623df02c122bc7e4e15fd8486" + integrity sha512-pfK/3MJcmbfU399TnXW5RTPS1S+ID6ra+CVj9TFZ2s0q9Ja1F5A1VirUUvViPkjiw+Kq3zveyn6U09Wg1zJXrw== + esbuild-linux-s390x@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz#d1885c4c5a76bbb5a0fe182e2c8c60eb9e29f2a6" integrity sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA== -esbuild-loader@^2.15.1: +esbuild-linux-s390x@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.6.tgz#1e024bddc75afe8dc70ed48fc9627af770d7f34b" + integrity sha512-OZeeDu32liefcwAE63FhVqM4heWTC8E3MglOC7SK0KYocDdY/6jyApw0UDkDHlcEK9mW6alX/SH9r3PDjcCo/Q== + +esbuild-loader@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-2.19.0.tgz#54f62d1da8262acfc3c5883c24da35af8324f116" integrity sha512-urGNVE6Tl2rqx92ElKi/LiExXjGvcH6HfDBFzJ9Ppwqh4n6Jmx8x7RKAyMzSM78b6CAaJLhDncG5sPrL0ROh5Q== @@ -5288,35 +5363,60 @@ esbuild-netbsd-64@0.14.54: resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz#69ae917a2ff241b7df1dbf22baf04bd330349e81" integrity sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w== +esbuild-netbsd-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.6.tgz#c11477d197f059c8794ee1691e3399201f7c4b9a" + integrity sha512-kaxw61wcHMyiEsSsi5ut1YYs/hvTC2QkxJwyRvC2Cnsz3lfMLEu8zAjpBKWh9aU/N0O/gsRap4wTur5GRuSvBA== + esbuild-openbsd-64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz#db4c8495287a350a6790de22edea247a57c5d47b" integrity sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw== +esbuild-openbsd-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.6.tgz#b29e7faed5b8d2aeaf3884c47c1a96b1cba8e263" + integrity sha512-CuoY60alzYfIZapUHqFXqXbj88bbRJu8Fp9okCSHRX2zWIcGz4BXAHXiG7dlCye5nFVrY72psesLuWdusyf2qw== + esbuild-sunos-64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz#54287ee3da73d3844b721c21bc80c1dc7e1bf7da" integrity sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw== +esbuild-sunos-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.15.6.tgz#9668f39e47179f50c0435040904b9c6e10e84a70" + integrity sha512-1ceefLdPWcd1nW/ZLruPEYxeUEAVX0YHbG7w+BB4aYgfknaLGotI/ZvPWUZpzhC8l1EybrVlz++lm3E6ODIJOg== + esbuild-windows-32@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz#f8aaf9a5667630b40f0fb3aa37bf01bbd340ce31" integrity sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w== +esbuild-windows-32@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.15.6.tgz#9ddcd56e3c4fb9729a218c713c4e76bdbc1678b4" + integrity sha512-pBqdOsKqCD5LRYiwF29PJRDJZi7/Wgkz46u3d17MRFmrLFcAZDke3nbdDa1c8YgY78RiemudfCeAemN8EBlIpA== + esbuild-windows-64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz#bf54b51bd3e9b0f1886ffdb224a4176031ea0af4" integrity sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ== +esbuild-windows-64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.15.6.tgz#1eaadeadfd995e9d065d35cb3e9f02607202f339" + integrity sha512-KpPOh4aTOo//g9Pk2oVAzXMpc9Sz9n5A9sZTmWqDSXCiiachfFhbuFlsKBGATYCVitXfmBIJ4nNYYWSOdz4hQg== + esbuild-windows-arm64@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz#937d15675a15e4b0e4fafdbaa3a01a776a2be982" integrity sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg== -esbuild@^0.12.28: - version "0.12.29" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.29.tgz#be602db7c4dc78944a9dbde0d1ea19d36c1f882d" - integrity sha512-w/XuoBCSwepyiZtIRsKsetiLDUVGPVw1E/R3VTFSecIy8UR7Cq3SOtwKHJMFoVqqVG36aGkzh4e8BvpO1Fdc7g== +esbuild-windows-arm64@0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.6.tgz#e18a778d354fc2ca2306688f3fedad8a3e57819e" + integrity sha512-DB3G2x9OvFEa00jV+OkDBYpufq5x/K7a6VW6E2iM896DG4ZnAvJKQksOsCPiM1DUaa+DrijXAQ/ZOcKAqf/3Hg== esbuild@^0.14.39: version "0.14.54" @@ -5345,6 +5445,33 @@ esbuild@^0.14.39: esbuild-windows-64 "0.14.54" esbuild-windows-arm64 "0.14.54" +esbuild@^0.15.6: + version "0.15.6" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.15.6.tgz#626e5941b98de506b862047be3c4b33f89278923" + integrity sha512-sgLOv3l4xklvXzzczhRwKRotyrfyZ2i1fCS6PTOLPd9wevDPArGU8HFtHrHCOcsMwTjLjzGm15gvC8uxVzQf+w== + optionalDependencies: + "@esbuild/linux-loong64" "0.15.6" + esbuild-android-64 "0.15.6" + esbuild-android-arm64 "0.15.6" + esbuild-darwin-64 "0.15.6" + esbuild-darwin-arm64 "0.15.6" + esbuild-freebsd-64 "0.15.6" + esbuild-freebsd-arm64 "0.15.6" + esbuild-linux-32 "0.15.6" + esbuild-linux-64 "0.15.6" + esbuild-linux-arm "0.15.6" + esbuild-linux-arm64 "0.15.6" + esbuild-linux-mips64le "0.15.6" + esbuild-linux-ppc64le "0.15.6" + esbuild-linux-riscv64 "0.15.6" + esbuild-linux-s390x "0.15.6" + esbuild-netbsd-64 "0.15.6" + esbuild-openbsd-64 "0.15.6" + esbuild-sunos-64 "0.15.6" + esbuild-windows-32 "0.15.6" + esbuild-windows-64 "0.15.6" + esbuild-windows-arm64 "0.15.6" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" From 1206ec43aca1578c1b058fdb5208e8f790a16d4d Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 1 Sep 2022 00:12:20 +0530 Subject: [PATCH 03/33] Remove jisonloader --- jisonLoader.js | 6 ------ jisonTransformer.js | 9 --------- 2 files changed, 15 deletions(-) delete mode 100644 jisonLoader.js delete mode 100644 jisonTransformer.js diff --git a/jisonLoader.js b/jisonLoader.js deleted file mode 100644 index cd4b2053a6..0000000000 --- a/jisonLoader.js +++ /dev/null @@ -1,6 +0,0 @@ -const { Generator } = require('jison'); -const { getOptions } = require('loader-utils'); - -module.exports = function jisonLoader(source) { - return new Generator(source, getOptions(this)).generate(); -}; diff --git a/jisonTransformer.js b/jisonTransformer.js deleted file mode 100644 index 466445f084..0000000000 --- a/jisonTransformer.js +++ /dev/null @@ -1,9 +0,0 @@ -const { Generator } = require('jison'); - -module.exports = { - process(source, filename, config, transformOptions) { - return new Generator(source, { - 'token-stack': true, - }).generate(); - }, -}; From d67e2723c69d6ff4f21c1c17d8a6e2fc4c3da192 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 1 Sep 2022 13:38:02 +0530 Subject: [PATCH 04/33] Serve --- .esbuild/esbuild.cjs | 13 +++++++ .esbuild/serve.cjs | 53 +++++++++++++++++++++++++++ .esbuild/util.cjs | 54 ++++++++++++++++++++++++++++ .webpack/webpack.config.base.js | 2 ++ .webpack/webpack.config.e2e.babel.js | 11 ------ cypress/platform/bundle-test.js | 2 +- esbuild.cjs | 35 ------------------ package.json | 8 ++--- 8 files changed, 127 insertions(+), 51 deletions(-) create mode 100644 .esbuild/esbuild.cjs create mode 100644 .esbuild/serve.cjs create mode 100644 .esbuild/util.cjs delete mode 100644 esbuild.cjs diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs new file mode 100644 index 0000000000..29b144e55b --- /dev/null +++ b/.esbuild/esbuild.cjs @@ -0,0 +1,13 @@ +const { esmBuild, umdBuild } = require('./util.cjs'); +const { build } = require('esbuild'); + +const handler = (e) => { + console.error(e); + process.exit(1); +}; + +build(esmBuild({ minify: false })).catch(handler); +build(umdBuild({ minify: false })).catch(handler); + +build(esmBuild()).catch(handler); +build(umdBuild()).catch(handler); diff --git a/.esbuild/serve.cjs b/.esbuild/serve.cjs new file mode 100644 index 0000000000..13eba401d0 --- /dev/null +++ b/.esbuild/serve.cjs @@ -0,0 +1,53 @@ +const esbuild = require('esbuild'); +const http = require('http'); +const path = require('path'); +const { umdBuild } = require('./util.cjs'); + +// Start esbuild's server on a random local port +esbuild + .serve( + { + servedir: path.join(__dirname, '..'), + }, + umdBuild({ minify: false }) + ) + .then((result) => { + // The result tells us where esbuild's local server is + const { host, port } = result; + + // Then start a proxy server on port 3000 + http + .createServer((req, res) => { + if (req.url.includes('mermaid.js')) { + req.url = '/dist/mermaid.js'; + } + const options = { + hostname: host, + port: port, + path: req.url, + method: req.method, + headers: req.headers, + }; + + // Forward each incoming request to esbuild + const proxyReq = http.request(options, (proxyRes) => { + // If esbuild returns "not found", send a custom 404 page + console.error('pp', req.url); + if (proxyRes.statusCode === 404) { + if (!req.url.endsWith('.html')) { + res.writeHead(404, { 'Content-Type': 'text/html' }); + res.end('

A custom 404 page

'); + return; + } + } + + // Otherwise, forward the response from esbuild to the client + res.writeHead(proxyRes.statusCode, proxyRes.headers); + proxyRes.pipe(res, { end: true }); + }); + + // Forward the body of the request to esbuild + req.pipe(proxyReq, { end: true }); + }) + .listen(3000); + }); diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs new file mode 100644 index 0000000000..0bc19bbbe3 --- /dev/null +++ b/.esbuild/util.cjs @@ -0,0 +1,54 @@ +/** @typedef {import('esbuild').BuildOptions} Options */ + +/** + * @param {Options} override + * @returns {Options} + */ +const buildOptions = (override = {}) => { + return { + bundle: true, + minify: true, + keepNames: true, + globalName: 'mermaid', + platform: 'browser', + resolveExtensions: ['.js', '.json', '.jison'], + external: ['require', 'fs', 'path'], + entryPoints: ['src/mermaid.js'], + outfile: 'dist/mermaid.min.js', + plugins: [jisonPlugin], + sourcemap: 'external', + ...override, + }; +}; + +exports.esmBuild = ({ minify = true } = {}) => { + return buildOptions({ + format: 'esm', + outfile: `dist/mermaid.esm${minify ? '.min' : ''}.mjs`, + minify, + }); +}; + +exports.umdBuild = ({ minify = true } = {}) => { + return buildOptions({ outfile: `dist/mermaid${minify ? '.min' : ''}.js`, minify }); +}; + +const jisonPlugin = { + name: 'jison', + setup(build) { + const { Generator } = require('jison'); + let fs = require('fs'); + + build.onLoad({ filter: /\.jison$/ }, async (args) => { + // Load the file from the file system + let source = await fs.promises.readFile(args.path, 'utf8'); + + try { + let contents = new Generator(source, {}).generate(); + return { contents, warnings: [] }; + } catch (e) { + return { errors: [] }; + } + }); + }, +}; diff --git a/.webpack/webpack.config.base.js b/.webpack/webpack.config.base.js index 16b46dc5a0..8ddf655fc0 100644 --- a/.webpack/webpack.config.base.js +++ b/.webpack/webpack.config.base.js @@ -1,4 +1,5 @@ import path from 'path'; +// const esbuild = require('esbuild'); const { ESBuildMinifyPlugin } = require('esbuild-loader'); export const resolveRoot = (...relativePath) => path.resolve(__dirname, '..', ...relativePath); @@ -33,6 +34,7 @@ export default { use: { loader: 'esbuild-loader', options: { + // implementation: esbuild, target: 'es2015', }, }, diff --git a/.webpack/webpack.config.e2e.babel.js b/.webpack/webpack.config.e2e.babel.js index 719fb9304a..7da3dad3e8 100644 --- a/.webpack/webpack.config.e2e.babel.js +++ b/.webpack/webpack.config.e2e.babel.js @@ -23,15 +23,4 @@ export default merge(baseConfig, { externals: { mermaid: 'mermaid', }, - module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules/, - use: { - loader: 'esbuild-loader', - }, - }, - ], - }, }); diff --git a/cypress/platform/bundle-test.js b/cypress/platform/bundle-test.js index 373f8741a0..22f4fe93c1 100644 --- a/cypress/platform/bundle-test.js +++ b/cypress/platform/bundle-test.js @@ -1,4 +1,4 @@ -import mermaid from '../../dist/mermaid.core'; +import mermaid from '../../dist/mermaid'; let code = `flowchart LR Power_Supply --> Transmitter_A diff --git a/esbuild.cjs b/esbuild.cjs deleted file mode 100644 index 54ec9c4f08..0000000000 --- a/esbuild.cjs +++ /dev/null @@ -1,35 +0,0 @@ -let jisonPlugin = { - name: 'jison', - setup(build) { - const { Generator } = require('jison'); - let fs = require('fs'); - - build.onLoad({ filter: /\.jison$/ }, async (args) => { - // Load the file from the file system - let source = await fs.promises.readFile(args.path, 'utf8'); - - try { - let contents = new Generator(source, {}).generate(); - return { contents, warnings: [] }; - } catch (e) { - return { errors: [] }; - } - }); - }, -}; - -const { build } = require('esbuild'); -build({ - bundle: true, - minify: true, - keepNames: true, - globalName: 'mermaid', - format: 'esm', - platform: 'browser', - resolveExtensions: ['.js', '.json', '.jison'], - external: ['require', 'fs', 'path'], - entryPoints: ['src/mermaid.js'], - outfile: 'dist/mermaid.min.js', - plugins: [jisonPlugin], - sourcemap: 'external', -}).catch(() => process.exit(1)); diff --git a/package.json b/package.json index e0a837872e..a54823ee84 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,12 @@ "name": "mermaid", "version": "9.1.5", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", - "main": "./dist/mermaid.min.js", - "module": "./dist/mermaid.min.js", + "main": "dist/mermaid.min.js", + "module": "dist/mermaid.esm.min.mjs", "exports": { ".": { "require": "./dist/mermaid.min.js", - "import": "./dist/mermaid.min.js" + "import": "./dist/mermaid.esm.min.mjs" }, "./*": "./*" }, @@ -21,7 +21,7 @@ "git graph" ], "scripts": { - "build:fast": "node esbuild.cjs", + "build:fast": "node .esbuild/esbuild.cjs", "build:development": "webpack --mode development --progress --color", "build:production": "webpack --mode production --progress --color", "build": "concurrently \"yarn build:development\" \"yarn build:production\"", From fe3bb0b6c0dcf8c07ebf2c36eac2b161a03c3050 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 1 Sep 2022 20:41:31 +0530 Subject: [PATCH 05/33] Typescript --- .esbuild/util.cjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 0bc19bbbe3..b5fcfdd7af 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -11,9 +11,10 @@ const buildOptions = (override = {}) => { keepNames: true, globalName: 'mermaid', platform: 'browser', - resolveExtensions: ['.js', '.json', '.jison'], + tsconfig: 'tsconfig.json', + resolveExtensions: ['.ts', '.js', '.json', '.jison'], external: ['require', 'fs', 'path'], - entryPoints: ['src/mermaid.js'], + entryPoints: ['src/mermaid.ts'], outfile: 'dist/mermaid.min.js', plugins: [jisonPlugin], sourcemap: 'external', From 01562528b7e0d4d02c4d844596ac501e9715b3fe Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 1 Sep 2022 22:45:10 +0530 Subject: [PATCH 06/33] Typescript --- .gitignore | 2 ++ package.json | 2 +- .../sequence/{sequenceRenderer.js => sequenceRenderer.ts} | 1 + .../user-journey/{journeyRenderer.js => journeyRenderer.ts} | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) rename src/diagrams/sequence/{sequenceRenderer.js => sequenceRenderer.ts} (99%) rename src/diagrams/user-journey/{journeyRenderer.js => journeyRenderer.ts} (99%) diff --git a/.gitignore b/.gitignore index c5c4338e54..9641d25748 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ cypress/snapshots/ # eslint --cache file .eslintcache +.tsbuildinfo +tsconfig.tsbuildinfo diff --git a/package.json b/package.json index bee4483b7c..46daf9e16f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "git graph" ], "scripts": { - "build:fast": "node .esbuild/esbuild.cjs", + "build:fast": "rm -rf dist; node .esbuild/esbuild.cjs; tsc --emitDeclarationOnly", "build:dev": "webpack --mode development --progress --color", "build:prod": "webpack --mode production --progress --color", "build": "concurrently \"yarn build:dev\" \"yarn build:prod\"", diff --git a/src/diagrams/sequence/sequenceRenderer.js b/src/diagrams/sequence/sequenceRenderer.ts similarity index 99% rename from src/diagrams/sequence/sequenceRenderer.js rename to src/diagrams/sequence/sequenceRenderer.ts index c3ea1bcfd7..a6ceb17064 100644 --- a/src/diagrams/sequence/sequenceRenderer.js +++ b/src/diagrams/sequence/sequenceRenderer.ts @@ -1,3 +1,4 @@ +// @ts-nocheck import { select, selectAll } from 'd3'; import svgDraw, { drawText, fixLifeLineHeights } from './svgDraw'; import { log } from '../../logger'; diff --git a/src/diagrams/user-journey/journeyRenderer.js b/src/diagrams/user-journey/journeyRenderer.ts similarity index 99% rename from src/diagrams/user-journey/journeyRenderer.js rename to src/diagrams/user-journey/journeyRenderer.ts index 0e3f94f34f..dad68f2f37 100644 --- a/src/diagrams/user-journey/journeyRenderer.js +++ b/src/diagrams/user-journey/journeyRenderer.ts @@ -1,3 +1,4 @@ +// @ts-nocheck import { select } from 'd3'; import svgDraw from './svgDraw'; import { getConfig } from '../../config'; From 84bf79f72b3e31e306ebbc976fe629edd4700179 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 1 Sep 2022 23:39:30 +0530 Subject: [PATCH 07/33] Fix export --- src/dagre-wrapper/intersect/intersect-node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dagre-wrapper/intersect/intersect-node.js b/src/dagre-wrapper/intersect/intersect-node.js index 4e4353bcb5..54a88ba617 100644 --- a/src/dagre-wrapper/intersect/intersect-node.js +++ b/src/dagre-wrapper/intersect/intersect-node.js @@ -1,5 +1,3 @@ -module.exports = intersectNode; - /** * @param node * @param point @@ -8,3 +6,5 @@ function intersectNode(node, point) { // console.info('Intersect Node'); return node.intersect(point); } + +export default intersectNode; From 6be05e9948baeb91185b33e28fc6e1c0288d2787 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 2 Sep 2022 00:34:03 +0530 Subject: [PATCH 08/33] Esbuild with types --- .esbuild/esbuild.cjs | 5 +++-- .esbuild/util.cjs | 21 ++++++++++++++++----- package.json | 11 ++++++----- src/diagrams/flowchart/parser/flow.jison | 2 +- tsconfig.json | 2 +- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs index 29b144e55b..5cdee62c7a 100644 --- a/.esbuild/esbuild.cjs +++ b/.esbuild/esbuild.cjs @@ -5,9 +5,10 @@ const handler = (e) => { console.error(e); process.exit(1); }; +const watch = process.argv.includes('--watch'); -build(esmBuild({ minify: false })).catch(handler); -build(umdBuild({ minify: false })).catch(handler); +build(umdBuild({ minify: false, watch })).catch(handler); +build(esmBuild({ minify: false, watch })).catch(handler); build(esmBuild()).catch(handler); build(umdBuild()).catch(handler); diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index b5fcfdd7af..3765242c33 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -22,16 +22,27 @@ const buildOptions = (override = {}) => { }; }; -exports.esmBuild = ({ minify = true } = {}) => { +/** + * @param {Options} override + * @returns {Options} + */ +exports.esmBuild = (override = { minify: true }) => { return buildOptions({ format: 'esm', - outfile: `dist/mermaid.esm${minify ? '.min' : ''}.mjs`, - minify, + outfile: `dist/mermaid.esm${override.minify ? '.min' : ''}.mjs`, + ...override, }); }; -exports.umdBuild = ({ minify = true } = {}) => { - return buildOptions({ outfile: `dist/mermaid${minify ? '.min' : ''}.js`, minify }); +/** + * @param {Options} override + * @returns {Options} + */ +exports.umdBuild = (override = { minify: true }) => { + return buildOptions({ + outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`, + ...override, + }); }; const jisonPlugin = { diff --git a/package.json b/package.json index 46daf9e16f..10520392c7 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,12 @@ "git graph" ], "scripts": { - "build:fast": "rm -rf dist; node .esbuild/esbuild.cjs; tsc --emitDeclarationOnly", - "build:dev": "webpack --mode development --progress --color", - "build:prod": "webpack --mode production --progress --color", - "build": "concurrently \"yarn build:dev\" \"yarn build:prod\"", + "clean": "rimraf dist", + "build:code": "node .esbuild/esbuild.cjs", + "build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly", + "build": "yarn clean; concurrently \"yarn build:code\" \"yarn build:types\"", "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > docs/Setup.md", - "build:watch": "yarn build:dev --watch", + "build:watch": "yarn build:code --watch", "release": "yarn build", "lint": "eslint --cache ./ --ext .js,.json,.html,.md", "lint:fix": "yarn lint --fix", @@ -114,6 +114,7 @@ "path-browserify": "^1.0.1", "prettier": "^2.3.2", "prettier-plugin-jsdoc": "^0.3.30", + "rimraf": "^3.0.2", "start-server-and-test": "^1.12.6", "terser-webpack-plugin": "^5.3.6", "ts-jest": "^28.0.8", diff --git a/src/diagrams/flowchart/parser/flow.jison b/src/diagrams/flowchart/parser/flow.jison index 15447dab6f..e459a23d06 100644 --- a/src/diagrams/flowchart/parser/flow.jison +++ b/src/diagrams/flowchart/parser/flow.jison @@ -271,7 +271,7 @@ document { $$ = [];} | document line { - if($2 !== []){ + if(Array.isArray($2) && $2.length > 0){ $1.push($2); } $$=$1;} diff --git a/tsconfig.json b/tsconfig.json index f3a860e327..8acf035d72 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ /* Visit https://aka.ms/tsconfig.json to read more about this file */ /* Projects */ - "incremental": true /* Enable incremental compilation */, + // "incremental": true /* Enable incremental compilation */, // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ From 53fe35e37e8131feacfc5d330461d9fa783f01a1 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 2 Sep 2022 00:36:01 +0530 Subject: [PATCH 09/33] Add webpack build --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 10520392c7..95df116b9d 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "clean": "rimraf dist", "build:code": "node .esbuild/esbuild.cjs", "build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly", + "build:webpack": "webpack --mode production --progress --color", "build": "yarn clean; concurrently \"yarn build:code\" \"yarn build:types\"", "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > docs/Setup.md", "build:watch": "yarn build:code --watch", From f1fa91a51cf69e3589c4619541dda8ccdf35f063 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 2 Sep 2022 00:46:02 +0530 Subject: [PATCH 10/33] fix flowchart jison --- package.json | 2 +- src/diagrams/flowchart/parser/flow.jison | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 95df116b9d..e7ae33c600 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ "build:code": "node .esbuild/esbuild.cjs", "build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly", "build:webpack": "webpack --mode production --progress --color", + "build:watch": "yarn build:code --watch", "build": "yarn clean; concurrently \"yarn build:code\" \"yarn build:types\"", "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > docs/Setup.md", - "build:watch": "yarn build:code --watch", "release": "yarn build", "lint": "eslint --cache ./ --ext .js,.json,.html,.md", "lint:fix": "yarn lint --fix", diff --git a/src/diagrams/flowchart/parser/flow.jison b/src/diagrams/flowchart/parser/flow.jison index e459a23d06..fae7c6cf26 100644 --- a/src/diagrams/flowchart/parser/flow.jison +++ b/src/diagrams/flowchart/parser/flow.jison @@ -271,7 +271,7 @@ document { $$ = [];} | document line { - if(Array.isArray($2) && $2.length > 0){ + if(!Array.isArray($2) || $2.length > 0){ $1.push($2); } $$=$1;} From 04f18630f32aaf580636b1b19a41a2d56d64c342 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 2 Sep 2022 00:48:34 +0530 Subject: [PATCH 11/33] use same esbuild in webpack --- .webpack/webpack.config.base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.webpack/webpack.config.base.js b/.webpack/webpack.config.base.js index 7350f4a9f8..3ebd1863d4 100644 --- a/.webpack/webpack.config.base.js +++ b/.webpack/webpack.config.base.js @@ -1,5 +1,5 @@ import path from 'path'; -// const esbuild = require('esbuild'); +const esbuild = require('esbuild'); const { ESBuildMinifyPlugin } = require('esbuild-loader'); export const resolveRoot = (...relativePath) => path.resolve(__dirname, '..', ...relativePath); @@ -39,7 +39,7 @@ export default { use: { loader: 'esbuild-loader', options: { - // implementation: esbuild, + implementation: esbuild, target: 'es2015', }, }, From 99923fcd0ff851badb6220f14e3bd821fc566fe1 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 2 Sep 2022 11:08:14 +0530 Subject: [PATCH 12/33] Test - esbuild --- .esbuild/util.cjs | 8 ++++---- jest.config.js | 4 ++-- package.json | 3 +-- yarn.lock | 10 +++++++++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 3765242c33..b5b39d4947 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -9,6 +9,7 @@ const buildOptions = (override = {}) => { bundle: true, minify: true, keepNames: true, + banner: { js: '"use strict";' }, globalName: 'mermaid', platform: 'browser', tsconfig: 'tsconfig.json', @@ -45,18 +46,17 @@ exports.umdBuild = (override = { minify: true }) => { }); }; +const { Generator } = require('jison'); +let fs = require('fs'); const jisonPlugin = { name: 'jison', setup(build) { - const { Generator } = require('jison'); - let fs = require('fs'); - build.onLoad({ filter: /\.jison$/ }, async (args) => { // Load the file from the file system let source = await fs.promises.readFile(args.path, 'utf8'); try { - let contents = new Generator(source, {}).generate(); + let contents = new Generator(source, { 'token-stack': true }).generate(); return { contents, warnings: [] }; } catch (e) { return { errors: [] }; diff --git a/jest.config.js b/jest.config.js index 65ea3ef58e..b7350d2f2d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,11 +1,11 @@ const path = require('path'); - /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ module.exports = { testEnvironment: 'jsdom', preset: 'ts-jest', transform: { - '^.+\\.jsx?$': ['babel-jest', { rootMode: 'upward' }], + '^.+\\.tsx?$': ['jest-esbuild', { banner: '"use strict";' }], + '^.+\\.jsx?$': ['jest-esbuild', { banner: '"use strict";' }], '^.+\\.jison$': [ path.resolve(__dirname, './src/jison/transformer.js'), { 'token-stack': true }, diff --git a/package.json b/package.json index e7ae33c600..c031a95788 100644 --- a/package.json +++ b/package.json @@ -85,8 +85,6 @@ "@types/dompurify": "^2.3.3", "@types/jest": "^28.1.7", "@types/stylis": "^4.0.2", - "babel-jest": "^29.0.1", - "babel-loader": "^8.2.2", "concurrently": "^7.0.0", "coveralls": "^3.0.2", "css-to-string-loader": "^0.1.3", @@ -108,6 +106,7 @@ "identity-obj-proxy": "^3.0.0", "jest": "^28.0.3", "jest-environment-jsdom": "^29.0.1", + "jest-esbuild": "^0.2.9", "jison": "^0.4.18", "js-base64": "3.7.2", "lint-staged": "^13.0.0", diff --git a/yarn.lock b/yarn.lock index dd665f9a80..118937d1b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5711,7 +5711,7 @@ esbuild-windows-arm64@0.15.6: resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.6.tgz#e18a778d354fc2ca2306688f3fedad8a3e57819e" integrity sha512-DB3G2x9OvFEa00jV+OkDBYpufq5x/K7a6VW6E2iM896DG4ZnAvJKQksOsCPiM1DUaa+DrijXAQ/ZOcKAqf/3Hg== -esbuild@^0.14.39: +esbuild@^0.14.39, esbuild@^0.14.48: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== @@ -7860,6 +7860,14 @@ jest-environment-node@^28.1.3: jest-mock "^28.1.3" jest-util "^28.1.3" +jest-esbuild@^0.2.9: + version "0.2.9" + resolved "https://registry.yarnpkg.com/jest-esbuild/-/jest-esbuild-0.2.9.tgz#c4c103e510400ad8a080753fd990dfe5a2a76025" + integrity sha512-GfcQgHf8XPwUydEurYTRdrhrDblVFXtgOsKmE/7KADxbsC0c5xpxQBarak4X7K0wl5XXfTmw7Qtat2V0/ssreg== + dependencies: + debug "^4.3.4" + esbuild "^0.14.48" + jest-get-type@^28.0.2: version "28.0.2" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" From 3a179170bb072a2431fc3fb026d8733aeb8d234f Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 6 Sep 2022 20:23:46 +0530 Subject: [PATCH 13/33] Surface `jison` errors Co-authored-by: Alois Klink --- .esbuild/util.cjs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index b5b39d4947..7fc77d0c57 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -1,3 +1,6 @@ +const { Generator } = require('jison'); +const fs = require('fs'); + /** @typedef {import('esbuild').BuildOptions} Options */ /** @@ -46,21 +49,14 @@ exports.umdBuild = (override = { minify: true }) => { }); }; -const { Generator } = require('jison'); -let fs = require('fs'); const jisonPlugin = { name: 'jison', setup(build) { build.onLoad({ filter: /\.jison$/ }, async (args) => { // Load the file from the file system - let source = await fs.promises.readFile(args.path, 'utf8'); - - try { - let contents = new Generator(source, { 'token-stack': true }).generate(); - return { contents, warnings: [] }; - } catch (e) { - return { errors: [] }; - } + const source = await fs.promises.readFile(args.path, 'utf8'); + const contents = new Generator(source, { 'token-stack': true }).generate(); + return { contents, warnings: [] }; }); }, }; From 51dbdb933c6e6f49294ca0766d695f417a683493 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 11:56:31 +0530 Subject: [PATCH 14/33] Fix mermaidAPI mock Co-authored-by: Alois Klink --- src/mermaid.spec.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mermaid.spec.js b/src/mermaid.spec.js index c6014dfff1..0e349dec56 100644 --- a/src/mermaid.spec.js +++ b/src/mermaid.spec.js @@ -1,15 +1,16 @@ -import mermaid from './mermaid'; -import { mermaidAPI } from './mermaidAPI'; -import flowDb from './diagrams/flowchart/flowDb'; +// mocks the mermaidAPI.render function (see `./__mocks__/mermaidAPI`) +jest.mock('./mermaidAPI'); +// jest.mock only works well with CJS, see https://github.com/facebook/jest/issues/9430 +const { default: mermaid } = require('./mermaid'); +const { mermaidAPI } = require('./mermaidAPI'); +const { default: flowDb } = require('./diagrams/flowchart/flowDb'); + import flowParser from './diagrams/flowchart/parser/flow'; import flowRenderer from './diagrams/flowchart/flowRenderer'; import Diagram from './Diagram'; const spyOn = jest.spyOn; -// mocks the mermaidAPI.render function (see `./__mocks__/mermaidAPI`) -jest.mock('./mermaidAPI'); - afterEach(() => { jest.restoreAllMocks(); }); @@ -54,6 +55,8 @@ describe('when using mermaid and ', function () { node.appendChild(document.createTextNode('graph TD;\na;')); mermaid.initThrowsErrors(undefined, node); + // mermaidAPI.render function has been mocked, since it doesn't yet work + // in Node.JS (only works in browser) expect(mermaidAPI.render).toHaveBeenCalled(); }); }); From a61c17c1a9b6d2809bdd05bbb5f17060c711d9c1 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 12:02:59 +0530 Subject: [PATCH 15/33] Fix doc formatting --- docs/Setup.md | 31 +++++++++++++++++++++---------- package.json | 2 +- src/docs/Setup.md | 31 +++++++++++++++++++++---------- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/docs/Setup.md b/docs/Setup.md index 1f948ee018..2ef56e1d8d 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -1407,6 +1407,15 @@ This sets the auto-wrap padding for the diagram (sides only) **Notes:** Default value: 0. +## parse + +### Parameters + +- `text` **[string][5]** +- `parseError` **[Function][6]?** + +Returns **[boolean][7]** + ## setSiteConfig ## setSiteConfig @@ -1424,7 +1433,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## getSiteConfig @@ -1436,7 +1445,7 @@ Returns **[object][5]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## setConfig @@ -1475,10 +1484,10 @@ $(function () { ### Parameters -- `id` **[string][6]** The id of the element to be rendered -- `text` **[string][6]** The graph definition -- `cb` **function (svgCode: [string][6], bindFunctions: function (element: [Element][7]): void): void** -- `container` **[Element][7]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][5]** The id of the element to be rendered +- `text` **[string][5]** The graph definition +- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** +- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1517,7 +1526,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][5]** The directive to push in +- `directive` **[object][8]** The directive to push in ## reset @@ -1615,6 +1624,8 @@ Returns **void** [2]: Setup.md?id=render [3]: 8.6.0_docs.md [4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[7]: https://developer.mozilla.org/docs/Web/API/Element +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[9]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/package.json b/package.json index b64b3bc6ef..7cec9e40ca 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "build": "yarn clean; concurrently \"yarn build:code\" \"yarn build:types\"", "docs:build": "ts-node-esm src/docs.mts", "docs:verify": "ts-node-esm src/docs.mts --verify", - "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md; yarn docs:build", + "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md; prettier --write src/docs/Setup.md; yarn docs:build", "release": "yarn build", "lint": "eslint --cache --ignore-path .gitignore .; prettier --check .", "lint:fix": "eslint --fix --ignore-path .gitignore .; prettier --write .", diff --git a/src/docs/Setup.md b/src/docs/Setup.md index a9d8e87e20..41e7068255 100644 --- a/src/docs/Setup.md +++ b/src/docs/Setup.md @@ -1405,6 +1405,15 @@ This sets the auto-wrap padding for the diagram (sides only) **Notes:** Default value: 0. +## parse + +### Parameters + +- `text` **[string][5]** +- `parseError` **[Function][6]?** + +Returns **[boolean][7]** + ## setSiteConfig ## setSiteConfig @@ -1422,7 +1431,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## getSiteConfig @@ -1434,7 +1443,7 @@ Returns **[object][5]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][5]** The siteConfig +Returns **[object][8]** The siteConfig ## setConfig @@ -1473,10 +1482,10 @@ $(function () { ### Parameters -- `id` **[string][6]** The id of the element to be rendered -- `text` **[string][6]** The graph definition -- `cb` **function (svgCode: [string][6], bindFunctions: function (element: [Element][7]): void): void** -- `container` **[Element][7]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][5]** The id of the element to be rendered +- `text` **[string][5]** The graph definition +- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** +- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1515,7 +1524,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][5]** The directive to push in +- `directive` **[object][8]** The directive to push in ## reset @@ -1613,6 +1622,8 @@ Returns **void** [2]: Setup.md?id=render [3]: 8.6.0_docs.md [4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[7]: https://developer.mozilla.org/docs/Web/API/Element +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[9]: https://developer.mozilla.org/docs/Web/API/Element From 056d5200c6507a495690ffd01bed180116f67289 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 7 Sep 2022 21:06:35 +0530 Subject: [PATCH 16/33] Fix postbuild --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 56af22bd5a..9017a59367 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "test": "yarn lint && jest src/.*", "test:watch": "jest --watch src", "prepublishOnly": "yarn build && yarn test", - "prepare": "concurrently \"husky install\" \"yarn build:prod\" \"yarn postbuild\"", + "prepare": "concurrently \"husky install\" \"yarn build\"", "pre-commit": "lint-staged" }, "repository": { From 8a476f882da2af2825295f42861da60ae341f891 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 9 Sep 2022 16:02:26 +0530 Subject: [PATCH 17/33] Remove native memoize --- package.json | 1 + src/utils.ts | 51 ++++++++++++++------------------------------------- yarn.lock | 5 +++++ 3 files changed, 20 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 9017a59367..a4eaaea47d 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "fast-clone": "^1.5.13", "graphlib": "^2.1.8", "khroma": "^2.0.0", + "micro-memoize": "^4.0.11", "moment-mini": "^2.24.0", "non-layered-tidy-tree-layout": "^2.0.2", "stylis": "^4.0.10" diff --git a/src/utils.ts b/src/utils.ts index f883273679..1eb6561e46 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,6 +20,7 @@ import { log } from './logger'; import { detectType } from './diagram-api/detectType'; import assignWithDepth from './assignWithDepth'; import { MermaidConfig } from './config.type'; +import memoize from 'micro-memoize'; // Effectively an enum of the supported curve types, accessible by name const d3CurveTypes = { @@ -43,10 +44,10 @@ const anyComment = /\s*%%.*\n/gm; /** * @function detectInit Detects the init config object from the text - * * @param config + * * ```mermaid - * %%{init: {"theme": "debug", "logLevel": 1 }}%% + * %%{init: {"theme": "debug", "logLevel": 1 }}%% * graph LR * a-->b * b-->c @@ -165,27 +166,6 @@ export const detectDirective = function (text, type = null) { } }; -/** - * Caches results of functions based on input - * - * @param {Function} fn Function to run - * @param {Function} resolver Function that resolves to an ID given arguments the `fn` takes - * @returns {Function} An optimized caching function - */ -const memoize = (fn, resolver) => { - let cache = {}; - return (...args) => { - let n = resolver ? resolver.apply(this, args) : args[0]; - if (n in cache) { - return cache[n]; - } else { - let result = fn(...args); - cache[n] = result; - return result; - } - }; -}; - /** * @function isSubstringInArray Detects whether a substring in present in a given array * @param {string} str The substring to detect @@ -594,7 +574,7 @@ export const wrapLabel = memoize( return completedLines.filter((line) => line !== '').join(config.joinWith); }, (label, maxWidth, config) => - `${label}-${maxWidth}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}-${config.joinWith}` + `${label}${maxWidth}${config.fontSize}${config.fontWeight}${config.fontFamily}${config.joinWith}` ); const breakString = memoize( @@ -632,7 +612,8 @@ const breakString = memoize( * If the wrapped text text has greater height, we extend the height, so it's value won't overflow. * * @param {any} text The text to measure - * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size + * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the + * resulting size * @returns {any} - The height for the given text */ export const calculateTextHeight = function (text, config) { @@ -647,7 +628,8 @@ export const calculateTextHeight = function (text, config) { * This calculates the width of the given text, font size and family. * * @param {any} text - The text to calculate the width of - * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size + * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the + * resulting size * @returns {any} - The width for the given text */ export const calculateTextWidth = function (text, config) { @@ -656,7 +638,8 @@ export const calculateTextWidth = function (text, config) { }; /** - * This calculates the dimensions of the given text, font size, font family, font weight, and margins. + * This calculates the dimensions of the given text, font size, font family, font weight, and + * margins. * * @param {any} text - The text to calculate the width of * @param {any} config - The config for fontSize, fontFamily, fontWeight, and margin all impacting @@ -727,7 +710,8 @@ export const calculateTextDimensions = memoize( * Applys d3 attributes * * @param {any} d3Elem D3 Element to apply the attributes onto - * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of attributes + * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of + * attributes */ const d3Attrs = function (d3Elem, attrs) { for (let attr of attrs) { @@ -860,18 +844,12 @@ export interface DetailedError { hash: any; } -/** - * - * @param error - */ +/** @param error */ export function isDetailedError(error: unknown): error is DetailedError { return 'str' in error; } -/** - * - * @param error - */ +/** @param error */ export function getErrorMessage(error: unknown): string { if (error instanceof Error) return error.message; return String(error); @@ -894,7 +872,6 @@ export default { getStylesFromArray, generateId, random, - memoize, runFunc, entityDecode, initIdGenerator: initIdGenerator, diff --git a/yarn.lock b/yarn.lock index 148b07402a..b8d72a344d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9070,6 +9070,11 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= +micro-memoize@^4.0.11: + version "4.0.11" + resolved "https://registry.yarnpkg.com/micro-memoize/-/micro-memoize-4.0.11.tgz#f664afc8bd8c11cb2838716a7306d6e1ec205d3a" + integrity sha512-CjxsaYe4j43df32DtzzNCwanPqZjZDwuQAZilsCYpa2ZVtSPDjHXbTlR4gsEZRyO9/twHs0b7HLjvy/sowl7sA== + micromark-core-commonmark@^1.0.1: version "1.0.6" resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz#edff4c72e5993d93724a3c206970f5a15b0585ad" From 5aae45dc978ce25947b24e1486ebccfcec3d8aa4 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 9 Sep 2022 16:34:57 +0530 Subject: [PATCH 18/33] fix: Use lodash memoize --- package.json | 2 +- src/utils.spec.js | 33 ++++++++++++++++++++++----------- src/utils.ts | 9 +++++---- yarn.lock | 10 +++++----- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index a4eaaea47d..5e321f2945 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "fast-clone": "^1.5.13", "graphlib": "^2.1.8", "khroma": "^2.0.0", - "micro-memoize": "^4.0.11", "moment-mini": "^2.24.0", "non-layered-tidy-tree-layout": "^2.0.2", "stylis": "^4.0.10" @@ -89,6 +88,7 @@ "@types/d3": "^7.4.0", "@types/dompurify": "^2.3.4", "@types/jest": "^28.1.7", + "@types/lodash": "^4.14.184", "@types/stylis": "^4.0.2", "@typescript-eslint/eslint-plugin": "^5.36.1", "@typescript-eslint/parser": "^5.36.1", diff --git a/src/utils.spec.js b/src/utils.spec.js index ebaa1415cf..6ffbd3af1a 100644 --- a/src/utils.spec.js +++ b/src/utils.spec.js @@ -2,6 +2,7 @@ import utils from './utils'; import assignWithDepth from './assignWithDepth'; import { detectType } from './diagram-api/detectType'; import { addDiagrams } from './diagram-api/diagram-orchestration'; +import { memoize } from 'lodash'; addDiagrams(); describe('when assignWithDepth: should merge objects within objects', function () { @@ -121,20 +122,30 @@ describe('when assignWithDepth: should merge objects within objects', function ( }); describe('when memoizing', function () { it('should return the same value', function () { - const fib = utils.memoize(function (n, canary) { - canary.flag = true; - if (n < 2) { - return 1; - } else { - //We'll console.log a loader every time we have to recurse - return fib(n - 2, canary) + fib(n - 1, canary); - } - }); + const fib = memoize( + function (n, x, canary) { + canary.flag = true; + if (n < 2) { + return 1; + } else { + //We'll console.log a loader every time we have to recurse + return fib(n - 2, x, canary) + fib(n - 1, x, canary); + } + }, + (n, x, _) => `${n}${x}` + ); let canary = { flag: false }; - fib(10, canary); + fib(10, 'a', canary); + expect(canary.flag).toBe(true); + canary = { flag: false }; + fib(10, 'a', canary); + expect(canary.flag).toBe(false); + fib(10, 'b', canary); + fib(10, 'b', canary); expect(canary.flag).toBe(true); canary = { flag: false }; - fib(10, canary); + fib(10, 'b', canary); + fib(10, 'a', canary); expect(canary.flag).toBe(false); }); }); diff --git a/src/utils.ts b/src/utils.ts index 1eb6561e46..200032435d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,7 +20,7 @@ import { log } from './logger'; import { detectType } from './diagram-api/detectType'; import assignWithDepth from './assignWithDepth'; import { MermaidConfig } from './config.type'; -import memoize from 'micro-memoize'; +import { memoize } from 'lodash'; // Effectively an enum of the supported curve types, accessible by name const d3CurveTypes = { @@ -47,7 +47,8 @@ const anyComment = /\s*%%.*\n/gm; * @param config * * ```mermaid - * %%{init: {"theme": "debug", "logLevel": 1 }}%% + * + * %%{init: {"theme": "debug", "logLevel": 1 }}%% * graph LR * a-->b * b-->c @@ -602,7 +603,7 @@ const breakString = memoize( return { hyphenatedStrings: lines, remainingWord: currentLine }; }, (word, maxWidth, hyphenCharacter = '-', config) => - `${word}-${maxWidth}-${hyphenCharacter}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}` + `${word}${maxWidth}${hyphenCharacter}${config.fontSize}${config.fontWeight}${config.fontFamily}` ); /** @@ -703,7 +704,7 @@ export const calculateTextDimensions = memoize( : 1; return dims[index]; }, - (text, config) => `${text}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}` + (text, config) => `${text}${config.fontSize}${config.fontWeight}${config.fontFamily}` ); /** diff --git a/yarn.lock b/yarn.lock index b8d72a344d..1967b28b18 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2643,6 +2643,11 @@ dependencies: "@types/node" "*" +"@types/lodash@^4.14.184": + version "4.14.184" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe" + integrity sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q== + "@types/mdast@^3.0.0": version "3.0.10" resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af" @@ -9070,11 +9075,6 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -micro-memoize@^4.0.11: - version "4.0.11" - resolved "https://registry.yarnpkg.com/micro-memoize/-/micro-memoize-4.0.11.tgz#f664afc8bd8c11cb2838716a7306d6e1ec205d3a" - integrity sha512-CjxsaYe4j43df32DtzzNCwanPqZjZDwuQAZilsCYpa2ZVtSPDjHXbTlR4gsEZRyO9/twHs0b7HLjvy/sowl7sA== - micromark-core-commonmark@^1.0.1: version "1.0.6" resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz#edff4c72e5993d93724a3c206970f5a15b0585ad" From d2e7b1e56f551d776e89be077313674141a00103 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 9 Sep 2022 16:58:48 +0530 Subject: [PATCH 19/33] fix: Support treeshaking --- package.json | 1 + src/utils.spec.js | 2 +- src/utils.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5e321f2945..e1709730e6 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "fast-clone": "^1.5.13", "graphlib": "^2.1.8", "khroma": "^2.0.0", + "lodash": "^4.17.21", "moment-mini": "^2.24.0", "non-layered-tidy-tree-layout": "^2.0.2", "stylis": "^4.0.10" diff --git a/src/utils.spec.js b/src/utils.spec.js index 6ffbd3af1a..d024da3db2 100644 --- a/src/utils.spec.js +++ b/src/utils.spec.js @@ -2,7 +2,7 @@ import utils from './utils'; import assignWithDepth from './assignWithDepth'; import { detectType } from './diagram-api/detectType'; import { addDiagrams } from './diagram-api/diagram-orchestration'; -import { memoize } from 'lodash'; +import memoize from 'lodash/memoize'; addDiagrams(); describe('when assignWithDepth: should merge objects within objects', function () { diff --git a/src/utils.ts b/src/utils.ts index 200032435d..7cd700e85e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -20,7 +20,7 @@ import { log } from './logger'; import { detectType } from './diagram-api/detectType'; import assignWithDepth from './assignWithDepth'; import { MermaidConfig } from './config.type'; -import { memoize } from 'lodash'; +import memoize from 'lodash/memoize'; // Effectively an enum of the supported curve types, accessible by name const d3CurveTypes = { From 1029ce4527108756b0ebefa159be9f3460fb6bb7 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 9 Sep 2022 17:32:13 +0530 Subject: [PATCH 20/33] fix: Add `.core` build. --- .esbuild/esbuild.cjs | 7 +++++++ .esbuild/util.cjs | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs index 5cdee62c7a..776ae6eec0 100644 --- a/.esbuild/esbuild.cjs +++ b/.esbuild/esbuild.cjs @@ -7,8 +7,15 @@ const handler = (e) => { }; const watch = process.argv.includes('--watch'); +// mermaid.js build(umdBuild({ minify: false, watch })).catch(handler); +// mermaid.esm.mjs build(esmBuild({ minify: false, watch })).catch(handler); +// mermaid.core.js +build(umdBuild({ minify: false, core: true })).catch(handler); + +// mermaid.min.js build(esmBuild()).catch(handler); +// mermaid.esm.min.mjs build(umdBuild()).catch(handler); diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 7fc77d0c57..518bb723fa 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -39,12 +39,17 @@ exports.esmBuild = (override = { minify: true }) => { }; /** - * @param {Options} override + * @param {Options & { core?: boolean }} override * @returns {Options} */ -exports.umdBuild = (override = { minify: true }) => { +exports.umdBuild = (override = { minify: true, core: false }) => { + const core = override.core; + if (core && override.minify) { + throw new Error('Cannot minify core build'); + } + delete override.core; return buildOptions({ - outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`, + outfile: `dist/mermaid${override.minify ? '.min' : core ? '.core' : ''}.js`, ...override, }); }; From c8d3c3ac4fd5c6a75b8840326c1c10f0588aa340 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 9 Sep 2022 17:48:09 +0530 Subject: [PATCH 21/33] Correct name `umd` -> `iife` --- .esbuild/esbuild.cjs | 8 ++++---- .esbuild/serve.cjs | 4 ++-- .esbuild/util.cjs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs index 776ae6eec0..affd08ef90 100644 --- a/.esbuild/esbuild.cjs +++ b/.esbuild/esbuild.cjs @@ -1,4 +1,4 @@ -const { esmBuild, umdBuild } = require('./util.cjs'); +const { esmBuild, iifeBuild } = require('./util.cjs'); const { build } = require('esbuild'); const handler = (e) => { @@ -8,14 +8,14 @@ const handler = (e) => { const watch = process.argv.includes('--watch'); // mermaid.js -build(umdBuild({ minify: false, watch })).catch(handler); +build(iifeBuild({ minify: false, watch })).catch(handler); // mermaid.esm.mjs build(esmBuild({ minify: false, watch })).catch(handler); // mermaid.core.js -build(umdBuild({ minify: false, core: true })).catch(handler); +build(iifeBuild({ minify: false, core: true })).catch(handler); // mermaid.min.js build(esmBuild()).catch(handler); // mermaid.esm.min.mjs -build(umdBuild()).catch(handler); +build(iifeBuild()).catch(handler); diff --git a/.esbuild/serve.cjs b/.esbuild/serve.cjs index 13eba401d0..c54ff1e9f1 100644 --- a/.esbuild/serve.cjs +++ b/.esbuild/serve.cjs @@ -1,7 +1,7 @@ const esbuild = require('esbuild'); const http = require('http'); const path = require('path'); -const { umdBuild } = require('./util.cjs'); +const { iifeBuild } = require('./util.cjs'); // Start esbuild's server on a random local port esbuild @@ -9,7 +9,7 @@ esbuild { servedir: path.join(__dirname, '..'), }, - umdBuild({ minify: false }) + iifeBuild({ minify: false }) ) .then((result) => { // The result tells us where esbuild's local server is diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 518bb723fa..e136ff52ef 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -42,7 +42,7 @@ exports.esmBuild = (override = { minify: true }) => { * @param {Options & { core?: boolean }} override * @returns {Options} */ -exports.umdBuild = (override = { minify: true, core: false }) => { +exports.iifeBuild = (override = { minify: true, core: false }) => { const core = override.core; if (core && override.minify) { throw new Error('Cannot minify core build'); From 5148acb20fe0ad0e37ab458e0295eee21a1c049d Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 9 Sep 2022 17:49:11 +0530 Subject: [PATCH 22/33] Specify `iife` format --- .esbuild/util.cjs | 1 + 1 file changed, 1 insertion(+) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index e136ff52ef..6b462ff4e6 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -50,6 +50,7 @@ exports.iifeBuild = (override = { minify: true, core: false }) => { delete override.core; return buildOptions({ outfile: `dist/mermaid${override.minify ? '.min' : core ? '.core' : ''}.js`, + format: 'iife', ...override, }); }; From 48a899f7a90db8d2e9d5443dd8aa8b08613a4c12 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sat, 10 Sep 2022 02:22:03 +0100 Subject: [PATCH 23/33] build: remove main function from `.jison` files When converting a `.jison` file into a CommonJS module, jison by default adds a main() function that calls `require("fs");` Even though the main function is never used in the browser, because `fs` is a Node.JS only module, this causes some esbuild issues. To disable this, we can just set an empty main to the jison generator. --- .esbuild/util.cjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 6b462ff4e6..f22186fc26 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -61,7 +61,9 @@ const jisonPlugin = { build.onLoad({ filter: /\.jison$/ }, async (args) => { // Load the file from the file system const source = await fs.promises.readFile(args.path, 'utf8'); - const contents = new Generator(source, { 'token-stack': true }).generate(); + const contents = new Generator(source, { 'token-stack': true }).generate({ + moduleMain: '() => {}', // disable moduleMain (default one requires Node.JS modules) + }); return { contents, warnings: [] }; }); }, From 37aaca009086d85cdb0d9c6fb46994c5a8eedc9b Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sun, 11 Sep 2022 20:55:03 +0100 Subject: [PATCH 24/33] build: convert core build to unbundled ESM The `mermaid.core.js` build was previously a UMD build that did not have `node_modules` bundled. This was designed for users to add `mermaid` to their own apps, then bundle with Webpack/ESBuild. Hence the bundle test in `cypress/platform/bundle-test.js`. As ESBuild does not support UMD, I've switched the `mermaid.core.js` to instead use ESM, as Mermaid now requires ESM (due to d3 requiring ESM). All modern bundlers also support ESM. --- .esbuild/esbuild.cjs | 7 +++---- .esbuild/util.cjs | 45 +++++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs index affd08ef90..e38951bdbc 100644 --- a/.esbuild/esbuild.cjs +++ b/.esbuild/esbuild.cjs @@ -1,4 +1,4 @@ -const { esmBuild, iifeBuild } = require('./util.cjs'); +const { esmBuild, esmCoreBuild, iifeBuild } = require('./util.cjs'); const { build } = require('esbuild'); const handler = (e) => { @@ -12,10 +12,9 @@ build(iifeBuild({ minify: false, watch })).catch(handler); // mermaid.esm.mjs build(esmBuild({ minify: false, watch })).catch(handler); -// mermaid.core.js -build(iifeBuild({ minify: false, core: true })).catch(handler); - // mermaid.min.js build(esmBuild()).catch(handler); // mermaid.esm.min.mjs build(iifeBuild()).catch(handler); +// mermaid.core.mjs (node_modules unbundled) +build(esmCoreBuild()).catch(handler); diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index f22186fc26..10832474fa 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -1,5 +1,6 @@ const { Generator } = require('jison'); const fs = require('fs'); +const { dependencies } = require('../package.json'); /** @typedef {import('esbuild').BuildOptions} Options */ @@ -27,8 +28,12 @@ const buildOptions = (override = {}) => { }; /** - * @param {Options} override - * @returns {Options} + * Build options for mermaid.esm.* build. + * + * For ESM browser use. + * + * @param {Options} override - Override options. + * @returns {Options} ESBuild build options. */ exports.esmBuild = (override = { minify: true }) => { return buildOptions({ @@ -39,17 +44,35 @@ exports.esmBuild = (override = { minify: true }) => { }; /** - * @param {Options & { core?: boolean }} override - * @returns {Options} + * Build options for mermaid.core.* build. + * + * This build does not bundle `./node_modules/`, as it is designed to be used + * with Webpack/ESBuild to merge webpack into a website. + * + * @param {Options} override - Override options. + * @returns {Options} ESBuild build options. + */ +exports.esmCoreBuild = (override) => { + return buildOptions({ + format: 'esm', + outfile: `dist/mermaid.core.mjs`, + external: ['require', 'fs', 'path', ...Object.keys(dependencies)], + platform: 'neutral', + ...override, + }); +}; + +/** + * Build options for mermaid.js build. + * + * For IIFE browser use (where ESM is not yet supported). + * + * @param {Options} override - Override options. + * @returns {Options} ESBuild build options. */ -exports.iifeBuild = (override = { minify: true, core: false }) => { - const core = override.core; - if (core && override.minify) { - throw new Error('Cannot minify core build'); - } - delete override.core; +exports.iifeBuild = (override = { minify: true }) => { return buildOptions({ - outfile: `dist/mermaid${override.minify ? '.min' : core ? '.core' : ''}.js`, + outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`, format: 'iife', ...override, }); From 5554725f634edeb8a66ae3411ad28805fa16892a Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sun, 11 Sep 2022 21:26:41 +0100 Subject: [PATCH 25/33] build: change package export to mermaid.core.mjs `mermaid.core.mjs` should be the default export. This is because it does not bundle `node_modules/`, allowing users of mermaid to bundle dependencies themselves, using Webpack/ESBuild/others. --- cypress/platform/bundle-test.js | 2 +- package.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/platform/bundle-test.js b/cypress/platform/bundle-test.js index 22f4fe93c1..b4ce798b20 100644 --- a/cypress/platform/bundle-test.js +++ b/cypress/platform/bundle-test.js @@ -1,4 +1,4 @@ -import mermaid from '../../dist/mermaid'; +import mermaid from '../../dist/mermaid.core.mjs'; let code = `flowchart LR Power_Supply --> Transmitter_A diff --git a/package.json b/package.json index e1709730e6..a94626597b 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,13 @@ "name": "mermaid", "version": "9.1.6", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", - "main": "dist/mermaid.min.js", - "module": "dist/mermaid.esm.min.mjs", + "main": "dist/mermaid.core.mjs", + "module": "dist/mermaid.core.mjs", "types": "dist/mermaid.d.ts", "exports": { ".": { "require": "./dist/mermaid.min.js", - "import": "./dist/mermaid.esm.min.mjs", + "import": "./dist/mermaid.core.mjs", "types": "./dist/mermaid.d.ts" }, "./*": "./*" From 3f76eb0ac24179fb80a264eeb0cf564a042c9920 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Mon, 12 Sep 2022 06:21:57 +0100 Subject: [PATCH 26/33] docs: update `mermaid.core.*` JSDoc Fix typo and add that `mermaid.core.*` is compatible with Vite. --- .esbuild/util.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 10832474fa..8c1c37eb2a 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -47,7 +47,7 @@ exports.esmBuild = (override = { minify: true }) => { * Build options for mermaid.core.* build. * * This build does not bundle `./node_modules/`, as it is designed to be used - * with Webpack/ESBuild to merge webpack into a website. + * with Webpack/ESBuild/Vite to use mermaid inside an app/website. * * @param {Options} override - Override options. * @returns {Options} ESBuild build options. From e740325d84deda904218f0f67b02382de7fc3e9f Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 12 Sep 2022 11:41:26 +0530 Subject: [PATCH 27/33] Unify webpack build --- .webpack/webpack.config.babel.js | 72 +++++++++++++++----------------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/.webpack/webpack.config.babel.js b/.webpack/webpack.config.babel.js index 9dfd834b7e..c7cc25ee44 100644 --- a/.webpack/webpack.config.babel.js +++ b/.webpack/webpack.config.babel.js @@ -3,43 +3,37 @@ import nodeExternals from 'webpack-node-externals'; import baseConfig from './webpack.config.base'; export default (_env, args) => { - switch (args.mode) { - case 'development': - return [ - baseConfig, - merge(baseConfig, { - externals: [nodeExternals()], - output: { - filename: '[name].core.js', - }, - }), - ]; - case 'production': - return [ - // umd - merge(baseConfig, { - output: { - filename: '[name].min.js', - }, - }), - // esm - mergeWithCustomize({ - customizeObject: customizeObject({ - 'output.library': 'replace', - }), - })(baseConfig, { - experiments: { - outputModule: true, - }, - output: { - library: { - type: 'module', - }, - filename: '[name].esm.min.mjs', - }, - }), - ]; - default: - throw new Error('No matching configuration was found!'); - } + return [ + // non-minified + baseConfig, + // core [To be used by webpack/esbuild/vite etc to bundle mermaid] + merge(baseConfig, { + externals: [nodeExternals()], + output: { + filename: '[name].core.js', + }, + }), + // umd + merge(baseConfig, { + output: { + filename: '[name].min.js', + }, + }), + // esm + mergeWithCustomize({ + customizeObject: customizeObject({ + 'output.library': 'replace', + }), + })(baseConfig, { + experiments: { + outputModule: true, + }, + output: { + library: { + type: 'module', + }, + filename: '[name].esm.min.mjs', + }, + }), + ]; }; From 681f4bb803f3351c7eb2777adde462b1db432748 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 12 Sep 2022 11:41:50 +0530 Subject: [PATCH 28/33] Keep webpack as default build option --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a94626597b..94c94ab1ac 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly", "build:webpack": "webpack --mode production --progress --color", "build:watch": "yarn build:code --watch", - "build": "yarn clean; concurrently \"yarn build:code\" \"yarn build:types\"", + "build:new": "concurrently \"yarn build:code\" \"yarn build:types\"", + "build": "yarn clean; yarn build:webpack", "docs:build": "ts-node-esm src/docs.mts", "docs:verify": "ts-node-esm src/docs.mts --verify", "postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md && prettier --write src/docs/Setup.md && yarn docs:build", From d8735060dcf8c4c8734c3771a88d46422e835f91 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 12 Sep 2022 11:55:40 +0530 Subject: [PATCH 29/33] Disable minimization on non `min` files. --- .webpack/webpack.config.babel.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.webpack/webpack.config.babel.js b/.webpack/webpack.config.babel.js index c7cc25ee44..15760b19b8 100644 --- a/.webpack/webpack.config.babel.js +++ b/.webpack/webpack.config.babel.js @@ -5,13 +5,20 @@ import baseConfig from './webpack.config.base'; export default (_env, args) => { return [ // non-minified - baseConfig, + merge(baseConfig, { + optimization: { + minimize: false, + }, + }), // core [To be used by webpack/esbuild/vite etc to bundle mermaid] merge(baseConfig, { externals: [nodeExternals()], output: { filename: '[name].core.js', }, + optimization: { + minimize: false, + }, }), // umd merge(baseConfig, { From a87abc00c65de91ed417e25c5f81973673f21153 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 13 Sep 2022 11:25:14 +0530 Subject: [PATCH 30/33] Add diagramAPI to outfile --- .esbuild/util.cjs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs index 8c1c37eb2a..0cddb7e45c 100644 --- a/.esbuild/util.cjs +++ b/.esbuild/util.cjs @@ -19,14 +19,19 @@ const buildOptions = (override = {}) => { tsconfig: 'tsconfig.json', resolveExtensions: ['.ts', '.js', '.json', '.jison'], external: ['require', 'fs', 'path'], - entryPoints: ['src/mermaid.ts'], - outfile: 'dist/mermaid.min.js', + outdir: 'dist', plugins: [jisonPlugin], sourcemap: 'external', ...override, }; }; +const getOutFiles = (extension) => { + return { + [`mermaid${extension}`]: 'src/mermaid.ts', + [`diagramAPI${extension}`]: 'src/diagram-api/diagramAPI.ts', + }; +}; /** * Build options for mermaid.esm.* build. * @@ -38,7 +43,8 @@ const buildOptions = (override = {}) => { exports.esmBuild = (override = { minify: true }) => { return buildOptions({ format: 'esm', - outfile: `dist/mermaid.esm${override.minify ? '.min' : ''}.mjs`, + entryPoints: getOutFiles(`.esm${override.minify ? '.min' : ''}`), + outExtension: { '.js': '.mjs' }, ...override, }); }; @@ -46,8 +52,8 @@ exports.esmBuild = (override = { minify: true }) => { /** * Build options for mermaid.core.* build. * - * This build does not bundle `./node_modules/`, as it is designed to be used - * with Webpack/ESBuild/Vite to use mermaid inside an app/website. + * This build does not bundle `./node_modules/`, as it is designed to be used with + * Webpack/ESBuild/Vite to use mermaid inside an app/website. * * @param {Options} override - Override options. * @returns {Options} ESBuild build options. @@ -55,7 +61,8 @@ exports.esmBuild = (override = { minify: true }) => { exports.esmCoreBuild = (override) => { return buildOptions({ format: 'esm', - outfile: `dist/mermaid.core.mjs`, + entryPoints: getOutFiles(`.core`), + outExtension: { '.js': '.mjs' }, external: ['require', 'fs', 'path', ...Object.keys(dependencies)], platform: 'neutral', ...override, @@ -72,7 +79,7 @@ exports.esmCoreBuild = (override) => { */ exports.iifeBuild = (override = { minify: true }) => { return buildOptions({ - outfile: `dist/mermaid${override.minify ? '.min' : ''}.js`, + entryPoints: getOutFiles(override.minify ? '.min' : ''), format: 'iife', ...override, }); From a7fa40ecdac19c2fccb77c1a4a0692ceb7033553 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Wed, 14 Sep 2022 11:35:49 +0530 Subject: [PATCH 31/33] Remove extension --- cypress/platform/bundle-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/platform/bundle-test.js b/cypress/platform/bundle-test.js index b4ce798b20..373f8741a0 100644 --- a/cypress/platform/bundle-test.js +++ b/cypress/platform/bundle-test.js @@ -1,4 +1,4 @@ -import mermaid from '../../dist/mermaid.core.mjs'; +import mermaid from '../../dist/mermaid.core'; let code = `flowchart LR Power_Supply --> Transmitter_A From 2693c9b02486901201288c68b0261f8dd57d7fdb Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 16 Sep 2022 18:09:24 +0530 Subject: [PATCH 32/33] Fix coverage --- docs/Setup.md | 46 +++--- jest.config.js | 3 +- package.json | 2 +- src/assignWithDepth.js | 1 + src/docs/Setup.md | 46 +++--- src/mermaid.ts | 1 + src/mermaidAPI.spec.js | 1 + src/mermaidAPI.ts | 3 - yarn.lock | 341 ++++++++++++++++++++++++++++++++++++++--- 9 files changed, 370 insertions(+), 74 deletions(-) diff --git a/docs/Setup.md b/docs/Setup.md index 8e428c14cb..e437b619b2 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -4,13 +4,10 @@ ## mermaidAPI -Edit this -Page[\[N|Solid\](img/GitHub-Mark-32px.png)][1] - This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js. -The core of this api is the [**render**][2] function which, given a graph +The core of this api is the [**render**][1] function which, given a graph definition as text, renders the graph/diagram and returns an svg element for the graph. It is then up to the user of the API to make use of the svg, either insert it somewhere in the @@ -21,7 +18,7 @@ In addition to the render function, a number of behavioral configuration options ## Configuration **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more\[[click -here][3]].** +here][2]].** ## **What follows are config instructions for older versions** @@ -36,7 +33,7 @@ htmlLabels:true, curve:'cardinal', }, }; mermaid.initialize(config); -A summary of all options and their defaults is found [here][4]. +A summary of all options and their defaults is found [here][3]. A description of each option follows below. ## theme @@ -1411,10 +1408,10 @@ This sets the auto-wrap padding for the diagram (sides only) ### Parameters -- `text` **[string][5]** -- `parseError` **[Function][6]?** +- `text` **[string][4]** +- `parseError` **[Function][5]?** -Returns **[boolean][7]** +Returns **[boolean][6]** ## setSiteConfig @@ -1433,7 +1430,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## getSiteConfig @@ -1445,7 +1442,7 @@ Returns **[object][8]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## setConfig @@ -1484,10 +1481,10 @@ $(function () { ### Parameters -- `id` **[string][5]** The id of the element to be rendered -- `text` **[string][5]** The graph definition -- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** -- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][4]** The id of the element to be rendered +- `text` **[string][4]** The graph definition +- `cb` **function (svgCode: [string][4], bindFunctions: function (element: [Element][8]): void): void** +- `container` **[Element][8]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1526,7 +1523,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][8]** The directive to push in +- `directive` **[object][7]** The directive to push in ## reset @@ -1620,12 +1617,11 @@ Returns **void** ``` -[1]: https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js -[2]: Setup.md?id=render -[3]: 8.6.0_docs.md -[4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function -[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean -[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[9]: https://developer.mozilla.org/docs/Web/API/Element +[1]: Setup.md?id=render +[2]: 8.6.0_docs.md +[3]: #mermaidapi-configuration-defaults +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[8]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/jest.config.js b/jest.config.js index 33618cf12d..5b43d379d7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,8 +5,7 @@ module.exports = { testEnvironment: 'jsdom', preset: 'ts-jest', transform: { - '^.+\\.tsx?$': ['jest-esbuild', { banner: '"use strict";' }], - '^.+\\.jsx?$': ['jest-esbuild', { banner: '"use strict";' }], + '^.+\\.[jt]sx?$': 'esbuild-jest', '^.+\\.jison$': [ path.resolve(__dirname, './src/jison/transformer.js'), { 'token-stack': true }, diff --git a/package.json b/package.json index 4d37acbca4..04c78ccaa2 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "cypress-image-snapshot": "^4.0.1", "documentation": "13.2.0", "esbuild": "^0.15.6", + "esbuild-jest": "^0.5.0", "esbuild-loader": "^2.19.0", "eslint": "^8.23.1", "eslint-config-prettier": "^8.5.0", @@ -116,7 +117,6 @@ "identity-obj-proxy": "^3.0.0", "jest": "^28.0.3", "jest-environment-jsdom": "^29.0.3", - "jest-esbuild": "^0.2.9", "jison": "^0.4.18", "js-base64": "3.7.2", "lint-staged": "^13.0.0", diff --git a/src/assignWithDepth.js b/src/assignWithDepth.js index 9f44b01ee4..eff568d3e6 100644 --- a/src/assignWithDepth.js +++ b/src/assignWithDepth.js @@ -1,3 +1,4 @@ +'use strict'; /** * @function assignWithDepth Extends the functionality of {@link ObjectConstructor.assign} with the * ability to merge arbitrary-depth objects For each key in src with path `k` (recursively) diff --git a/src/docs/Setup.md b/src/docs/Setup.md index 41e7068255..01dab44a6c 100644 --- a/src/docs/Setup.md +++ b/src/docs/Setup.md @@ -2,13 +2,10 @@ ## mermaidAPI -Edit this -Page[\[N|Solid\](img/GitHub-Mark-32px.png)][1] - This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js. -The core of this api is the [**render**][2] function which, given a graph +The core of this api is the [**render**][1] function which, given a graph definition as text, renders the graph/diagram and returns an svg element for the graph. It is then up to the user of the API to make use of the svg, either insert it somewhere in the @@ -19,7 +16,7 @@ In addition to the render function, a number of behavioral configuration options ## Configuration **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more\[[click -here][3]].** +here][2]].** ## **What follows are config instructions for older versions** @@ -34,7 +31,7 @@ htmlLabels:true, curve:'cardinal', }, }; mermaid.initialize(config); -A summary of all options and their defaults is found [here][4]. +A summary of all options and their defaults is found [here][3]. A description of each option follows below. ## theme @@ -1409,10 +1406,10 @@ This sets the auto-wrap padding for the diagram (sides only) ### Parameters -- `text` **[string][5]** -- `parseError` **[Function][6]?** +- `text` **[string][4]** +- `parseError` **[Function][5]?** -Returns **[boolean][7]** +Returns **[boolean][6]** ## setSiteConfig @@ -1431,7 +1428,7 @@ function _Default value: At default, will mirror Global Config_ - `conf` **MermaidConfig** The base currentConfig to use as siteConfig -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## getSiteConfig @@ -1443,7 +1440,7 @@ Returns **[object][8]** The siteConfig **Notes**: Returns **any** values in siteConfig. -Returns **[object][8]** The siteConfig +Returns **[object][7]** The siteConfig ## setConfig @@ -1482,10 +1479,10 @@ $(function () { ### Parameters -- `id` **[string][5]** The id of the element to be rendered -- `text` **[string][5]** The graph definition -- `cb` **function (svgCode: [string][5], bindFunctions: function (element: [Element][9]): void): void** -- `container` **[Element][9]** Selector to element in which a div with the graph temporarily will be +- `id` **[string][4]** The id of the element to be rendered +- `text` **[string][4]** The graph definition +- `cb` **function (svgCode: [string][4], bindFunctions: function (element: [Element][8]): void): void** +- `container` **[Element][8]** Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed. @@ -1524,7 +1521,7 @@ Pushes in a directive to the configuration ### Parameters -- `directive` **[object][8]** The directive to push in +- `directive` **[object][7]** The directive to push in ## reset @@ -1618,12 +1615,11 @@ Returns **void** ``` -[1]: https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js -[2]: Setup.md?id=render -[3]: 8.6.0_docs.md -[4]: #mermaidapi-configuration-defaults -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function -[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean -[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[9]: https://developer.mozilla.org/docs/Web/API/Element +[1]: Setup.md?id=render +[2]: 8.6.0_docs.md +[3]: #mermaidapi-configuration-defaults +[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[8]: https://developer.mozilla.org/docs/Web/API/Element diff --git a/src/mermaid.ts b/src/mermaid.ts index 809387f60f..6eec7ea66c 100644 --- a/src/mermaid.ts +++ b/src/mermaid.ts @@ -1,3 +1,4 @@ +'use strict'; /** * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid * functionality and to render the diagrams to svg code. diff --git a/src/mermaidAPI.spec.js b/src/mermaidAPI.spec.js index 3c4a28ca96..241b5ec864 100644 --- a/src/mermaidAPI.spec.js +++ b/src/mermaidAPI.spec.js @@ -1,3 +1,4 @@ +'use strict'; import mermaid from './mermaid'; import mermaidAPI from './mermaidAPI'; import assignWithDepth from './assignWithDepth'; diff --git a/src/mermaidAPI.ts b/src/mermaidAPI.ts index c8d51941a8..64bfbeff70 100644 --- a/src/mermaidAPI.ts +++ b/src/mermaidAPI.ts @@ -1,7 +1,4 @@ /** - * Edit this - * Page[[N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js) - * * This is the API to be used when optionally handling the integration with the web page, instead of * using the default integration provided by mermaid.js. * diff --git a/yarn.lock b/yarn.lock index 934aff2931..940dd18e2b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -244,6 +244,11 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.0.tgz#2a592fd89bacb1fcde68de31bee4f2f2dacb0e86" integrity sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw== +"@babel/compat-data@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.1.tgz#72d647b4ff6a4f82878d184613353af1dd0290f9" + integrity sha512-72a9ghR0gnESIa7jBN53U32FOVCEoztyIlKaNoU05zRhEecduGK9L9c3ww7Mp06JiR+0ls0GBPFJQwwtjn9ksg== + "@babel/core@7.12.3": version "7.12.3" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.3.tgz#1b436884e1e3bff6fb1328dc02b208759de92ad8" @@ -266,6 +271,27 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/core@^7.1.0", "@babel/core@^7.12.17": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.1.tgz#c8fa615c5e88e272564ace3d42fbc8b17bfeb22b" + integrity sha512-1H8VgqXme4UXCRv7/Wa1bq7RVymKOzC7znjyFM8KiEzwFqcKUKYNoQef4GhdklgNvoBXyW4gYhuBNCM5o1zImw== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.19.0" + "@babel/helper-compilation-targets" "^7.19.1" + "@babel/helper-module-transforms" "^7.19.0" + "@babel/helpers" "^7.19.0" + "@babel/parser" "^7.19.1" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.19.1" + "@babel/types" "^7.19.0" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.19.0": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.0.tgz#d2f5f4f2033c00de8096be3c9f45772563e150c3" @@ -346,6 +372,16 @@ browserslist "^4.20.2" semver "^6.3.0" +"@babel/helper-compilation-targets@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.1.tgz#7f630911d83b408b76fe584831c98e5395d7a17c" + integrity sha512-LlLkkqhCMyz2lkQPvJNdIYU7O5YjWRgC2R4omjCTpZd8u8KMQzZvX4qce+/BluN1rcQiV7BoGUpmQ0LeHerbhg== + dependencies: + "@babel/compat-data" "^7.19.1" + "@babel/helper-validator-option" "^7.18.6" + browserslist "^4.21.3" + semver "^6.3.0" + "@babel/helper-create-class-features-plugin@^7.16.0": version "7.18.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.0.tgz#fac430912606331cb075ea8d82f9a4c145a4da19" @@ -683,6 +719,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.0.tgz#497fcafb1d5b61376959c1c338745ef0577aa02c" integrity sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw== +"@babel/parser@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.1.tgz#6f6d6c2e621aad19a92544cc217ed13f1aac5b4c" + integrity sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -1204,7 +1245,7 @@ "@babel/helper-plugin-utils" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.18.6": +"@babel/plugin-transform-modules-commonjs@^7.12.13", "@babel/plugin-transform-modules-commonjs@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz#afd243afba166cca69892e24a8fd8c9f2ca87883" integrity sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q== @@ -1530,6 +1571,22 @@ debug "^4.1.0" globals "^11.1.0" +"@babel/traverse@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.1.tgz#0fafe100a8c2a603b4718b1d9bf2568d1d193347" + integrity sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.19.0" + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.19.1" + "@babel/types" "^7.19.0" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.0.tgz#75f21d73d73dc0351f3368d28db73465f4814600" @@ -1549,6 +1606,14 @@ resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.0.tgz#fe364f025ba74f6de6c837a84ef44bdb1d61e68f" integrity sha512-mgmE7XBYY/21erpzhexk4Cj1cyTQ9LzvnTxtzM17BJ7ERMNE6W72mQRo0I1Ud8eFJ+RVVIcBNhLFZ3GX4XFz5w== +"@cnakazawa/watch@^1.0.3": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" + integrity sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + "@commitlint/cli@^17.1.2": version "17.1.2" resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-17.1.2.tgz#38240f84936df5216f749f06f838dc50cc85a43d" @@ -2028,6 +2093,27 @@ jest-haste-map "^28.1.3" slash "^3.0.0" +"@jest/transform@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b" + integrity sha512-E9JjhUgNzvuQ+vVAL21vlyfy12gP0GhazGgJC4h6qUt1jSdUXGWJ1wfu/X7Sd8etSgxV4ovT1pb9v5D6QW4XgA== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^26.6.2" + babel-plugin-istanbul "^6.0.0" + chalk "^4.0.0" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.2.4" + jest-haste-map "^26.6.2" + jest-regex-util "^26.0.0" + jest-util "^26.6.2" + micromatch "^4.0.2" + pirates "^4.0.1" + slash "^3.0.0" + source-map "^0.6.1" + write-file-atomic "^3.0.0" + "@jest/transform@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-28.1.3.tgz#59d8098e50ab07950e0f2fc0fc7ec462371281b0" @@ -2070,6 +2156,17 @@ slash "^3.0.0" write-file-atomic "^4.0.1" +"@jest/types@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" + integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^15.0.0" + chalk "^4.0.0" + "@jest/types@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.3.tgz#b05de80996ff12512bc5ceb1d208285a7d11748b" @@ -2246,6 +2343,17 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== +"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": + version "7.1.19" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.19.tgz#7b497495b7d1b4812bdb9d02804d0576f43ee460" + integrity sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + "@types/babel__core@^7.1.14": version "7.1.17" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.17.tgz#f50ac9d20d64153b510578d84f9643f9a3afbe64" @@ -2588,7 +2696,7 @@ resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.10.tgz#6dfbf5ea17142f7f9a043809f1cd4c448cb68249" integrity sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA== -"@types/graceful-fs@^4.1.3": +"@types/graceful-fs@^4.1.2", "@types/graceful-fs@^4.1.3": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== @@ -2808,6 +2916,13 @@ resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw== +"@types/yargs@^15.0.0": + version "15.0.14" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.14.tgz#26d821ddb89e70492160b66d10a0eb6df8f6fb06" + integrity sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ== + dependencies: + "@types/yargs-parser" "*" + "@types/yargs@^17.0.8": version "17.0.10" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a" @@ -3327,6 +3442,14 @@ ansi-styles@~1.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178" integrity sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg= +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" @@ -3489,6 +3612,20 @@ axios@^0.21.1: dependencies: follow-redirects "^1.14.0" +babel-jest@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.6.3.tgz#d87d25cb0037577a0c89f82e5755c5d293c01056" + integrity sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA== + dependencies: + "@jest/transform" "^26.6.2" + "@jest/types" "^26.6.2" + "@types/babel__core" "^7.1.7" + babel-plugin-istanbul "^6.0.0" + babel-preset-jest "^26.6.2" + chalk "^4.0.0" + graceful-fs "^4.2.4" + slash "^3.0.0" + babel-jest@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-28.1.3.tgz#c1187258197c099072156a0a121c11ee1e3917d5" @@ -3532,7 +3669,7 @@ babel-plugin-dynamic-import-node@^2.3.3: dependencies: object.assign "^4.1.0" -babel-plugin-istanbul@^6.1.1: +babel-plugin-istanbul@^6.0.0, babel-plugin-istanbul@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== @@ -3543,6 +3680,16 @@ babel-plugin-istanbul@^6.1.1: istanbul-lib-instrument "^5.0.4" test-exclude "^6.0.0" +babel-plugin-jest-hoist@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.6.2.tgz#8185bd030348d254c6d7dd974355e6a28b21e62d" + integrity sha512-PO9t0697lNTmcEHH69mdtYiOIkkOlj9fySqfO3K1eCcdISevLAE0xY59VLLUj0SoiPiTX/JU2CYFpILydUa5Lw== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.0.0" + "@types/babel__traverse" "^7.0.6" + babel-plugin-jest-hoist@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-28.1.3.tgz#1952c4d0ea50f2d6d794353762278d1d8cca3fbe" @@ -3605,6 +3752,14 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" +babel-preset-jest@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.6.2.tgz#747872b1171df032252426586881d62d31798fee" + integrity sha512-YvdtlVm9t3k777c5NPQIv6cxFFFapys25HiUmuSgHwIZhfifweR5c5Sf5nwE3MAbfu327CYSvps8Yx6ANLyleQ== + dependencies: + babel-plugin-jest-hoist "^26.6.2" + babel-preset-current-node-syntax "^1.0.0" + babel-preset-jest@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-28.1.3.tgz#5dfc20b99abed5db994406c2b9ab94c73aaa419d" @@ -3790,6 +3945,16 @@ browserslist@^4.14.5, browserslist@^4.20.2, browserslist@^4.21.0: node-releases "^2.0.5" update-browserslist-db "^1.0.4" +browserslist@^4.21.3: + version "4.21.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" + integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== + dependencies: + caniuse-lite "^1.0.30001400" + electron-to-chromium "^1.4.251" + node-releases "^2.0.6" + update-browserslist-db "^1.0.9" + bs-logger@0.x: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -3927,6 +4092,18 @@ caniuse-lite@^1.0.30001359: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001397.tgz" integrity sha512-SW9N2TbCdLf0eiNDRrrQXx2sOkaakNZbCjgNpPyMJJbiOrU5QzMIrXOVMRM1myBXTD5iTkdrtU/EguCrBocHlA== +caniuse-lite@^1.0.30001400: + version "1.0.30001402" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001402.tgz#aa29e1f47f5055b0d0c07696a67b8b08023d14c8" + integrity sha512-Mx4MlhXO5NwuvXGgVb+hg65HZ+bhUYsz8QtDGDo2QmaJS2GBX47Xfi2koL86lc8K+l+htXeTEB/Aeqvezoo6Ew== + +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== + dependencies: + rsvp "^4.8.4" + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -4037,6 +4214,11 @@ chrome-trace-event@^1.0.2: resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + ci-info@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.0.tgz#b4ed1fb6818dea4803a55c623041f9165d2066b2" @@ -5459,6 +5641,11 @@ electron-to-chromium@^1.4.172: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.177.tgz#b6a4436eb788ca732556cd69f384b8a3c82118c5" integrity sha512-FYPir3NSBEGexSZUEeht81oVhHfLFl6mhUKSkjHN/iB/TwEIt/WHQrqVGfTLN5gQxwJCQkIJBe05eOXjI7omgg== +electron-to-chromium@^1.4.251: + version "1.4.253" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.253.tgz#3402fd2159530fc6d94237f1b9535fa7bebaf399" + integrity sha512-1pezJ2E1UyBTGbA7fUlHdPSXQw1k+82VhTFLG5G0AUqLGvsZqFzleOblceqegZzxYX4kC7hGEEdzIQI9RZ1Cuw== + emittery@^0.10.2: version "0.10.2" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933" @@ -5605,6 +5792,15 @@ esbuild-freebsd-arm64@0.15.6: resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.6.tgz#70c8a2a30bf6bb9d547a0d8dc93aa015ec4f77f9" integrity sha512-KtQkQOhnNciXm2yrTYZMD3MOm2zBiiwFSU+dkwNbcfDumzzUprr1x70ClTdGuZwieBS1BM/k0KajRQX7r504Xw== +esbuild-jest@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/esbuild-jest/-/esbuild-jest-0.5.0.tgz#7a9964bfdecafca3b675a8aeb08193bcdba8b9d7" + integrity sha512-AMZZCdEpXfNVOIDvURlqYyHwC8qC1/BFjgsrOiSL1eyiIArVtHL8YAC83Shhn16cYYoAWEW17yZn0W/RJKJKHQ== + dependencies: + "@babel/core" "^7.12.17" + "@babel/plugin-transform-modules-commonjs" "^7.12.13" + babel-jest "^26.6.3" + esbuild-linux-32@0.14.54: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" @@ -5757,7 +5953,7 @@ esbuild-windows-arm64@0.15.6: resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.6.tgz#e18a778d354fc2ca2306688f3fedad8a3e57819e" integrity sha512-DB3G2x9OvFEa00jV+OkDBYpufq5x/K7a6VW6E2iM896DG4ZnAvJKQksOsCPiM1DUaa+DrijXAQ/ZOcKAqf/3Hg== -esbuild@^0.14.39, esbuild@^0.14.48: +esbuild@^0.14.39: version "0.14.54" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== @@ -6099,6 +6295,11 @@ events@^3.2.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== +exec-sh@^0.3.2: + version "0.3.6" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.6.tgz#ff264f9e325519a60cb5e273692943483cca63bc" + integrity sha512-nQn+hI3yp+oD0huYhKwvYI32+JFeq+XkNcD1GAo3Y/MjxsfVGmrrzrnzjWiNY6f+pUCP440fThsFh5gZrRAU/w== + execa@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" @@ -6595,7 +6796,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^2.3.2, fsevents@~2.3.2: +fsevents@^2.1.2, fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== @@ -7424,6 +7625,13 @@ is-buffer@^2.0.0: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + is-ci@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.1.tgz#db6ecbed1bd659c43dac0f45661e7674103d1867" @@ -7629,7 +7837,7 @@ is-text-path@^1.0.1: dependencies: text-extensions "^1.0.0" -is-typedarray@~1.0.0: +is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= @@ -7893,19 +8101,32 @@ jest-environment-node@^28.1.3: jest-mock "^28.1.3" jest-util "^28.1.3" -jest-esbuild@^0.2.9: - version "0.2.9" - resolved "https://registry.yarnpkg.com/jest-esbuild/-/jest-esbuild-0.2.9.tgz#c4c103e510400ad8a080753fd990dfe5a2a76025" - integrity sha512-GfcQgHf8XPwUydEurYTRdrhrDblVFXtgOsKmE/7KADxbsC0c5xpxQBarak4X7K0wl5XXfTmw7Qtat2V0/ssreg== - dependencies: - debug "^4.3.4" - esbuild "^0.14.48" - jest-get-type@^28.0.2: version "28.0.2" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== +jest-haste-map@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa" + integrity sha512-easWIJXIw71B2RdR8kgqpjQrbMRWQBgiBwXYEhtGUTaX+doCjBheluShdDMeR8IMfJiTqH4+zfhtg29apJf/8w== + dependencies: + "@jest/types" "^26.6.2" + "@types/graceful-fs" "^4.1.2" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.4" + jest-regex-util "^26.0.0" + jest-serializer "^26.6.2" + jest-util "^26.6.2" + jest-worker "^26.6.2" + micromatch "^4.0.2" + sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^2.1.2" + jest-haste-map@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-28.1.3.tgz#abd5451129a38d9841049644f34b034308944e2b" @@ -8028,6 +8249,11 @@ jest-pnp-resolver@^1.2.2: resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== +jest-regex-util@^26.0.0: + version "26.0.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" + integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== + jest-regex-util@^28.0.2: version "28.0.2" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead" @@ -8116,6 +8342,14 @@ jest-runtime@^28.1.3: slash "^3.0.0" strip-bom "^4.0.0" +jest-serializer@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.6.2.tgz#d139aafd46957d3a448f3a6cdabe2919ba0742d1" + integrity sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g== + dependencies: + "@types/node" "*" + graceful-fs "^4.2.4" + jest-snapshot@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-28.1.3.tgz#17467b3ab8ddb81e2f605db05583d69388fc0668" @@ -8145,6 +8379,18 @@ jest-snapshot@^28.1.3: pretty-format "^28.1.3" semver "^7.3.5" +jest-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" + integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== + dependencies: + "@jest/types" "^26.6.2" + "@types/node" "*" + chalk "^4.0.0" + graceful-fs "^4.2.4" + is-ci "^2.0.0" + micromatch "^4.0.2" + jest-util@^28.0.0, jest-util@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.3.tgz#f4f932aa0074f0679943220ff9cbba7e497028b0" @@ -8195,6 +8441,15 @@ jest-watcher@^28.1.3: jest-util "^28.1.3" string-length "^4.0.1" +jest-worker@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" + integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^7.0.0" + jest-worker@^27.4.5: version "27.5.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.0.tgz#99ee77e4d06168107c27328bd7f54e74c3a48d59" @@ -9201,7 +9456,7 @@ micromark@~2.11.0: debug "^4.0.0" parse-entities "^2.0.0" -micromatch@^3.1.5: +micromatch@^3.1.4, micromatch@^3.1.5: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -9296,7 +9551,7 @@ minimist-options@4.1.0: is-plain-obj "^1.1.0" kind-of "^6.0.3" -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.5, minimist@^1.2.6: +minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== @@ -9445,6 +9700,11 @@ node-releases@^2.0.5: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.5.tgz#280ed5bc3eba0d96ce44897d8aee478bfb3d9666" integrity sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q== +node-releases@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" + integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== + nomnom@1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.5.2.tgz#f4345448a853cfbd5c0d26320f2477ab0526fe2f" @@ -10016,7 +10276,7 @@ pify@^5.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== -pirates@^4.0.4, pirates@^4.0.5: +pirates@^4.0.1, pirates@^4.0.4, pirates@^4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== @@ -10809,6 +11069,11 @@ robust-predicates@^3.0.0: resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.1.tgz#ecde075044f7f30118682bd9fb3f123109577f9a" integrity sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g== +rsvp@^4.8.4: + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -10862,6 +11127,21 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +sane@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== + dependencies: + "@cnakazawa/watch" "^1.0.3" + anymatch "^2.0.0" + capture-exit "^2.0.0" + exec-sh "^0.3.2" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" @@ -12005,6 +12285,13 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -12239,6 +12526,14 @@ update-browserslist-db@^1.0.4: escalade "^3.1.1" picocolors "^1.0.0" +update-browserslist-db@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz#2924d3927367a38d5c555413a7ce138fc95fcb18" + integrity sha512-/xsqn21EGVdXI3EXSum1Yckj3ZVZugqyOZQ/CxYPBD/R+ko9NSUScf8tFF4dOKY+2pvSSJA/S+5B8s4Zr4kyvg== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -12522,7 +12817,7 @@ wait-on@6.0.0: minimist "^1.2.5" rxjs "^7.1.0" -walker@^1.0.8: +walker@^1.0.7, walker@^1.0.8, walker@~1.0.5: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== @@ -12801,6 +13096,16 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +write-file-atomic@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" + integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== + dependencies: + imurmurhash "^0.1.4" + is-typedarray "^1.0.0" + signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" + write-file-atomic@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.1.tgz#9faa33a964c1c85ff6f849b80b42a88c2c537c8f" From bb413d555e331db108f20ababe30e035d49ace41 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Fri, 16 Sep 2022 18:22:46 +0530 Subject: [PATCH 33/33] cleanup --- src/utils.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index f7182d44b4..d6b3170349 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -167,8 +167,6 @@ export const detectDirective = function (text, type = null) { }; /** - * > > > > > > > Develop - * * @function isSubstringInArray Detects whether a substring in present in a given array * @param {string} str The substring to detect * @param {Array} arr The array to search