Skip to content

Commit 05dadfc

Browse files
committed
docs(en): merging all conflicts
2 parents 053a3e4 + ebd74c7 commit 05dadfc

File tree

12 files changed

+171
-16
lines changed

12 files changed

+171
-16
lines changed

.vitepress/config.ts

+35
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ export default defineConfig({
307307
sidebar: {
308308
'/guide/': [
309309
{
310+
<<<<<<< HEAD
310311
text: '指引',
311312
items: [
312313
{
@@ -320,6 +321,30 @@ export default defineConfig({
320321
{
321322
text: '功能',
322323
link: '/guide/features'
324+
=======
325+
text: 'Introduction',
326+
items: [
327+
{
328+
text: 'Getting Started',
329+
link: '/guide/',
330+
},
331+
{
332+
text: 'Philosophy',
333+
link: '/guide/philosophy',
334+
},
335+
{
336+
text: 'Why Vite',
337+
link: '/guide/why',
338+
},
339+
],
340+
},
341+
{
342+
text: 'Guide',
343+
items: [
344+
{
345+
text: 'Features',
346+
link: '/guide/features',
347+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
323348
},
324349
{
325350
text: '命令行接口',
@@ -358,24 +383,34 @@ export default defineConfig({
358383
link: '/guide/backend-integration'
359384
},
360385
{
386+
<<<<<<< HEAD
361387
text: '比较',
362388
link: '/guide/comparisons'
363389
},
364390
{
365391
text: '故障排除',
366392
link: '/guide/troubleshooting'
393+
=======
394+
text: 'Troubleshooting',
395+
link: '/guide/troubleshooting',
396+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
367397
},
368398
{
369399
text: '性能',
370400
link: '/guide/performance',
371401
},
372402
{
403+
<<<<<<< HEAD
373404
text: '理念',
374405
link: '/guide/philosophy',
375406
},
376407
{
377408
text: '从 v5 迁移',
378409
link: '/guide/migration'
410+
=======
411+
text: 'Migration from v5',
412+
link: '/guide/migration',
413+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
379414
},
380415
{
381416
text: '破坏性变更',

.vitepress/theme/components/landing/1. hero-section/HeroDiagram.vue

+10-5
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ onMounted(() => {
520520
bottom: 0;
521521
transform: translate3d(0, 0, 0) scale(1);
522522
transition: transform 0.3s ease-in-out;
523-
background: linear-gradient(
523+
background:
524+
linear-gradient(
524525
130deg,
525526
rgba(61, 61, 61, 0.3) 0%,
526527
rgba(61, 61, 61, 0) 40%
@@ -713,7 +714,8 @@ onMounted(() => {
713714
opacity: 0.1;
714715
}
715716
716-
background: url('/noise.png'),
717+
background:
718+
url('/noise.png'),
717719
radial-gradient(
718720
circle at right center,
719721
rgb(86, 50, 119) 0%,
@@ -729,7 +731,8 @@ onMounted(() => {
729731
);
730732
731733
@media (min-width: 1024px) {
732-
background: url('/noise.png'),
734+
background:
735+
url('/noise.png'),
733736
radial-gradient(
734737
circle at right center,
735738
rgba(75, 41, 105, 0.5) 0%,
@@ -747,7 +750,8 @@ onMounted(() => {
747750
}
748751
749752
@media (min-width: 1500px) {
750-
background: url('/noise.png'),
753+
background:
754+
url('/noise.png'),
751755
radial-gradient(
752756
circle at right center,
753757
rgba(75, 41, 105, 0.5) 0%,
@@ -765,7 +769,8 @@ onMounted(() => {
765769
}
766770
767771
@media (min-width: 1800px) {
768-
background: url('/noise.png'),
772+
background:
773+
url('/noise.png'),
769774
radial-gradient(
770775
circle at right center,
771776
rgba(75, 41, 105, 0.5) 0%,

.vitepress/theme/components/landing/2. feature-section/FeatureInstantServerStart.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ onUnmounted(() => {
342342
bottom: 0;
343343
height: 100%;
344344
border-radius: 12px 0 0 12px;
345-
background: url('/noise.png'),
345+
background:
346+
url('/noise.png'),
346347
radial-gradient(
347348
ellipse 140% 80% at 96% bottom,
348349
#13b351 0%,

.vitepress/theme/composables/sponsor.ts

-6
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ const viteSponsors: Pick<Sponsors, 'special' | 'gold'> = {
4545
url: 'https://nuxtlabs.com',
4646
img: '/nuxtlabs.svg',
4747
},
48-
// sponsors bluwy
49-
{
50-
name: 'Astro',
51-
url: 'https://astro.build',
52-
img: '/astro.svg',
53-
},
5448
],
5549
gold: [
5650
// now automated via sponsors.vuejs.org too

.vitepress/theme/styles/landing.css

+4-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ html:has(.landing) {
176176

177177
&.btn--primary {
178178
position: relative;
179-
background: radial-gradient(
179+
background:
180+
radial-gradient(
180181
141.42% 141.42% at 100% 0%,
181182
rgba(255, 255, 255, 0.4) 0%,
182183
rgba(255, 255, 255, 0) 100%
@@ -194,7 +195,8 @@ html:has(.landing) {
194195
box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.75) inset;
195196

196197
&:hover {
197-
background: radial-gradient(
198+
background:
199+
radial-gradient(
198200
141.42% 141.42% at 100% 0%,
199201
rgba(255, 255, 255, 0.5) 0%,
200202
rgba(255, 255, 255, 0) 100%

_data/team.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const core = [
4545
avatar: 'https://github.com/bluwy.png',
4646
name: 'Bjorn Lu',
4747
title: 'Open Source Developer',
48-
desc: 'Vite, Astro, and Svelte core team member.',
48+
desc: 'Building tools for fun.',
4949
links: [
5050
{ icon: 'github', link: 'https://github.com/bluwy' },
5151
{ icon: 'bluesky', link: 'https://bsky.app/profile/bluwy.me' },

blog/announcing-vite2.md

+4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ Vite(法语意思是 “快”,发音为 `/vit/`,类似 veet)是一种
3333

3434
想知道 Vite 有多快?看看这个[视频比较](https://twitter.com/amasad/status/1355379680275128321), 在 Repl.it 上从零启动一个基于 Vite 的 React 应用,浏览器页面加载完毕的时候,基于 CRA(`create-react-app`)的应用甚至还没有安装完依赖。
3535

36+
<<<<<<< HEAD
3637
如果你还没听说过 Vite 到底是什么,可以到 [这里](/guide/why) 了解一下项目的设计初衷。如果你想要了解 Vite 跟其它一些类似的工具有什么区别,可以参考这里的 [对比](/guide/comparisons)
38+
=======
39+
If you've never heard of Vite before and would love to learn more about it, check out [the rationale behind the project](https://vite.dev/guide/why.html). If you are interested in how Vite differs from other similar tools, check out the [comparisons](https://v5.vite.dev/guide/comparisons.html).
40+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
3741
3842
## 2.0 带来了什么 {#whats-new-in-2-0}
3943

guide/features.md

+48-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export type { T }
7171

7272
- [TypeScript 文档](https://www.typescriptlang.org/tsconfig#useDefineForClassFields)
7373

74+
<<<<<<< HEAD
7475
从 Vite v2.5.0 开始,如果 TypeScript 的 target 是 `ESNext``ES2022` 及更新版本,此选项默认值则为 `true`。这与 [`tsc` v4.3.2 及以后版本的行为](https://github.com/microsoft/TypeScript/pull/42663) 一致。这也是标准的 ECMAScript 的运行时行为。
7576

7677
若设了其他 TypeScript target,则本项会默认为 `false`.
@@ -83,6 +84,15 @@ export type { T }
8384
大多数库都希望 `"useDefineForClassFields": true`,如 [MobX](https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties)
8485

8586
但是有几个库还没有兼容这个新的默认值,其中包括 [`lit-element`](https://github.com/lit/lit-element/issues/1030)。如果遇到这种情况,请将 `useDefineForClassFields` 设置为 `false`
87+
=======
88+
The default value will be `true` if the TypeScript target is `ES2022` or newer including `ESNext`. It is consistent with the [behavior of TypeScript 4.3.2+](https://github.com/microsoft/TypeScript/pull/42663).
89+
Other TypeScript targets will default to `false`.
90+
91+
`true` is the standard ECMAScript runtime behavior.
92+
93+
If you are using a library that heavily relies on class fields, please be careful about the library's intended usage of it.
94+
While most libraries expect `"useDefineForClassFields": true`, you can explicitly set `useDefineForClassFields` to `false` if your library doesn't support it.
95+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
8696
8797
#### `target` {#target}
8898

@@ -124,21 +134,39 @@ Vite 默认的类型定义是写给它的 Node.js API 的。要将其补充到
124134
/// <reference types="vite/client" />
125135
```
126136

137+
<<<<<<< HEAD
127138
或者,你也可以将 `vite/client` 添加到 `tsconfig.json` 中的 `compilerOptions.types` 下:
139+
=======
140+
::: details Using `compilerOptions.types`
141+
142+
Alternatively, you can add `vite/client` to `compilerOptions.types` inside `tsconfig.json`:
143+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
128144
129145
```json [tsconfig.json]
130146
{
131147
"compilerOptions": {
132-
"types": ["vite/client"]
148+
"types": ["vite/client", "some-other-global-lib"]
133149
}
134150
}
135151
```
136152

153+
<<<<<<< HEAD
137154
这将会提供以下类型定义补充:
138155

139156
- 资源导入 (例如:导入一个 `.svg` 文件)
140157
- `import.meta.env` 上 Vite 注入的 [常量变量](./env-and-mode#env-variables) 的类型定义
141158
- `import.meta.hot` 上的 [HMR API](./api-hmr) 类型定义
159+
=======
160+
Note that if [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types) is specified, only these packages will be included in the global scope (instead of all visible ”@types” packages).
161+
162+
:::
163+
164+
`vite/client` provides the following type shims:
165+
166+
- Asset imports (e.g. importing an `.svg` file)
167+
- Types for the Vite-injected [constants](./env-and-mode#env-variables) on `import.meta.env`
168+
- Types for the [HMR API](./api-hmr) on `import.meta.hot`
169+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
142170
143171
::: tip
144172
要覆盖默认的类型定义,请添加一个包含你所定义类型的文件,请在三斜线注释 reference `vite/client` 前添加定义。
@@ -204,6 +232,7 @@ HTML 文件位于 Vite 项目的[最前端和中心](/guide/#index-html-and-proj
204232

205233
要退出对某些元素的 HTML 处理,可以在元素上添加 `vite-ignore` 属性,这在引用外部 assets 或 CDN 时非常有用。
206234

235+
<<<<<<< HEAD
207236
## Vue {#vue}
208237

209238
Vite 为 Vue 提供第一优先级支持:
@@ -212,14 +241,32 @@ Vite 为 Vue 提供第一优先级支持:
212241
- Vue 3 JSX 支持:[@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
213242
- Vue 2.7 SFC 支持:[@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2)
214243
- Vue 2.7 JSX 支持:[@vitejs/plugin-vue2-jsx](https://github.com/vitejs/vite-plugin-vue2-jsx)
244+
=======
245+
## Frameworks
246+
247+
All modern frameworks maintain integrations with Vite. Most framework plugins are maintained by each framework team, with the exception of the official Vue and React Vite plugins that are maintained in the vite org:
248+
249+
- Vue support via [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue)
250+
- Vue JSX support via [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
251+
- React support via [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react)
252+
- React using SWC support via [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc)
253+
254+
Check out the [Plugins Guide](https://vite.dev/plugins) for more information.
255+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
215256
216257
## JSX {#jsx}
217258

218259
`.jsx``.tsx` 文件同样开箱即用。JSX 的转译同样是通过 [esbuild](https://esbuild.github.io)
219260

261+
<<<<<<< HEAD
220262
Vue 用户应使用官方提供的 [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) 插件,它提供了 Vue 3 特性的支持,包括 HMR,全局组件解析,指令和插槽。
221263

222264
如果不是在 React 或 Vue 中使用 JSX,自定义的 `jsxFactory``jsxFragment` 可以使用 [`esbuild` 选项](/config/shared-options.md#esbuild) 进行配置。例如对 Preact:
265+
=======
266+
Your framework of choice will already configure JSX out of the box (for example, Vue users should use the official [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) plugin, which provides Vue 3 specific features including HMR, global component resolving, directives and slots).
267+
268+
If using JSX with your own framework, custom `jsxFactory` and `jsxFragment` can be configured using the [`esbuild` option](/config/shared-options.md#esbuild). For example, the Preact plugin would use:
269+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
223270
224271
```js twoslash [vite.config.js]
225272
import { defineConfig } from 'vite'

guide/index.md

+36
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,35 @@ Vite 也支持多个 `.html` 作入口点的 [多页面应用模式](./build#mul
202202

203203
## 使用未发布的功能 {#using-unreleased-commits}
204204

205+
<<<<<<< HEAD
205206
如果你迫不及待想要体验最新的功能,可以自行克隆 [vite 仓库](https://github.com/vitejs/vite) 到本地机器上然后自行将其链接(将需要 [pnpm](https://pnpm.io/)):
207+
=======
208+
If you can't wait for a new release to test the latest features, you can install a specific commit of Vite with https://pkg.pr.new:
209+
210+
::: code-group
211+
212+
```bash [npm]
213+
$ npm install -D https://pkg.pr.new/vite@SHA
214+
```
215+
216+
```bash [Yarn]
217+
$ yarn add -D https://pkg.pr.new/vite@SHA
218+
```
219+
220+
```bash [pnpm]
221+
$ pnpm add -D https://pkg.pr.new/vite@SHA
222+
```
223+
224+
```bash [Bun]
225+
$ bun add -D https://pkg.pr.new/vite@SHA
226+
```
227+
228+
:::
229+
230+
Replace `SHA` with any of [Vite's commit SHAs](https://github.com/vitejs/vite/commits/main/). Note that only commits within the last month will work, as older commit releases are purged.
231+
232+
Alternatively, you can also clone the [vite repo](https://github.com/vitejs/vite) to your local machine and then build and link it yourself ([pnpm](https://pnpm.io/) is required):
233+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
206234
207235
```bash
208236
git clone https://github.com/vitejs/vite.git
@@ -215,6 +243,14 @@ pnpm link --global # 在这一步中可使用你喜欢的包管理器
215243

216244
然后,回到你的 Vite 项目并运行 `pnpm link --global vite`(或者使用你的其他包管理工具来全局链接 `vite`)。重新启动开发服务器来体验新功能吧!
217245

246+
<<<<<<< HEAD
218247
## 社区 {#community}
248+
=======
249+
::: tip Dependencies using Vite
250+
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/package_json#pnpmoverrides).
251+
:::
252+
253+
## Community
254+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
219255
220256
如果你有疑问或者需要帮助,可以到 [Discord](https://chat.vite.dev)[GitHub Discussions](https://github.com/vitejs/vite/discussions) 社区来寻求帮助。

guide/why.md

+10
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ Vite 目前的插件 API 与使用 `esbuild` 作为打包器并不兼容。尽
5757

5858
Rollup 已经开始着手改进性能,[在 v4 中将其解析器切换到 SWC](https://github.com/rollup/rollup/pull/5073)。同时还有一个正在进行中的工作,即构建一个名为 Rolldown 的 Rust 版本的 Rollup。一旦 Rolldown 准备就绪,它就可以在 Vite 中取代 Rollup 和 esbuild,显著提高构建性能,并消除开发和构建之间的不一致性。你可以观看 [Evan You 在 ViteConf 2023 的主题演讲](https://youtu.be/hrdwQHoAp0M) 了解更多细节。
5959

60+
<<<<<<< HEAD
6061
## Vite 与 X 的区别是? {#how-is-vite-different-from-x}
6162

6263
你可以查看 [比较](./comparisons.md) 章节获取更多细节,了解 Vite 与同类工具的异同。
64+
=======
65+
## How Vite Relates to Other Unbundled Build Tools?
66+
67+
[WMR](https://github.com/preactjs/wmr) by the Preact team looked to provide a similar feature set. Vite's universal Rollup plugin API for dev and build was inspired by it. WMR is no longer maintained. The Preact team now recommends Vite with [@preactjs/preset-vite](https://github.com/preactjs/preset-vite).
68+
69+
[Snowpack](https://www.snowpack.dev/) was also a no-bundle native ESM dev server, very similar in scope to Vite. Vite's dependency pre-bundling is also inspired by Snowpack v1 (now [`esinstall`](https://github.com/snowpackjs/snowpack/tree/main/esinstall)). Snowpack is no longer being maintained. The Snowpack team is now working on [Astro](https://astro.build/), a static site builder powered by Vite.
70+
71+
[@web/dev-server](https://modern-web.dev/docs/dev-server/overview/) (previously `es-dev-server`) is a great project and Vite 1.0's Koa-based server setup was inspired by it. The `@web` umbrella project is actively maintained and contains many other excellent tools that may benefit Vite users as well.
72+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79

package.json

+19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
<<<<<<< HEAD
23
"name": "vite-docs-cn",
34
"version": "1.0.0",
45
"description": "Vite.js documentation Chinese translation.",
@@ -32,4 +33,22 @@
3233
"gitHooks": {
3334
"commit-msg": "node scripts/verifyCommit.js"
3435
}
36+
=======
37+
"name": "docs",
38+
"private": true,
39+
"type": "module",
40+
"scripts": {
41+
"docs": "vitepress dev",
42+
"docs-build": "vitepress build",
43+
"docs-serve": "vitepress serve"
44+
},
45+
"devDependencies": {
46+
"@shikijs/vitepress-twoslash": "^2.5.0",
47+
"@types/express": "^4.17.21",
48+
"feed": "^4.2.2",
49+
"vitepress": "^1.6.3",
50+
"vitepress-plugin-group-icons": "^1.3.6",
51+
"vue": "^3.5.13"
52+
}
53+
>>>>>>> ebd74c77072778dd0436838f2b46ccda4e5fed79
3554
}

public/_redirects

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ https://cn.vitejs.dev/* https://cn.vite.dev/:splat 301!
55
/guide/api-vite-runtime.html /guide/api-environment 302
66
/guide/api-vite-environment /guide/api-environment 302
77
/guide/api-vite-environment.html /guide/api-environment 302
8+
/guide/comparisons /guide/why#how-vite-relates-to-other-unbundled-build-tools 302
9+
/guide/comparisons.html /guide/why#how-vite-relates-to-other-unbundled-build-tools 302

0 commit comments

Comments
 (0)