From 9e582ca3b7a1b040bb8ea8c9928ab075c52cb724 Mon Sep 17 00:00:00 2001 From: patak <583075+patak-dev@users.noreply.github.com> Date: Thu, 15 May 2025 18:48:18 -0700 Subject: [PATCH 1/4] chore!: remove node 18 support (#19972) Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com> --- guide/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/index.md b/guide/index.md index 0ea505ae..4afc63cc 100644 --- a/guide/index.md +++ b/guide/index.md @@ -44,7 +44,7 @@ The supported template presets are: ## Scaffolding Your First Vite Project ::: tip Compatibility Note -Vite requires [Node.js](https://nodejs.org/en/) version 18+ or 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. +Vite requires [Node.js](https://nodejs.org/en/) version 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. ::: ::: code-group From dc4e7c3e3e7cbb5731e532c6f3ec99c3aeb58066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0?= Date: Fri, 16 May 2025 11:35:42 +0900 Subject: [PATCH 2/4] refactor(css)!: remove sass legacy API support (#19977) --- config/shared-options.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/shared-options.md b/config/shared-options.md index 592818c1..c99ece54 100644 --- a/config/shared-options.md +++ b/config/shared-options.md @@ -227,9 +227,8 @@ Note if an inline config is provided, Vite will not search for other PostCSS con 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: - `sass`/`scss`: - - 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. - - [Options (modern)](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/) - - [Options (legacy)](https://sass-lang.com/documentation/js-api/interfaces/LegacyStringOptions). + - 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. + - [Options](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/) - `less`: [Options](https://lesscss.org/usage/#less-options). - `styl`/`stylus`: Only [`define`](https://stylus-lang.com/docs/js.html#define-name-node) is supported, which can be passed as an object. @@ -248,7 +247,7 @@ export default defineConfig({ }, }, scss: { - api: 'modern-compiler', // or "modern", "legacy" + api: 'modern-compiler', // or "modern" importers: [ // ... ], From c85353d9e1570517230edd6c9b7df4c07e0ad4d1 Mon Sep 17 00:00:00 2001 From: patak <583075+patak-dev@users.noreply.github.com> Date: Thu, 15 May 2025 19:38:54 -0700 Subject: [PATCH 3/4] feat: buildApp hook (#19971) --- guide/api-environment-frameworks.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index 3eac0479..07d30c1a 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -329,6 +329,8 @@ export default { } ``` +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. + ## Environment Agnostic Code 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. From 970f31db25273559a20b45c459f74cb85d4d2039 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Mon, 19 May 2025 10:11:46 +0800 Subject: [PATCH 4/4] fix: resolved conflict --- config/shared-options.md | 18 +++--------------- guide/api-environment-frameworks.md | 8 ++------ guide/index.md | 7 +------ 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/config/shared-options.md b/config/shared-options.md index 0c47243e..04976021 100644 --- a/config/shared-options.md +++ b/config/shared-options.md @@ -227,18 +227,10 @@ declare const __APP_VERSION__: string 指定传递给 CSS 预处理器的选项。文件扩展名用作选项的键。每个预处理器支持的选项可以在它们各自的文档中找到: - `sass`/`scss`: -<<<<<<< HEAD - - 选择要使用的 sass 应用程序接口 `api: "modern-compiler" | "modern" | "legacy"` (如果安装了`sass-embedded`,默认为`"modern-compiler"`,否则为 `"modern"`). 为获得最佳性能,建议使用 `api: "modern-compiler"` 和 `sass-embedded` 软件包。`"legacy"` API 已过时,将在 Vite 7 中移除。 - - [Options (modern)](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/) - - [Options (legacy)](https://sass-lang.com/documentation/js-api/interfaces/LegacyStringOptions). + - 选择要使用的 sass 应用程序接口 `api: "modern-compiler" | "modern"` (如果安装了`sass-embedded`,默认为`"modern-compiler"`,否则为 `"modern"`). 为获得最佳性能,建议使用 `api: "modern-compiler"` 和 `sass-embedded` 软件包。 + - [Options](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/) - `less`: [选项](https://lesscss.org/usage/#less-options). - `styl`/`stylus`: 仅支持 [`define`](https://stylus-lang.com/docs/js.html#define-name-node),可以作为对象传递。 -======= - - 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. - - [Options](https://sass-lang.com/documentation/js-api/interfaces/stringoptions/) -- `less`: [Options](https://lesscss.org/usage/#less-options). -- `styl`/`stylus`: Only [`define`](https://stylus-lang.com/docs/js.html#define-name-node) is supported, which can be passed as an object. ->>>>>>> c85353d9e1570517230edd6c9b7df4c07e0ad4d1 **示例:** @@ -255,11 +247,7 @@ export default defineConfig({ }, }, scss: { -<<<<<<< HEAD - api: 'modern-compiler', // 或 "modern","legacy" -======= - api: 'modern-compiler', // or "modern" ->>>>>>> c85353d9e1570517230edd6c9b7df4c07e0ad4d1 + api: 'modern-compiler', // 或 "modern" importers: [ // ... ], diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index 0b56cee4..386e3070 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -329,12 +329,8 @@ export default { } ``` -<<<<<<< HEAD -## 环境无关的代码 {#environment-agnostic-code} -======= -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. +插件还可以定义一个 `buildApp` 钩子。顺序 `'pre'` 和 `null'` 在配置的 `builder.buildApp` 之前执行,顺序 `'post'` 钩子在其之后执行。`environment.isBuilt` 可用于检查环境是否已被构建。 -## Environment Agnostic Code ->>>>>>> c85353d9e1570517230edd6c9b7df4c07e0ad4d1 +## 环境无关的代码 {#environment-agnostic-code} 大部分情况,当前的 `environment` 实例会作为正在运行代码的上下文中的一部分,所以通过 `server.environments` 来访问它们的需求应该很少。例如,在插件钩子内部,环境是作为 `PluginContext` 的一部分暴露出来的,所以可以使用 `this.environment` 来访问它。参见 [用于插件的环境 API](./api-environment-plugins.md) 了解如何构建对环境敏感的插件。 diff --git a/guide/index.md b/guide/index.md index 0f9c911c..0ee4dd22 100644 --- a/guide/index.md +++ b/guide/index.md @@ -43,13 +43,8 @@ Vite 还提供了强大的扩展性,可通过其 [插件 API](./api-plugin) ## 搭建第一个 Vite 项目 {#scaffolding-your-first-vite-project} -<<<<<<< HEAD ::: tip 兼容性注意 -Vite 需要 [Node.js](https://nodejs.org/en/) 版本 18+ 或 20+。然而,有些模板需要依赖更高的 Node 版本才能正常运行,当你的包管理器发出警告时,请注意升级你的 Node 版本。 -======= -::: tip Compatibility Note -Vite requires [Node.js](https://nodejs.org/en/) version 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it. ->>>>>>> c85353d9e1570517230edd6c9b7df4c07e0ad4d1 +Vite 需要 [Node.js](https://nodejs.org/en/) 版本 20+。然而,有些模板需要依赖更高的 Node 版本才能正常运行,当你的包管理器发出警告时,请注意升级你的 Node 版本。 ::: ::: code-group