From 968fb14270244d720a23d6c48b0d12b700f606c4 Mon Sep 17 00:00:00 2001 From: Yuki Takei Date: Wed, 28 Feb 2024 07:26:47 +0000 Subject: [PATCH 1/4] downgrade string-width --- packages/editor/package.json | 5 ++++- yarn.lock | 21 +-------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/packages/editor/package.json b/packages/editor/package.json index 0b0bc5608cb..2ca286a769d 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -21,6 +21,9 @@ "react": "^18.2.0", "react-dom": "^18.2.0" }, + "// comments for devDependencies": { + "string-width": "5.0.0 or above exports only ESM." + }, "devDependencies": { "@codemirror/lang-markdown": "^6.2.0", "@codemirror/language": "^6.8.0", @@ -50,7 +53,7 @@ "react-hook-form": "^7.45.4", "react-toastify": "^9.1.3", "reactstrap": "^9.2.0", - "string-width": "^7.1.0", + "string-width": "=4.2.2", "swr": "^2.2.2", "ts-deepmerge": "^6.2.0", "y-codemirror.next": "^0.3.2", diff --git a/yarn.lock b/yarn.lock index 1ed69266b03..69acf07501d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7661,11 +7661,6 @@ emittery@^0.13.1: "@babel/runtime" "^7.0.0" prop-types "^15.6.0" -emoji-regex@^10.3.0: - version "10.3.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.3.0.tgz#76998b9268409eb3dae3de989254d456e70cfe23" - integrity sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw== - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -9008,11 +9003,6 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-east-asian-width@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz#5e6ebd9baee6fb8b7b6bd505221065f0cd91f64e" - integrity sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA== - get-func-name@^2.0.0, get-func-name@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" @@ -16566,15 +16556,6 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -string-width@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-7.1.0.tgz#d994252935224729ea3719c49f7206dc9c46550a" - integrity sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw== - dependencies: - emoji-regex "^10.3.0" - get-east-asian-width "^1.0.0" - strip-ansi "^7.1.0" - string.prototype.matchall@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz#8e6ecb0d8a1fb1fda470d81acecb2dba057a481d" @@ -16662,7 +16643,7 @@ strip-ansi@^3.0.0: dependencies: ansi-regex "^2.0.0" -strip-ansi@^7.0.1, strip-ansi@^7.1.0: +strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== From e6c37e82d813799334d36213dce4cf9d896c9d7a Mon Sep 17 00:00:00 2001 From: Yuki Takei Date: Wed, 28 Feb 2024 07:40:13 +0000 Subject: [PATCH 2/4] unify versions of libraries --- apps/app/package.json | 6 +++--- packages/editor/package.json | 6 +++--- yarn.lock | 30 ++++++++++++++---------------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/apps/app/package.json b/apps/app/package.json index 798c51babc2..16c1e9777ad 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -101,7 +101,7 @@ "connect-redis": "^4.0.4", "cookie-parser": "^1.4.5", "csurf": "^1.11.0", - "csv-to-markdown-table": "^1.1.0", + "csv-to-markdown-table": "^1.4.1", "date-fns": "^2.23.0", "dayjs": "^1.11.7", "detect-indent": "^7.0.0", @@ -131,7 +131,7 @@ "is-iso-date": "^0.0.1", "ldapjs": "^3.0.2", "lucene-query-parser": "^1.2.0", - "markdown-table": "^1.1.1", + "markdown-table": "^3.0.3", "md5": "^2.2.1", "mermaid": "^10.1.0", "method-override": "^3.0.0", @@ -214,7 +214,7 @@ "xss": "^1.0.14", "y-mongodb-provider": "^0.1.7", "y-socket.io": "^1.1.0", - "yjs": "^13.6.7" + "yjs": "^13.6.12" }, "// comments for defDependencies": { "@handsontable/react": "v3 requires handsontable >= 7.0.0.", diff --git a/packages/editor/package.json b/packages/editor/package.json index 2ca286a769d..d12ebcd22a6 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -45,10 +45,10 @@ "cm6-theme-material-dark": "^0.2.0", "cm6-theme-nord": "^0.2.0", "codemirror": "^6.0.1", - "csv-to-markdown-table": "1.4.1", + "csv-to-markdown-table": "^1.4.1", "emoji-mart": "npm:panta82-emoji-mart@^3.0.1", "eslint-plugin-react-refresh": "^0.4.1", - "markdown-table": "3.0.3", + "markdown-table": "^3.0.3", "react-dropzone": "^14.2.3", "react-hook-form": "^7.45.4", "react-toastify": "^9.1.3", @@ -58,6 +58,6 @@ "ts-deepmerge": "^6.2.0", "y-codemirror.next": "^0.3.2", "y-socket.io": "^1.1.0", - "yjs": "^13.6.7" + "yjs": "^13.6.12" } } diff --git a/yarn.lock b/yarn.lock index 69acf07501d..b8067511a6d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6759,16 +6759,11 @@ csurf@^1.11.0: csrf "3.1.0" http-errors "~1.7.3" -csv-to-markdown-table@1.4.1: +csv-to-markdown-table@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/csv-to-markdown-table/-/csv-to-markdown-table-1.4.1.tgz#7167eb16cf76da45abd54e13993e99f029c05754" integrity sha512-jhLkfM7LXGQCuhxCwIw0QmpHCbMXy8ouC+T8KKoKaZ43DQAezpHCxNl74j2S9Sb4SEnVgMK8/RqJfNUk6xMHRQ== -csv-to-markdown-table@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/csv-to-markdown-table/-/csv-to-markdown-table-1.1.0.tgz#1c4546b4a6d7265d7715df51825c1852a7286247" - integrity sha512-gsnCustJ+9ckvdsivA8pRkBSUbr7vaMK5uuXU+gn5df93hUe2EqGPTazAJFGjc3vy0R9hjKHoLRjphTFy04bPg== - cubic2quad@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/cubic2quad/-/cubic2quad-1.2.1.tgz#2442260b72c02ee4b6a2fe998fcc1c4073622286" @@ -11526,13 +11521,20 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -lib0@^0.2.31, lib0@^0.2.42, lib0@^0.2.52, lib0@^0.2.74, lib0@^0.2.82: +lib0@^0.2.31, lib0@^0.2.42, lib0@^0.2.52, lib0@^0.2.82: version "0.2.85" resolved "https://registry.yarnpkg.com/lib0/-/lib0-0.2.85.tgz#2ccc3b6e02bd6165a4b8e68f89db5f9e7787dfc5" integrity sha512-vtAhVttLXCu3ps2OIsTz8CdKYKdcMo7ds1MNBIcSXz6vrY8sxASqpTi4vmsAIn7xjWvyT7haKcWW6woP6jebjQ== dependencies: isomorphic.js "^0.2.4" +lib0@^0.2.86: + version "0.2.89" + resolved "https://registry.yarnpkg.com/lib0/-/lib0-0.2.89.tgz#f695ba69be34e28f73b3eeb5da92006f3897a470" + integrity sha512-5j19vcCjsQhvLG6mcDD+nprtJUCbmqLz5Hzt5xgi9SV6RIW/Dty7ZkVZHGBuPOADMKjQuKDvuQTH495wsmw8DQ== + dependencies: + isomorphic.js "^0.2.4" + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -11968,10 +11970,6 @@ markdown-it@^13.0.1: mdurl "^1.0.1" uc.micro "^1.0.5" -markdown-table@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.1.tgz#4b3dd3a133d1518b8ef0dbc709bf2a1b4824bc8c" - markdown-table@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.2.tgz#9b59eb2c1b22fe71954a65ff512887065a7bb57c" @@ -18664,12 +18662,12 @@ yauzl@^2.10.0: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" -yjs@^13.6.7: - version "13.6.7" - resolved "https://registry.yarnpkg.com/yjs/-/yjs-13.6.7.tgz#f1176c37f65eb566cf390bd813e2099d598795f4" - integrity sha512-mCZTh4kjvUS2DnaktsYN6wLH3WZCJBLqrTdkWh1bIDpA/sB/GNFaLA/dyVJj2Hc7KwONuuoC/vWe9bwBBosZLQ== +yjs@^13.6.12: + version "13.6.12" + resolved "https://registry.yarnpkg.com/yjs/-/yjs-13.6.12.tgz#dc8be640270f04c4bb92c1984fdabbc13fc9c49f" + integrity sha512-KOT8ILoyVH2f/PxPadeu5kVVS055D1r3x1iFfJVJzFdnN98pVGM8H07NcKsO+fG3F7/0tf30Vnokf5YIqhU/iw== dependencies: - lib0 "^0.2.74" + lib0 "^0.2.86" yn@3.1.1: version "3.1.1" From 2b7e0b47e2b56861c2da3af256b92de8a08ad240 Mon Sep 17 00:00:00 2001 From: Yuki Takei Date: Wed, 28 Feb 2024 07:40:51 +0000 Subject: [PATCH 3/4] yarn-deduplicate --- yarn.lock | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/yarn.lock b/yarn.lock index b8067511a6d..480183b92af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2864,14 +2864,7 @@ resolved "https://registry.yarnpkg.com/@replit/codemirror-vscode-keymap/-/codemirror-vscode-keymap-6.0.2.tgz#cc9b9092db5afb9800fda5a03801b4f6600b427e" integrity sha512-j45qTwGxzpsv82lMD/NreGDORFKSctMDVkGRopaP+OrzSzv+pXDQuU3LnFvKpasyjVT0lf+PKG1v2DSCn/vxxg== -"@restart/hooks@^0.4.0": - version "0.4.5" - resolved "https://registry.yarnpkg.com/@restart/hooks/-/hooks-0.4.5.tgz#e7acbea237bfc9e479970500cf87538b41a1ed02" - integrity sha512-tLGtY0aHeIfT7aPwUkvQuhIy3+q3w4iqmUzFLPlOAf/vNUacLaBt1j/S//jv/dQhenRh8jvswyMojCwmLvJw8A== - dependencies: - dequal "^2.0.2" - -"@restart/hooks@^0.4.7": +"@restart/hooks@^0.4.0", "@restart/hooks@^0.4.7": version "0.4.16" resolved "https://registry.yarnpkg.com/@restart/hooks/-/hooks-0.4.16.tgz#95ae8ac1cc7e2bd4fed5e39800ff85604c6d59fb" integrity sha512-f7aCv7c+nU/3mF7NWLtVVr0Ra80RqsO89hO72r+Y/nvQr5+q0UFGkocElTH6MJApvReVh6JHUFYn2cw1WdHF3w== @@ -11521,14 +11514,7 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -lib0@^0.2.31, lib0@^0.2.42, lib0@^0.2.52, lib0@^0.2.82: - version "0.2.85" - resolved "https://registry.yarnpkg.com/lib0/-/lib0-0.2.85.tgz#2ccc3b6e02bd6165a4b8e68f89db5f9e7787dfc5" - integrity sha512-vtAhVttLXCu3ps2OIsTz8CdKYKdcMo7ds1MNBIcSXz6vrY8sxASqpTi4vmsAIn7xjWvyT7haKcWW6woP6jebjQ== - dependencies: - isomorphic.js "^0.2.4" - -lib0@^0.2.86: +lib0@^0.2.31, lib0@^0.2.42, lib0@^0.2.52, lib0@^0.2.82, lib0@^0.2.86: version "0.2.89" resolved "https://registry.yarnpkg.com/lib0/-/lib0-0.2.89.tgz#f695ba69be34e28f73b3eeb5da92006f3897a470" integrity sha512-5j19vcCjsQhvLG6mcDD+nprtJUCbmqLz5Hzt5xgi9SV6RIW/Dty7ZkVZHGBuPOADMKjQuKDvuQTH495wsmw8DQ== @@ -11970,12 +11956,7 @@ markdown-it@^13.0.1: mdurl "^1.0.1" uc.micro "^1.0.5" -markdown-table@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.2.tgz#9b59eb2c1b22fe71954a65ff512887065a7bb57c" - integrity sha512-y8j3a5/DkJCmS5x4dMCQL+OR0+2EAq3DOtio1COSHsmW2BGXnNCK3v12hJt1LrUz5iZH5g0LmuYOjDdI+czghA== - -markdown-table@^3.0.3: +markdown-table@^3.0.0, markdown-table@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.3.tgz#e6331d30e493127e031dd385488b5bd326e4a6bd" integrity sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw== From f6a5ed5d9776d4804204fba61a12267ab74f73ca Mon Sep 17 00:00:00 2001 From: Yuki Takei Date: Wed, 28 Feb 2024 08:39:41 +0000 Subject: [PATCH 4/4] fix lint error --- .../src/services/renderer/remark-plugins/xsv-to-table.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/app/src/services/renderer/remark-plugins/xsv-to-table.ts b/apps/app/src/services/renderer/remark-plugins/xsv-to-table.ts index ab2b29a7621..a8f443dd851 100644 --- a/apps/app/src/services/renderer/remark-plugins/xsv-to-table.ts +++ b/apps/app/src/services/renderer/remark-plugins/xsv-to-table.ts @@ -2,8 +2,8 @@ import csvToMarkdownTable from 'csv-to-markdown-table'; import { fromMarkdown } from 'mdast-util-from-markdown'; import { gfmTableFromMarkdown } from 'mdast-util-gfm-table'; import { gfmTable } from 'micromark-extension-gfm-table'; -import { Plugin } from 'unified'; -import { Node } from 'unist'; +import type { Plugin } from 'unified'; +import type { Node } from 'unist'; import { visit } from 'unist-util-visit'; type Lang = 'csv' | 'csv-h' | 'tsv' | 'tsv-h'; @@ -12,13 +12,10 @@ function isXsv(lang: unknown): lang is Lang { return /^(csv|csv-h|tsv|tsv-h)$/.test(lang as string); } -// workaround for the broken type definition of csv-to-markdown-table -- 2022.09.15 Yuki Takei -const csvToMarkdown = csvToMarkdownTable.csvToMarkdown ?? csvToMarkdownTable; - function rewriteNode(node: Node, lang: Lang) { const tableContents = node.value as string; - const tableDoc = csvToMarkdown( + const tableDoc = csvToMarkdownTable( tableContents, lang === 'csv' || lang === 'csv-h' ? ',' : '\t', lang === 'csv-h' || lang === 'tsv-h',