Skip to content

Commit 6a4ac01

Browse files
committed
chore: merge main
2 parents 95039fe + 0d18fc1 commit 6a4ac01

File tree

122 files changed

+2137
-2563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+2137
-2563
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Get changed files
4848
id: changed-files
49-
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
49+
uses: tj-actions/changed-files@a284dc1814e3fd07f2e34267fc8f81227ed29fb8 # v45.0.9
5050
with:
5151
files: |
5252
docs/**
@@ -63,7 +63,7 @@ jobs:
6363
strategy:
6464
matrix:
6565
os: [ubuntu-latest]
66-
node_version: [18, 20, 22]
66+
node_version: [20, 22]
6767
include:
6868
# Active LTS + other OS
6969
- os: macos-latest

docs/.vitepress/config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export default defineConfig({
136136
pt: { label: 'Português', link: 'https://pt.vite.dev' },
137137
ko: { label: '한국어', link: 'https://ko.vite.dev' },
138138
de: { label: 'Deutsch', link: 'https://de.vite.dev' },
139+
fa: { label: 'فارسی', link: 'https://fa.vite.dev' },
139140
},
140141

141142
themeConfig: {
@@ -422,15 +423,15 @@ export default defineConfig({
422423
link: '/changes/hotupdate-hook',
423424
},
424425
{
425-
text: 'Move to per-environment APIs',
426+
text: 'Move to Per-environment APIs',
426427
link: '/changes/per-environment-apis',
427428
},
428429
{
429-
text: 'SSR using ModuleRunner API',
430+
text: 'SSR Using ModuleRunner API',
430431
link: '/changes/ssr-using-modulerunner',
431432
},
432433
{
433-
text: 'Shared plugins during build',
434+
text: 'Shared Plugins During Build',
434435
link: '/changes/shared-plugins-during-build',
435436
},
436437
],

docs/blog/announcing-vite5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ _November 16, 2023_
3333

3434
Vite 4 [was released](./announcing-vite4.md) almost a year ago, and it served as a solid base for the ecosystem. npm downloads per week jumped from 2.5 million to 7.5 million, as projects keep building on a shared infrastructure. Frameworks continued to innovate, and on top of [Astro](https://astro.build/), [Nuxt](https://nuxt.com/), [SvelteKit](https://kit.svelte.dev/), [Solid Start](https://www.solidjs.com/blog/introducing-solidstart), [Qwik City](https://qwik.builder.io/qwikcity/overview/), between others, we saw new frameworks joining and making the ecosystem stronger. [RedwoodJS](https://redwoodjs.com/) and [Remix](https://remix.run/) switching to Vite paves the way for further adoption in the React ecosystem. [Vitest](https://vitest.dev) kept growing at an even faster pace than Vite. Its team has been hard at work and will soon [release Vitest 1.0](https://github.com/vitest-dev/vitest/issues/3596). The story of Vite when used with other tools such as [Storybook](https://storybook.js.org), [Nx](https://nx.dev), and [Playwright](https://playwright.dev) kept improving, and the same goes for environments, with Vite dev working both in [Deno](https://deno.com) and [Bun](https://bun.sh).
3535

36-
We had the second edition of [ViteConf](https://viteconf.org/23/replay) a month ago, hosted by [StackBlitz](https://stackblitz.com). Like last year, most of the projects in the ecosystem got together to share ideas and connect to keep expanding the commons. We're also seeing new pieces complement the meta-framework tool belt like [Volar](https://volarjs.dev/) and [Nitro](https://nitro.unjs.io/). The Rollup team released [Rollup 4](https://rollupjs.org) that same day, a tradition Lukas started last year.
36+
We had the second edition of [ViteConf](https://viteconf.org/23/replay) a month ago, hosted by [StackBlitz](https://stackblitz.com). Like last year, most of the projects in the ecosystem got together to share ideas and connect to keep expanding the commons. We're also seeing new pieces complement the meta-framework tool belt like [Volar](https://volarjs.dev/) and [Nitro](https://nitro.build/). The Rollup team released [Rollup 4](https://rollupjs.org) that same day, a tradition Lukas started last year.
3737

3838
Six months ago, Vite 4.3 [was released](./announcing-vite4.md). This release significantly improved the dev server performance. However, there is still ample room for improvement. At ViteConf, [Evan You unveiled Vite's long-term plan to work on Rolldown](https://www.youtube.com/watch?v=hrdwQHoAp0M), a Rust-port of Rollup with compatible APIs. Once it is ready, we intend to use it in Vite Core to take on the tasks of both Rollup and esbuild. This will mean a boost in build performance (and later on in dev performance too as we move perf-sensitive parts of Vite itself to Rust), and a big reduction of inconsistencies between dev and build. Rolldown is currently in early stages and the team is preparing to open source the codebase before the end of the year. Stay tuned!
3939

docs/changes/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ We don't recommend switching to these APIs yet. They are included in Vite to hel
1616

1717
- [`this.environment` in Hooks](/changes/this-environment-in-hooks)
1818
- [HMR `hotUpdate` Plugin Hook](/changes/hotupdate-hook)
19-
- [Move to per-environment APIs](/changes/per-environment-apis)
20-
- [SSR using `ModuleRunner` API](/changes/ssr-using-modulerunner)
21-
- [Shared plugins during build](/changes/shared-plugins-during-build)
19+
- [Move to Per-environment APIs](/changes/per-environment-apis)
20+
- [SSR Using `ModuleRunner` API](/changes/ssr-using-modulerunner)
21+
- [Shared Plugins During Build](/changes/shared-plugins-during-build)
2222

2323
## Past
2424

docs/changes/per-environment-apis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Move to per-environment APIs
1+
# Move to Per-environment APIs
22

33
::: tip Feedback
44
Give us feedback at [Environment API feedback discussion](https://github.com/vitejs/vite/discussions/16358)

docs/changes/ssr-using-modulerunner.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SSR using `ModuleRunner` API
1+
# SSR Using `ModuleRunner` API
22

33
::: tip Feedback
44
Give us feedback at [Environment API feedback discussion](https://github.com/vitejs/vite/discussions/16358)

docs/changes/this-environment-in-hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Affect scope: `Vite Plugin Authors`
1818

1919
## Migration Guide
2020

21-
For the existing plugin to do a quick migration, replace the `options.ssr` argument with `this.environment.name !== 'client'` in the `resolveId`, `load` and `transform` hooks:
21+
For the existing plugin to do a quick migration, replace the `options.ssr` argument with `this.environment.config.consumer === 'server'` in the `resolveId`, `load` and `transform` hooks:
2222

2323
```ts
2424
import { Plugin } from 'vite'
@@ -28,7 +28,7 @@ export function myPlugin(): Plugin {
2828
name: 'my-plugin',
2929
resolveId(id, importer, options) {
3030
const isSSR = options.ssr // [!code --]
31-
const isSSR = this.environment.name !== 'client' // [!code ++]
31+
const isSSR = this.environment.config.consumer === 'server' // [!code ++]
3232

3333
if (isSSR) {
3434
// SSR specific logic

docs/config/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
}
1515
```
1616

17-
Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM, e.g. `type: "module"` in `package.json`. In this case, the config file is auto pre-processed before load.
17+
Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM, e.g. `"type": "module"` in `package.json`. In this case, the config file is auto pre-processed before load.
1818

1919
You can also explicitly specify a config file to use with the `--config` CLI option (resolved relative to `cwd`):
2020

docs/config/shared-options.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,8 @@ Note if an inline config is provided, Vite will not search for other PostCSS con
227227
Specify options to pass to CSS pre-processors. The file extensions are used as keys for the options. The supported options for each preprocessor can be found in their respective documentation:
228228

229229
- `sass`/`scss`:
230-
- Select the sass API to use with `api: "modern-compiler" | "modern" | "legacy"` (default `"modern-compiler"` if `sass-embedded` is installed, otherwise `"modern"`). For the best performance, it's recommended to use `api: "modern-compiler"` with the `sass-embedded` package. The `"legacy"` API is deprecated and will be removed in Vite 7.
231-
- [Options (modern)](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/)
232-
- [Options (legacy)](https://sass-lang.com/documentation/js-api/interfaces/LegacyStringOptions).
230+
- Select the sass API to use with `api: "modern-compiler" | "modern"` (default `"modern-compiler"` if `sass-embedded` is installed, otherwise `"modern"`). For the best performance, it's recommended to use `api: "modern-compiler"` with the `sass-embedded` package.
231+
- [Options](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/)
233232
- `less`: [Options](https://lesscss.org/usage/#less-options).
234233
- `styl`/`stylus`: Only [`define`](https://stylus-lang.com/docs/js.html#define-name-node) is supported, which can be passed as an object.
235234

@@ -248,7 +247,7 @@ export default defineConfig({
248247
},
249248
},
250249
scss: {
251-
api: 'modern-compiler', // or "modern", "legacy"
250+
api: 'modern-compiler', // or "modern"
252251
importers: [
253252
// ...
254253
],

docs/guide/api-environment-frameworks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Resources:
1111
Please share your feedback with us.
1212
:::
1313

14-
## Environments and frameworks
14+
## Environments and Frameworks
1515

1616
The implicit `ssr` environment and other non-client environments use a `RunnableDevEnvironment` by default during dev. While this requires the runtime to be the same with the one the Vite server is running in, this works similarly with `ssrLoadModule` and allows frameworks to migrate and enable HMR for their SSR dev story. You can guard any runnable environment with an `isRunnableDevEnvironment` function.
1717

@@ -329,6 +329,8 @@ export default {
329329
}
330330
```
331331
332+
Plugins can also define a `buildApp` hook. Order `'pre'` and `null'` are executed before the configured `builder.buildApp`, and order `'post'` hooks are executed after it. `environment.isBuilt` can be used to check if an environment has already being build.
333+
332334
## Environment Agnostic Code
333335
334336
Most of the time, the current `environment` instance will be available as part of the context of the code being run so the need to access them through `server.environments` should be rare. For example, inside plugin hooks the environment is exposed as part of the `PluginContext`, so it can be accessed using `this.environment`. See [Environment API for Plugins](./api-environment-plugins.md) to learn about how to build environment aware plugins.

0 commit comments

Comments
 (0)