Skip to content

Commit

Permalink
Merge branch 'main' into feat-sass-modern
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jul 29, 2024
2 parents 3bf2dc1 + 952bae3 commit 2125ef6
Show file tree
Hide file tree
Showing 33 changed files with 207 additions and 161 deletions.
22 changes: 17 additions & 5 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@ A full changelog of past releases is [available on GitHub](https://github.com/vi

Vite does not have a fixed release cycle.

- **Patch** releases are released as needed.
- **Minor** releases always contain new features and are also released as needed. Minor releases always go through a beta pre-release phase.
- **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 an early discussion phase, and both alpha and beta pre-release phases.
- **Patch** releases are released as needed (usually every week).
- **Minor** releases always contain new features and are released as needed. Minor releases always have a beta pre-release phase (usually every two months).
- **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).

The previous Vite Major will keep receiving important fixes and security patches. After that, it would only get updates if there are security concerns. We recommend updating Vite regularly. Check out the [Migration Guides](https://vitejs.dev/guide/migration.html) when you update to each Major.
The Vite versions ranges that are supported by the Vite team is automatically determined by:

The Vite team partners with the main projects in the ecosystem to test new Vite versions before they are released 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.
- **Current Minor** gets regular fixes.
- **Previous Major** (only for its latest minor) and **Previous Minor** receives important fixes and security patches.
- **Second-to-last Major** (only for its latest minor) and **Second-to-last Minor** receives security patches.
- All versions before these are no longer supported.

As an example, if the Vite latest is at 5.3.10:

- Regular patches are released for `[email protected]`.
- Important fixes and security patches are backported to `vite@4` and `[email protected]`.
- Security patches are also backported to `vite@3`, and `[email protected]`.
- `vite@2` and `[email protected]` are no longer supported. Users should upgrade to receive updates.

We recommend updating Vite regularly. Check out the [Migration Guides](https://vitejs.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.

## Semantic Versioning Edge Cases

Expand Down
43 changes: 42 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const require = createRequire(import.meta.url)
const pkg = require('./package.json')
const pkgVite = require('./packages/vite/package.json')

// Some rules work better with typechecking enabled, but as enabling it is slow,
// we only do so when linting in IDEs for now. If you want to lint with typechecking
// explicitly, set this to `true` manually.
const shouldTypeCheck = typeof process.env.VSCODE_PID === 'string'

export default tseslint.config(
{
ignores: [
Expand All @@ -34,6 +39,12 @@ export default tseslint.config(
parserOptions: {
sourceType: 'module',
ecmaVersion: 2022,
project: shouldTypeCheck
? [
'./packages/*/tsconfig.json',
'./packages/vite/src/*/tsconfig.json',
]
: undefined,
},
globals: {
...globals.es2021,
Expand Down Expand Up @@ -133,7 +144,8 @@ export default tseslint.config(
},
],

'regexp/no-contradiction-with-assertion': 'error',
'regexp/prefer-regexp-exec': 'error',
'regexp/prefer-regexp-test': 'error',
// in some cases using explicit letter-casing is more performant than the `i` flag
'regexp/use-ignore-case': 'off',
},
Expand Down Expand Up @@ -221,6 +233,14 @@ export default tseslint.config(
'n/no-extraneous-import': 'off',
},
},
{
name: 'disables/vite/cjs',
files: ['packages/vite/index.cjs'],
rules: {
'no-restricted-globals': 'off',
'n/no-missing-require': 'off',
},
},
{
name: 'disables/create-vite/templates',
files: [
Expand Down Expand Up @@ -285,4 +305,25 @@ export default tseslint.config(
'@typescript-eslint/ban-ts-comment': 'off',
},
},
{
name: 'disables/typechecking',
files: [
'**/*.js',
'**/*.mjs',
'**/*.cjs',
'**/*.d.ts',
'**/*.d.cts',
'**/__tests__/**',
'docs/**',
'playground/**',
'scripts/**',
'vitest.config.ts',
'vitest.config.e2e.ts',
],
languageOptions: {
parserOptions: {
project: false,
},
},
},
)
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@types/debug": "^4.1.12",
"@types/estree": "^1.0.5",
"@types/etag": "^1.8.3",
"@types/fs-extra": "^11.0.4",
"@types/less": "^3.0.6",
"@types/micromatch": "^4.0.9",
"@types/node": "^20.14.11",
Expand All @@ -62,7 +61,6 @@
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-regexp": "^2.6.0",
"execa": "^9.3.0",
"fs-extra": "^11.2.0",
"globals": "^15.8.0",
"lint-staged": "^15.2.7",
"npm-run-all2": "^6.2.2",
Expand Down
20 changes: 10 additions & 10 deletions packages/create-vite/__tests__/cli.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { join } from 'node:path'
import fs from 'node:fs'
import path from 'node:path'
import type { SyncOptions, SyncResult } from 'execa'
import { execaCommandSync } from 'execa'
import fs from 'fs-extra'
import { afterEach, beforeAll, expect, test } from 'vitest'

const CLI_PATH = join(__dirname, '..')
const CLI_PATH = path.join(__dirname, '..')

const projectName = 'test-app'
const genPath = join(__dirname, projectName)
const genPath = path.join(__dirname, projectName)

const run = <SO extends SyncOptions>(
args: string[],
Expand All @@ -19,30 +19,30 @@ const run = <SO extends SyncOptions>(
// Helper to create a non-empty directory
const createNonEmptyDir = () => {
// Create the temporary directory
fs.mkdirpSync(genPath)
fs.mkdirSync(genPath, { recursive: true })

// Create a package.json file
const pkgJson = join(genPath, 'package.json')
const pkgJson = path.join(genPath, 'package.json')
fs.writeFileSync(pkgJson, '{ "foo": "bar" }')
}

// Vue 3 starter template
const templateFiles = fs
.readdirSync(join(CLI_PATH, 'template-vue'))
.readdirSync(path.join(CLI_PATH, 'template-vue'))
// _gitignore is renamed to .gitignore
.map((filePath) => (filePath === '_gitignore' ? '.gitignore' : filePath))
.sort()

beforeAll(() => fs.remove(genPath))
afterEach(() => fs.remove(genPath))
beforeAll(() => fs.rmSync(genPath, { recursive: true, force: true }))
afterEach(() => fs.rmSync(genPath, { recursive: true, force: true }))

test('prompts for the project name if none supplied', () => {
const { stdout } = run([])
expect(stdout).toContain('Project name:')
})

test('prompts for the framework if none supplied when target dir is current directory', () => {
fs.mkdirpSync(genPath)
fs.mkdirSync(genPath, { recursive: true })
const { stdout } = run(['.'], { cwd: genPath })
expect(stdout).toContain('Select a framework:')
})
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const legacyEnvVarMarker = `__VITE_IS_LEGACY__`
const _require = createRequire(import.meta.url)

const nonLeadingHashInFileNameRE = /[^/]+\[hash(?::\d+)?\]/
const prefixedHashInFileNameRE = /\W?\[hash(:\d+)?\]/
const prefixedHashInFileNameRE = /\W?\[hash(?::\d+)?\]/

function viteLegacyPlugin(options: Options = {}): Plugin[] {
let config: ResolvedConfig
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-legacy/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["src"],
"include": ["build.config.ts", "src"],
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
Expand Down
Loading

0 comments on commit 2125ef6

Please sign in to comment.