Skip to content

Commit

Permalink
i18n(zh-cn): Update cloudflare.mdx (#8828)
Browse files Browse the repository at this point in the history
* i18n(zh-cn): Update `cloudflare.mdx`

* Update cloudflare.mdx

* fix typo

* fix typo

* fix typo

---------

Co-authored-by: liruifengv <liruifeng1024@gmail.com>
  • Loading branch information
Nin3lee and liruifengv committed Jul 17, 2024
1 parent 1bc9db9 commit 661479f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/content/docs/zh-cn/guides/integrations-guide/cloudflare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export default defineConfig({

<p>
**类型:** `'passthrough' | 'cloudflare' | 'compile' | 'custom'`<br />
**默认值:** `'passthrough'`
**默认值:** `'compile'`
</p>

确定适配器使用哪个图像服务。当配置了不兼容的图像服务时,适配器将默认使用 `passthrough` 模式。否则,它将使用全局配置的图像服务:
确定适配器使用哪个图像服务。当配置了不兼容的图像服务时,适配器将默认使用 `compile` 模式。否则,它将使用全局配置的图像服务:

* **`cloudflare`** 使用 [Cloudflare 图像调整](https://developers.cloudflare.com/images/image-resizing/) 服务。
* **`passthrough`** 使用现有的 [`noop`](/zh-cn/guides/images/#配置-no-op-透传服务) 服务。
Expand All @@ -113,6 +113,7 @@ export default defineConfig({
此处提供的代理尽最大努力模拟真实生产环境。虽然它们旨在尽可能接近真实情况,但两者之间可能存在轻微的差异和不一致。
:::

#### platformProxy.enabled
<p>
**类型:** `{ enabled?: boolean }`<br />
**默认值:** `{ enabled: false }`
Expand Down Expand Up @@ -179,6 +180,8 @@ export default defineConfig({
**默认值:** `undefined`
</p>

`routes.extend.include` 数组中配置 Cloudflare 适配器按需生成的其他路由。

#### routes.extend.exclude

<p>
Expand Down Expand Up @@ -314,14 +317,13 @@ declare namespace App {

### 路由

你可以使用 [Cloudflare 路由](https://developers.cloudflare.com/pages/platform/functions/routing/#functions-invocation-routes) 通过 `_routes.json` 文件来定义哪些路由会调用函数,哪些路由是静态资源。

#### 自定义 `_routes.json`
[Cloudflare 路由](https://developers.cloudflare.com/pages/platform/functions/routing/#functions-invocation-routes) 使用 `_routes.json` 文件来确定哪些请求被路由到 SSR 功能,哪些请求作为静态资产提供。默认情况下,`_routes.json` 文件将根据项目的文件和配置自动生成。

默认情况下,适配器会基于你应用的动态和静态路由生成一个 `_routes.json` 文件,当中包含了 `include``exclude` 规则
你可以在适配器配置中 [指定要遵循的其他路由模式](#routesextend),或者创建你自己的自定义 `_routes.json` 文件以完全覆盖自动生成

#### 自定义 `_routes.json`

这将使 Cloudflare 能够在没有函数调用的情况下提供文件和处理静态重定向。创建自定义的 `_routes.json` 将覆盖这种自动生成的文件。参阅 [Cloudflare 关于创建自定义 `routes.json` 的文档](https://developers.cloudflare.com/pages/platform/functions/routing/#create-a-_routesjson-file) 了解更多细节。
创建自定义的 `public/_routes.json` 将覆盖这种自动生成的文件。参阅 [Cloudflare 关于创建自定义 `_routes.json` 的文档](https://developers.cloudflare.com/pages/platform/functions/routing/#create-a-_routesjson-file) 了解更多细节。

## Cloudflare 模块导入

Expand Down

0 comments on commit 661479f

Please sign in to comment.