chore: update dependencies and remove vitest

This commit is contained in:
DIYgod 2023-04-29 00:08:58 +01:00
parent b1a880cd34
commit d28faae2f9
No known key found for this signature in database
5 changed files with 537 additions and 977 deletions

View File

@ -7,7 +7,6 @@
"scripts": {
"build": "next build",
"dev": "next -p 2222",
"test-unit": "vitest",
"test-e2e": "playwright test",
"start": "node server.js",
"uno-generate": "unocss \"src/**/*.{ts,tsx}\" -o src/generated/uno.css",
@ -35,35 +34,35 @@
"@codemirror/language-data": "6.3.0",
"@codemirror/state": "6.2.0",
"@codemirror/theme-one-dark": "6.1.2",
"@codemirror/view": "6.9.6",
"@crossbell/connect-kit": "0.0.74",
"@crossbell/contract": "0.0.74",
"@crossbell/indexer": "0.0.74",
"@crossbell/notification": "0.0.74",
"@crossbell/ui": "0.0.74",
"@crossbell/util-hooks": "0.0.74",
"@codemirror/view": "6.10.0",
"@crossbell/connect-kit": "0.0.78",
"@crossbell/contract": "0.0.78",
"@crossbell/indexer": "0.0.78",
"@crossbell/notification": "0.0.78",
"@crossbell/ui": "0.0.78",
"@crossbell/util-hooks": "0.0.78",
"@ddietr/codemirror-themes": "1.4.1",
"@dqbd/tiktoken": "^1.0.6",
"@dqbd/tiktoken": "^1.0.7",
"@emoji-mart/data": "1.1.2",
"@emoji-mart/react": "1.1.1",
"@floating-ui/react": "^0.23.1",
"@headlessui/react": "1.7.14",
"@heroicons/react": "2.0.17",
"@iconify-json/mingcute": "^1.1.5",
"@iconify-json/mingcute": "^1.1.6",
"@lezer/highlight": "*",
"@mantine/core": "^6.0.9",
"@monaco-editor/react": "4.5.0",
"@popperjs/core": "^2.11.7",
"@prisma/client": "^4.13.0",
"@tanstack/react-query": "4.29.5",
"@tanstack/react-query-devtools": "4.29.5",
"@tanstack/react-query-devtools": "4.29.6",
"@tanstack/react-query-persist-client": "4.29.5",
"@uiw/codemirror-extensions-events": "4.19.16",
"@urql/core": "4.0.6",
"@urql/core": "4.0.7",
"ahooks": "^3.7.6",
"aplayer": "^1.10.1",
"aplayer-react": "^1.0.5",
"axios": "1.3.6",
"aplayer-react": "^1.1.0",
"axios": "1.4.0",
"canvas-confetti": "^1.6.0",
"chroma-js": "^2.4.2",
"clsx": "1.2.1",
@ -82,8 +81,8 @@
"isomorphic-dompurify": "^1.3.0",
"js-yaml": "4.1.0",
"jsonfeed-to-rss": "^3.0.6",
"katex": "^0.16.6",
"langchain": "^0.0.63",
"katex": "^0.16.7",
"langchain": "^0.0.66",
"lottie-react": "^2.4.0",
"mdast-util-to-hast": "^12.3.0",
"mdast-util-to-string": "3.2.0",
@ -101,14 +100,14 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "7.43.9",
"react-hot-toast": "2.4.0",
"react-hot-toast": "2.4.1",
"react-i18next": "^12.2.2",
"react-parallax-tilt": "^1.7.131",
"react-popper": "^2.3.0",
"react-scroll": "1.8.9",
"react-sortablejs": "6.1.4",
"react-string-replace": "^1.1.0",
"react-virtuoso": "4.3.1",
"react-virtuoso": "4.3.2",
"refractor": "4.8.1",
"rehype-autolink-headings": "6.1.1",
"rehype-infer-description-meta": "^1.1.0",
@ -131,7 +130,7 @@
"remark-stringify": "10.0.2",
"remove-markdown": "0.5.0",
"serialize-javascript": "^6.0.1",
"sharp": "0.32.0",
"sharp": "0.32.1",
"sortablejs": "1.15.0",
"tailwind-merge": "^1.12.0",
"tailwind-scrollbar-hide": "^1.1.7",
@ -147,7 +146,7 @@
},
"devDependencies": {
"@next/bundle-analyzer": "13.3.1",
"@playwright/test": "1.32.3",
"@playwright/test": "1.33.0",
"@trivago/prettier-plugin-sort-imports": "4.1.1",
"@types/canvas-confetti": "^1.6.0",
"@types/chroma-js": "^2.4.0",
@ -157,11 +156,11 @@
"@types/katex": "^0.16.0",
"@types/mdast": "^3.0.11",
"@types/mjml": "4.7.1",
"@types/node": "18.16.0",
"@types/node": "18.16.2",
"@types/pangu": "^4.0.0",
"@types/prismjs": "1.26.0",
"@types/react": "18.0.38",
"@types/react-dom": "18.0.11",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.1",
"@types/react-infinite-scroller": "1.2.3",
"@types/react-scroll": "1.8.6",
"@types/remove-markdown": "0.3.1",
@ -171,7 +170,6 @@
"@types/uuid": "9.0.1",
"@unocss/cli": "0.51.8",
"@unocss/preset-icons": "0.51.8",
"@vitejs/plugin-react": "4.0.0",
"autoprefixer": "10.4.14",
"babel-loader": "^9.1.2",
"cross-spawn": "7.0.3",
@ -183,24 +181,19 @@
"eslint-plugin-import": "2.27.5",
"eslint-plugin-unused-imports": "2.0.0",
"husky": "8.0.3",
"lint-staged": "13.2.1",
"lint-staged": "13.2.2",
"next-pwa": "^5.6.0",
"postcss-import": "15.1.0",
"prettier": "2.8.8",
"prettier-package-json": "2.8.0",
"prisma": "^4.13.0",
"tailwindcss": "3.3.1",
"tailwindcss": "3.3.2",
"typescript": "5.0.4",
"unocss": "0.51.8",
"vitest": "0.30.1"
"unocss": "0.51.8"
},
"engines": {
"node": ">=15"
},
"resolutions": {
"vitest>vite": "^4.3.1",
"rehype-katex>katex": "^0.16.6"
},
"nextBundleAnalysis": {
"budget": 358400,
"budgetPercentIncreaseRed": 20,

File diff suppressed because it is too large Load Diff

View File

@ -1,90 +0,0 @@
import { describe, expect, test } from "vitest"
import { renderPageContent } from "./index"
describe("html", () => {
test("simple", async () => {
const { contentHTML, excerpt } = await renderPageContent(
`
# Hello
This is the **excerpt**
> Hello Blockquote <sup>foo</sup>
- [ ] task list
- [x] done
<script>alert('xss')</script>
<img src="foo.png" alt="my image" onerror="console.log(1)" />
<figcaption><a href="https://example.com">my caption</a></figcaption>
<img src />
\`\`\`js
function foo() {}
<script>alert('xss')</script>
\`\`\`
\`\`\`
<script>alert('xss')</script>
\`\`\`
`,
true,
)
expect(contentHTML).not.toMatch(/<script>/)
expect(excerpt).toMatchInlineSnapshot(`
"This is the excerpt Hello Blockquote foo
task list done
my caption
Copy
function foo() {}
<script>alert('xss')</script>
C"
`)
})
test("wrap table", async () => {
const { contentHTML } = await renderPageContent(
`|a|b|
|---|---|
|c|d|
`,
true,
)
expect(contentHTML.trim()).toMatchInlineSnapshot(
'"<div class=\\"table-wrapper\\"><table><thead><tr><th>a</th><th>b</th></tr></thead><tbody><tr><td>c</td><td>d</td></tr></tbody></table></div>"',
)
})
test("callout", async () => {
const { contentHTML } = await renderPageContent(
`
> TIP:
>
> Some tip!
> WARN:
>
> Some warning!
`,
true,
)
expect(contentHTML).toMatchInlineSnapshot(`
"<blockquote class=\\"callout callout-tip\\">
<p>Some tip!</p>
</blockquote>
<blockquote class=\\"callout callout-warn\\">
<p>Some warning!</p>
</blockquote>"
`)
})
})

View File

@ -1,68 +0,0 @@
import { describe, expect, test } from "vitest"
import removeMarkdown from "remove-markdown"
describe("remove markdown", () => {
test("remove image url but keep alt", () => {
expect(
removeMarkdown("![alt text](https://i.imgur.com/1ZQ3Q2l.jpg)", {
useImgAltText: true,
gfm: true,
}),
).toBe("alt text")
})
test("test markdown", () => {
expect(
removeMarkdown(
`# Heading 1
CSS xLog 使 Tailwind Tailwind Tailwind [](https://tailwindcss.com/docs/customizing-colors),并不支持根据 Dark Mode 切换色值。
Tailwind CSS \`tw-colors-i\`。比如我们需要类似这样的色值配置:
\`\`\`js
// tailwind.config.ts
module.exports = {
theme: {
colors: {
slate: {
50: 'rgb(var(--tw-colors-i-slate-50))',
100: 'rgb(var(--tw-colors-i-slate-100))',
// ...
},
},
},
}
\`\`\``,
{
useImgAltText: true,
gfm: true,
},
),
).toMatchInlineSnapshot(`
"Heading 1
CSS xLog 使 Tailwind Tailwind Tailwind Dark Mode
Tailwind CSS tw-colors-i
// tailwind.config.ts
module.exports = {
theme: {
colors: {
slate: {
50: 'rgb(var(--tw-colors-i-slate-50))',
100: 'rgb(var(--tw-colors-i-slate-100))',
// ...
},
},
},
}
\`"
`)
})
})

View File

@ -1,20 +0,0 @@
import path from "path"
import { defineConfig } from "vitest/config"
import react from "@vitejs/plugin-react"
export default defineConfig({
resolve: {
alias: {
"~": path.resolve("./src"),
},
},
plugins: [react()],
test: {
include: ["src/**/*.test.ts"],
deps: {
external: ["rehype-prism-plus"],
inline: ["react-avatar-editor"],
},
},
})