Skip to content

Commit 18e54bf

Browse files
committed
chore: merge commit '24692dbeccd148a60f563bc96e12e3609e5ba642' into rolldown-vite
2 parents 5f406c7 + 24692db commit 18e54bf

File tree

106 files changed

+1901
-1485
lines changed

Some content is hidden

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

106 files changed

+1901
-1485
lines changed

.github/renovate.json5

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"excludePackagePrefixes": ["actions/", "github/"],
1515
"pinDigests": true,
1616
},
17+
{
18+
"groupName": "rolldown-related dependencies",
19+
"matchDepNames": ["rolldown", "rolldown-plugin-dts", "tsdown"],
20+
},
1721
],
1822
"ignoreDeps": [
1923
// manually bumping
@@ -22,6 +26,8 @@
2226
"node",
2327
"typescript",
2428
"@rollup/plugin-dynamic-import-vars", // prefer version using tinyglobby
29+
"@oxc-project/runtime", // align version with rolldown
30+
"@oxc-project/types", // align version with rolldown
2531

2632
// pinned
2733
"slash3",

docs/.vitepress/theme/composables/sponsor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ const viteSponsors: Pick<Sponsors, 'special' | 'gold'> = {
3535
special: [
3636
// sponsors patak-dev
3737
{
38-
name: 'StackBlitz',
39-
url: 'https://stackblitz.com',
40-
img: '/stackblitz.svg',
38+
name: 'Bolt',
39+
url: 'https://bolt.new',
40+
img: '/bolt.svg',
4141
},
4242
// sponsors antfu
4343
{

docs/.vitepress/theme/styles/vars.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
}
9090

9191
.vp-sponsor-grid.big .vp-sponsor-grid-image {
92-
max-height: 96px;
92+
max-height: 56px;
9393
}
9494

9595
.vp-sponsor-grid.mini .vp-sponsor-grid-image[alt='Bit'] {

docs/config/dep-optimization-options.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Unless noted, the options in this section are only applied to the dependency opt
1010

1111
By default, Vite will crawl all your `.html` files to detect dependencies that need to be pre-bundled (ignoring `node_modules`, `build.outDir`, `__tests__` and `coverage`). If `build.rollupOptions.input` is specified, Vite will crawl those entry points instead.
1212

13-
If neither of these fit your needs, you can specify custom entries using this option - the value should be a [`tinyglobby` pattern](https://github.com/SuperchupuDev/tinyglobby) or array of patterns that are relative from Vite project root. This will overwrite default entries inference. Only `node_modules` and `build.outDir` folders will be ignored by default when `optimizeDeps.entries` is explicitly defined. If other folders need to be ignored, you can use an ignore pattern as part of the entries list, marked with an initial `!`. If you don't want to ignore `node_modules` and `build.outDir`, you can specify using literal string paths (without `tinyglobby` patterns) instead.
13+
If neither of these fit your needs, you can specify custom entries using this option - the value should be a [`tinyglobby` pattern](https://github.com/SuperchupuDev/tinyglobby) or array of patterns that are relative from Vite project root. This will overwrite default entries inference. Only `node_modules` and `build.outDir` folders will be ignored by default when `optimizeDeps.entries` is explicitly defined. If other folders need to be ignored, you can use an ignore pattern as part of the entries list, marked with an initial `!`. `node_modules` will not be ignored for patterns that explicitly include the string `node_modules`.
1414

1515
## optimizeDeps.exclude
1616

@@ -78,6 +78,13 @@ Certain options are omitted since changing them would not be compatible with Vit
7878

7979
Set to `true` to force dependency pre-bundling, ignoring previously cached optimized dependencies.
8080

81+
## optimizeDeps.noDiscovery
82+
83+
- **Type:** `boolean`
84+
- **Default:** `false`
85+
86+
When set to `true`, automatic dependency discovery will be disabled and only dependencies listed in `optimizeDeps.include` will be optimized. CJS-only dependencies must be present in `optimizeDeps.include` during dev.
87+
8188
## optimizeDeps.holdUntilCrawlEnd
8289

8390
- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/15834)

docs/config/shared-options.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default defineConfig({
5454
```
5555

5656
::: tip NOTE
57-
For TypeScript users, make sure to add the type declarations in the `env.d.ts` or `vite-env.d.ts` file to get type checks and Intellisense.
57+
For TypeScript users, make sure to add the type declarations in the `vite-env.d.ts` file to get type checks and Intellisense.
5858

5959
Example:
6060

@@ -227,7 +227,7 @@ 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"` (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.
230+
- Uses `sass-embedded` if installed, otherwise uses `sass`. For the best performance, it's recommended to install the `sass-embedded` package.
231231
- [Options](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/)
232232
- `less`: [Options](https://lesscss.org/usage/#less-options).
233233
- `styl`/`stylus`: Only [`define`](https://stylus-lang.com/docs/js.html#define-name-node) is supported, which can be passed as an object.
@@ -247,7 +247,6 @@ export default defineConfig({
247247
},
248248
},
249249
scss: {
250-
api: 'modern-compiler', // or "modern"
251250
importers: [
252251
// ...
253252
],
@@ -279,11 +278,12 @@ export default defineConfig({
279278

280279
## css.preprocessorMaxWorkers
281280

282-
- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/15835)
283281
- **Type:** `number | true`
284-
- **Default:** `0` (does not create any workers and run in the main thread)
282+
- **Default:** `true`
283+
284+
Specifies the maximum number of threads CSS preprocessors can use. `true` means up to the number of CPUs minus 1. When set to `0`, Vite will not create any workers and will run the preprocessors in the main thread.
285285

286-
If this option is set, CSS preprocessors will run in workers when possible. `true` means the number of CPUs minus 1.
286+
Depending on the preprocessor options, Vite may run the preprocessors on the main thread even if this option is not set to `0`.
287287

288288
## css.devSourcemap
289289

docs/guide/api-environment-frameworks.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Note that although the `FetchableDevEnvironment` is implemented as a class, it i
8484

8585
## Default `RunnableDevEnvironment`
8686

87-
Given a Vite server configured in middleware mode as described by the [SSR setup guide](/guide/ssr#setting-up-the-dev-server), let's implement the SSR middleware using the environment API. Error handling is omitted.
87+
Given a Vite server configured in middleware mode as described by the [SSR setup guide](/guide/ssr#setting-up-the-dev-server), let's implement the SSR middleware using the environment API. Remember that it doesn't have to be called `ssr`, so we'll name it `server` in this example. Error handling is omitted.
8888

8989
```js
9090
import fs from 'node:fs'
@@ -94,7 +94,7 @@ import { createServer } from 'vite'
9494

9595
const __dirname = path.dirname(fileURLToPath(import.meta.url))
9696

97-
const server = await createServer({
97+
const viteServer = await createServer({
9898
server: { middlewareMode: true },
9999
appType: 'custom',
100100
environments: {
@@ -106,7 +106,7 @@ const server = await createServer({
106106

107107
// You might need to cast this to RunnableDevEnvironment in TypeScript or
108108
// use isRunnableDevEnvironment to guard the access to the runner
109-
const environment = server.environments.node
109+
const serverEnvironment = viteServer.environments.server
110110

111111
app.use('*', async (req, res, next) => {
112112
const url = req.originalUrl
@@ -118,12 +118,14 @@ app.use('*', async (req, res, next) => {
118118
// 2. Apply Vite HTML transforms. This injects the Vite HMR client,
119119
// and also applies HTML transforms from Vite plugins, e.g. global
120120
// preambles from @vitejs/plugin-react
121-
template = await server.transformIndexHtml(url, template)
121+
template = await viteServer.transformIndexHtml(url, template)
122122

123123
// 3. Load the server entry. import(url) automatically transforms
124124
// ESM source code to be usable in Node.js! There is no bundling
125125
// required, and provides full HMR support.
126-
const { render } = await environment.runner.import('/src/entry-server.js')
126+
const { render } = await serverEnvironment.runner.import(
127+
'/src/entry-server.js',
128+
)
127129

128130
// 4. render the app HTML. This assumes entry-server.js's exported
129131
// `render` function calls appropriate framework SSR APIs,

docs/guide/api-environment-instances.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ During dev, the available environments in a dev server can be accessed using `se
1919
// create the server, or get it from the configureServer hook
2020
const server = await createServer(/* options */)
2121

22-
const environment = server.environments.client
23-
environment.transformRequest(url)
22+
const clientEnvironment = server.environments.client
23+
clientEnvironment.transformRequest(url)
2424
console.log(server.environments.ssr.moduleGraph)
2525
```
2626

docs/guide/api-environment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ For a simple SPA/MPA, no new APIs around environments are exposed to the config.
2222
When we move to a typical server-side rendered (SSR) app, we'll have two environments:
2323

2424
- `client`: runs the app in the browser.
25-
- `server`: runs the app in node (or other server runtimes) which renders pages before sending them to the browser.
25+
- `ssr`: runs the app in node (or other server runtimes) which renders pages before sending them to the browser.
2626

2727
In dev, Vite executes the server code in the same Node process as the Vite dev server, giving a close approximation to the production environment. However, it is also possible for servers to run in other JS runtimes, like [Cloudflare's workerd](https://github.com/cloudflare/workerd) which have different constraints. Modern apps may also run in more than two environments, e.g. a browser, a node server, and an edge server. Vite 5 didn't allow to properly represent these environments.
2828

docs/guide/api-hmr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ if (import.meta.hot) {
6262
6363
## IntelliSense for TypeScript
6464
65-
Vite provides type definitions for `import.meta.hot` in [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts). You can create an `env.d.ts` in the `src` directory so TypeScript picks up the type definitions:
65+
Vite provides type definitions for `import.meta.hot` in [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts). You can create an `vite-env.d.ts` in the `src` directory so TypeScript picks up the type definitions:
6666
67-
```ts
67+
```ts [vite-env.d.ts]
6868
/// <reference types="vite/client" />
6969
```
7070

docs/guide/features.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ For example, to make the default import of `*.svg` a React component:
153153
export default content
154154
}
155155
```
156-
- The file containing the reference to `vite/client`:
156+
- The file containing the reference to `vite/client` (normally `vite-env.d.ts`):
157157
```ts
158158
/// <reference types="./vite-env-override.d.ts" />
159159
/// <reference types="vite/client" />
@@ -313,7 +313,7 @@ npm add -D stylus
313313

314314
If using Vue single file components, this also automatically enables `<style lang="sass">` et al.
315315

316-
Vite improves `@import` resolving for Sass and Less so that Vite aliases are also respected. In addition, relative `url()` references inside imported Sass/Less files that are in different directories from the root file are also automatically rebased to ensure correctness.
316+
Vite improves `@import` resolving for Sass and Less so that Vite aliases are also respected. In addition, relative `url()` references inside imported Sass/Less files that are in different directories from the root file are also automatically rebased to ensure correctness. Rebasing `url()` references that starts with a variable or a interpolation are not supported due to its API constraints.
317317

318318
`@import` alias and url rebasing are not supported for Stylus due to its API constraints.
319319

@@ -364,7 +364,7 @@ Special queries can modify how assets are loaded:
364364
```js twoslash
365365
import 'vite/client'
366366
// ---cut---
367-
// Explicitly load assets as URL
367+
// Explicitly load assets as URL (automatically inlined depending on the file size)
368368
import assetAsURL from './asset.js?url'
369369
```
370370

0 commit comments

Comments
 (0)