From 2c161e2a1e2cc92c299883bf3b1a6d92b0231d91 Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 20:53:43 +0800 Subject: [PATCH 01/12] Upgrade shiki --- packages/astro/package.json | 2 +- .../render-with-components/package.json | 2 +- packages/integrations/mdx/package.json | 2 +- packages/markdown/remark/package.json | 2 +- pnpm-lock.yaml | 36 ++++++++++--------- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/packages/astro/package.json b/packages/astro/package.json index ac9cb074feaa..c3bbba73bc32 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -146,7 +146,7 @@ "rehype": "^12.0.1", "semver": "^7.3.8", "server-destroy": "^1.0.1", - "shiki": "^0.11.1", + "shiki": "^0.14.1", "slash": "^4.0.0", "string-width": "^5.1.2", "strip-ansi": "^7.0.1", diff --git a/packages/integrations/markdoc/test/fixtures/render-with-components/package.json b/packages/integrations/markdoc/test/fixtures/render-with-components/package.json index f14c97f0fd20..784b6c727414 100644 --- a/packages/integrations/markdoc/test/fixtures/render-with-components/package.json +++ b/packages/integrations/markdoc/test/fixtures/render-with-components/package.json @@ -7,6 +7,6 @@ "astro": "workspace:*" }, "devDependencies": { - "shiki": "^0.11.1" + "shiki": "^0.14.1" } } diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index 6f3cad30de26..c801d674e6c5 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -44,7 +44,7 @@ "remark-frontmatter": "^4.0.1", "remark-gfm": "^3.0.1", "remark-smartypants": "^2.0.0", - "shiki": "^0.11.1", + "shiki": "^0.14.1", "source-map": "^0.7.4", "unist-util-visit": "^4.1.0", "vfile": "^5.3.2" diff --git a/packages/markdown/remark/package.json b/packages/markdown/remark/package.json index 82ae5bbb8774..edf4cfba5109 100644 --- a/packages/markdown/remark/package.json +++ b/packages/markdown/remark/package.json @@ -37,7 +37,7 @@ "remark-parse": "^10.0.1", "remark-rehype": "^10.1.0", "remark-smartypants": "^2.0.0", - "shiki": "^0.11.1", + "shiki": "^0.14.1", "unified": "^10.1.2", "unist-util-visit": "^4.1.0", "vfile": "^5.3.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index df1b6d1e70a8..541b5ef88c14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -649,8 +649,8 @@ importers: specifier: ^1.0.1 version: 1.0.1 shiki: - specifier: ^0.11.1 - version: 0.11.1 + specifier: ^0.14.1 + version: 0.14.1 slash: specifier: ^4.0.0 version: 4.0.0 @@ -3913,8 +3913,8 @@ importers: version: link:../../../../../astro devDependencies: shiki: - specifier: ^0.11.1 - version: 0.11.1 + specifier: ^0.14.1 + version: 0.14.1 packages/integrations/markdoc/test/fixtures/render-with-config: dependencies: @@ -3970,8 +3970,8 @@ importers: specifier: ^2.0.0 version: 2.0.0 shiki: - specifier: ^0.11.1 - version: 0.11.1 + specifier: ^0.14.1 + version: 0.14.1 source-map: specifier: ^0.7.4 version: 0.7.4 @@ -4032,7 +4032,7 @@ importers: version: 4.0.2 rehype-pretty-code: specifier: ^0.4.0 - version: 0.4.0(shiki@0.11.1) + version: 0.4.0(shiki@0.14.1) remark-math: specifier: ^5.1.1 version: 5.1.1 @@ -4872,8 +4872,8 @@ importers: specifier: ^2.0.0 version: 2.0.0 shiki: - specifier: ^0.11.1 - version: 0.11.1 + specifier: ^0.14.1 + version: 0.14.1 unified: specifier: ^10.1.2 version: 10.1.2 @@ -9388,6 +9388,9 @@ packages: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} + /ansi-sequence-parser@1.1.0: + resolution: {integrity: sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==} + /ansi-styles@3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} @@ -15463,14 +15466,14 @@ packages: unified: 10.1.2 dev: false - /rehype-pretty-code@0.4.0(shiki@0.11.1): + /rehype-pretty-code@0.4.0(shiki@0.14.1): resolution: {integrity: sha512-Bp91nfo4blpgCXlvGP1hsG+kRFfjqBVU09o1RFcnNA62u+iIzJiJRGzpfBj4FaItq7CEQL5ASGB7vLxN5xCvyA==} engines: {node: ^12.16.0 || >=13.2.0} peerDependencies: shiki: '*' dependencies: parse-numeric-range: 1.3.0 - shiki: 0.11.1 + shiki: 0.14.1 dev: true /rehype-raw@6.1.1: @@ -15981,12 +15984,13 @@ packages: vscode-textmate: 5.2.0 dev: true - /shiki@0.11.1: - resolution: {integrity: sha512-EugY9VASFuDqOexOgXR18ZV+TbFrQHeCpEYaXamO+SZlsnT/2LxuLBX25GGtIrwaEVFXUAbUQ601SWE2rMwWHA==} + /shiki@0.14.1: + resolution: {integrity: sha512-+Jz4nBkCBe0mEDqo1eKRcCdjRtrCjozmcbTUjbPTX7OOJfEbTZzlUWlZtGe3Gb5oV1/jnojhG//YZc3rs9zSEw==} dependencies: + ansi-sequence-parser: 1.1.0 jsonc-parser: 3.2.0 vscode-oniguruma: 1.7.0 - vscode-textmate: 6.0.0 + vscode-textmate: 8.0.0 /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} @@ -17377,8 +17381,8 @@ packages: resolution: {integrity: sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==} dev: true - /vscode-textmate@6.0.0: - resolution: {integrity: sha512-gu73tuZfJgu+mvCSy4UZwd2JXykjK9zAZsfmDeut5dx/1a7FeTk0XwJsSuqQn+cuMCGVbIBfl+s53X4T19DnzQ==} + /vscode-textmate@8.0.0: + resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} /vscode-uri@2.1.2: resolution: {integrity: sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==} From b5f90fa46cc802cd6902125cf090f3be7ac92bfe Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 20:53:51 +0800 Subject: [PATCH 02/12] Update themes --- packages/astro/components/shiki-themes.js | 72 ++++++++++++--------- packages/astro/scripts/shiki-gen-themes.mjs | 33 +++++++--- 2 files changed, 66 insertions(+), 39 deletions(-) diff --git a/packages/astro/components/shiki-themes.js b/packages/astro/components/shiki-themes.js index 68c36f4cd05d..4d8dcb2d9470 100644 --- a/packages/astro/components/shiki-themes.js +++ b/packages/astro/components/shiki-themes.js @@ -1,33 +1,43 @@ +/** + * This file is prebuilt from packages/astro/scripts/shiki-gen-themes.mjs + * Do not edit this directly, but instead edit that file and rerun it to generate this file. + */ + +// prettier-ignore export const themes = { - 'css-variables': () => import('shiki/themes/css-variables.json').then((mod) => mod.default), - 'dark-plus': () => import('shiki/themes/dark-plus.json').then((mod) => mod.default), - 'dracula-soft': () => import('shiki/themes/dracula-soft.json').then((mod) => mod.default), - dracula: () => import('shiki/themes/dracula.json').then((mod) => mod.default), - 'github-dark-dimmed': () => - import('shiki/themes/github-dark-dimmed.json').then((mod) => mod.default), - 'github-dark': () => import('shiki/themes/github-dark.json').then((mod) => mod.default), - 'github-light': () => import('shiki/themes/github-light.json').then((mod) => mod.default), - hc_light: () => import('shiki/themes/hc_light.json').then((mod) => mod.default), - 'light-plus': () => import('shiki/themes/light-plus.json').then((mod) => mod.default), - 'material-darker': () => import('shiki/themes/material-darker.json').then((mod) => mod.default), - 'material-default': () => import('shiki/themes/material-default.json').then((mod) => mod.default), - 'material-lighter': () => import('shiki/themes/material-lighter.json').then((mod) => mod.default), - 'material-ocean': () => import('shiki/themes/material-ocean.json').then((mod) => mod.default), - 'material-palenight': () => - import('shiki/themes/material-palenight.json').then((mod) => mod.default), - 'min-dark': () => import('shiki/themes/min-dark.json').then((mod) => mod.default), - 'min-light': () => import('shiki/themes/min-light.json').then((mod) => mod.default), - monokai: () => import('shiki/themes/monokai.json').then((mod) => mod.default), - nord: () => import('shiki/themes/nord.json').then((mod) => mod.default), - 'one-dark-pro': () => import('shiki/themes/one-dark-pro.json').then((mod) => mod.default), - poimandres: () => import('shiki/themes/poimandres.json').then((mod) => mod.default), - 'rose-pine-dawn': () => import('shiki/themes/rose-pine-dawn.json').then((mod) => mod.default), - 'rose-pine-moon': () => import('shiki/themes/rose-pine-moon.json').then((mod) => mod.default), - 'rose-pine': () => import('shiki/themes/rose-pine.json').then((mod) => mod.default), - 'slack-dark': () => import('shiki/themes/slack-dark.json').then((mod) => mod.default), - 'slack-ochin': () => import('shiki/themes/slack-ochin.json').then((mod) => mod.default), - 'solarized-dark': () => import('shiki/themes/solarized-dark.json').then((mod) => mod.default), - 'solarized-light': () => import('shiki/themes/solarized-light.json').then((mod) => mod.default), - 'vitesse-dark': () => import('shiki/themes/vitesse-dark.json').then((mod) => mod.default), - 'vitesse-light': () => import('shiki/themes/vitesse-light.json').then((mod) => mod.default), + 'css-variables': () => import('shiki/themes/css-variables.json').then(mod => mod.default), + 'dark-plus': () => import('shiki/themes/dark-plus.json').then(mod => mod.default), + 'dracula-soft': () => import('shiki/themes/dracula-soft.json').then(mod => mod.default), + 'dracula': () => import('shiki/themes/dracula.json').then(mod => mod.default), + 'github-dark-dimmed': () => import('shiki/themes/github-dark-dimmed.json').then(mod => mod.default), + 'github-dark': () => import('shiki/themes/github-dark.json').then(mod => mod.default), + 'github-light': () => import('shiki/themes/github-light.json').then(mod => mod.default), + 'hc_light': () => import('shiki/themes/hc_light.json').then(mod => mod.default), + 'light-plus': () => import('shiki/themes/light-plus.json').then(mod => mod.default), + 'material-theme-darker': () => import('shiki/themes/material-theme-darker.json').then(mod => mod.default), + 'material-theme-lighter': () => import('shiki/themes/material-theme-lighter.json').then(mod => mod.default), + 'material-theme-ocean': () => import('shiki/themes/material-theme-ocean.json').then(mod => mod.default), + 'material-theme-palenight': () => import('shiki/themes/material-theme-palenight.json').then(mod => mod.default), + 'material-theme': () => import('shiki/themes/material-theme.json').then(mod => mod.default), + 'min-dark': () => import('shiki/themes/min-dark.json').then(mod => mod.default), + 'min-light': () => import('shiki/themes/min-light.json').then(mod => mod.default), + 'monokai': () => import('shiki/themes/monokai.json').then(mod => mod.default), + 'nord': () => import('shiki/themes/nord.json').then(mod => mod.default), + 'one-dark-pro': () => import('shiki/themes/one-dark-pro.json').then(mod => mod.default), + 'poimandres': () => import('shiki/themes/poimandres.json').then(mod => mod.default), + 'rose-pine-dawn': () => import('shiki/themes/rose-pine-dawn.json').then(mod => mod.default), + 'rose-pine-moon': () => import('shiki/themes/rose-pine-moon.json').then(mod => mod.default), + 'rose-pine': () => import('shiki/themes/rose-pine.json').then(mod => mod.default), + 'slack-dark': () => import('shiki/themes/slack-dark.json').then(mod => mod.default), + 'slack-ochin': () => import('shiki/themes/slack-ochin.json').then(mod => mod.default), + 'solarized-dark': () => import('shiki/themes/solarized-dark.json').then(mod => mod.default), + 'solarized-light': () => import('shiki/themes/solarized-light.json').then(mod => mod.default), + 'vitesse-dark': () => import('shiki/themes/vitesse-dark.json').then(mod => mod.default), + 'vitesse-light': () => import('shiki/themes/vitesse-light.json').then(mod => mod.default), + // compat + 'material-darker': () => import('shiki/themes/material-theme-darker').then(mod => mod.default), + 'material-default': () => import('shiki/themes/material-theme').then(mod => mod.default), + 'material-lighter': () => import('shiki/themes/material-theme-lighter').then(mod => mod.default), + 'material-ocean': () => import('shiki/themes/material-theme-ocean').then(mod => mod.default), + 'material-palenight': () => import('shiki/themes/material-theme-palenight').then(mod => mod.default), }; diff --git a/packages/astro/scripts/shiki-gen-themes.mjs b/packages/astro/scripts/shiki-gen-themes.mjs index 756be8349f26..381b4d4b58cd 100644 --- a/packages/astro/scripts/shiki-gen-themes.mjs +++ b/packages/astro/scripts/shiki-gen-themes.mjs @@ -2,18 +2,35 @@ import fs from 'fs'; const dir = await fs.promises.readdir('packages/astro/node_modules/shiki/themes/'); +const toThemeImport = (theme) => `import('shiki/themes/${theme}').then(mod => mod.default)`; + const themeImports = dir.map((f) => { - return [f.slice(0, f.indexOf('.json')), `import('shiki/themes/${f}').then(mod => mod.default)`]; + return [f.slice(0, f.indexOf('.json')), toThemeImport(f)]; }); -let code = `export const themes = {`; -let i = 0; +// Map of old theme names to new names to preserve compatibility when we upgrade shiki +const compatThemes = { + 'material-darker': 'material-theme-darker', + 'material-default': 'material-theme', + 'material-lighter': 'material-theme-lighter', + 'material-ocean': 'material-theme-ocean', + 'material-palenight': 'material-theme-palenight', +}; + +let code = `\ +/** + * This file is prebuilt from packages/astro/scripts/shiki-gen-themes.mjs + * Do not edit this directly, but instead edit that file and rerun it to generate this file. + */ +`; + +code += `\n// prettier-ignore\nexport const themes = {`; for (const [key, imp] of themeImports) { - if (i > 0) { - code += ','; - } - code += `\n\t'${key}': () => ${imp}`; - i++; + code += `\n\t'${key}': () => ${imp},`; +} +code += `\n\t// old theme names for compat`; +for (const oldName in compatThemes) { + code += `\n\t'${oldName}': () => ${toThemeImport(compatThemes[oldName])},`; } code += '\n};'; From 8e36d4b7a1435ac1f6a1862d46b321b926567423 Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 21:03:31 +0800 Subject: [PATCH 03/12] Update languages --- packages/astro/components/shiki-languages.js | 2187 ++--------------- .../astro/scripts/shiki-gen-languages.mjs | 35 +- 2 files changed, 190 insertions(+), 2032 deletions(-) diff --git a/packages/astro/components/shiki-languages.js b/packages/astro/components/shiki-languages.js index 4bb3d4498207..c86461fa6524 100644 --- a/packages/astro/components/shiki-languages.js +++ b/packages/astro/components/shiki-languages.js @@ -1,2020 +1,175 @@ +/** + * This file is prebuilt from packages/astro/scripts/shiki-gen-languages.mjs + * Do not edit this directly, but instead edit that file and rerun it to generate this file. + */ + import { BUNDLED_LANGUAGES } from 'shiki'; +function handleLang(mod) { + const lang = BUNDLED_LANGUAGES.find((l) => l.id === mod.default); + if (lang) { + return { + ...lang, + grammar, + }; + } else { + return undefined; + } +} + export const languages = { - abap: () => - import('shiki/languages/abap.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'abap'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'actionscript-3': () => - import('shiki/languages/actionscript-3.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'actionscript-3'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - ada: () => - import('shiki/languages/ada.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'ada'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - apache: () => - import('shiki/languages/apache.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'apache'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - apex: () => - import('shiki/languages/apex.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'apex'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - apl: () => - import('shiki/languages/apl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'apl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - applescript: () => - import('shiki/languages/applescript.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'applescript'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - asm: () => - import('shiki/languages/asm.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'asm'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - astro: () => - import('shiki/languages/astro.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'astro'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - awk: () => - import('shiki/languages/awk.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'awk'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - ballerina: () => - import('shiki/languages/ballerina.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'ballerina'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - bat: () => - import('shiki/languages/bat.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'bat'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - berry: () => - import('shiki/languages/berry.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'berry'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - bibtex: () => - import('shiki/languages/bibtex.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'bibtex'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - bicep: () => - import('shiki/languages/bicep.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'bicep'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - blade: () => - import('shiki/languages/blade.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'blade'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - c: () => - import('shiki/languages/c.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'c'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - cadence: () => - import('shiki/languages/cadence.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'cadence'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - clarity: () => - import('shiki/languages/clarity.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'clarity'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - clojure: () => - import('shiki/languages/clojure.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'clojure'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - cmake: () => - import('shiki/languages/cmake.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'cmake'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - cobol: () => - import('shiki/languages/cobol.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'cobol'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - codeql: () => - import('shiki/languages/codeql.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'codeql'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - coffee: () => - import('shiki/languages/coffee.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'coffee'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'cpp-macro': () => - import('shiki/languages/cpp-macro.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'cpp-macro'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - cpp: () => - import('shiki/languages/cpp.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'cpp'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - crystal: () => - import('shiki/languages/crystal.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'crystal'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - csharp: () => - import('shiki/languages/csharp.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'csharp'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - css: () => - import('shiki/languages/css.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'css'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - cue: () => - import('shiki/languages/cue.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'cue'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - d: () => - import('shiki/languages/d.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'd'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - dart: () => - import('shiki/languages/dart.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'dart'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - diff: () => - import('shiki/languages/diff.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'diff'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - docker: () => - import('shiki/languages/docker.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'docker'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'dream-maker': () => - import('shiki/languages/dream-maker.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'dream-maker'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - elixir: () => - import('shiki/languages/elixir.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'elixir'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - elm: () => - import('shiki/languages/elm.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'elm'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - erb: () => - import('shiki/languages/erb.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'erb'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - erlang: () => - import('shiki/languages/erlang.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'erlang'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - fish: () => - import('shiki/languages/fish.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'fish'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - fsharp: () => - import('shiki/languages/fsharp.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'fsharp'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - gherkin: () => - import('shiki/languages/gherkin.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'gherkin'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'git-commit': () => - import('shiki/languages/git-commit.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'git-commit'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'git-rebase': () => - import('shiki/languages/git-rebase.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'git-rebase'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - glsl: () => - import('shiki/languages/glsl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'glsl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - gnuplot: () => - import('shiki/languages/gnuplot.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'gnuplot'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - go: () => - import('shiki/languages/go.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'go'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - graphql: () => - import('shiki/languages/graphql.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'graphql'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - groovy: () => - import('shiki/languages/groovy.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'groovy'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - hack: () => - import('shiki/languages/hack.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'hack'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - haml: () => - import('shiki/languages/haml.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'haml'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - handlebars: () => - import('shiki/languages/handlebars.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'handlebars'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - haskell: () => - import('shiki/languages/haskell.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'haskell'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - hcl: () => - import('shiki/languages/hcl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'hcl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - hlsl: () => - import('shiki/languages/hlsl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'hlsl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - html: () => - import('shiki/languages/html.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'html'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - ini: () => - import('shiki/languages/ini.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'ini'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - java: () => - import('shiki/languages/java.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'java'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - javascript: () => - import('shiki/languages/javascript.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'javascript'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'jinja-html': () => - import('shiki/languages/jinja-html.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'jinja-html'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - jinja: () => - import('shiki/languages/jinja.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'jinja'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - json: () => - import('shiki/languages/json.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'json'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - jsonc: () => - import('shiki/languages/jsonc.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'jsonc'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - jsonnet: () => - import('shiki/languages/jsonnet.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'jsonnet'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - jssm: () => - import('shiki/languages/jssm.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'jssm'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - jsx: () => - import('shiki/languages/jsx.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'jsx'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - julia: () => - import('shiki/languages/julia.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'julia'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - kotlin: () => - import('shiki/languages/kotlin.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'kotlin'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - latex: () => - import('shiki/languages/latex.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'latex'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - less: () => - import('shiki/languages/less.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'less'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - liquid: () => - import('shiki/languages/liquid.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'liquid'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - lisp: () => - import('shiki/languages/lisp.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'lisp'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - logo: () => - import('shiki/languages/logo.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'logo'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - lua: () => - import('shiki/languages/lua.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'lua'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - make: () => - import('shiki/languages/make.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'make'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - markdown: () => - import('shiki/languages/markdown.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'markdown'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - marko: () => - import('shiki/languages/marko.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'marko'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - matlab: () => - import('shiki/languages/matlab.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'matlab'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - mdx: () => - import('shiki/languages/mdx.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'mdx'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - mermaid: () => - import('shiki/languages/mermaid.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'mermaid'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - nginx: () => - import('shiki/languages/nginx.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'nginx'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - nim: () => - import('shiki/languages/nim.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'nim'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - nix: () => - import('shiki/languages/nix.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'nix'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'objective-c': () => - import('shiki/languages/objective-c.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'objective-c'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'objective-cpp': () => - import('shiki/languages/objective-cpp.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'objective-cpp'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - ocaml: () => - import('shiki/languages/ocaml.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'ocaml'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - pascal: () => - import('shiki/languages/pascal.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'pascal'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - perl: () => - import('shiki/languages/perl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'perl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'php-html': () => - import('shiki/languages/php-html.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'php-html'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - php: () => - import('shiki/languages/php.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'php'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - plsql: () => - import('shiki/languages/plsql.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'plsql'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - postcss: () => - import('shiki/languages/postcss.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'postcss'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - powershell: () => - import('shiki/languages/powershell.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'powershell'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - prisma: () => - import('shiki/languages/prisma.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'prisma'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - prolog: () => - import('shiki/languages/prolog.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'prolog'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - pug: () => - import('shiki/languages/pug.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'pug'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - puppet: () => - import('shiki/languages/puppet.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'puppet'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - purescript: () => - import('shiki/languages/purescript.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'purescript'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - python: () => - import('shiki/languages/python.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'python'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - r: () => - import('shiki/languages/r.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'r'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - raku: () => - import('shiki/languages/raku.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'raku'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - razor: () => - import('shiki/languages/razor.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'razor'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - rel: () => - import('shiki/languages/rel.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'rel'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - riscv: () => - import('shiki/languages/riscv.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'riscv'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - rst: () => - import('shiki/languages/rst.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'rst'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - ruby: () => - import('shiki/languages/ruby.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'ruby'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - rust: () => - import('shiki/languages/rust.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'rust'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - sas: () => - import('shiki/languages/sas.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'sas'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - sass: () => - import('shiki/languages/sass.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'sass'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - scala: () => - import('shiki/languages/scala.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'scala'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - scheme: () => - import('shiki/languages/scheme.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'scheme'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - scss: () => - import('shiki/languages/scss.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'scss'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - shaderlab: () => - import('shiki/languages/shaderlab.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'shaderlab'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - shellscript: () => - import('shiki/languages/shellscript.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'shellscript'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - smalltalk: () => - import('shiki/languages/smalltalk.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'smalltalk'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - solidity: () => - import('shiki/languages/solidity.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'solidity'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - sparql: () => - import('shiki/languages/sparql.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'sparql'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - sql: () => - import('shiki/languages/sql.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'sql'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'ssh-config': () => - import('shiki/languages/ssh-config.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'ssh-config'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - stata: () => - import('shiki/languages/stata.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'stata'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - stylus: () => - import('shiki/languages/stylus.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'stylus'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - svelte: () => - import('shiki/languages/svelte.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'svelte'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - swift: () => - import('shiki/languages/swift.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'swift'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'system-verilog': () => - import('shiki/languages/system-verilog.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'system-verilog'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - tasl: () => - import('shiki/languages/tasl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'tasl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - tcl: () => - import('shiki/languages/tcl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'tcl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - tex: () => - import('shiki/languages/tex.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'tex'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - toml: () => - import('shiki/languages/toml.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'toml'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - tsx: () => - import('shiki/languages/tsx.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'tsx'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - turtle: () => - import('shiki/languages/turtle.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'turtle'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - twig: () => - import('shiki/languages/twig.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'twig'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - typescript: () => - import('shiki/languages/typescript.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'typescript'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - vb: () => - import('shiki/languages/vb.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'vb'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - verilog: () => - import('shiki/languages/verilog.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'verilog'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - vhdl: () => - import('shiki/languages/vhdl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'vhdl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - viml: () => - import('shiki/languages/viml.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'viml'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - 'vue-html': () => - import('shiki/languages/vue-html.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'vue-html'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - vue: () => - import('shiki/languages/vue.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'vue'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - wasm: () => - import('shiki/languages/wasm.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'wasm'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - wenyan: () => - import('shiki/languages/wenyan.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'wenyan'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - xml: () => - import('shiki/languages/xml.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'xml'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - xsl: () => - import('shiki/languages/xsl.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'xsl'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - yaml: () => - import('shiki/languages/yaml.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'yaml'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), - zenscript: () => - import('shiki/languages/zenscript.tmLanguage.json') - .then((mod) => mod.default) - .then((grammar) => { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === 'zenscript'); - if (lang) { - return { - ...lang, - grammar, - }; - } else { - return undefined; - } - }), + 'abap': () => import('shiki/languages/abap.tmLanguage.json').then(handleLang), + 'actionscript-3': () => import('shiki/languages/actionscript-3.tmLanguage.json').then(handleLang), + 'ada': () => import('shiki/languages/ada.tmLanguage.json').then(handleLang), + 'apache': () => import('shiki/languages/apache.tmLanguage.json').then(handleLang), + 'apex': () => import('shiki/languages/apex.tmLanguage.json').then(handleLang), + 'apl': () => import('shiki/languages/apl.tmLanguage.json').then(handleLang), + 'applescript': () => import('shiki/languages/applescript.tmLanguage.json').then(handleLang), + 'ara': () => import('shiki/languages/ara.tmLanguage.json').then(handleLang), + 'asm': () => import('shiki/languages/asm.tmLanguage.json').then(handleLang), + 'astro': () => import('shiki/languages/astro.tmLanguage.json').then(handleLang), + 'awk': () => import('shiki/languages/awk.tmLanguage.json').then(handleLang), + 'ballerina': () => import('shiki/languages/ballerina.tmLanguage.json').then(handleLang), + 'bat': () => import('shiki/languages/bat.tmLanguage.json').then(handleLang), + 'berry': () => import('shiki/languages/berry.tmLanguage.json').then(handleLang), + 'bibtex': () => import('shiki/languages/bibtex.tmLanguage.json').then(handleLang), + 'bicep': () => import('shiki/languages/bicep.tmLanguage.json').then(handleLang), + 'blade': () => import('shiki/languages/blade.tmLanguage.json').then(handleLang), + 'c': () => import('shiki/languages/c.tmLanguage.json').then(handleLang), + 'cadence': () => import('shiki/languages/cadence.tmLanguage.json').then(handleLang), + 'clarity': () => import('shiki/languages/clarity.tmLanguage.json').then(handleLang), + 'clojure': () => import('shiki/languages/clojure.tmLanguage.json').then(handleLang), + 'cmake': () => import('shiki/languages/cmake.tmLanguage.json').then(handleLang), + 'cobol': () => import('shiki/languages/cobol.tmLanguage.json').then(handleLang), + 'codeql': () => import('shiki/languages/codeql.tmLanguage.json').then(handleLang), + 'coffee': () => import('shiki/languages/coffee.tmLanguage.json').then(handleLang), + 'cpp-macro': () => import('shiki/languages/cpp-macro.tmLanguage.json').then(handleLang), + 'cpp': () => import('shiki/languages/cpp.tmLanguage.json').then(handleLang), + 'crystal': () => import('shiki/languages/crystal.tmLanguage.json').then(handleLang), + 'csharp': () => import('shiki/languages/csharp.tmLanguage.json').then(handleLang), + 'css': () => import('shiki/languages/css.tmLanguage.json').then(handleLang), + 'cue': () => import('shiki/languages/cue.tmLanguage.json').then(handleLang), + 'd': () => import('shiki/languages/d.tmLanguage.json').then(handleLang), + 'dart': () => import('shiki/languages/dart.tmLanguage.json').then(handleLang), + 'dax': () => import('shiki/languages/dax.tmLanguage.json').then(handleLang), + 'diff': () => import('shiki/languages/diff.tmLanguage.json').then(handleLang), + 'docker': () => import('shiki/languages/docker.tmLanguage.json').then(handleLang), + 'dream-maker': () => import('shiki/languages/dream-maker.tmLanguage.json').then(handleLang), + 'elixir': () => import('shiki/languages/elixir.tmLanguage.json').then(handleLang), + 'elm': () => import('shiki/languages/elm.tmLanguage.json').then(handleLang), + 'erb': () => import('shiki/languages/erb.tmLanguage.json').then(handleLang), + 'erlang': () => import('shiki/languages/erlang.tmLanguage.json').then(handleLang), + 'fish': () => import('shiki/languages/fish.tmLanguage.json').then(handleLang), + 'fsharp': () => import('shiki/languages/fsharp.tmLanguage.json').then(handleLang), + 'gherkin': () => import('shiki/languages/gherkin.tmLanguage.json').then(handleLang), + 'git-commit': () => import('shiki/languages/git-commit.tmLanguage.json').then(handleLang), + 'git-rebase': () => import('shiki/languages/git-rebase.tmLanguage.json').then(handleLang), + 'glsl': () => import('shiki/languages/glsl.tmLanguage.json').then(handleLang), + 'gnuplot': () => import('shiki/languages/gnuplot.tmLanguage.json').then(handleLang), + 'go': () => import('shiki/languages/go.tmLanguage.json').then(handleLang), + 'graphql': () => import('shiki/languages/graphql.tmLanguage.json').then(handleLang), + 'groovy': () => import('shiki/languages/groovy.tmLanguage.json').then(handleLang), + 'hack': () => import('shiki/languages/hack.tmLanguage.json').then(handleLang), + 'haml': () => import('shiki/languages/haml.tmLanguage.json').then(handleLang), + 'handlebars': () => import('shiki/languages/handlebars.tmLanguage.json').then(handleLang), + 'haskell': () => import('shiki/languages/haskell.tmLanguage.json').then(handleLang), + 'hcl': () => import('shiki/languages/hcl.tmLanguage.json').then(handleLang), + 'hlsl': () => import('shiki/languages/hlsl.tmLanguage.json').then(handleLang), + 'html': () => import('shiki/languages/html.tmLanguage.json').then(handleLang), + 'http': () => import('shiki/languages/http.tmLanguage.json').then(handleLang), + 'imba': () => import('shiki/languages/imba.tmLanguage.json').then(handleLang), + 'ini': () => import('shiki/languages/ini.tmLanguage.json').then(handleLang), + 'java': () => import('shiki/languages/java.tmLanguage.json').then(handleLang), + 'javascript': () => import('shiki/languages/javascript.tmLanguage.json').then(handleLang), + 'jinja-html': () => import('shiki/languages/jinja-html.tmLanguage.json').then(handleLang), + 'jinja': () => import('shiki/languages/jinja.tmLanguage.json').then(handleLang), + 'jison': () => import('shiki/languages/jison.tmLanguage.json').then(handleLang), + 'json': () => import('shiki/languages/json.tmLanguage.json').then(handleLang), + 'json5': () => import('shiki/languages/json5.tmLanguage.json').then(handleLang), + 'jsonc': () => import('shiki/languages/jsonc.tmLanguage.json').then(handleLang), + 'jsonnet': () => import('shiki/languages/jsonnet.tmLanguage.json').then(handleLang), + 'jssm': () => import('shiki/languages/jssm.tmLanguage.json').then(handleLang), + 'jsx': () => import('shiki/languages/jsx.tmLanguage.json').then(handleLang), + 'julia': () => import('shiki/languages/julia.tmLanguage.json').then(handleLang), + 'kotlin': () => import('shiki/languages/kotlin.tmLanguage.json').then(handleLang), + 'latex': () => import('shiki/languages/latex.tmLanguage.json').then(handleLang), + 'less': () => import('shiki/languages/less.tmLanguage.json').then(handleLang), + 'liquid': () => import('shiki/languages/liquid.tmLanguage.json').then(handleLang), + 'lisp': () => import('shiki/languages/lisp.tmLanguage.json').then(handleLang), + 'logo': () => import('shiki/languages/logo.tmLanguage.json').then(handleLang), + 'lua': () => import('shiki/languages/lua.tmLanguage.json').then(handleLang), + 'make': () => import('shiki/languages/make.tmLanguage.json').then(handleLang), + 'markdown': () => import('shiki/languages/markdown.tmLanguage.json').then(handleLang), + 'marko': () => import('shiki/languages/marko.tmLanguage.json').then(handleLang), + 'matlab': () => import('shiki/languages/matlab.tmLanguage.json').then(handleLang), + 'mdx': () => import('shiki/languages/mdx.tmLanguage.json').then(handleLang), + 'mermaid': () => import('shiki/languages/mermaid.tmLanguage.json').then(handleLang), + 'nginx': () => import('shiki/languages/nginx.tmLanguage.json').then(handleLang), + 'nim': () => import('shiki/languages/nim.tmLanguage.json').then(handleLang), + 'nix': () => import('shiki/languages/nix.tmLanguage.json').then(handleLang), + 'objective-c': () => import('shiki/languages/objective-c.tmLanguage.json').then(handleLang), + 'objective-cpp': () => import('shiki/languages/objective-cpp.tmLanguage.json').then(handleLang), + 'ocaml': () => import('shiki/languages/ocaml.tmLanguage.json').then(handleLang), + 'pascal': () => import('shiki/languages/pascal.tmLanguage.json').then(handleLang), + 'perl': () => import('shiki/languages/perl.tmLanguage.json').then(handleLang), + 'php-html': () => import('shiki/languages/php-html.tmLanguage.json').then(handleLang), + 'php': () => import('shiki/languages/php.tmLanguage.json').then(handleLang), + 'plsql': () => import('shiki/languages/plsql.tmLanguage.json').then(handleLang), + 'postcss': () => import('shiki/languages/postcss.tmLanguage.json').then(handleLang), + 'powerquery': () => import('shiki/languages/powerquery.tmLanguage.json').then(handleLang), + 'powershell': () => import('shiki/languages/powershell.tmLanguage.json').then(handleLang), + 'prisma': () => import('shiki/languages/prisma.tmLanguage.json').then(handleLang), + 'prolog': () => import('shiki/languages/prolog.tmLanguage.json').then(handleLang), + 'proto': () => import('shiki/languages/proto.tmLanguage.json').then(handleLang), + 'pug': () => import('shiki/languages/pug.tmLanguage.json').then(handleLang), + 'puppet': () => import('shiki/languages/puppet.tmLanguage.json').then(handleLang), + 'purescript': () => import('shiki/languages/purescript.tmLanguage.json').then(handleLang), + 'python': () => import('shiki/languages/python.tmLanguage.json').then(handleLang), + 'r': () => import('shiki/languages/r.tmLanguage.json').then(handleLang), + 'raku': () => import('shiki/languages/raku.tmLanguage.json').then(handleLang), + 'razor': () => import('shiki/languages/razor.tmLanguage.json').then(handleLang), + 'rel': () => import('shiki/languages/rel.tmLanguage.json').then(handleLang), + 'riscv': () => import('shiki/languages/riscv.tmLanguage.json').then(handleLang), + 'rst': () => import('shiki/languages/rst.tmLanguage.json').then(handleLang), + 'ruby': () => import('shiki/languages/ruby.tmLanguage.json').then(handleLang), + 'rust': () => import('shiki/languages/rust.tmLanguage.json').then(handleLang), + 'sas': () => import('shiki/languages/sas.tmLanguage.json').then(handleLang), + 'sass': () => import('shiki/languages/sass.tmLanguage.json').then(handleLang), + 'scala': () => import('shiki/languages/scala.tmLanguage.json').then(handleLang), + 'scheme': () => import('shiki/languages/scheme.tmLanguage.json').then(handleLang), + 'scss': () => import('shiki/languages/scss.tmLanguage.json').then(handleLang), + 'shaderlab': () => import('shiki/languages/shaderlab.tmLanguage.json').then(handleLang), + 'shellscript': () => import('shiki/languages/shellscript.tmLanguage.json').then(handleLang), + 'smalltalk': () => import('shiki/languages/smalltalk.tmLanguage.json').then(handleLang), + 'solidity': () => import('shiki/languages/solidity.tmLanguage.json').then(handleLang), + 'sparql': () => import('shiki/languages/sparql.tmLanguage.json').then(handleLang), + 'sql': () => import('shiki/languages/sql.tmLanguage.json').then(handleLang), + 'ssh-config': () => import('shiki/languages/ssh-config.tmLanguage.json').then(handleLang), + 'stata': () => import('shiki/languages/stata.tmLanguage.json').then(handleLang), + 'stylus': () => import('shiki/languages/stylus.tmLanguage.json').then(handleLang), + 'svelte': () => import('shiki/languages/svelte.tmLanguage.json').then(handleLang), + 'swift': () => import('shiki/languages/swift.tmLanguage.json').then(handleLang), + 'system-verilog': () => import('shiki/languages/system-verilog.tmLanguage.json').then(handleLang), + 'tasl': () => import('shiki/languages/tasl.tmLanguage.json').then(handleLang), + 'tcl': () => import('shiki/languages/tcl.tmLanguage.json').then(handleLang), + 'tex': () => import('shiki/languages/tex.tmLanguage.json').then(handleLang), + 'toml': () => import('shiki/languages/toml.tmLanguage.json').then(handleLang), + 'tsx': () => import('shiki/languages/tsx.tmLanguage.json').then(handleLang), + 'turtle': () => import('shiki/languages/turtle.tmLanguage.json').then(handleLang), + 'twig': () => import('shiki/languages/twig.tmLanguage.json').then(handleLang), + 'typescript': () => import('shiki/languages/typescript.tmLanguage.json').then(handleLang), + 'v': () => import('shiki/languages/v.tmLanguage.json').then(handleLang), + 'vb': () => import('shiki/languages/vb.tmLanguage.json').then(handleLang), + 'verilog': () => import('shiki/languages/verilog.tmLanguage.json').then(handleLang), + 'vhdl': () => import('shiki/languages/vhdl.tmLanguage.json').then(handleLang), + 'viml': () => import('shiki/languages/viml.tmLanguage.json').then(handleLang), + 'vue-html': () => import('shiki/languages/vue-html.tmLanguage.json').then(handleLang), + 'vue': () => import('shiki/languages/vue.tmLanguage.json').then(handleLang), + 'wasm': () => import('shiki/languages/wasm.tmLanguage.json').then(handleLang), + 'wenyan': () => import('shiki/languages/wenyan.tmLanguage.json').then(handleLang), + 'wgsl': () => import('shiki/languages/wgsl.tmLanguage.json').then(handleLang), + 'xml': () => import('shiki/languages/xml.tmLanguage.json').then(handleLang), + 'xsl': () => import('shiki/languages/xsl.tmLanguage.json').then(handleLang), + 'yaml': () => import('shiki/languages/yaml.tmLanguage.json').then(handleLang), + 'zenscript': () => import('shiki/languages/zenscript.tmLanguage.json').then(handleLang), }; diff --git a/packages/astro/scripts/shiki-gen-languages.mjs b/packages/astro/scripts/shiki-gen-languages.mjs index 9a497f6e996c..981e2fda71a7 100644 --- a/packages/astro/scripts/shiki-gen-languages.mjs +++ b/packages/astro/scripts/shiki-gen-languages.mjs @@ -4,31 +4,34 @@ const dir = await fs.promises.readdir('packages/astro/node_modules/shiki/languag const langImports = dir.map((f) => { const key = f.slice(0, f.indexOf('.tmLanguage.json')); - return [ - key, - `import('shiki/languages/${f}').then(mod => mod.default).then(grammar => { - const lang = BUNDLED_LANGUAGES.find(l => l.id === '${key}'); - if(lang) { + return [key, `import('shiki/languages/${f}').then(handleLang)`]; +}); + +let code = `\ +/** + * This file is prebuilt from packages/astro/scripts/shiki-gen-languages.mjs + * Do not edit this directly, but instead edit that file and rerun it to generate this file. + */ + +import { BUNDLED_LANGUAGES } from 'shiki'; + +function handleLang(mod) { + const lang = BUNDLED_LANGUAGES.find((l) => l.id === mod.default); + if (lang) { return { ...lang, - grammar + grammar, }; } else { return undefined; } -})`, - ]; -}); -let code = `import { BUNDLED_LANGUAGES } from 'shiki'; +} +// prettier-ignore export const languages = {`; -let i = 0; + for (const [key, imp] of langImports) { - if (i > 0) { - code += ','; - } - code += `\n\t'${key}': () => ${imp}`; - i++; + code += `\n\t'${key}': () => ${imp},`; } code += '\n};'; From 37694936730434b843eeb501792e3b7e683ae585 Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 21:03:54 +0800 Subject: [PATCH 04/12] Simplify --- packages/astro/scripts/shiki-gen-themes.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/astro/scripts/shiki-gen-themes.mjs b/packages/astro/scripts/shiki-gen-themes.mjs index 381b4d4b58cd..4d400c8505bf 100644 --- a/packages/astro/scripts/shiki-gen-themes.mjs +++ b/packages/astro/scripts/shiki-gen-themes.mjs @@ -22,9 +22,10 @@ let code = `\ * This file is prebuilt from packages/astro/scripts/shiki-gen-themes.mjs * Do not edit this directly, but instead edit that file and rerun it to generate this file. */ -`; -code += `\n// prettier-ignore\nexport const themes = {`; +// prettier-ignore +export const themes = {`; + for (const [key, imp] of themeImports) { code += `\n\t'${key}': () => ${imp},`; } From 0a532a623017bbd830208be23007265028a7742a Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 21:20:28 +0800 Subject: [PATCH 05/12] Fix compat for other remark code --- packages/integrations/mdx/src/remark-shiki.ts | 20 +++++++++++++++++++ packages/markdown/remark/src/remark-shiki.ts | 20 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/packages/integrations/mdx/src/remark-shiki.ts b/packages/integrations/mdx/src/remark-shiki.ts index d4620194c6f0..3f3310de7158 100644 --- a/packages/integrations/mdx/src/remark-shiki.ts +++ b/packages/integrations/mdx/src/remark-shiki.ts @@ -10,7 +10,27 @@ import { visit } from 'unist-util-visit'; */ const highlighterCacheAsync = new Map>(); +// Map of old theme names to new names to preserve compatibility when we upgrade shiki +const compatThemes: Record = { + 'material-darker': 'material-theme-darker', + 'material-default': 'material-theme', + 'material-lighter': 'material-theme-lighter', + 'material-ocean': 'material-theme-ocean', + 'material-palenight': 'material-theme-palenight', +}; + +const normalizeTheme = (theme: string | shiki.IShikiTheme) => { + if (typeof theme === 'string') { + return compatThemes[theme] || theme; + } else if (compatThemes[theme.name]) { + return { ...theme, name: compatThemes[theme.name] }; + } else { + return theme; + } +}; + const remarkShiki = async ({ langs = [], theme = 'github-dark', wrap = false }: ShikiConfig) => { + theme = normalizeTheme(theme); const cacheID: string = typeof theme === 'string' ? theme : theme.name; let highlighterAsync = highlighterCacheAsync.get(cacheID); if (!highlighterAsync) { diff --git a/packages/markdown/remark/src/remark-shiki.ts b/packages/markdown/remark/src/remark-shiki.ts index ad7c982f9f9f..8035635f9d78 100644 --- a/packages/markdown/remark/src/remark-shiki.ts +++ b/packages/markdown/remark/src/remark-shiki.ts @@ -10,10 +10,30 @@ import type { ShikiConfig } from './types.js'; */ const highlighterCacheAsync = new Map>(); +// Map of old theme names to new names to preserve compatibility when we upgrade shiki +const compatThemes: Record = { + 'material-darker': 'material-theme-darker', + 'material-default': 'material-theme', + 'material-lighter': 'material-theme-lighter', + 'material-ocean': 'material-theme-ocean', + 'material-palenight': 'material-theme-palenight', +}; + +const normalizeTheme = (theme: string | shiki.IShikiTheme) => { + if (typeof theme === 'string') { + return compatThemes[theme] || theme; + } else if (compatThemes[theme.name]) { + return { ...theme, name: compatThemes[theme.name] }; + } else { + return theme; + } +}; + const remarkShiki = async ( { langs = [], theme = 'github-dark', wrap = false }: ShikiConfig, scopedClassName?: string | null ) => { + theme = normalizeTheme(theme); const cacheID: string = typeof theme === 'string' ? theme : theme.name; let highlighterAsync = highlighterCacheAsync.get(cacheID); if (!highlighterAsync) { From 5083db5a8f611c5110da5cbe577ad345a005750b Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 21:23:02 +0800 Subject: [PATCH 06/12] Update theme again --- packages/astro/components/shiki-themes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/components/shiki-themes.js b/packages/astro/components/shiki-themes.js index 4d8dcb2d9470..7f07d2417849 100644 --- a/packages/astro/components/shiki-themes.js +++ b/packages/astro/components/shiki-themes.js @@ -34,7 +34,7 @@ export const themes = { 'solarized-light': () => import('shiki/themes/solarized-light.json').then(mod => mod.default), 'vitesse-dark': () => import('shiki/themes/vitesse-dark.json').then(mod => mod.default), 'vitesse-light': () => import('shiki/themes/vitesse-light.json').then(mod => mod.default), - // compat + // old theme names for compat 'material-darker': () => import('shiki/themes/material-theme-darker').then(mod => mod.default), 'material-default': () => import('shiki/themes/material-theme').then(mod => mod.default), 'material-lighter': () => import('shiki/themes/material-theme-lighter').then(mod => mod.default), From 033a3b3cc5385f69d26432609d529b77b5c404de Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 21:27:15 +0800 Subject: [PATCH 07/12] Fix language gen --- packages/astro/components/shiki-languages.js | 313 +++++++++--------- .../astro/scripts/shiki-gen-languages.mjs | 6 +- 2 files changed, 160 insertions(+), 159 deletions(-) diff --git a/packages/astro/components/shiki-languages.js b/packages/astro/components/shiki-languages.js index c86461fa6524..f1e7e7b520b4 100644 --- a/packages/astro/components/shiki-languages.js +++ b/packages/astro/components/shiki-languages.js @@ -5,8 +5,8 @@ import { BUNDLED_LANGUAGES } from 'shiki'; -function handleLang(mod) { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === mod.default); +function handleLang(grammar, lang) { + const lang = BUNDLED_LANGUAGES.find((l) => l.id === lang); if (lang) { return { ...lang, @@ -17,159 +17,160 @@ function handleLang(mod) { } } +// prettier-ignore export const languages = { - 'abap': () => import('shiki/languages/abap.tmLanguage.json').then(handleLang), - 'actionscript-3': () => import('shiki/languages/actionscript-3.tmLanguage.json').then(handleLang), - 'ada': () => import('shiki/languages/ada.tmLanguage.json').then(handleLang), - 'apache': () => import('shiki/languages/apache.tmLanguage.json').then(handleLang), - 'apex': () => import('shiki/languages/apex.tmLanguage.json').then(handleLang), - 'apl': () => import('shiki/languages/apl.tmLanguage.json').then(handleLang), - 'applescript': () => import('shiki/languages/applescript.tmLanguage.json').then(handleLang), - 'ara': () => import('shiki/languages/ara.tmLanguage.json').then(handleLang), - 'asm': () => import('shiki/languages/asm.tmLanguage.json').then(handleLang), - 'astro': () => import('shiki/languages/astro.tmLanguage.json').then(handleLang), - 'awk': () => import('shiki/languages/awk.tmLanguage.json').then(handleLang), - 'ballerina': () => import('shiki/languages/ballerina.tmLanguage.json').then(handleLang), - 'bat': () => import('shiki/languages/bat.tmLanguage.json').then(handleLang), - 'berry': () => import('shiki/languages/berry.tmLanguage.json').then(handleLang), - 'bibtex': () => import('shiki/languages/bibtex.tmLanguage.json').then(handleLang), - 'bicep': () => import('shiki/languages/bicep.tmLanguage.json').then(handleLang), - 'blade': () => import('shiki/languages/blade.tmLanguage.json').then(handleLang), - 'c': () => import('shiki/languages/c.tmLanguage.json').then(handleLang), - 'cadence': () => import('shiki/languages/cadence.tmLanguage.json').then(handleLang), - 'clarity': () => import('shiki/languages/clarity.tmLanguage.json').then(handleLang), - 'clojure': () => import('shiki/languages/clojure.tmLanguage.json').then(handleLang), - 'cmake': () => import('shiki/languages/cmake.tmLanguage.json').then(handleLang), - 'cobol': () => import('shiki/languages/cobol.tmLanguage.json').then(handleLang), - 'codeql': () => import('shiki/languages/codeql.tmLanguage.json').then(handleLang), - 'coffee': () => import('shiki/languages/coffee.tmLanguage.json').then(handleLang), - 'cpp-macro': () => import('shiki/languages/cpp-macro.tmLanguage.json').then(handleLang), - 'cpp': () => import('shiki/languages/cpp.tmLanguage.json').then(handleLang), - 'crystal': () => import('shiki/languages/crystal.tmLanguage.json').then(handleLang), - 'csharp': () => import('shiki/languages/csharp.tmLanguage.json').then(handleLang), - 'css': () => import('shiki/languages/css.tmLanguage.json').then(handleLang), - 'cue': () => import('shiki/languages/cue.tmLanguage.json').then(handleLang), - 'd': () => import('shiki/languages/d.tmLanguage.json').then(handleLang), - 'dart': () => import('shiki/languages/dart.tmLanguage.json').then(handleLang), - 'dax': () => import('shiki/languages/dax.tmLanguage.json').then(handleLang), - 'diff': () => import('shiki/languages/diff.tmLanguage.json').then(handleLang), - 'docker': () => import('shiki/languages/docker.tmLanguage.json').then(handleLang), - 'dream-maker': () => import('shiki/languages/dream-maker.tmLanguage.json').then(handleLang), - 'elixir': () => import('shiki/languages/elixir.tmLanguage.json').then(handleLang), - 'elm': () => import('shiki/languages/elm.tmLanguage.json').then(handleLang), - 'erb': () => import('shiki/languages/erb.tmLanguage.json').then(handleLang), - 'erlang': () => import('shiki/languages/erlang.tmLanguage.json').then(handleLang), - 'fish': () => import('shiki/languages/fish.tmLanguage.json').then(handleLang), - 'fsharp': () => import('shiki/languages/fsharp.tmLanguage.json').then(handleLang), - 'gherkin': () => import('shiki/languages/gherkin.tmLanguage.json').then(handleLang), - 'git-commit': () => import('shiki/languages/git-commit.tmLanguage.json').then(handleLang), - 'git-rebase': () => import('shiki/languages/git-rebase.tmLanguage.json').then(handleLang), - 'glsl': () => import('shiki/languages/glsl.tmLanguage.json').then(handleLang), - 'gnuplot': () => import('shiki/languages/gnuplot.tmLanguage.json').then(handleLang), - 'go': () => import('shiki/languages/go.tmLanguage.json').then(handleLang), - 'graphql': () => import('shiki/languages/graphql.tmLanguage.json').then(handleLang), - 'groovy': () => import('shiki/languages/groovy.tmLanguage.json').then(handleLang), - 'hack': () => import('shiki/languages/hack.tmLanguage.json').then(handleLang), - 'haml': () => import('shiki/languages/haml.tmLanguage.json').then(handleLang), - 'handlebars': () => import('shiki/languages/handlebars.tmLanguage.json').then(handleLang), - 'haskell': () => import('shiki/languages/haskell.tmLanguage.json').then(handleLang), - 'hcl': () => import('shiki/languages/hcl.tmLanguage.json').then(handleLang), - 'hlsl': () => import('shiki/languages/hlsl.tmLanguage.json').then(handleLang), - 'html': () => import('shiki/languages/html.tmLanguage.json').then(handleLang), - 'http': () => import('shiki/languages/http.tmLanguage.json').then(handleLang), - 'imba': () => import('shiki/languages/imba.tmLanguage.json').then(handleLang), - 'ini': () => import('shiki/languages/ini.tmLanguage.json').then(handleLang), - 'java': () => import('shiki/languages/java.tmLanguage.json').then(handleLang), - 'javascript': () => import('shiki/languages/javascript.tmLanguage.json').then(handleLang), - 'jinja-html': () => import('shiki/languages/jinja-html.tmLanguage.json').then(handleLang), - 'jinja': () => import('shiki/languages/jinja.tmLanguage.json').then(handleLang), - 'jison': () => import('shiki/languages/jison.tmLanguage.json').then(handleLang), - 'json': () => import('shiki/languages/json.tmLanguage.json').then(handleLang), - 'json5': () => import('shiki/languages/json5.tmLanguage.json').then(handleLang), - 'jsonc': () => import('shiki/languages/jsonc.tmLanguage.json').then(handleLang), - 'jsonnet': () => import('shiki/languages/jsonnet.tmLanguage.json').then(handleLang), - 'jssm': () => import('shiki/languages/jssm.tmLanguage.json').then(handleLang), - 'jsx': () => import('shiki/languages/jsx.tmLanguage.json').then(handleLang), - 'julia': () => import('shiki/languages/julia.tmLanguage.json').then(handleLang), - 'kotlin': () => import('shiki/languages/kotlin.tmLanguage.json').then(handleLang), - 'latex': () => import('shiki/languages/latex.tmLanguage.json').then(handleLang), - 'less': () => import('shiki/languages/less.tmLanguage.json').then(handleLang), - 'liquid': () => import('shiki/languages/liquid.tmLanguage.json').then(handleLang), - 'lisp': () => import('shiki/languages/lisp.tmLanguage.json').then(handleLang), - 'logo': () => import('shiki/languages/logo.tmLanguage.json').then(handleLang), - 'lua': () => import('shiki/languages/lua.tmLanguage.json').then(handleLang), - 'make': () => import('shiki/languages/make.tmLanguage.json').then(handleLang), - 'markdown': () => import('shiki/languages/markdown.tmLanguage.json').then(handleLang), - 'marko': () => import('shiki/languages/marko.tmLanguage.json').then(handleLang), - 'matlab': () => import('shiki/languages/matlab.tmLanguage.json').then(handleLang), - 'mdx': () => import('shiki/languages/mdx.tmLanguage.json').then(handleLang), - 'mermaid': () => import('shiki/languages/mermaid.tmLanguage.json').then(handleLang), - 'nginx': () => import('shiki/languages/nginx.tmLanguage.json').then(handleLang), - 'nim': () => import('shiki/languages/nim.tmLanguage.json').then(handleLang), - 'nix': () => import('shiki/languages/nix.tmLanguage.json').then(handleLang), - 'objective-c': () => import('shiki/languages/objective-c.tmLanguage.json').then(handleLang), - 'objective-cpp': () => import('shiki/languages/objective-cpp.tmLanguage.json').then(handleLang), - 'ocaml': () => import('shiki/languages/ocaml.tmLanguage.json').then(handleLang), - 'pascal': () => import('shiki/languages/pascal.tmLanguage.json').then(handleLang), - 'perl': () => import('shiki/languages/perl.tmLanguage.json').then(handleLang), - 'php-html': () => import('shiki/languages/php-html.tmLanguage.json').then(handleLang), - 'php': () => import('shiki/languages/php.tmLanguage.json').then(handleLang), - 'plsql': () => import('shiki/languages/plsql.tmLanguage.json').then(handleLang), - 'postcss': () => import('shiki/languages/postcss.tmLanguage.json').then(handleLang), - 'powerquery': () => import('shiki/languages/powerquery.tmLanguage.json').then(handleLang), - 'powershell': () => import('shiki/languages/powershell.tmLanguage.json').then(handleLang), - 'prisma': () => import('shiki/languages/prisma.tmLanguage.json').then(handleLang), - 'prolog': () => import('shiki/languages/prolog.tmLanguage.json').then(handleLang), - 'proto': () => import('shiki/languages/proto.tmLanguage.json').then(handleLang), - 'pug': () => import('shiki/languages/pug.tmLanguage.json').then(handleLang), - 'puppet': () => import('shiki/languages/puppet.tmLanguage.json').then(handleLang), - 'purescript': () => import('shiki/languages/purescript.tmLanguage.json').then(handleLang), - 'python': () => import('shiki/languages/python.tmLanguage.json').then(handleLang), - 'r': () => import('shiki/languages/r.tmLanguage.json').then(handleLang), - 'raku': () => import('shiki/languages/raku.tmLanguage.json').then(handleLang), - 'razor': () => import('shiki/languages/razor.tmLanguage.json').then(handleLang), - 'rel': () => import('shiki/languages/rel.tmLanguage.json').then(handleLang), - 'riscv': () => import('shiki/languages/riscv.tmLanguage.json').then(handleLang), - 'rst': () => import('shiki/languages/rst.tmLanguage.json').then(handleLang), - 'ruby': () => import('shiki/languages/ruby.tmLanguage.json').then(handleLang), - 'rust': () => import('shiki/languages/rust.tmLanguage.json').then(handleLang), - 'sas': () => import('shiki/languages/sas.tmLanguage.json').then(handleLang), - 'sass': () => import('shiki/languages/sass.tmLanguage.json').then(handleLang), - 'scala': () => import('shiki/languages/scala.tmLanguage.json').then(handleLang), - 'scheme': () => import('shiki/languages/scheme.tmLanguage.json').then(handleLang), - 'scss': () => import('shiki/languages/scss.tmLanguage.json').then(handleLang), - 'shaderlab': () => import('shiki/languages/shaderlab.tmLanguage.json').then(handleLang), - 'shellscript': () => import('shiki/languages/shellscript.tmLanguage.json').then(handleLang), - 'smalltalk': () => import('shiki/languages/smalltalk.tmLanguage.json').then(handleLang), - 'solidity': () => import('shiki/languages/solidity.tmLanguage.json').then(handleLang), - 'sparql': () => import('shiki/languages/sparql.tmLanguage.json').then(handleLang), - 'sql': () => import('shiki/languages/sql.tmLanguage.json').then(handleLang), - 'ssh-config': () => import('shiki/languages/ssh-config.tmLanguage.json').then(handleLang), - 'stata': () => import('shiki/languages/stata.tmLanguage.json').then(handleLang), - 'stylus': () => import('shiki/languages/stylus.tmLanguage.json').then(handleLang), - 'svelte': () => import('shiki/languages/svelte.tmLanguage.json').then(handleLang), - 'swift': () => import('shiki/languages/swift.tmLanguage.json').then(handleLang), - 'system-verilog': () => import('shiki/languages/system-verilog.tmLanguage.json').then(handleLang), - 'tasl': () => import('shiki/languages/tasl.tmLanguage.json').then(handleLang), - 'tcl': () => import('shiki/languages/tcl.tmLanguage.json').then(handleLang), - 'tex': () => import('shiki/languages/tex.tmLanguage.json').then(handleLang), - 'toml': () => import('shiki/languages/toml.tmLanguage.json').then(handleLang), - 'tsx': () => import('shiki/languages/tsx.tmLanguage.json').then(handleLang), - 'turtle': () => import('shiki/languages/turtle.tmLanguage.json').then(handleLang), - 'twig': () => import('shiki/languages/twig.tmLanguage.json').then(handleLang), - 'typescript': () => import('shiki/languages/typescript.tmLanguage.json').then(handleLang), - 'v': () => import('shiki/languages/v.tmLanguage.json').then(handleLang), - 'vb': () => import('shiki/languages/vb.tmLanguage.json').then(handleLang), - 'verilog': () => import('shiki/languages/verilog.tmLanguage.json').then(handleLang), - 'vhdl': () => import('shiki/languages/vhdl.tmLanguage.json').then(handleLang), - 'viml': () => import('shiki/languages/viml.tmLanguage.json').then(handleLang), - 'vue-html': () => import('shiki/languages/vue-html.tmLanguage.json').then(handleLang), - 'vue': () => import('shiki/languages/vue.tmLanguage.json').then(handleLang), - 'wasm': () => import('shiki/languages/wasm.tmLanguage.json').then(handleLang), - 'wenyan': () => import('shiki/languages/wenyan.tmLanguage.json').then(handleLang), - 'wgsl': () => import('shiki/languages/wgsl.tmLanguage.json').then(handleLang), - 'xml': () => import('shiki/languages/xml.tmLanguage.json').then(handleLang), - 'xsl': () => import('shiki/languages/xsl.tmLanguage.json').then(handleLang), - 'yaml': () => import('shiki/languages/yaml.tmLanguage.json').then(handleLang), - 'zenscript': () => import('shiki/languages/zenscript.tmLanguage.json').then(handleLang), + 'abap': () => import('shiki/languages/abap.tmLanguage.json').then((mod) => handleLang(mod.default, 'abap')), + 'actionscript-3': () => import('shiki/languages/actionscript-3.tmLanguage.json').then((mod) => handleLang(mod.default, 'actionscript-3')), + 'ada': () => import('shiki/languages/ada.tmLanguage.json').then((mod) => handleLang(mod.default, 'ada')), + 'apache': () => import('shiki/languages/apache.tmLanguage.json').then((mod) => handleLang(mod.default, 'apache')), + 'apex': () => import('shiki/languages/apex.tmLanguage.json').then((mod) => handleLang(mod.default, 'apex')), + 'apl': () => import('shiki/languages/apl.tmLanguage.json').then((mod) => handleLang(mod.default, 'apl')), + 'applescript': () => import('shiki/languages/applescript.tmLanguage.json').then((mod) => handleLang(mod.default, 'applescript')), + 'ara': () => import('shiki/languages/ara.tmLanguage.json').then((mod) => handleLang(mod.default, 'ara')), + 'asm': () => import('shiki/languages/asm.tmLanguage.json').then((mod) => handleLang(mod.default, 'asm')), + 'astro': () => import('shiki/languages/astro.tmLanguage.json').then((mod) => handleLang(mod.default, 'astro')), + 'awk': () => import('shiki/languages/awk.tmLanguage.json').then((mod) => handleLang(mod.default, 'awk')), + 'ballerina': () => import('shiki/languages/ballerina.tmLanguage.json').then((mod) => handleLang(mod.default, 'ballerina')), + 'bat': () => import('shiki/languages/bat.tmLanguage.json').then((mod) => handleLang(mod.default, 'bat')), + 'berry': () => import('shiki/languages/berry.tmLanguage.json').then((mod) => handleLang(mod.default, 'berry')), + 'bibtex': () => import('shiki/languages/bibtex.tmLanguage.json').then((mod) => handleLang(mod.default, 'bibtex')), + 'bicep': () => import('shiki/languages/bicep.tmLanguage.json').then((mod) => handleLang(mod.default, 'bicep')), + 'blade': () => import('shiki/languages/blade.tmLanguage.json').then((mod) => handleLang(mod.default, 'blade')), + 'c': () => import('shiki/languages/c.tmLanguage.json').then((mod) => handleLang(mod.default, 'c')), + 'cadence': () => import('shiki/languages/cadence.tmLanguage.json').then((mod) => handleLang(mod.default, 'cadence')), + 'clarity': () => import('shiki/languages/clarity.tmLanguage.json').then((mod) => handleLang(mod.default, 'clarity')), + 'clojure': () => import('shiki/languages/clojure.tmLanguage.json').then((mod) => handleLang(mod.default, 'clojure')), + 'cmake': () => import('shiki/languages/cmake.tmLanguage.json').then((mod) => handleLang(mod.default, 'cmake')), + 'cobol': () => import('shiki/languages/cobol.tmLanguage.json').then((mod) => handleLang(mod.default, 'cobol')), + 'codeql': () => import('shiki/languages/codeql.tmLanguage.json').then((mod) => handleLang(mod.default, 'codeql')), + 'coffee': () => import('shiki/languages/coffee.tmLanguage.json').then((mod) => handleLang(mod.default, 'coffee')), + 'cpp-macro': () => import('shiki/languages/cpp-macro.tmLanguage.json').then((mod) => handleLang(mod.default, 'cpp-macro')), + 'cpp': () => import('shiki/languages/cpp.tmLanguage.json').then((mod) => handleLang(mod.default, 'cpp')), + 'crystal': () => import('shiki/languages/crystal.tmLanguage.json').then((mod) => handleLang(mod.default, 'crystal')), + 'csharp': () => import('shiki/languages/csharp.tmLanguage.json').then((mod) => handleLang(mod.default, 'csharp')), + 'css': () => import('shiki/languages/css.tmLanguage.json').then((mod) => handleLang(mod.default, 'css')), + 'cue': () => import('shiki/languages/cue.tmLanguage.json').then((mod) => handleLang(mod.default, 'cue')), + 'd': () => import('shiki/languages/d.tmLanguage.json').then((mod) => handleLang(mod.default, 'd')), + 'dart': () => import('shiki/languages/dart.tmLanguage.json').then((mod) => handleLang(mod.default, 'dart')), + 'dax': () => import('shiki/languages/dax.tmLanguage.json').then((mod) => handleLang(mod.default, 'dax')), + 'diff': () => import('shiki/languages/diff.tmLanguage.json').then((mod) => handleLang(mod.default, 'diff')), + 'docker': () => import('shiki/languages/docker.tmLanguage.json').then((mod) => handleLang(mod.default, 'docker')), + 'dream-maker': () => import('shiki/languages/dream-maker.tmLanguage.json').then((mod) => handleLang(mod.default, 'dream-maker')), + 'elixir': () => import('shiki/languages/elixir.tmLanguage.json').then((mod) => handleLang(mod.default, 'elixir')), + 'elm': () => import('shiki/languages/elm.tmLanguage.json').then((mod) => handleLang(mod.default, 'elm')), + 'erb': () => import('shiki/languages/erb.tmLanguage.json').then((mod) => handleLang(mod.default, 'erb')), + 'erlang': () => import('shiki/languages/erlang.tmLanguage.json').then((mod) => handleLang(mod.default, 'erlang')), + 'fish': () => import('shiki/languages/fish.tmLanguage.json').then((mod) => handleLang(mod.default, 'fish')), + 'fsharp': () => import('shiki/languages/fsharp.tmLanguage.json').then((mod) => handleLang(mod.default, 'fsharp')), + 'gherkin': () => import('shiki/languages/gherkin.tmLanguage.json').then((mod) => handleLang(mod.default, 'gherkin')), + 'git-commit': () => import('shiki/languages/git-commit.tmLanguage.json').then((mod) => handleLang(mod.default, 'git-commit')), + 'git-rebase': () => import('shiki/languages/git-rebase.tmLanguage.json').then((mod) => handleLang(mod.default, 'git-rebase')), + 'glsl': () => import('shiki/languages/glsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'glsl')), + 'gnuplot': () => import('shiki/languages/gnuplot.tmLanguage.json').then((mod) => handleLang(mod.default, 'gnuplot')), + 'go': () => import('shiki/languages/go.tmLanguage.json').then((mod) => handleLang(mod.default, 'go')), + 'graphql': () => import('shiki/languages/graphql.tmLanguage.json').then((mod) => handleLang(mod.default, 'graphql')), + 'groovy': () => import('shiki/languages/groovy.tmLanguage.json').then((mod) => handleLang(mod.default, 'groovy')), + 'hack': () => import('shiki/languages/hack.tmLanguage.json').then((mod) => handleLang(mod.default, 'hack')), + 'haml': () => import('shiki/languages/haml.tmLanguage.json').then((mod) => handleLang(mod.default, 'haml')), + 'handlebars': () => import('shiki/languages/handlebars.tmLanguage.json').then((mod) => handleLang(mod.default, 'handlebars')), + 'haskell': () => import('shiki/languages/haskell.tmLanguage.json').then((mod) => handleLang(mod.default, 'haskell')), + 'hcl': () => import('shiki/languages/hcl.tmLanguage.json').then((mod) => handleLang(mod.default, 'hcl')), + 'hlsl': () => import('shiki/languages/hlsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'hlsl')), + 'html': () => import('shiki/languages/html.tmLanguage.json').then((mod) => handleLang(mod.default, 'html')), + 'http': () => import('shiki/languages/http.tmLanguage.json').then((mod) => handleLang(mod.default, 'http')), + 'imba': () => import('shiki/languages/imba.tmLanguage.json').then((mod) => handleLang(mod.default, 'imba')), + 'ini': () => import('shiki/languages/ini.tmLanguage.json').then((mod) => handleLang(mod.default, 'ini')), + 'java': () => import('shiki/languages/java.tmLanguage.json').then((mod) => handleLang(mod.default, 'java')), + 'javascript': () => import('shiki/languages/javascript.tmLanguage.json').then((mod) => handleLang(mod.default, 'javascript')), + 'jinja-html': () => import('shiki/languages/jinja-html.tmLanguage.json').then((mod) => handleLang(mod.default, 'jinja-html')), + 'jinja': () => import('shiki/languages/jinja.tmLanguage.json').then((mod) => handleLang(mod.default, 'jinja')), + 'jison': () => import('shiki/languages/jison.tmLanguage.json').then((mod) => handleLang(mod.default, 'jison')), + 'json': () => import('shiki/languages/json.tmLanguage.json').then((mod) => handleLang(mod.default, 'json')), + 'json5': () => import('shiki/languages/json5.tmLanguage.json').then((mod) => handleLang(mod.default, 'json5')), + 'jsonc': () => import('shiki/languages/jsonc.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsonc')), + 'jsonnet': () => import('shiki/languages/jsonnet.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsonnet')), + 'jssm': () => import('shiki/languages/jssm.tmLanguage.json').then((mod) => handleLang(mod.default, 'jssm')), + 'jsx': () => import('shiki/languages/jsx.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsx')), + 'julia': () => import('shiki/languages/julia.tmLanguage.json').then((mod) => handleLang(mod.default, 'julia')), + 'kotlin': () => import('shiki/languages/kotlin.tmLanguage.json').then((mod) => handleLang(mod.default, 'kotlin')), + 'latex': () => import('shiki/languages/latex.tmLanguage.json').then((mod) => handleLang(mod.default, 'latex')), + 'less': () => import('shiki/languages/less.tmLanguage.json').then((mod) => handleLang(mod.default, 'less')), + 'liquid': () => import('shiki/languages/liquid.tmLanguage.json').then((mod) => handleLang(mod.default, 'liquid')), + 'lisp': () => import('shiki/languages/lisp.tmLanguage.json').then((mod) => handleLang(mod.default, 'lisp')), + 'logo': () => import('shiki/languages/logo.tmLanguage.json').then((mod) => handleLang(mod.default, 'logo')), + 'lua': () => import('shiki/languages/lua.tmLanguage.json').then((mod) => handleLang(mod.default, 'lua')), + 'make': () => import('shiki/languages/make.tmLanguage.json').then((mod) => handleLang(mod.default, 'make')), + 'markdown': () => import('shiki/languages/markdown.tmLanguage.json').then((mod) => handleLang(mod.default, 'markdown')), + 'marko': () => import('shiki/languages/marko.tmLanguage.json').then((mod) => handleLang(mod.default, 'marko')), + 'matlab': () => import('shiki/languages/matlab.tmLanguage.json').then((mod) => handleLang(mod.default, 'matlab')), + 'mdx': () => import('shiki/languages/mdx.tmLanguage.json').then((mod) => handleLang(mod.default, 'mdx')), + 'mermaid': () => import('shiki/languages/mermaid.tmLanguage.json').then((mod) => handleLang(mod.default, 'mermaid')), + 'nginx': () => import('shiki/languages/nginx.tmLanguage.json').then((mod) => handleLang(mod.default, 'nginx')), + 'nim': () => import('shiki/languages/nim.tmLanguage.json').then((mod) => handleLang(mod.default, 'nim')), + 'nix': () => import('shiki/languages/nix.tmLanguage.json').then((mod) => handleLang(mod.default, 'nix')), + 'objective-c': () => import('shiki/languages/objective-c.tmLanguage.json').then((mod) => handleLang(mod.default, 'objective-c')), + 'objective-cpp': () => import('shiki/languages/objective-cpp.tmLanguage.json').then((mod) => handleLang(mod.default, 'objective-cpp')), + 'ocaml': () => import('shiki/languages/ocaml.tmLanguage.json').then((mod) => handleLang(mod.default, 'ocaml')), + 'pascal': () => import('shiki/languages/pascal.tmLanguage.json').then((mod) => handleLang(mod.default, 'pascal')), + 'perl': () => import('shiki/languages/perl.tmLanguage.json').then((mod) => handleLang(mod.default, 'perl')), + 'php-html': () => import('shiki/languages/php-html.tmLanguage.json').then((mod) => handleLang(mod.default, 'php-html')), + 'php': () => import('shiki/languages/php.tmLanguage.json').then((mod) => handleLang(mod.default, 'php')), + 'plsql': () => import('shiki/languages/plsql.tmLanguage.json').then((mod) => handleLang(mod.default, 'plsql')), + 'postcss': () => import('shiki/languages/postcss.tmLanguage.json').then((mod) => handleLang(mod.default, 'postcss')), + 'powerquery': () => import('shiki/languages/powerquery.tmLanguage.json').then((mod) => handleLang(mod.default, 'powerquery')), + 'powershell': () => import('shiki/languages/powershell.tmLanguage.json').then((mod) => handleLang(mod.default, 'powershell')), + 'prisma': () => import('shiki/languages/prisma.tmLanguage.json').then((mod) => handleLang(mod.default, 'prisma')), + 'prolog': () => import('shiki/languages/prolog.tmLanguage.json').then((mod) => handleLang(mod.default, 'prolog')), + 'proto': () => import('shiki/languages/proto.tmLanguage.json').then((mod) => handleLang(mod.default, 'proto')), + 'pug': () => import('shiki/languages/pug.tmLanguage.json').then((mod) => handleLang(mod.default, 'pug')), + 'puppet': () => import('shiki/languages/puppet.tmLanguage.json').then((mod) => handleLang(mod.default, 'puppet')), + 'purescript': () => import('shiki/languages/purescript.tmLanguage.json').then((mod) => handleLang(mod.default, 'purescript')), + 'python': () => import('shiki/languages/python.tmLanguage.json').then((mod) => handleLang(mod.default, 'python')), + 'r': () => import('shiki/languages/r.tmLanguage.json').then((mod) => handleLang(mod.default, 'r')), + 'raku': () => import('shiki/languages/raku.tmLanguage.json').then((mod) => handleLang(mod.default, 'raku')), + 'razor': () => import('shiki/languages/razor.tmLanguage.json').then((mod) => handleLang(mod.default, 'razor')), + 'rel': () => import('shiki/languages/rel.tmLanguage.json').then((mod) => handleLang(mod.default, 'rel')), + 'riscv': () => import('shiki/languages/riscv.tmLanguage.json').then((mod) => handleLang(mod.default, 'riscv')), + 'rst': () => import('shiki/languages/rst.tmLanguage.json').then((mod) => handleLang(mod.default, 'rst')), + 'ruby': () => import('shiki/languages/ruby.tmLanguage.json').then((mod) => handleLang(mod.default, 'ruby')), + 'rust': () => import('shiki/languages/rust.tmLanguage.json').then((mod) => handleLang(mod.default, 'rust')), + 'sas': () => import('shiki/languages/sas.tmLanguage.json').then((mod) => handleLang(mod.default, 'sas')), + 'sass': () => import('shiki/languages/sass.tmLanguage.json').then((mod) => handleLang(mod.default, 'sass')), + 'scala': () => import('shiki/languages/scala.tmLanguage.json').then((mod) => handleLang(mod.default, 'scala')), + 'scheme': () => import('shiki/languages/scheme.tmLanguage.json').then((mod) => handleLang(mod.default, 'scheme')), + 'scss': () => import('shiki/languages/scss.tmLanguage.json').then((mod) => handleLang(mod.default, 'scss')), + 'shaderlab': () => import('shiki/languages/shaderlab.tmLanguage.json').then((mod) => handleLang(mod.default, 'shaderlab')), + 'shellscript': () => import('shiki/languages/shellscript.tmLanguage.json').then((mod) => handleLang(mod.default, 'shellscript')), + 'smalltalk': () => import('shiki/languages/smalltalk.tmLanguage.json').then((mod) => handleLang(mod.default, 'smalltalk')), + 'solidity': () => import('shiki/languages/solidity.tmLanguage.json').then((mod) => handleLang(mod.default, 'solidity')), + 'sparql': () => import('shiki/languages/sparql.tmLanguage.json').then((mod) => handleLang(mod.default, 'sparql')), + 'sql': () => import('shiki/languages/sql.tmLanguage.json').then((mod) => handleLang(mod.default, 'sql')), + 'ssh-config': () => import('shiki/languages/ssh-config.tmLanguage.json').then((mod) => handleLang(mod.default, 'ssh-config')), + 'stata': () => import('shiki/languages/stata.tmLanguage.json').then((mod) => handleLang(mod.default, 'stata')), + 'stylus': () => import('shiki/languages/stylus.tmLanguage.json').then((mod) => handleLang(mod.default, 'stylus')), + 'svelte': () => import('shiki/languages/svelte.tmLanguage.json').then((mod) => handleLang(mod.default, 'svelte')), + 'swift': () => import('shiki/languages/swift.tmLanguage.json').then((mod) => handleLang(mod.default, 'swift')), + 'system-verilog': () => import('shiki/languages/system-verilog.tmLanguage.json').then((mod) => handleLang(mod.default, 'system-verilog')), + 'tasl': () => import('shiki/languages/tasl.tmLanguage.json').then((mod) => handleLang(mod.default, 'tasl')), + 'tcl': () => import('shiki/languages/tcl.tmLanguage.json').then((mod) => handleLang(mod.default, 'tcl')), + 'tex': () => import('shiki/languages/tex.tmLanguage.json').then((mod) => handleLang(mod.default, 'tex')), + 'toml': () => import('shiki/languages/toml.tmLanguage.json').then((mod) => handleLang(mod.default, 'toml')), + 'tsx': () => import('shiki/languages/tsx.tmLanguage.json').then((mod) => handleLang(mod.default, 'tsx')), + 'turtle': () => import('shiki/languages/turtle.tmLanguage.json').then((mod) => handleLang(mod.default, 'turtle')), + 'twig': () => import('shiki/languages/twig.tmLanguage.json').then((mod) => handleLang(mod.default, 'twig')), + 'typescript': () => import('shiki/languages/typescript.tmLanguage.json').then((mod) => handleLang(mod.default, 'typescript')), + 'v': () => import('shiki/languages/v.tmLanguage.json').then((mod) => handleLang(mod.default, 'v')), + 'vb': () => import('shiki/languages/vb.tmLanguage.json').then((mod) => handleLang(mod.default, 'vb')), + 'verilog': () => import('shiki/languages/verilog.tmLanguage.json').then((mod) => handleLang(mod.default, 'verilog')), + 'vhdl': () => import('shiki/languages/vhdl.tmLanguage.json').then((mod) => handleLang(mod.default, 'vhdl')), + 'viml': () => import('shiki/languages/viml.tmLanguage.json').then((mod) => handleLang(mod.default, 'viml')), + 'vue-html': () => import('shiki/languages/vue-html.tmLanguage.json').then((mod) => handleLang(mod.default, 'vue-html')), + 'vue': () => import('shiki/languages/vue.tmLanguage.json').then((mod) => handleLang(mod.default, 'vue')), + 'wasm': () => import('shiki/languages/wasm.tmLanguage.json').then((mod) => handleLang(mod.default, 'wasm')), + 'wenyan': () => import('shiki/languages/wenyan.tmLanguage.json').then((mod) => handleLang(mod.default, 'wenyan')), + 'wgsl': () => import('shiki/languages/wgsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'wgsl')), + 'xml': () => import('shiki/languages/xml.tmLanguage.json').then((mod) => handleLang(mod.default, 'xml')), + 'xsl': () => import('shiki/languages/xsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'xsl')), + 'yaml': () => import('shiki/languages/yaml.tmLanguage.json').then((mod) => handleLang(mod.default, 'yaml')), + 'zenscript': () => import('shiki/languages/zenscript.tmLanguage.json').then((mod) => handleLang(mod.default, 'zenscript')), }; diff --git a/packages/astro/scripts/shiki-gen-languages.mjs b/packages/astro/scripts/shiki-gen-languages.mjs index 981e2fda71a7..e38888252e97 100644 --- a/packages/astro/scripts/shiki-gen-languages.mjs +++ b/packages/astro/scripts/shiki-gen-languages.mjs @@ -4,7 +4,7 @@ const dir = await fs.promises.readdir('packages/astro/node_modules/shiki/languag const langImports = dir.map((f) => { const key = f.slice(0, f.indexOf('.tmLanguage.json')); - return [key, `import('shiki/languages/${f}').then(handleLang)`]; + return [key, `import('shiki/languages/${f}').then((mod) => handleLang(mod.default, '${key}'))`]; }); let code = `\ @@ -15,8 +15,8 @@ let code = `\ import { BUNDLED_LANGUAGES } from 'shiki'; -function handleLang(mod) { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === mod.default); +function handleLang(grammar, lang) { + const lang = BUNDLED_LANGUAGES.find((l) => l.id === lang); if (lang) { return { ...lang, From 3cf6fb669917d1af657b0c90058441c17114218e Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 21:29:12 +0800 Subject: [PATCH 08/12] Add changeset --- .changeset/smooth-cows-jog.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/smooth-cows-jog.md diff --git a/.changeset/smooth-cows-jog.md b/.changeset/smooth-cows-jog.md new file mode 100644 index 000000000000..19359312fb5e --- /dev/null +++ b/.changeset/smooth-cows-jog.md @@ -0,0 +1,8 @@ +--- +'@astrojs/markdoc': patch +'@astrojs/mdx': patch +'@astrojs/markdown-remark': patch +'astro': patch +--- + +Upgrade shiki to v0.14.1 From dd3fa05d2f16db6352aa128aeef08fbdb02e8ad8 Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 28 Apr 2023 21:35:02 +0800 Subject: [PATCH 09/12] Fix code --- packages/astro/components/shiki-languages.js | 4 ++-- packages/astro/scripts/shiki-gen-languages.mjs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/astro/components/shiki-languages.js b/packages/astro/components/shiki-languages.js index f1e7e7b520b4..2fcbc407a5d5 100644 --- a/packages/astro/components/shiki-languages.js +++ b/packages/astro/components/shiki-languages.js @@ -5,8 +5,8 @@ import { BUNDLED_LANGUAGES } from 'shiki'; -function handleLang(grammar, lang) { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === lang); +function handleLang(grammar, language) { + const lang = BUNDLED_LANGUAGES.find((l) => l.id === language); if (lang) { return { ...lang, diff --git a/packages/astro/scripts/shiki-gen-languages.mjs b/packages/astro/scripts/shiki-gen-languages.mjs index e38888252e97..29cdca41364d 100644 --- a/packages/astro/scripts/shiki-gen-languages.mjs +++ b/packages/astro/scripts/shiki-gen-languages.mjs @@ -15,8 +15,8 @@ let code = `\ import { BUNDLED_LANGUAGES } from 'shiki'; -function handleLang(grammar, lang) { - const lang = BUNDLED_LANGUAGES.find((l) => l.id === lang); +function handleLang(grammar, language) { + const lang = BUNDLED_LANGUAGES.find((l) => l.id === language); if (lang) { return { ...lang, From e9bfba09d564cc279da956f4fb0a08c797af474c Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 2 May 2023 16:01:47 +0800 Subject: [PATCH 10/12] Update test theme colors --- packages/astro/test/astro-component-code.test.js | 14 +++++++------- packages/astro/test/astro-markdown-shiki.test.js | 16 ++++++++-------- .../integrations/markdoc/test/render.test.js | 2 +- .../mdx/test/mdx-syntax-highlighting.test.js | 2 +- .../component/test/astro-markdown-shiki.test.js | 14 +++++++------- .../component/test/astro-markdown.test.js | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/astro/test/astro-component-code.test.js b/packages/astro/test/astro-component-code.test.js index e9efb4ca9f59..e721f9498789 100644 --- a/packages/astro/test/astro-component-code.test.js +++ b/packages/astro/test/astro-component-code.test.js @@ -15,7 +15,7 @@ describe('', () => { const $ = cheerio.load(html); expect($('pre')).to.have.lengthOf(1); expect($('pre').attr('style')).to.equal( - 'background-color: #0d1117; overflow-x: auto;', + 'background-color: #24292e; overflow-x: auto;', 'applies default and overflow' ); expect($('pre > code')).to.have.lengthOf(1); @@ -28,7 +28,7 @@ describe('', () => { let html = await fixture.readFile('/basic/index.html'); const $ = cheerio.load(html); expect($('pre')).to.have.lengthOf(1); - expect($('pre').attr('class'), 'astro-code'); + expect($('pre').attr('class'), 'astro-code nord'); expect($('pre > code')).to.have.lengthOf(1); // test: contains many generated spans expect($('pre > code span').length).to.be.greaterThanOrEqual(6); @@ -38,7 +38,7 @@ describe('', () => { let html = await fixture.readFile('/custom-theme/index.html'); const $ = cheerio.load(html); expect($('pre')).to.have.lengthOf(1); - expect($('pre').attr('class')).to.equal('astro-code'); + expect($('pre').attr('class')).to.equal('astro-code nord'); expect($('pre').attr('style')).to.equal( 'background-color: #2e3440ff; overflow-x: auto;', 'applies custom theme' @@ -52,7 +52,7 @@ describe('', () => { expect($('pre')).to.have.lengthOf(1); // test: applies wrap overflow expect($('pre').attr('style')).to.equal( - 'background-color: #0d1117; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;' + 'background-color: #24292e; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;' ); } { @@ -60,14 +60,14 @@ describe('', () => { const $ = cheerio.load(html); expect($('pre')).to.have.lengthOf(1); // test: applies wrap overflow - expect($('pre').attr('style')).to.equal('background-color: #0d1117; overflow-x: auto;'); + expect($('pre').attr('style')).to.equal('background-color: #24292e; overflow-x: auto;'); } { let html = await fixture.readFile('/wrap-null/index.html'); const $ = cheerio.load(html); expect($('pre')).to.have.lengthOf(1); // test: applies wrap overflow - expect($('pre').attr('style')).to.equal('background-color: #0d1117'); + expect($('pre').attr('style')).to.equal('background-color: #24292e'); } }); @@ -75,7 +75,7 @@ describe('', () => { let html = await fixture.readFile('/css-theme/index.html'); const $ = cheerio.load(html); expect($('pre')).to.have.lengthOf(1); - expect($('pre').attr('class')).to.equal('astro-code'); + expect($('pre').attr('class')).to.equal('astro-code css-variables'); expect( $('pre, pre span') .map((i, f) => (f.attribs ? f.attribs.style : 'no style found')) diff --git a/packages/astro/test/astro-markdown-shiki.test.js b/packages/astro/test/astro-markdown-shiki.test.js index 9c8d86689a71..ebdef6e14474 100644 --- a/packages/astro/test/astro-markdown-shiki.test.js +++ b/packages/astro/test/astro-markdown-shiki.test.js @@ -20,7 +20,7 @@ describe('Astro Markdown Shiki', () => { expect($('pre')).to.have.lengthOf(2); expect($('pre').hasClass('astro-code')).to.equal(true); - expect($('pre').attr().style).to.equal('background-color: #0d1117; overflow-x: auto;'); + expect($('pre').attr().style).to.equal('background-color: #24292e; overflow-x: auto;'); }); it('Can render diff syntax with "user-select: none"', async () => { @@ -47,7 +47,7 @@ describe('Astro Markdown Shiki', () => { expect($('pre')).to.have.lengthOf(1); expect($('pre').hasClass('astro-code')).to.equal(true); - expect($('pre').attr().style).to.equal('background-color: #ffffff; overflow-x: auto;'); + expect($('pre').attr().style).to.equal('background-color: #fff; overflow-x: auto;'); }); }); @@ -84,9 +84,9 @@ describe('Astro Markdown Shiki', () => { const segments = $('.line').get(6).children; expect(segments).to.have.lengthOf(3); - expect(segments[0].attribs.style).to.be.equal('color: #C9D1D9'); - expect(segments[1].attribs.style).to.be.equal('color: #79C0FF'); - expect(segments[2].attribs.style).to.be.equal('color: #C9D1D9'); + expect(segments[0].attribs.style).to.be.equal('color: #E1E4E8'); + expect(segments[1].attribs.style).to.be.equal('color: #79B8FF'); + expect(segments[2].attribs.style).to.be.equal('color: #E1E4E8'); const unknownLang = $('.line').last().html(); expect(unknownLang).to.be.equal( @@ -98,7 +98,7 @@ describe('Astro Markdown Shiki', () => { describe('Wrap', () => { describe('wrap = true', () => { const style = - 'background-color: #0d1117; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;'; + 'background-color: #24292e; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;'; let fixture; before(async () => { @@ -117,7 +117,7 @@ describe('Astro Markdown Shiki', () => { }); describe('wrap = false', () => { - const style = 'background-color: #0d1117; overflow-x: auto;'; + const style = 'background-color: #24292e; overflow-x: auto;'; let fixture; before(async () => { @@ -135,7 +135,7 @@ describe('Astro Markdown Shiki', () => { }); describe('wrap = null', () => { - const style = 'background-color: #0d1117'; + const style = 'background-color: #24292e'; let fixture; before(async () => { diff --git a/packages/integrations/markdoc/test/render.test.js b/packages/integrations/markdoc/test/render.test.js index 48d13a759c86..86ffcb7077ec 100644 --- a/packages/integrations/markdoc/test/render.test.js +++ b/packages/integrations/markdoc/test/render.test.js @@ -122,7 +122,7 @@ function renderComponentsChecks(html) { // Renders Astro Code component const pre = document.querySelector('pre'); expect(pre).to.not.be.null; - expect(pre.className).to.equal('astro-code'); + expect(pre.className).to.equal('astro-code github-dark'); } /** @param {string} html */ diff --git a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js index d420faabcbfc..40281cffd1c4 100644 --- a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js +++ b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js @@ -25,7 +25,7 @@ describe('MDX syntax highlighting', () => { const shikiCodeBlock = document.querySelector('pre.astro-code'); expect(shikiCodeBlock).to.not.be.null; - expect(shikiCodeBlock.getAttribute('style')).to.contain('background-color:#0d1117'); + expect(shikiCodeBlock.getAttribute('style')).to.contain('background-color:#24292e'); }); it('respects markdown.shikiConfig.theme', async () => { diff --git a/packages/markdown/component/test/astro-markdown-shiki.test.js b/packages/markdown/component/test/astro-markdown-shiki.test.js index fb4f8f9622a2..580552770cdd 100644 --- a/packages/markdown/component/test/astro-markdown-shiki.test.js +++ b/packages/markdown/component/test/astro-markdown-shiki.test.js @@ -41,7 +41,7 @@ describe('Astro Markdown Shiki', () => { expect($('pre')).to.have.lengthOf(1); expect($('pre').hasClass('astro-code')).to.equal(true); - expect($('pre').attr().style).to.equal('background-color: #ffffff; overflow-x: auto;'); + expect($('pre').attr().style).to.equal('background-color: #fff; overflow-x: auto;'); }); }); @@ -78,12 +78,12 @@ describe('Astro Markdown Shiki', () => { const segments = $('.line').get(6).children; expect(segments).to.have.lengthOf(3); - expect(segments[0].attribs.style).to.be.equal('color: #C9D1D9'); - expect(segments[1].attribs.style).to.be.equal('color: #79C0FF'); + expect(segments[0].attribs.style).to.be.equal('color: #E1E4E8'); + expect(segments[1].attribs.style).to.be.equal('color: #79B8FF'); const unknownLang = $('.line').last().html(); expect(unknownLang).to.be.equal( - 'This language does not exist' + 'This language does not exist' ); }); }); @@ -91,7 +91,7 @@ describe('Astro Markdown Shiki', () => { describe('Wrap', () => { describe('wrap = true', () => { const style = - 'background-color: #0d1117; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;'; + 'background-color: #24292e; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;'; let fixture; before(async () => { @@ -110,7 +110,7 @@ describe('Astro Markdown Shiki', () => { }); describe('wrap = false', () => { - const style = 'background-color: #0d1117; overflow-x: auto;'; + const style = 'background-color: #24292e; overflow-x: auto;'; let fixture; before(async () => { @@ -128,7 +128,7 @@ describe('Astro Markdown Shiki', () => { }); describe('wrap = null', () => { - const style = 'background-color: #0d1117'; + const style = 'background-color: #24292e'; let fixture; before(async () => { diff --git a/packages/markdown/component/test/astro-markdown.test.js b/packages/markdown/component/test/astro-markdown.test.js index d2b156334535..21c839b34f87 100644 --- a/packages/markdown/component/test/astro-markdown.test.js +++ b/packages/markdown/component/test/astro-markdown.test.js @@ -119,7 +119,7 @@ describe('Astro Markdown', () => { // test 1: the "pre" tag receives scoped style const preClassList = $('pre').attr('class').split(/\s+/); - expect(preClassList.length).to.equal(2); + expect(preClassList.length).to.equal(3); const preAstroClass = preClassList.find(isAstroScopedClass); expect(Boolean(preAstroClass)).to.equal(true); From 341bb7c521727b4fc0bc214d1d3e964f39f47410 Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 2 May 2023 16:04:25 +0800 Subject: [PATCH 11/12] Update changeset --- .changeset/smooth-cows-jog.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.changeset/smooth-cows-jog.md b/.changeset/smooth-cows-jog.md index 19359312fb5e..8c6d4563cf87 100644 --- a/.changeset/smooth-cows-jog.md +++ b/.changeset/smooth-cows-jog.md @@ -1,8 +1,8 @@ --- '@astrojs/markdoc': patch '@astrojs/mdx': patch -'@astrojs/markdown-remark': patch -'astro': patch +'@astrojs/markdown-remark': minor +'astro': minor --- -Upgrade shiki to v0.14.1 +Upgrade shiki to v0.14.1. This updates the shiki theme colors and adds the theme name to the `pre` tag, e.g. `
`.

From 68ee0976cfbaa54e34274a8f089fc42b5b4e9749 Mon Sep 17 00:00:00 2001
From: bluwy 
Date: Tue, 2 May 2023 16:19:08 +0800
Subject: [PATCH 12/12] Fix test again

---
 packages/astro/test/astro-markdown-shiki.test.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/astro/test/astro-markdown-shiki.test.js b/packages/astro/test/astro-markdown-shiki.test.js
index ebdef6e14474..bf3e0724b0bd 100644
--- a/packages/astro/test/astro-markdown-shiki.test.js
+++ b/packages/astro/test/astro-markdown-shiki.test.js
@@ -90,7 +90,7 @@ describe('Astro Markdown Shiki', () => {
 
 			const unknownLang = $('.line').last().html();
 			expect(unknownLang).to.be.equal(
-				'This language does not exist'
+				'This language does not exist'
 			);
 		});
 	});