build: upgrade deps

This commit is contained in:
Rongjian Zhang 2022-02-05 22:00:10 +08:00
parent b90ac7ec1f
commit 0e2bca356a
22 changed files with 2298 additions and 1948 deletions

View File

@ -19,15 +19,15 @@
"docs:serve": "vitepress serve docs" "docs:serve": "vitepress serve docs"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.0", "@babel/core": "^7.17.0",
"@babel/plugin-transform-runtime": "^7.16.4", "@babel/plugin-transform-runtime": "^7.16.10",
"@babel/preset-env": "^7.16.4", "@babel/preset-env": "^7.16.11",
"@icon-park/svg": "^1.3.5", "@icon-park/svg": "^1.3.5",
"@primer/css": "^15.2.0", "@microsoft/api-extractor": "^7.19.4",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.35", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.35",
"@testing-library/jest-dom": "^5.15.0", "@testing-library/jest-dom": "^5.16.1",
"@testing-library/svelte": "^3.0.3", "@testing-library/svelte": "^3.0.3",
"chokidar": "^3.5.2", "chokidar": "^3.5.3",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"glob": "^7.2.0", "glob": "^7.2.0",
"jsdom": "^19.0.0", "jsdom": "^19.0.0",
@ -35,13 +35,13 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mustache": "^4.2.0", "mustache": "^4.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^2.4.1", "prettier": "^2.5.1",
"prettier-plugin-svelte": "^2.5.0", "prettier-plugin-svelte": "^2.6.0",
"sass": "^1.49.0", "sass": "^1.49.0",
"svelte": "^3.44.2", "svelte": "^3.46.3",
"svelte-preprocess": "^4.9.8", "svelte-preprocess": "^4.10.2",
"svgo": "^2.8.0", "svgo": "^2.8.0",
"typescript": "^4.5.2", "typescript": "^4.5.5",
"vite": "^2.7.13", "vite": "^2.7.13",
"vite-plugin-vue2": "^1.9.3", "vite-plugin-vue2": "^1.9.3",
"vitest": "^0.2.7", "vitest": "^0.2.7",

View File

@ -25,25 +25,26 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"@popperjs/core": "^2.9.2", "@popperjs/core": "^2.11.2",
"@types/codemirror": "^0.0.108", "@primer/css": "^15.2.0",
"@types/codemirror": "^5.60.5",
"@types/lodash.debounce": "^4.0.6", "@types/lodash.debounce": "^4.0.6",
"@types/lodash.throttle": "^4.1.6", "@types/lodash.throttle": "^4.1.6",
"@types/mdast": "^3.0.7", "@types/mdast": "^3.0.10",
"codemirror-ssr": "^0.0.6", "codemirror-ssr": "^0.0.6",
"hast-util-sanitize": "^3.0.2", "hast-util-sanitize": "^4.0.0",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1", "lodash.throttle": "^4.1.1",
"rehype-raw": "^5.1.0", "rehype-raw": "^6.1.1",
"rehype-sanitize": "^4.0.0", "rehype-sanitize": "^5.0.1",
"rehype-stringify": "^8.0.0", "rehype-stringify": "^9.0.3",
"remark-parse": "^9.0.0", "remark-parse": "^10.0.1",
"remark-rehype": "^8.1.0", "remark-rehype": "^10.1.0",
"select-files": "^1.0.1", "select-files": "^1.0.1",
"tippy.js": "^6.3.1", "tippy.js": "^6.3.7",
"unified": "^9.2.2", "unified": "^10.1.1",
"unist-util-visit": "^2.0.3", "unist-util-visit": "^4.1.0",
"vfile": "^4.2.1", "vfile": "^5.3.0",
"word-count": "^0.2.2" "word-count": "^0.2.2"
} }
} }

View File

@ -4,7 +4,7 @@
import type { Root, Element } from 'hast' import type { Root, Element } from 'hast'
import type { BytemdLocale } from './types' import type { BytemdLocale } from './types'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import visit from 'unist-util-visit' import { visit } from 'unist-util-visit'
export let hast: Root export let hast: Root
export let currentBlockIndex: number export let currentBlockIndex: number

View File

@ -1,14 +1,15 @@
import unified from 'unified' import { unified } from 'unified'
import remarkParse from 'remark-parse' import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype' import remarkRehype from 'remark-rehype'
import rehypeRaw from 'rehype-raw' import rehypeRaw from 'rehype-raw'
import rehypeSanitize from 'rehype-sanitize' import rehypeSanitize from 'rehype-sanitize'
import rehypeStringify from 'rehype-stringify' import rehypeStringify from 'rehype-stringify'
import ghSchema from 'hast-util-sanitize/lib/github.json' import { defaultSchema } from 'hast-util-sanitize'
import type { Schema } from 'hast-util-sanitize' import type { Schema } from 'hast-util-sanitize'
import type { Processor } from 'unified'
import type { ViewerProps } from './types' import type { ViewerProps } from './types'
const schemaStr = JSON.stringify(ghSchema) const schemaStr = JSON.stringify(defaultSchema)
/** /**
* Get unified processor with ByteMD plugins * Get unified processor with ByteMD plugins
@ -17,7 +18,7 @@ export function getProcessor({
sanitize, sanitize,
plugins, plugins,
}: Omit<ViewerProps, 'value'>) { }: Omit<ViewerProps, 'value'>) {
let p = unified().use(remarkParse) let p: Processor = unified().use(remarkParse)
plugins?.forEach(({ remark }) => { plugins?.forEach(({ remark }) => {
if (remark) p = remark(p) if (remark) p = remark(p)

View File

@ -19,7 +19,7 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"remark-breaks": "^2.0.2" "remark-breaks": "^3.0.2"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -19,7 +19,7 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"remark-footnotes": "^3.0.0" "remark-footnotes": "^4.0.1"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -1,9 +1,7 @@
import type { BytemdPlugin } from 'bytemd' import type { BytemdPlugin } from 'bytemd'
import remarkFootnotes, { RemarkFootnotesOptions } from 'remark-footnotes' import remarkFootnotes, { Options } from 'remark-footnotes'
export default function footnotes( export default function footnotes(options?: Options): BytemdPlugin {
options?: RemarkFootnotesOptions
): BytemdPlugin {
return { return {
remark: (u) => u.use(remarkFootnotes, options), remark: (u) => u.use(remarkFootnotes, options),
} }

View File

@ -19,13 +19,13 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"@types/js-yaml": "^3.12.7", "@types/js-yaml": "^4.0.5",
"js-yaml": "^3.14.1", "js-yaml": "^4.1.0",
"remark-frontmatter": "^3.0.0" "remark-frontmatter": "^4.0.1"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0", "bytemd": "^1.11.0",
"vfile": "^4.2.1" "vfile": "^5.3.0"
}, },
"peerDependencies": { "peerDependencies": {
"bytemd": "^1.5.0" "bytemd": "^1.5.0"

View File

@ -1,6 +1,6 @@
import type { BytemdPlugin } from 'bytemd' import type { BytemdPlugin } from 'bytemd'
import remarkFrontmatter from 'remark-frontmatter' import remarkFrontmatter from 'remark-frontmatter'
import { safeLoad } from 'js-yaml' import { load } from 'js-yaml'
export interface BytemdPluginFrontmatterOptions { export interface BytemdPluginFrontmatterOptions {
onError?(err: any): void onError?(err: any): void
@ -8,7 +8,7 @@ export interface BytemdPluginFrontmatterOptions {
declare module 'vfile' { declare module 'vfile' {
interface VFile { interface VFile {
frontmatter: ReturnType<typeof safeLoad> frontmatter: ReturnType<typeof load>
} }
} }
@ -17,13 +17,14 @@ export default function frontmatter({
}: BytemdPluginFrontmatterOptions = {}): BytemdPlugin { }: BytemdPluginFrontmatterOptions = {}): BytemdPlugin {
return { return {
remark: (p) => remark: (p) =>
p.use(remarkFrontmatter).use(() => (tree: any, file) => { p.use(remarkFrontmatter).use(() => (tree: any, file: any) => {
// TODO: arg types
// console.log(tree); // console.log(tree);
const fisrtNode = tree.children[0] const fisrtNode = tree.children[0]
if (fisrtNode?.type !== 'yaml') return if (fisrtNode?.type !== 'yaml') return
try { try {
file.frontmatter = safeLoad(fisrtNode.value) file.frontmatter = load(fisrtNode.value)
} catch (err) { } catch (err) {
onError?.(err) onError?.(err)
} }

View File

@ -19,7 +19,7 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"remark-gemoji": "^6.0.0" "remark-gemoji": "^7.0.1"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -1,5 +1,4 @@
import type { BytemdPlugin } from 'bytemd' import type { BytemdPlugin } from 'bytemd'
// @ts-ignore
import remarkGemoji from 'remark-gemoji' import remarkGemoji from 'remark-gemoji'
export default function gemoji(): BytemdPlugin { export default function gemoji(): BytemdPlugin {

View File

@ -19,7 +19,7 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"remark-gfm": "^1.0.0" "remark-gfm": "^3.0.1"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -1,9 +1,9 @@
import type { BytemdPlugin } from 'bytemd' import type { BytemdPlugin } from 'bytemd'
import en from './locales/en.json' import en from './locales/en.json'
import remarkGfm, { RemarkGfmOptions } from 'remark-gfm' import remarkGfm, { Options } from 'remark-gfm'
import { icons } from './icons' import { icons } from './icons'
export interface BytemdPluginGfmOptions extends RemarkGfmOptions { export interface BytemdPluginGfmOptions extends Options {
locale?: Partial<typeof en> locale?: Partial<typeof en>
} }

View File

@ -19,7 +19,7 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"rehype-highlight": "^4.1.0" "rehype-highlight": "^5.0.2"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -1,20 +1,11 @@
import type { BytemdPlugin } from 'bytemd' import type { BytemdPlugin } from 'bytemd'
// @ts-ignore import rehypeHighlight, { Options } from 'rehype-highlight'
import rehypeHighlight from 'rehype-highlight'
export interface BytemdPluginHighlightSsrOptions {
prefix?: string
subset?: boolean | string[]
ignoreMissing?: boolean
plainText?: string[]
aliases?: Record<string, string[]>
}
export default function highlightSsr({ export default function highlightSsr({
subset = false, subset = false,
ignoreMissing = true, ignoreMissing = true,
...rest ...rest
}: BytemdPluginHighlightSsrOptions = {}): BytemdPlugin { }: Options): BytemdPlugin {
return { return {
rehype: (u) => u.use(rehypeHighlight, { subset, ignoreMissing, ...rest }), rehype: (u) => u.use(rehypeHighlight, { subset, ignoreMissing, ...rest }),
} }

View File

@ -19,7 +19,7 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"highlight.js": "^10.7.3" "highlight.js": "^11.4.0"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -16,7 +16,7 @@ export default function highlight({
if (els.length === 0) return if (els.length === 0) return
if (!hljs) { if (!hljs) {
hljs = await import('highlight.js') hljs = await import('highlight.js').then((m) => m.default)
if (init) await init(hljs) if (init) await init(hljs)
} }

View File

@ -20,8 +20,8 @@
], ],
"dependencies": { "dependencies": {
"@bytemd/plugin-math": "^1.11.0", "@bytemd/plugin-math": "^1.11.0",
"rehype-katex": "^4.0.0", "rehype-katex": "^6.0.2",
"remark-math": "^4.0.0" "remark-math": "^5.1.1"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -20,8 +20,8 @@
], ],
"dependencies": { "dependencies": {
"@types/katex": "^0.11.1", "@types/katex": "^0.11.1",
"katex": "^0.12.0", "katex": "^0.15.2",
"remark-math": "^4.0.0" "remark-math": "^5.1.1"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -20,7 +20,7 @@
], ],
"dependencies": { "dependencies": {
"@types/mermaid": "^8.2.7", "@types/mermaid": "^8.2.7",
"mermaid": "^8.13.8" "mermaid": "^8.13.10"
}, },
"devDependencies": { "devDependencies": {
"bytemd": "^1.11.0" "bytemd": "^1.11.0"

View File

@ -25,7 +25,7 @@
"react": "*" "react": "*"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^17.0.14", "@types/react": "^17.0.38",
"react": "^17.0.2" "react": "^17.0.2"
} }
} }

File diff suppressed because it is too large Load Diff