chore: merge with upstream

pull/4132/head
Cristopher 1 year ago
commit 86f3c52b0f
No known key found for this signature in database
GPG Key ID: E31DBC7E9AEE527C

@ -13,7 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-add-labels@v1
with:
labels: cr-tracked
github_token: ${{ secrets.CR_PAT }}
- run: gh issue edit ${{ github.event.issue.number }} --add-label cr-tracked --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.CR_PAT }}

@ -16,6 +16,10 @@ on:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
release:
if: ${{ !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked') && !contains(github.event.pull_request.labels.*.name, 'spam') && !contains(github.event.pull_request.labels.*.name, 'invalid') }}

@ -1,3 +1,15 @@
## [1.3.4](https://github.com/vuejs/vitepress/compare/v1.3.3...v1.3.4) (2024-08-24)
### Bug Fixes
- check if `_importGlobMap` (vite internal) exists before using it ([612d66f](https://github.com/vuejs/vitepress/commit/612d66fbb5162d9905cfb10919ca1761ce8c4680))
## [1.3.3](https://github.com/vuejs/vitepress/compare/v1.3.2...v1.3.3) (2024-08-17)
### Miscellaneous
- bump deps ([a20db24](https://github.com/vuejs/vitepress/commit/a20db247822438ac4e0e76bc4a2b4ee2f5d94940))
## [1.3.2](https://github.com/vuejs/vitepress/compare/v1.3.1...v1.3.2) (2024-08-05)
### Bug Fixes

@ -7,14 +7,10 @@ export declare const data: Data
export default defineLoader({
watch: ['./data/*'],
async load(files: string[]): Promise<Data> {
const foo = fs.readFileSync(
files.find((f) => f.endsWith('foo.json'))!,
'utf-8'
)
const bar = fs.readFileSync(
files.find((f) => f.endsWith('bar.json'))!,
'utf-8'
)
return [JSON.parse(foo), JSON.parse(bar)]
const data: Data = []
for (const file of files.sort().filter((file) => file.endsWith('.json'))) {
data.push(JSON.parse(fs.readFileSync(file, 'utf-8')))
}
return data
}
})

@ -1,3 +1,6 @@
import fs from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
describe('static data file support in vite 3', () => {
beforeAll(async () => {
await goto('/data-loading/data')
@ -7,10 +10,10 @@ describe('static data file support in vite 3', () => {
expect(await page.textContent('pre#basic')).toMatchInlineSnapshot(`
"[
{
"foo": true
"a": true
},
{
"bar": true
"b": true
}
]"
`)
@ -39,4 +42,68 @@ describe('static data file support in vite 3', () => {
]"
`)
})
// TODO: make it `.runIf(!process.env.VITE_TEST_BUILD)` -- it currently works, but is skipped to avoid vite's ecosystem-ci from failing (https://github.com/vitejs/vite/pull/16471#issuecomment-2308437187)
test.skip('hmr works', async () => {
const a = fileURLToPath(new URL('./data/a.json', import.meta.url))
const b = fileURLToPath(new URL('./data/b.json', import.meta.url))
try {
await fs.writeFile(a, JSON.stringify({ a: false }, null, 2) + '\n')
await page.waitForFunction(
() =>
document.querySelector('pre#basic')?.textContent ===
JSON.stringify([{ a: false }, { b: true }], null, 2),
undefined,
{ timeout: 3000 }
)
} finally {
await fs.writeFile(a, JSON.stringify({ a: true }, null, 2) + '\n')
}
let err = true
try {
await fs.unlink(b)
await page.waitForFunction(
() =>
document.querySelector('pre#basic')?.textContent ===
JSON.stringify([{ a: true }], null, 2),
undefined,
{ timeout: 3000 }
)
err = false
} finally {
if (err) {
await fs.writeFile(b, JSON.stringify({ b: true }, null, 2) + '\n')
}
}
try {
await fs.writeFile(b, JSON.stringify({ b: false }, null, 2) + '\n')
await page.waitForFunction(
() =>
document.querySelector('pre#basic')?.textContent ===
JSON.stringify([{ a: true }, { b: false }], null, 2),
undefined,
{ timeout: 3000 }
)
} finally {
await fs.writeFile(b, JSON.stringify({ b: true }, null, 2) + '\n')
}
})
/*
MODIFY a.json with { a: false }
this should trigger a hmr update and the content should be updated to [{ a: false }, { b: true }]
reset a.json
DELETE b.json
this should trigger a hmr update and the content should be updated to [{ a: true }]
reset b.json if failed
CREATE b.json with { b: false }
this should trigger a hmr update and the content should be updated to [{ a: true }, { b: false }]
reset b.json
*/
})

@ -1,6 +1,6 @@
{
"name": "vitepress",
"version": "1.3.2",
"version": "1.3.4",
"description": "Vite & Vue powered static site generator",
"keywords": [
"vite",
@ -98,22 +98,22 @@
"*": "prettier --write --ignore-unknown"
},
"dependencies": {
"@docsearch/css": "^3.6.0",
"@docsearch/js": "^3.6.0",
"@shikijs/core": "^1.10.3",
"@shikijs/transformers": "^1.10.3",
"@types/markdown-it": "^14.1.1",
"@vitejs/plugin-vue": "^5.0.5",
"@vue/devtools-api": "^7.3.5",
"@vue/shared": "^3.4.31",
"@vueuse/core": "^10.11.0",
"@vueuse/integrations": "^10.11.0",
"@docsearch/css": "^3.6.1",
"@docsearch/js": "^3.6.1",
"@shikijs/core": "^1.13.0",
"@shikijs/transformers": "^1.13.0",
"@types/markdown-it": "^14.1.2",
"@vitejs/plugin-vue": "^5.1.2",
"@vue/devtools-api": "^7.3.8",
"@vue/shared": "^3.4.38",
"@vueuse/core": "^11.0.0",
"@vueuse/integrations": "^11.0.0",
"focus-trap": "^7.5.4",
"mark.js": "8.11.1",
"minisearch": "^7.0.0",
"shiki": "^1.10.3",
"vite": "^5.3.3",
"vue": "^3.4.31"
"minisearch": "^7.1.0",
"shiki": "^1.13.0",
"vite": "^5.4.1",
"vue": "^3.4.38"
},
"devDependencies": {
"@clack/prompts": "^0.7.0",
@ -124,7 +124,7 @@
"@mdit-vue/plugin-title": "^2.1.3",
"@mdit-vue/plugin-toc": "^2.1.3",
"@mdit-vue/shared": "^2.1.3",
"@polka/compression": "^1.0.0-next.25",
"@polka/compression": "^1.0.0-next.26",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
@ -140,24 +140,24 @@
"@types/markdown-it-emoji": "^3.0.1",
"@types/micromatch": "^4.0.9",
"@types/minimist": "^1.2.5",
"@types/node": "^20.14.10",
"@types/node": "^22.4.0",
"@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9",
"chokidar": "^3.6.0",
"conventional-changelog-cli": "^5.0.0",
"cross-spawn": "^7.0.3",
"debug": "^4.3.5",
"esbuild": "^0.23.0",
"execa": "^9.3.0",
"debug": "^4.3.6",
"esbuild": "^0.23.1",
"execa": "^9.3.1",
"fs-extra": "^11.2.0",
"get-port": "^7.1.0",
"gray-matter": "^4.0.3",
"lint-staged": "^15.2.7",
"lint-staged": "^15.2.9",
"lodash.template": "^4.5.0",
"lru-cache": "^11.0.0",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.0.1",
"markdown-it-attrs": "^4.1.6",
"markdown-it-attrs": "^4.2.0",
"markdown-it-container": "^4.0.0",
"markdown-it-emoji": "^3.0.0",
"markdown-it-mathjax3": "^4.3.2",
@ -169,24 +169,24 @@
"path-to-regexp": "^6.2.2",
"picocolors": "^1.0.1",
"pkg-dir": "^8.0.0",
"playwright-chromium": "^1.45.1",
"playwright-chromium": "^1.46.1",
"polka": "^1.0.0-next.25",
"postcss-prefix-selector": "^1.16.1",
"prettier": "^3.3.3",
"prompts": "^2.4.2",
"punycode": "^2.3.1",
"rimraf": "^6.0.1",
"rollup": "^4.18.1",
"rollup": "^4.20.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"semver": "^7.6.2",
"semver": "^7.6.3",
"simple-git-hooks": "^2.11.1",
"sirv": "^2.0.4",
"sitemap": "^8.0.0",
"supports-color": "^9.4.0",
"tinyglobby": "^0.2.5",
"typescript": "^5.5.3",
"vitest": "^2.0.2",
"typescript": "^5.5.4",
"vitest": "^2.0.5",
"vue-tsc": "^2.0.29",
"wait-on": "^7.2.0"
},
@ -202,7 +202,7 @@
"optional": true
}
},
"packageManager": "pnpm@9.5.0",
"packageManager": "pnpm@9.7.1",
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [

File diff suppressed because it is too large Load Diff

@ -5,7 +5,7 @@
"outDir": "../../dist/client",
"declaration": true,
"declarationDir": "../../dist/client-types",
"types": ["vite/client"],
"types": ["vite/client", "@types/node"],
"paths": {
"vitepress": ["index.ts"],
"vitepress/theme": ["../../theme.d.ts"]

@ -123,7 +123,7 @@ export const staticDataPlugin: Plugin = {
},
transform(_code, id) {
if (server && loaderMatch.test(id)) {
if (server && loaderMatch.test(id) && '_importGlobMap' in server) {
// register this module as a glob importer
const { watch } = idToLoaderModulesMap[id]!
if (watch) {

Loading…
Cancel
Save