Skip to content
Merged

m2d #1411

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions guide/api-environment-frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const server = await createServer({
createEnvironment(name, config) {
return createFetchableDevEnvironment(name, config, {
handleRequest(request: Request): Promise<Response> | Response {
// handle Request and return a Response
// 处理请求和返回响应
},
})
},
Expand All @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion guide/api-environment-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
6 changes: 3 additions & 3 deletions guide/api-environment-runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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(),
)
Expand Down