From 9cab7e00a467605322ce545e819ff014adb9c1b6 Mon Sep 17 00:00:00 2001 From: WuMingDao <146366930+WuMingDao@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:16:22 +0800 Subject: [PATCH 1/4] Add translate comments in api-environment-runtimes.md to Chinese --- guide/api-environment-runtimes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guide/api-environment-runtimes.md b/guide/api-environment-runtimes.md index d1af0526..8dd25056 100644 --- a/guide/api-environment-runtimes.md +++ b/guide/api-environment-runtimes.md @@ -163,7 +163,7 @@ import { transport } from './rpc-implementation.js' const moduleRunner = new ModuleRunner( { transport, - createImportMeta: createNodeImportMeta, // if the module runner runs in Node.js + createImportMeta: createNodeImportMeta, // 如果模块运行程序在 Node.js 中运行 }, new ESModulesEvaluator(), ) @@ -325,7 +325,7 @@ function createWorkerEnvironment(name, config, context) { const workerHotChannel = { send: (data) => worker.postMessage(data), on: (event, handler) => { - // client is already connected + // 客户端已链接 if (event === 'vite:client:connect') return if (event === 'vite:client:disconnect') { const listener = () => { @@ -399,7 +399,7 @@ export const runner = new ModuleRunner( return response.json() }, }, - hmr: false, // disable HMR as HMR requires transport.connect + hmr: false, // 禁用 HMR,因为 HMR 需要 transport.connect }, new ESModulesEvaluator(), ) From 78d107f2380425ecc53fa33af20ec72f7d3382d2 Mon Sep 17 00:00:00 2001 From: WuMingDao <146366930+WuMingDao@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:32:58 +0800 Subject: [PATCH 2/4] Add commet translate comments to Chinese in api-environment-frameworks.md Translate comments in the API environment framework to Chinese. --- guide/api-environment-frameworks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/api-environment-frameworks.md b/guide/api-environment-frameworks.md index c1fec5ff..f9e8dabd 100644 --- a/guide/api-environment-frameworks.md +++ b/guide/api-environment-frameworks.md @@ -142,7 +142,7 @@ const server = await createServer({ createEnvironment(name, config) { return createFetchableDevEnvironment(name, config, { handleRequest(request: Request): Promise | Response { - // handle Request and return a Response + // 处理请求和返回响应 }, }) }, @@ -151,7 +151,7 @@ const server = await createServer({ }, }) -// Any consumer of the environment API can now call `dispatchFetch` +// 环境 API 的任何使用者现在都可以调用 `dispatchFetch` if (isFetchableDevEnvironment(server.environments.custom)) { const response: Response = await server.environments.custom.dispatchFetch( new Request('/request-to-handle'), From b9dc421152771d144e8b49efcf2db0f773f0799b Mon Sep 17 00:00:00 2001 From: WuMingDao <146366930+WuMingDao@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:36:51 +0800 Subject: [PATCH 3/4] Add comment translae in api-environment-plugins.md Translate comment to Chinese for clarity. --- guide/api-environment-plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/api-environment-plugins.md b/guide/api-environment-plugins.md index efbde571..46724dfe 100644 --- a/guide/api-environment-plugins.md +++ b/guide/api-environment-plugins.md @@ -56,7 +56,7 @@ Vite 服务器有一个共享的插件管道,但在处理模块时,它总是 ```ts configEnvironment(name: string, options: EnvironmentOptions) { - // add "workerd" condition to the rsc environment + // 将 "workerd" 条件增加到 rsc 环境 if (name === 'rsc') { return { resolve: { From abe3e2cc405ccd4e851cc4da2f6dab5d0f32f950 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Fri, 31 Oct 2025 16:52:39 +0800 Subject: [PATCH 4/4] Update guide/api-environment-runtimes.md --- guide/api-environment-runtimes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/api-environment-runtimes.md b/guide/api-environment-runtimes.md index 8dd25056..6a97ed79 100644 --- a/guide/api-environment-runtimes.md +++ b/guide/api-environment-runtimes.md @@ -325,7 +325,7 @@ function createWorkerEnvironment(name, config, context) { const workerHotChannel = { send: (data) => worker.postMessage(data), on: (event, handler) => { - // 客户端已链接 + // 客户端已连接 if (event === 'vite:client:connect') return if (event === 'vite:client:disconnect') { const listener = () => {