Skip to content

Commit

Permalink
feat: switch to vite 5 and bump deps (#3200)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: VitePress now runs on Vite 5. Please refer https://vitejs.dev/guide/migration for breaking changes and migration guide if you're relying on some Vite-specific things.
  • Loading branch information
brc-dd authored Nov 16, 2023
1 parent 2d96200 commit d2238ee
Show file tree
Hide file tree
Showing 18 changed files with 634 additions and 926 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
shell-emulator=true
resolution-mode=highest
auto-install-peers=false
4 changes: 2 additions & 2 deletions __tests__/e2e/__snapshots__/home.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ exports[`render correct content > main content 1`] = `
[
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of \\"de Finibus Bonorum et Malorum\\" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, \\"Lorem ipsum dolor sit amet..\\", comes from a line in section 1.10.32.",
"The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from \\"de Finibus Bonorum et Malorum\\" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.",
"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.",
"The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.",
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).",
"There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.",
]
Expand Down
32 changes: 16 additions & 16 deletions __tests__/e2e/data-loading/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ describe('static data file support in vite 3', () => {
expect(await page.textContent('pre#basic')).toMatchInlineSnapshot(`
"[
{
\\"foo\\": true
"foo": true
},
{
\\"bar\\": true
"bar": true
}
]"
`)
expect(await page.textContent('pre#content')).toMatchInlineSnapshot(`
"[
{
\\"src\\": \\"---\\\\ntitle: bar\\\\n---\\\\n\\\\nHello\\\\n\\\\n---\\\\n\\\\nworld\\\\n\\",
\\"html\\": \\"<p>Hello</p>\\\\n<hr>\\\\n<p>world</p>\\\\n\\",
\\"frontmatter\\": {
\\"title\\": \\"bar\\"
"src": "---\\ntitle: bar\\n---\\n\\nHello\\n\\n---\\n\\nworld\\n",
"html": "<p>Hello</p>\\n<hr>\\n<p>world</p>\\n",
"frontmatter": {
"title": "bar"
},
\\"excerpt\\": \\"<p>Hello</p>\\\\n\\",
\\"url\\": \\"/data-loading/content/bar.html\\",
\\"transformed\\": true
"excerpt": "<p>Hello</p>\\n",
"url": "/data-loading/content/bar.html",
"transformed": true
},
{
\\"src\\": \\"---\\\\ntitle: foo\\\\n---\\\\n\\\\nHello\\\\n\\\\n---\\\\n\\\\nworld\\\\n\\",
\\"html\\": \\"<p>Hello</p>\\\\n<hr>\\\\n<p>world</p>\\\\n\\",
\\"frontmatter\\": {
\\"title\\": \\"foo\\"
"src": "---\\ntitle: foo\\n---\\n\\nHello\\n\\n---\\n\\nworld\\n",
"html": "<p>Hello</p>\\n<hr>\\n<p>world</p>\\n",
"frontmatter": {
"title": "foo"
},
\\"excerpt\\": \\"<p>Hello</p>\\\\n\\",
\\"url\\": \\"/data-loading/content/foo.html\\",
\\"transformed\\": true
"excerpt": "<p>Hello</p>\\n",
"url": "/data-loading/content/foo.html",
"transformed": true
}
]"
`)
Expand Down
8 changes: 6 additions & 2 deletions __tests__/init/init.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import fs from 'fs-extra'
import getPort from 'get-port'
import { nanoid } from 'nanoid'
import path from 'path'
import { chromium } from 'playwright-chromium'
import { fileURLToPath, URL } from 'url'
import { createServer, scaffold, ScaffoldThemeType } from 'vitepress'

const root = fileURLToPath(new URL('./.temp', import.meta.url))
const tempDir = fileURLToPath(new URL('./.temp', import.meta.url))
const getTempRoot = () => path.join(tempDir, nanoid())

const browser = await chromium.launch({
headless: !process.env.DEBUG,
Expand All @@ -30,9 +33,11 @@ const variations = themes.flatMap((theme) =>
afterAll(async () => {
await page.close()
await browser.close()
await fs.remove(tempDir)
})

test.each(variations)('init %s', async (_, { theme, useTs }) => {
const root = getTempRoot()
await fs.remove(root)
scaffold({ root, theme, useTs, injectNpmScripts: false })

Expand Down Expand Up @@ -62,7 +67,6 @@ test.each(variations)('init %s', async (_, { theme, useTs }) => {

// teardown
} finally {
await fs.remove(root)
await server.close()
}
})
2 changes: 1 addition & 1 deletion __tests__/unit/node/markdown/plugins/snippet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('node/markdown/plugins/snippet', () => {
)
).toMatchInlineSnapshot(`
"fn main() {
println!(\\"Hello\\");
println!("Hello");
}"
`)
})
Expand Down
81 changes: 44 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0-rc.25",
"description": "Vite & Vue powered static site generator",
"type": "module",
"packageManager": "pnpm@8.9.2",
"packageManager": "pnpm@8.10.5",
"main": "dist/node/index.js",
"types": "types/index.d.ts",
"exports": {
Expand Down Expand Up @@ -92,17 +92,17 @@
"dependencies": {
"@docsearch/css": "^3.5.2",
"@docsearch/js": "^3.5.2",
"@types/markdown-it": "^13.0.4",
"@vitejs/plugin-vue": "4.3.1",
"@types/markdown-it": "^13.0.6",
"@vitejs/plugin-vue": "^4.5.0",
"@vue/devtools-api": "^6.5.1",
"@vueuse/core": "^10.5.0",
"@vueuse/integrations": "^10.5.0",
"@vueuse/core": "^10.6.1",
"@vueuse/integrations": "^10.6.1",
"focus-trap": "^7.5.4",
"mark.js": "8.11.1",
"minisearch": "^6.1.0",
"minisearch": "^6.2.0",
"shiki": "^0.14.5",
"vite": "^4.5.0",
"vue": "^3.3.6"
"vite": "^5.0.0",
"vue": "^3.3.8"
},
"peerDependencies": {
"markdown-it-mathjax3": "^4.3.2",
Expand All @@ -129,23 +129,23 @@
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.4",
"@types/compression": "^1.7.4",
"@types/cross-spawn": "^6.0.4",
"@types/debug": "^4.1.10",
"@types/escape-html": "^1.0.3",
"@types/fs-extra": "^11.0.3",
"@types/lodash.template": "^4.5.2",
"@types/mark.js": "^8.11.10",
"@types/markdown-it-attrs": "^4.1.2",
"@types/markdown-it-container": "^2.0.8",
"@types/markdown-it-emoji": "^2.0.3",
"@types/micromatch": "^4.0.4",
"@types/minimist": "^1.2.4",
"@types/node": "^20.8.7",
"@types/postcss-prefix-selector": "^1.16.2",
"@types/prompts": "^2.4.7",
"@vue/shared": "^3.3.6",
"@rollup/plugin-replace": "^5.0.5",
"@types/compression": "^1.7.5",
"@types/cross-spawn": "^6.0.5",
"@types/debug": "^4.1.12",
"@types/escape-html": "^1.0.4",
"@types/fs-extra": "^11.0.4",
"@types/lodash.template": "^4.5.3",
"@types/mark.js": "^8.11.11",
"@types/markdown-it-attrs": "^4.1.3",
"@types/markdown-it-container": "^2.0.9",
"@types/markdown-it-emoji": "^2.0.4",
"@types/micromatch": "^4.0.5",
"@types/minimist": "^1.2.5",
"@types/node": "^20.9.0",
"@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.8",
"@vue/shared": "^3.3.8",
"chokidar": "^3.5.3",
"compression": "^1.7.4",
"conventional-changelog-cli": "^4.1.0",
Expand All @@ -154,13 +154,13 @@
"esbuild": "^0.19.5",
"escape-html": "^1.0.3",
"execa": "^8.0.1",
"fast-glob": "^3.3.1",
"fast-glob": "^3.3.2",
"fs-extra": "^11.1.1",
"get-port": "^7.0.0",
"gray-matter": "^4.0.3",
"lint-staged": "^15.0.2",
"lint-staged": "^15.1.0",
"lodash.template": "^4.5.0",
"lru-cache": "^10.0.1",
"lru-cache": "^10.0.2",
"markdown-it": "^13.0.2",
"markdown-it-anchor": "^8.6.7",
"markdown-it-attrs": "^4.1.6",
Expand All @@ -169,20 +169,20 @@
"markdown-it-mathjax3": "^4.3.2",
"micromatch": "^4.0.5",
"minimist": "^1.2.8",
"nanoid": "^5.0.2",
"nanoid": "^5.0.3",
"npm-run-all": "^4.1.5",
"ora": "^7.0.1",
"path-to-regexp": "^6.2.1",
"picocolors": "^1.0.0",
"pkg-dir": "^7.0.0",
"pkg-dir": "^8.0.0",
"playwright-chromium": "^1.39.0",
"polka": "1.0.0-next.22",
"polka": "1.0.0-next.23",
"postcss-prefix-selector": "^1.16.0",
"prettier": "^3.0.3",
"prettier": "^3.1.0",
"prompts": "^2.4.2",
"punycode": "^2.3.0",
"punycode": "^2.3.1",
"rimraf": "^5.0.5",
"rollup": "^4.1.4",
"rollup": "^4.4.1",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.0",
"semver": "^7.5.4",
Expand All @@ -192,9 +192,9 @@
"sitemap": "^7.1.1",
"supports-color": "^9.4.0",
"typescript": "^5.2.2",
"vitest": "^0.34.6",
"vue-tsc": "^1.8.19",
"wait-on": "^7.0.1"
"vitest": "^1.0.0-beta.4",
"vue-tsc": "^1.8.22",
"wait-on": "^7.2.0"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
Expand All @@ -207,6 +207,13 @@
"pnpm": {
"overrides": {
"ora>string-width": "^5"
},
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights",
"postcss"
]
}
}
}
Loading

0 comments on commit d2238ee

Please sign in to comment.