Skip to content

Commit 67b155b

Browse files
committedMay 14, 2024
feat: update deps
1 parent a5dbe29 commit 67b155b

18 files changed

+358
-243
lines changed
 

‎docs/.vitepress/config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default withMermaid(defineConfig({
103103
{
104104
name: 'shiki:inline-decorations',
105105
preprocess(code, options) {
106-
const reg = /^\/\/ @decorations:(.*?)\n/
106+
const reg = /^\/\/ @decorations:(.*)\n/
107107
code = code.replace(reg, (match, decorations) => {
108108
options.decorations ||= []
109109
options.decorations.push(...JSON.parse(decorations))
@@ -117,13 +117,13 @@ export default withMermaid(defineConfig({
117117
processHoverInfo(info) {
118118
return defaultHoverInfoProcessor(info)
119119
// Remove shiki_core namespace
120-
.replace(/_shikijs_core[\w_]*\./g, '')
120+
.replace(/_shikijs_core\w*\./g, '')
121121
},
122122
}),
123123
{
124124
name: 'shiki:remove-escape',
125125
postprocess(code) {
126-
return code.replace(/\[\\\!code/g, '[!code')
126+
return code.replace(/\[\\!code/g, '[!code')
127127
},
128128
},
129129
],

‎docs/.vitepress/store/playground.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const usePlayground = defineStore('playground', () => {
8181
if ((o[0] || !input.value) && n[0] !== o[0]) {
8282
const sample = await fetchSample(lang.value)
8383
if (sample)
84-
input.value = sample.trim().replace(/\n.*?from.*?$/i, '').trim()
84+
input.value = sample.trim().replace(/\n.*?from.*$/i, '').trim()
8585
}
8686
run()
8787
}, { immediate: true })

‎package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"type": "module",
33
"version": "1.5.1",
44
"private": true,
5-
"packageManager": "pnpm@9.1.0",
5+
"packageManager": "pnpm@9.1.1",
66
"scripts": {
77
"lint": "eslint . --cache",
88
"release": "bumpp && pnpm -r publish",
@@ -14,7 +14,7 @@
1414
"prepare": "simple-git-hooks"
1515
},
1616
"devDependencies": {
17-
"@antfu/eslint-config": "^2.17.0",
17+
"@antfu/eslint-config": "^2.18.0",
1818
"@antfu/ni": "^0.21.12",
1919
"@antfu/utils": "^0.7.8",
2020
"@rollup/plugin-alias": "^5.1.0",
@@ -30,7 +30,7 @@
3030
"@shikijs/vitepress-twoslash": "workspace:*",
3131
"@types/fs-extra": "^11.0.4",
3232
"@types/hast": "^3.0.4",
33-
"@types/node": "^20.12.11",
33+
"@types/node": "^20.12.12",
3434
"@vitest/coverage-v8": "^1.6.0",
3535
"ansi-sequence-parser": "^1.1.1",
3636
"bumpp": "^9.4.1",
@@ -46,9 +46,9 @@
4646
"mdast-util-gfm": "^3.0.0",
4747
"mdast-util-to-hast": "^13.1.0",
4848
"ofetch": "^1.3.4",
49-
"pnpm": "^9.1.0",
49+
"pnpm": "^9.1.1",
5050
"prettier": "^3.2.5",
51-
"rimraf": "^5.0.5",
51+
"rimraf": "^5.0.7",
5252
"rollup": "^4.17.2",
5353
"rollup-plugin-copy": "^3.5.0",
5454
"rollup-plugin-dts": "^6.1.0",
@@ -63,8 +63,8 @@
6363
"vite-tsconfig-paths": "^4.3.2",
6464
"vitepress-plugin-mermaid": "^2.0.16",
6565
"vitest": "^1.6.0",
66-
"vue-tsc": "^2.0.16",
67-
"wrangler": "^3.53.1"
66+
"vue-tsc": "^2.0.17",
67+
"wrangler": "^3.55.0"
6868
},
6969
"resolutions": {
7070
"@shikijs/compat": "workspace:*",
@@ -75,7 +75,7 @@
7575
"@shikijs/twoslash": "workspace:*",
7676
"@shikijs/vitepress-twoslash": "workspace:*",
7777
"@types/hast": "^3.0.4",
78-
"@types/mdast": "^4.0.3",
78+
"@types/mdast": "^4.0.4",
7979
"@types/unist": "^3.0.2",
8080
"shiki": "workspace:*",
8181
"unified": "^11.0.4",

‎packages/core/rollup.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default defineConfig([
5454
dir: 'dist',
5555
format: 'esm',
5656
chunkFileNames: 'chunk-[name].d.mts',
57-
entryFileNames: f => `${f.name.replace(/src[\\\/]/, '')}.d.mts`,
57+
entryFileNames: f => `${f.name.replace(/src[\\/]/, '')}.d.mts`,
5858
},
5959
plugins: [
6060
dts({

‎packages/core/src/code-to-hast.ts

+1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ function splitWhitespaceTokens(tokens: ThemedToken[][]) {
254254
return line.flatMap((token) => {
255255
if (token.content.match(/^\s+$/))
256256
return token
257+
// eslint-disable-next-line regexp/no-super-linear-backtracking
257258
const match = token.content.match(/^(\s*)(.*?)(\s*)$/)
258259
if (!match)
259260
return token

‎packages/rehype/test/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ it('run', async () => {
2020
parseMetaString: (str) => {
2121
return Object.fromEntries(str.split(' ').reduce((prev: [string, boolean | string][], curr: string) => {
2222
const [key, value] = curr.split('=')
23-
const isNormalKey = /^[A-Za-z0-9]+$/.test(key)
23+
const isNormalKey = /^[A-Z0-9]+$/i.test(key)
2424
if (isNormalKey)
2525
prev = [...prev, [key, value || true]]
2626
return prev

‎packages/shiki/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
"@shikijs/core": "workspace:*"
104104
},
105105
"devDependencies": {
106-
"tm-grammars": "^1.11.0",
107-
"tm-themes": "^1.4.1",
106+
"tm-grammars": "^1.11.3",
107+
"tm-themes": "^1.4.3",
108108
"vscode-oniguruma": "^1.7.0"
109109
}
110110
}

‎packages/shiki/rollup.config.mjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ export default defineConfig([
5252
dir: 'dist',
5353
format: 'esm',
5454
entryFileNames: (f) => {
55-
if (f.facadeModuleId?.match(/[\\\/]langs[\\\/]/))
55+
if (f.facadeModuleId?.match(/[\\/]langs[\\/]/))
5656
return `langs/${f.name}.mjs`
5757
return '[name].mjs'
5858
},
5959
chunkFileNames: (f) => {
60-
if (f.moduleIds.some(i => i.match(/[\\\/]langs[\\\/]/)))
60+
if (f.moduleIds.some(i => i.match(/[\\/]langs[\\/]/)))
6161
return `langs/${f.name}.mjs`
62-
else if (f.moduleIds.some(i => i.match(/[\\\/]themes[\\\/]/)))
62+
else if (f.moduleIds.some(i => i.match(/[\\/]themes[\\/]/)))
6363
return 'themes/[name].mjs'
6464
return 'chunks/[name].mjs'
6565
},
@@ -75,7 +75,7 @@ export default defineConfig([
7575
dir: 'dist',
7676
format: 'esm',
7777
chunkFileNames: 'types/[name].d.mts',
78-
entryFileNames: f => `${f.name.replace(/src[\\\/]/, '')}.d.mts`,
78+
entryFileNames: f => `${f.name.replace(/src[\\/]/, '')}.d.mts`,
7979
},
8080
plugins: [
8181
dts({

‎packages/shiki/scripts/prepare/langs.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ export async function prepareLangs() {
5050
await fs.writeFile(
5151
`./src/assets/langs/${lang.name}.js`,
5252
`${COMMENT_HEAD}
53-
${deps.map(i => `import ${i.replace(/[^\w]/g, '_')} from './${i}'`).join('\n')}
53+
${deps.map(i => `import ${i.replace(/\W/g, '_')} from './${i}'`).join('\n')}
5454
5555
const lang = Object.freeze(${JSON.stringify(json)})
5656
5757
export default [
5858
${[
59-
...deps.map(i => ` ...${i.replace(/[^\w]/g, '_')}`),
59+
...deps.map(i => ` ...${i.replace(/\W/g, '_')}`),
6060
' lang',
6161
].join(',\n') || ''}
6262
]
63-
`.replace(/\n\n+/g, '\n\n'),
63+
`.replace(/\n{2,}/g, '\n\n'),
6464
'utf-8',
6565
)
6666

@@ -165,5 +165,5 @@ export const bundledLanguages = {
165165
}
166166

167167
function isInvalidFilename(filename: string) {
168-
return !filename.match(/^[a-zA-Z0-9_-]+$/)
168+
return !filename.match(/^[\w-]+$/)
169169
}

‎packages/transformers/src/transformers/transformer-meta-highlight-word.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export function parseMetaHighlightWords(meta: string): string[] {
55
return []
66

77
// https://regex101.com/r/BHS5fd/1
8-
const match = Array.from(meta.matchAll(/\/((?:\\.|[^\/])+?)\//ig))
8+
const match = Array.from(meta.matchAll(/\/((?:\\.|[^/])+)\//g))
99

1010
return match
1111
// Escape backslashes

‎packages/transformers/src/transformers/transformer-meta-highlight.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ShikiTransformer } from 'shiki'
33
export function parseMetaHighlightString(meta: string) {
44
if (!meta)
55
return null
6-
const match = meta.match(/{([\d,-]+)}/)
6+
const match = meta.match(/\{([\d,-]+)\}/)
77
if (!match)
88
return null
99
const lines = match[1].split(',')

‎packages/twoslash/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"twoslash": "^0.2.6"
6060
},
6161
"devDependencies": {
62-
"@iconify-json/carbon": "^1.1.32",
63-
"@iconify-json/codicon": "^1.1.47",
62+
"@iconify-json/carbon": "^1.1.33",
63+
"@iconify-json/codicon": "^1.1.48",
6464
"@shikijs/twoslash": "^3.1.2",
6565
"hast-util-from-html": "^2.0.1",
6666
"typescript": "^5.4.5"

‎packages/twoslash/src/renderer-rich.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -633,20 +633,20 @@ export function rendererRich(options: RendererRichOptions = {}): TwoslashRendere
633633
}
634634
}
635635

636-
const regexType = /^[A-Z][a-zA-Z0-9_]*(\<[^\>]*\>)?:/
637-
const regexFunction = /^[a-zA-Z0-9_]*\(/
636+
const regexType = /^[A-Z]\w*(<[^>]*>)?:/
637+
const regexFunction = /^\w*\(/
638638

639639
/**
640640
* The default hover info processor, which will do some basic cleanup
641641
*/
642642
export function defaultHoverInfoProcessor(type: string) {
643643
let content = type
644644
// remove leading `(property)` or `(method)` on each line
645-
.replace(/^\(([\w-]+?)\)\s+/mg, '')
645+
.replace(/^\(([\w-]+)\)\s+/gm, '')
646646
// remove import statement
647647
.replace(/\nimport .*$/, '')
648648
// remove interface or namespace lines with only the name
649-
.replace(/^(interface|namespace) \w+$/mg, '')
649+
.replace(/^(interface|namespace) \w+$/gm, '')
650650
.trim()
651651

652652
// Add `type` or `function` keyword if needed

‎packages/twoslash/test/fixtures.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('fixtures', () => {
1313
const ext = file.split('.').pop()!
1414

1515
let theme = 'vitesse-dark'
16-
code = code.replace(/\/\/\s+@theme:\s+(.*)\n/, (_, t) => {
16+
code = code.replace(/\/\/\s+@theme:\s+(\S*)\n/, (_, t) => {
1717
theme = t
1818
return ''
1919
})

‎packages/vitepress-twoslash/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function transformerTwoslash(options: VitePressPluginTwoslashOptions = {}
7373
},
7474
postprocess(html) {
7575
if (this.meta.twoslash)
76-
return html.replace(/{/g, '&#123;')
76+
return html.replace(/\{/g, '&#123;')
7777
},
7878
}
7979
}

‎packages/vitepress-twoslash/src/renderer-floating-vue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function vPre<T extends ElementContent>(el: T): T {
152152

153153
function renderMarkdown(this: ShikiTransformerContextCommon, md: string): ElementContent[] {
154154
const mdast = fromMarkdown(
155-
md.replace(/{@link ([^}]*)}/g, '$1'), // replace jsdoc links
155+
md.replace(/\{@link ([^}]*)\}/g, '$1'), // replace jsdoc links
156156
{ mdastExtensions: [gfmFromMarkdown()] },
157157
)
158158

‎packages/vitepress-twoslash/test/fixtures.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('fixtures', () => {
1414
const ext = file.split('.').pop()!
1515

1616
let theme = 'vitesse-dark'
17-
code = code.replace(/\/\/\s+@theme:\s+(.*)\n/, (_, t) => {
17+
code = code.replace(/\/\/\s+@theme:\s+(\S*)\n/, (_, t) => {
1818
theme = t
1919
return ''
2020
})

‎pnpm-lock.yaml

+321-207
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.