From 92851ca59c2ff7f12dfef2f888411865afa0e499 Mon Sep 17 00:00:00 2001 From: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:45:59 -0800 Subject: [PATCH] Revert "build: Upgrade shiki (#446)" (#449) This reverts commit 579ea3165c404089050ef6cf5a22482022eb743c. --- package-lock.json | 38 ++++++++++++++++++++++++++++---------- package.json | 2 +- src/views/sqlPreview.ts | 10 +++++----- tsconfig.json | 4 ++-- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 60be1b0..4b87be3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@types/vscode": "^1.87.0", "prql-js": "^0.11.3", - "shiki": "^1.1.7" + "shiki": "^0.14.7" }, "devDependencies": { "@types/node": "^20.11.24", @@ -200,11 +200,6 @@ "node": ">= 8" } }, - "node_modules/@shikijs/core": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.1.7.tgz", - "integrity": "sha512-gTYLUIuD1UbZp/11qozD3fWpUTuMqPSf3svDMMrL0UmlGU7D9dPw/V1FonwAorCUJBltaaESxq90jrSjQyGixg==" - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -473,6 +468,11 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==" + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -1166,6 +1166,11 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/jsonc-parser": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==" + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -1523,11 +1528,14 @@ } }, "node_modules/shiki": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.1.7.tgz", - "integrity": "sha512-9kUTMjZtcPH3i7vHunA6EraTPpPOITYTdA5uMrvsJRexktqP0s7P3s9HVK80b4pP42FRVe03D7fT3NmJv2yYhw==", + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", + "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", "dependencies": { - "@shikijs/core": "1.1.7" + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" } }, "node_modules/slash": { @@ -1657,6 +1665,16 @@ "punycode": "^2.1.0" } }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==" + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==" + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 772631e..0c31b1d 100644 --- a/package.json +++ b/package.json @@ -192,6 +192,6 @@ "dependencies": { "@types/vscode": "^1.87.0", "prql-js": "^0.11.3", - "shiki": "^1.1.7" + "shiki": "^0.14.7" } } diff --git a/src/views/sqlPreview.ts b/src/views/sqlPreview.ts index 1380551..282ebe4 100644 --- a/src/views/sqlPreview.ts +++ b/src/views/sqlPreview.ts @@ -13,6 +13,7 @@ import { WebviewPanelOnDidChangeViewStateEvent, Uri, } from 'vscode'; + import * as shiki from 'shiki'; import { readFileSync } from 'node:fs'; @@ -510,7 +511,7 @@ export class SqlPreview { // create html to display for the generated sql const highlighter = await this.getHighlighter(); - const sqlHtml = highlighter.codeToHtml(sqlCode, { lang: 'sql', theme: this.themeName}); + const sqlHtml = highlighter.codeToHtml(sqlCode, { lang: 'sql' }); return { status: 'ok', sqlHtml: sqlHtml, sql: sqlCode }; } @@ -525,8 +526,7 @@ export class SqlPreview { return Promise.resolve(this._highlighter); } return (this._highlighter = await shiki.getHighlighter({ - themes: [this.themeName], - langs: ['sql'], + theme: this.themeName, })); } @@ -540,7 +540,7 @@ export class SqlPreview { .getConfiguration('workbench') .get('colorTheme', 'dark-plus'); // default to dark plus - if (colorTheme in shiki.bundledThemes) { + if (shiki.BUNDLED_THEMES.includes(colorTheme as shiki.Theme)) { return colorTheme; } @@ -549,7 +549,7 @@ export class SqlPreview { .toLowerCase() .replace('theme', '') .replace(/\s+/g, '-'); - if (colorTheme in shiki.bundledThemes) { + if (shiki.BUNDLED_THEMES.includes(colorTheme as shiki.Theme)) { return colorTheme; } diff --git a/tsconfig.json b/tsconfig.json index d0f2cf7..e11436a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "module": "commonjs", - "target": "ES2021", - "lib": ["ES2021", "DOM"], + "target": "es2020", + "lib": ["es2020"], "outDir": "out", "sourceMap": true, "strict": true,