chore: switch to shiki-es
This commit is contained in:
parent
db5a022f3b
commit
04431c7319
|
@ -1,4 +1,4 @@
|
||||||
import type { Highlighter, Lang } from 'shiki'
|
import type { Highlighter, Lang } from 'shiki-es'
|
||||||
|
|
||||||
export const shiki = ref<Highlighter>()
|
export const shiki = ref<Highlighter>()
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ let shikiImport: Promise<void> | undefined
|
||||||
|
|
||||||
export function highlightCode(code: string, lang: Lang) {
|
export function highlightCode(code: string, lang: Lang) {
|
||||||
if (!shikiImport) {
|
if (!shikiImport) {
|
||||||
shikiImport = import('shiki')
|
shikiImport = import('shiki-es')
|
||||||
.then(async (r) => {
|
.then(async (r) => {
|
||||||
r.setCDN('/shiki/')
|
r.setCDN('/shiki/')
|
||||||
shiki.value = await r.getHighlighter({
|
shiki.value = await r.getHighlighter({
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
"prettier": "^2.8.0",
|
"prettier": "^2.8.0",
|
||||||
"rollup-plugin-node-polyfills": "^0.2.1",
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
||||||
"shiki": "^0.11.1",
|
"shiki": "^0.11.1",
|
||||||
|
"shiki-es": "^0.1.2",
|
||||||
"simple-git-hooks": "^2.8.1",
|
"simple-git-hooks": "^2.8.1",
|
||||||
"std-env": "^3.3.1",
|
"std-env": "^3.3.1",
|
||||||
"theme-vitesse": "^0.6.0",
|
"theme-vitesse": "^0.6.0",
|
||||||
|
|
|
@ -50,6 +50,7 @@ specifiers:
|
||||||
prettier: ^2.8.0
|
prettier: ^2.8.0
|
||||||
rollup-plugin-node-polyfills: ^0.2.1
|
rollup-plugin-node-polyfills: ^0.2.1
|
||||||
shiki: ^0.11.1
|
shiki: ^0.11.1
|
||||||
|
shiki-es: ^0.1.2
|
||||||
simple-git-hooks: ^2.8.1
|
simple-git-hooks: ^2.8.1
|
||||||
std-env: ^3.3.1
|
std-env: ^3.3.1
|
||||||
theme-vitesse: ^0.6.0
|
theme-vitesse: ^0.6.0
|
||||||
|
@ -112,6 +113,7 @@ devDependencies:
|
||||||
prettier: 2.8.0
|
prettier: 2.8.0
|
||||||
rollup-plugin-node-polyfills: 0.2.1
|
rollup-plugin-node-polyfills: 0.2.1
|
||||||
shiki: 0.11.1
|
shiki: 0.11.1
|
||||||
|
shiki-es: 0.1.2
|
||||||
simple-git-hooks: 2.8.1
|
simple-git-hooks: 2.8.1
|
||||||
std-env: 3.3.1
|
std-env: 3.3.1
|
||||||
theme-vitesse: 0.6.0
|
theme-vitesse: 0.6.0
|
||||||
|
@ -7250,11 +7252,15 @@ packages:
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/shiki-es/0.1.2:
|
||||||
|
resolution: {integrity: sha512-eqtfk8idlYlSLAn0gp0Ly2+FbKc2d78IddigHSS4iHAnpXoY2kdRzyFGZOdi6TvemYMnRhZBi1HsSqZc5eNKqg==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/shiki/0.11.1:
|
/shiki/0.11.1:
|
||||||
resolution: {integrity: sha512-EugY9VASFuDqOexOgXR18ZV+TbFrQHeCpEYaXamO+SZlsnT/2LxuLBX25GGtIrwaEVFXUAbUQ601SWE2rMwWHA==}
|
resolution: {integrity: sha512-EugY9VASFuDqOexOgXR18ZV+TbFrQHeCpEYaXamO+SZlsnT/2LxuLBX25GGtIrwaEVFXUAbUQ601SWE2rMwWHA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
jsonc-parser: 3.2.0
|
jsonc-parser: 3.2.0
|
||||||
vscode-oniguruma: 1.7.0
|
vscode-oniguruma: 1.6.1
|
||||||
vscode-textmate: 6.0.0
|
vscode-textmate: 6.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
@ -8304,8 +8310,8 @@ packages:
|
||||||
vscode-languageserver-protocol: 3.16.0
|
vscode-languageserver-protocol: 3.16.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vscode-oniguruma/1.7.0:
|
/vscode-oniguruma/1.6.1:
|
||||||
resolution: {integrity: sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==}
|
resolution: {integrity: sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vscode-textmate/6.0.0:
|
/vscode-textmate/6.0.0:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { copy } from 'fs-extra'
|
||||||
|
|
||||||
const dereference = process.platform === 'win32' ? true : undefined
|
const dereference = process.platform === 'win32' ? true : undefined
|
||||||
|
|
||||||
await copy('node_modules/shiki/', 'public/shiki/', {
|
await copy('node_modules/shiki-es/dist/assets', 'public/shiki/', {
|
||||||
dereference,
|
dereference,
|
||||||
filter: src => src === 'node_modules/shiki/' || src.includes('languages') || src.includes('dist'),
|
filter: src => src === 'node_modules/shiki/' || src.includes('languages') || src.includes('dist'),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue