Skip to content

Commit cac9204

Browse files
committed
chore: merge main
2 parents 158a968 + 3d92ac3 commit cac9204

File tree

13 files changed

+245
-119
lines changed

13 files changed

+245
-119
lines changed

.stackblitz/codeflow.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
Hi! We're really excited that you're interested in contributing to Vite! Before submitting your contribution, please read through the following guide. We also suggest you read the [Project Philosophy](https://vite.dev/guide/philosophy) in our documentation.
44

5-
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll see a Codeflow button on issues to start a PR to fix them. A button will also appear on PRs to review them without needing to check out the branch locally. When using Codeflow, the Vite repository will be cloned for you in an online editor, with the Vite package built in watch mode ready to test your changes. If you'd like to learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
6-
7-
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/vitejs/vite)
8-
95
## Repo Setup
106

117
To develop locally, fork the Vite repository and clone it in your local machine. The Vite repo is a monorepo using pnpm workspaces. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/). You can find the required pnpm version in `package.json` under the `packageManager` key.
@@ -356,3 +352,5 @@ If you have publish access, the steps below explain how to cut a release for a p
356352
3. Click on the "Review deployments" button in the yellow box, a popup will appear.
357353
4. Check "Release" and click "Approve and deploy".
358354
5. The package will start publishing to npm.
355+
356+
To learn more about how and when Vite does releases, check out the [Releases](https://vite.dev/releases) documentation.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<a href="https://npmjs.com/package/rolldown-vite"><img src="https://img.shields.io/npm/v/rolldown-vite.svg" alt="npm package"></a>
1010
<a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/rolldown-vite.svg" alt="node compatibility"></a>
1111
<a href="https://github.com/vitejs/rolldown-vite/actions/workflows/ci.yml"><img src="https://github.com/vitejs/rolldown-vite/actions/workflows/ci.yml/badge.svg?branch=main" alt="build status"></a>
12-
<a href="https://pr.new/vitejs/rolldown-vite"><img src="https://developer.stackblitz.com/img/start_pr_dark_small.svg" alt="Start new PR in StackBlitz Codeflow"></a>
1312
<a href="https://chat.vite.dev"><img src="https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord" alt="discord chat"></a>
1413
</p>
1514
<br/>

docs/.vitepress/config.ts

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ import {
1010
import llmstxt from 'vitepress-plugin-llms'
1111
import type { PluginOption } from 'vite'
1212
import { markdownItImageSize } from 'markdown-it-image-size'
13+
import packageJson from '../../packages/vite/package.json' with { type: 'json' }
1314
import { buildEnd } from './buildEnd.config'
1415

16+
const viteVersion = packageJson.version
17+
const viteMajorVersion = +viteVersion.split('.')[0]
18+
1519
const ogDescription = 'Next Generation Frontend Tooling'
1620
const ogImage = 'https://vite.dev/og-image.jpg'
1721
const ogTitle = 'Vite'
@@ -42,42 +46,31 @@ const additionalTitle = ((): string => {
4246
}
4347
})()
4448
const versionLinks = ((): DefaultTheme.NavItemWithLink[] => {
45-
const oldVersions: DefaultTheme.NavItemWithLink[] = [
46-
{
47-
text: 'Vite 6 Docs',
48-
link: 'https://v6.vite.dev',
49-
},
50-
{
51-
text: 'Vite 5 Docs',
52-
link: 'https://v5.vite.dev',
53-
},
54-
{
55-
text: 'Vite 4 Docs',
56-
link: 'https://v4.vite.dev',
57-
},
58-
{
59-
text: 'Vite 3 Docs',
60-
link: 'https://v3.vite.dev',
61-
},
62-
{
63-
text: 'Vite 2 Docs',
64-
link: 'https://v2.vite.dev',
65-
},
66-
]
49+
const links: DefaultTheme.NavItemWithLink[] = []
6750

68-
switch (deployType) {
69-
case 'main':
70-
case 'local':
71-
return [
72-
{
73-
text: 'Vite 7 Docs (release)',
74-
link: 'https://vite.dev',
75-
},
76-
...oldVersions,
77-
]
78-
case 'release':
79-
return oldVersions
51+
if (deployType !== 'main') {
52+
links.push({
53+
text: 'Unreleased Docs',
54+
link: 'https://main.vite.dev',
55+
})
56+
}
57+
58+
if (deployType === 'main' || deployType === 'local') {
59+
links.push({
60+
text: `Vite ${viteMajorVersion} Docs (release)`,
61+
link: 'https://vite.dev',
62+
})
8063
}
64+
65+
// Create version links from v2 onwards
66+
for (let i = viteMajorVersion - 1; i >= 2; i--) {
67+
links.push({
68+
text: `Vite ${i} Docs`,
69+
link: `https://v${i}.vite.dev`,
70+
})
71+
}
72+
73+
return links
8174
})()
8275

8376
function inlineScript(file: string): HeadConfig {
@@ -237,21 +230,25 @@ export default defineConfig({
237230
text: 'DEV Community',
238231
link: 'https://dev.to/t/vite',
239232
},
240-
{
241-
text: 'Changelog',
242-
link: 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md',
243-
},
244-
{
245-
text: 'Contributing',
246-
link: 'https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md',
247-
},
248233
],
249234
},
250235
],
251236
},
252237
{
253-
text: 'Version',
254-
items: versionLinks,
238+
text: `v${viteVersion}`,
239+
items: [
240+
{
241+
text: 'Changelog',
242+
link: 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md',
243+
},
244+
{
245+
text: 'Contributing',
246+
link: 'https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md',
247+
},
248+
{
249+
items: versionLinks,
250+
},
251+
],
255252
},
256253
],
257254

@@ -330,7 +327,7 @@ export default defineConfig({
330327
link: '/guide/rolldown',
331328
},
332329
{
333-
text: 'Migration from v6',
330+
text: `Migration from v${viteMajorVersion - 1}`,
334331
link: '/guide/migration',
335332
},
336333
{
@@ -532,6 +529,9 @@ In addition, Vite is highly extensible via its [Plugin API](https://vite.dev/gui
532529
'gsap/dist/MotionPathPlugin',
533530
],
534531
},
532+
define: {
533+
__VITE_VERSION__: JSON.stringify(viteVersion),
534+
},
535535
},
536536
buildEnd,
537537
})
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<script setup lang="ts">
2+
import { ref, computed } from 'vue'
3+
4+
declare const __VITE_VERSION__: string
5+
6+
// Constants
7+
const supportedVersionMessage = {
8+
color: 'var(--vp-c-brand-1)',
9+
text: 'supported',
10+
}
11+
const notSupportedVersionMessage = {
12+
color: 'var(--vp-c-danger-1)',
13+
text: 'not supported',
14+
}
15+
const previousMajorLatestMinors: Record<string, string> = {
16+
'2': '2.9',
17+
'3': '3.2',
18+
'4': '4.5',
19+
'5': '5.4',
20+
'6': '6.4',
21+
}
22+
23+
// Current latest Vite version and support info
24+
const parsedViteVersion = parseVersion(__VITE_VERSION__)!
25+
const supportInfo = computeSupportInfo(parsedViteVersion)
26+
27+
// Check supported version input
28+
const checkedVersion = ref(`${Math.max(parsedViteVersion.major - 3, 2)}.0.0`)
29+
const checkedResult = computed(() => {
30+
const version = checkedVersion.value
31+
if (!isValidViteVersion(version)) return notSupportedVersionMessage
32+
33+
const parsedVersion = parseVersion(checkedVersion.value)
34+
if (!parsedVersion) return notSupportedVersionMessage
35+
36+
const satisfies = (targetVersion: string) => {
37+
const compared = parseVersion(targetVersion)!
38+
return (
39+
parsedVersion.major === compared.major &&
40+
parsedVersion.minor >= compared.minor
41+
)
42+
}
43+
const satisfiesOneSupportedVersion =
44+
parsedVersion.major >= parsedViteVersion.major || // Treat future major versions as supported
45+
supportInfo.regularPatches.some(satisfies) ||
46+
supportInfo.importantFixes.some(satisfies) ||
47+
supportInfo.securityPatches.some(satisfies)
48+
49+
return satisfiesOneSupportedVersion
50+
? supportedVersionMessage
51+
: notSupportedVersionMessage
52+
})
53+
54+
function parseVersion(version: string) {
55+
let [major, minor, patch] = version.split('.').map((v) => {
56+
const num = /^\d+$/.exec(v)?.[0]
57+
return num ? parseInt(num) : null
58+
})
59+
if (!major) return null
60+
minor ??= 0
61+
patch ??= 0
62+
63+
return { major, minor, patch }
64+
}
65+
66+
function computeSupportInfo(
67+
version: NonNullable<ReturnType<typeof parseVersion>>,
68+
) {
69+
const { major, minor } = version
70+
const f = (versions: string[]) => {
71+
return versions
72+
.map((v) => previousMajorLatestMinors[v] ?? v)
73+
.filter((version) => {
74+
if (!isValidViteVersion(version)) return false
75+
// Negative versions are invalid
76+
if (/-\d/.test(version)) return false
77+
return true
78+
})
79+
}
80+
81+
return {
82+
regularPatches: f([`${major}.${minor}`]),
83+
importantFixes: f([`${major - 1}`, `${major}.${minor - 1}`]),
84+
securityPatches: f([`${major - 2}`, `${major}.${minor - 2}`]),
85+
}
86+
}
87+
88+
function versionsToText(versions: string[]) {
89+
versions = versions.map((v) => `<code>vite@${v}</code>`)
90+
if (versions.length === 0) return ''
91+
if (versions.length === 1) return versions[0]
92+
return (
93+
versions.slice(0, -1).join(', ') + ' and ' + versions[versions.length - 1]
94+
)
95+
}
96+
97+
function isValidViteVersion(version: string) {
98+
if (version.length === 1) version += '.'
99+
// Vite 0.x shouldn't be mentioned, and Vite 1.x was never released
100+
if (version.startsWith('0.') || version.startsWith('1.')) return false
101+
return true
102+
}
103+
</script>
104+
105+
<template>
106+
<div>
107+
<ul>
108+
<li v-if="supportInfo.regularPatches.length">
109+
Regular patches are released for
110+
<span v-html="versionsToText(supportInfo.regularPatches)"></span>.
111+
</li>
112+
<li v-if="supportInfo.importantFixes.length">
113+
Important fixes and security patches are backported to
114+
<span v-html="versionsToText(supportInfo.importantFixes)"></span>.
115+
</li>
116+
<li v-if="supportInfo.securityPatches.length">
117+
Security patches are also backported to
118+
<span v-html="versionsToText(supportInfo.securityPatches)"></span>.
119+
</li>
120+
<li>
121+
All versions before these are no longer supported. Users should upgrade
122+
to receive updates.
123+
</li>
124+
</ul>
125+
<p>
126+
If you're using Vite
127+
<input
128+
class="checked-input"
129+
type="text"
130+
v-model="checkedVersion"
131+
placeholder="0.0.0"
132+
/>, it is
133+
<strong :style="{ color: checkedResult.color }">{{
134+
checkedResult.text
135+
}}</strong
136+
>.
137+
</p>
138+
</div>
139+
</template>
140+
141+
<style scoped>
142+
.checked-input {
143+
display: inline-block;
144+
padding: 0px 5px;
145+
width: 100px;
146+
color: var(--vp-c-text-1);
147+
background: var(--vp-c-bg-soft);
148+
font-size: var(--vp-code-font-size);
149+
font-family: var(--vp-font-family-mono);
150+
border: 1px solid var(--vp-c-divider);
151+
border-radius: 5px;
152+
transition: border-color 0.1s;
153+
}
154+
155+
.checked-input:focus,
156+
.checked-input:hover {
157+
border-color: var(--vp-c-brand);
158+
}
159+
</style>

docs/guide/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ pnpm link --global # use your preferred package manager for this step
259259

260260
Then go to your Vite based project and run `pnpm link --global vite` (or the package manager that you used to link `vite` globally). Now restart the development server to ride on the bleeding edge!
261261

262+
To learn more about how and when Vite does releases, check out the [Releases](../releases.md) documentation.
263+
262264
::: tip Dependencies using Vite
263265
To replace the Vite version used by dependencies transitively, you should use [npm overrides](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#overrides) or [pnpm overrides](https://pnpm.io/9.x/package_json#pnpmoverrides).
264266
:::

docs/releases.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<script setup>
2+
import SupportedVersions from './.vitepress/theme/components/SupportedVersions.vue';
3+
</script>
4+
15
# Releases
26

37
Vite releases follow [Semantic Versioning](https://semver.org/). You can see the latest stable version of Vite in the [Vite npm package page](https://www.npmjs.com/package/vite).
@@ -12,20 +16,21 @@ Vite does not have a fixed release cycle.
1216
- **Minor** releases always contain new features and are released as needed. Minor releases always have a beta pre-release phase (usually every two months).
1317
- **Major** releases generally align with [Node.js EOL schedule](https://endoflife.date/nodejs), and will be announced ahead of time. These releases will go through long-term discussions with the ecosystem, and have alpha and beta pre-release phases (usually every year).
1418

15-
The Vite version ranges that are supported by the Vite team are automatically determined by:
19+
## Supported Versions
20+
21+
In summary, the current supported Vite versions are:
22+
23+
<SupportedVersions />
24+
25+
<br>
26+
27+
The supported version ranges are are automatically determined by:
1628

1729
- **Current Minor** gets regular fixes.
1830
- **Previous Major** (only for its latest minor) and **Previous Minor** receives important fixes and security patches.
1931
- **Second-to-last Major** (only for its latest minor) and **Second-to-last Minor** receives security patches.
2032
- All versions before these are no longer supported.
2133

22-
As an example, if the Vite latest is at 5.3.10:
23-
24-
- Regular patches are released for `[email protected]`.
25-
- Important fixes and security patches are backported to `vite@4` and `[email protected]`.
26-
- Security patches are also backported to `vite@3`, and `[email protected]`.
27-
- `vite@2` and `[email protected]` are no longer supported. Users should upgrade to receive updates.
28-
2934
We recommend updating Vite regularly. Check out the [Migration Guides](https://vite.dev/guide/migration.html) when you update to each Major. The Vite team works closely with the main projects in the ecosystem to ensure the quality of new versions. We test new Vite versions before releasing them through the [vite-ecosystem-ci project](https://github.com/vitejs/vite-ecosystem-ci). Most projects using Vite should be able to quickly offer support or migrate to new versions as soon as they are released.
3035

3136
## Semantic Versioning Edge Cases

packages/create-vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
"cross-spawn": "^7.0.6",
3838
"mri": "^1.2.0",
3939
"picocolors": "^1.1.1",
40-
"tsdown": "^0.15.10"
40+
"tsdown": "^0.15.12"
4141
}
4242
}

packages/plugin-legacy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"acorn": "^8.15.0",
6262
"fdir": "^6.5.0",
6363
"picocolors": "^1.1.1",
64-
"tsdown": "^0.15.10",
64+
"tsdown": "^0.15.12",
6565
"vite": "workspace:*"
6666
}
6767
}

0 commit comments

Comments
 (0)