Skip to content

Commit 5c45d06

Browse files
docs: add banner component (#7264)
Co-authored-by: dalaoshu <[email protected]>
1 parent d69cc75 commit 5c45d06

File tree

5 files changed

+55
-2
lines changed

5 files changed

+55
-2
lines changed

docs/.vitepress/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ declare module 'vue' {
1313
HomePage: typeof import('./components/HomePage.vue')['default']
1414
ListItem: typeof import('./components/ListItem.vue')['default']
1515
NonProjectOption: typeof import('./components/NonProjectOption.vue')['default']
16+
OldDocument: typeof import('./components/OldDocument.vue')['default']
1617
Version: typeof import('./components/Version.vue')['default']
1718
}
1819
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<template>
2+
<div class="old-document">
3+
<p>
4+
This documentation covers Vitest v2 <strong>(old version)</strong>. For the
5+
latest version, see
6+
<a href="https://vitest.dev" class="new-document-link">https://vitest.dev</a>.
7+
</p>
8+
</div>
9+
</template>
10+
11+
<style>
12+
:root {
13+
--vp-layout-top-height: 96px;
14+
@media (min-width: 455px) {
15+
--vp-layout-top-height: 64px;
16+
}
17+
@media (min-width: 960px) {
18+
--vp-layout-top-height: 32px;
19+
}
20+
}
21+
22+
.old-document {
23+
position: fixed;
24+
display: flex;
25+
height: var(--vp-layout-top-height);
26+
width: 100%;
27+
padding: 4px 32px;
28+
justify-content: center;
29+
align-items: center;
30+
color: var(--vp-c-old-document-text);
31+
background: var(--vp-c-old-document-bg);
32+
z-index: var(--vp-z-index-layout-top);
33+
34+
.new-document-link {
35+
text-decoration: underline;
36+
color: var(--vp-c-text-1);
37+
&:hover {
38+
color: var(--vp-c-text-2);
39+
}
40+
}
41+
}
42+
</style>

docs/.vitepress/style/vars.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
--vp-c-brand-3: #506e10;
99
--vp-c-sponsor: #ca2971;
1010
--vitest-c-sponsor-hover: #c13071;
11+
12+
/* Old Document */
13+
--vp-c-old-document-bg: #f4f8e0;
14+
--vp-c-old-document-text: #2a3a1b;
1115
}
1216

1317
.dark {
@@ -16,6 +20,10 @@
1620
--vp-c-brand-3: #acd268;
1721
--vp-c-sponsor: #ee4e95;
1822
--vitest-c-sponsor-hover: #e51370;
23+
24+
/* Old Document */
25+
--vp-c-old-document-bg: #2d3b2e;
26+
--vp-c-old-document-text: #c5d9b6;
1927
}
2028

2129

docs/.vitepress/theme/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
66
import { h } from 'vue'
77
import HomePage from '../components/HomePage.vue'
88
import Version from '../components/Version.vue'
9+
import OldDocument from '../components/OldDocument.vue'
910
import '../style/main.css'
1011
import '../style/vars.css'
1112
import 'uno.css'
@@ -20,6 +21,7 @@ export default {
2021
Layout() {
2122
return h(DefaultTheme.Layout, null, {
2223
'home-features-after': () => h(HomePage),
24+
'layout-top': () => h(OldDocument),
2325
})
2426
},
2527
enhanceApp({ app }) {

packages/coverage-istanbul/src/provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { CoverageProvider, ReportContext, ResolvedCoverageOptions, Vitest } from 'vitest/node'
22
import { promises as fs } from 'node:fs'
3+
// @ts-expect-error missing types
4+
import { defaults as istanbulDefaults } from '@istanbuljs/schema'
35
import createDebug from 'debug'
46
import libCoverage, { type CoverageMap } from 'istanbul-lib-coverage'
57
import { createInstrumenter, type Instrumenter } from 'istanbul-lib-instrument'
@@ -11,8 +13,6 @@ import { resolve } from 'pathe'
1113
import TestExclude from 'test-exclude'
1214
import c from 'tinyrainbow'
1315
import { BaseCoverageProvider } from 'vitest/coverage'
14-
// @ts-expect-error missing types
15-
import { defaults as istanbulDefaults } from '@istanbuljs/schema'
1616

1717
import { version } from '../package.json' with { type: 'json' }
1818
import { COVERAGE_STORE_KEY } from './constants'

0 commit comments

Comments
 (0)