Skip to content

Commit

Permalink
Merge branch 'main' into i18n/fr-update-integrations-guide/vercel.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
dreyfus92 authored Aug 22, 2024
2 parents b654254 + 9931f64 commit 612850f
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/content/docs/en/guides/integrations-guide/netlify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ If you use `redirects` configuration in your Astro config, the Netlify adapter c

```js title="astro.config.mjs"
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/static';
import netlify from '@astrojs/netlify';

export default defineConfig({
// ...
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/reference/configuration-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ export const collections = { blog, dogs };
```

:::note
Loaders will not automatically [exclude files prefaced with an `_`](/en/guides/routing/#excluding-pages). Use a regular expression such as `pattern: '**\/[^_]*.md` in your loader to ignore these files.
Loaders will not automatically [exclude files prefaced with an `_`](/en/guides/routing/#excluding-pages). Use a regular expression such as `pattern: '**\/[^_]*.md'` in your loader to ignore these files.
:::

#### Querying and rendering with the Content Layer API
Expand Down
7 changes: 6 additions & 1 deletion src/content/docs/fr/guides/astro-db.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,18 @@ Pour ajouter des données de développement pour les tests et le débogage dans
L'exemple suivant définit deux lignes de données de développement pour une table `Comment` :

```ts title="db/seed.ts"
import { db, Comment } from 'astro:db';
import { db, Comment, Author } from 'astro:db';

export default async function() {
await db.insert(Author).values([
{ id: 1, name: "Kasim" },
{ id: 2, name: "Mina" },
]);

await db.insert(Comment).values([
{ authorId: 1, body: 'Hope you like Astro DB!' },
{ authorId: 2, body: 'Enjoy!'},
])
}
```

Expand Down
8 changes: 3 additions & 5 deletions src/content/docs/fr/guides/content-collections.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Collections de contenus
description: Les collections de contenu permettent d'organiser votre Markdown et de vérifier la typographie de votre contenu avec des schémas.
description: >-
Les collections de contenu permettent d'organiser votre Markdown et de
vérifier les types dans votre frontmatter à l'aide de schémas.
i18nReady: true
---
import { FileTree } from '@astrojs/starlight/components';
Expand Down Expand Up @@ -36,10 +38,6 @@ Le répertoire `.astro` sera mis à jour automatiquement chaque fois que vous la

:::tip
Si vous utilisez Git pour le contrôle de version, nous vous recommandons d'ignorer le répertoire `.astro` en ajoutant `.astro` à votre `.gitignore`. Cela indique à Git d'ignorer ce répertoire et tous les fichiers qu'il contient.

```bash
echo "\n.astro" >> .gitignore
```
:::


Expand Down
4 changes: 1 addition & 3 deletions src/content/docs/fr/guides/integrations-guide/netlify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,13 @@ Pour plus d'informations, voir [le guide d'autorisation des images distantes](/f

Pour les sites statiques (`output : 'static'`) hébergés sur Netlify, vous n'avez généralement pas besoin d'adaptateur. Cependant, certaines fonctionnalités de déploiement ne sont disponibles qu'à travers un adaptateur.

### Sites statiques

Les sites statiques devront installer cet adaptateur pour utiliser et configurer le [service d'image de Netlify](#support-du-cdn-dimages-netlify).

Si vous utilisez la configuration `redirects` dans votre configuration Astro, l'adaptateur Netlify peut être utilisé pour traduire cette configuration au format `_redirects` approprié.

```js title="astro.config.mjs"
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/static';
import netlify from '@astrojs/netlify';

export default defineConfig({
// ...
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/fr/reference/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ Un objet [URL](https://developer.mozilla.org/fr/docs/Web/API/URL) construit à p

Equivalent à `new URL(Astro.request.url)`.

`Astro.url` aura pour valeur `localhost` en mode dev pour les sites statiques quand [site](/fr/reference/configuration-reference/#site) n'est pas configuré et pour les sites rendus à la demande utilisant la sortie `server` ou `hybrid`.

```astro
<h1>L'URL actuelle est : {Astro.url}</h1>
<h1>Le chemin d'accès à l'URL actuelle est : {Astro.url.pathname}</h1>
Expand Down
18 changes: 11 additions & 7 deletions src/content/docs/fr/reference/configuration-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,10 @@ const dogs = defineCollection({
export const collections = { blog, dogs };
```

:::note
Les chargeurs n'[excluront pas automatiquement les fichiers précédés d'un `_`](/fr/guides/routing/#exclure-des-pages). Utilisez une expression régulière telle que `pattern: '**\/[^_]*.md'` dans votre chargeur pour ignorer ces fichiers.
:::

#### Interrogation et rendu avec l'API Content Layer

La collection peut être [interrogeée de la même manière que les collections de contenu](/fr/guides/content-collections/#interroger-les-collections):
Expand Down Expand Up @@ -1781,8 +1785,8 @@ Vous pouvez convertir une collection de contenu existante avec des entrées Mark

const blog = defineCollection({
// Pour la couche de contenu, vous ne définissez plus de `type`
type: 'content',
loader: glob({ pattern: "**\/*.md", base: "./src/data/blog" }),
type: 'content',
loader: glob({ pattern: "**\/*.md", base: "./src/data/blog" }),
schema: z.object({
title: z.string(),
description: z.string(),
Expand Down Expand Up @@ -1813,13 +1817,13 @@ Vous pouvez convertir une collection de contenu existante avec des entrées Mark
```astro ins={4,9} del={3,8}
// src/pages/index.astro
---
import { getEntry } from 'astro:content';
import { getEntry, render } from 'astro:content';
import { getEntry } from 'astro:content';
import { getEntry, render } from 'astro:content';
const post = await getEntry('blog', params.slug);
const post = await getEntry('blog', params.slug);
const { Content, headings } = await post.render();
const { Content, headings } = await render(post);
const { Content, headings } = await post.render();
const { Content, headings } = await render(post);
---
<Content />
Expand Down
4 changes: 0 additions & 4 deletions src/content/docs/ko/guides/content-collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ Astro는 프로젝트의 `.astro` 디렉터리에 콘텐츠 컬렉션을 위한

:::tip
버전 제어를 위해 Git을 사용하는 경우 `.gitignore``.astro`를 추가하여 `.astro` 디렉터리를 무시하는 것이 좋습니다. 이는 Git에게 이 디렉터리와 그 안에 있는 모든 파일을 무시하도록 지시합니다.

```bash
echo "\n.astro" >> .gitignore
```
:::

### 여러 컬렉션으로 구성하기
Expand Down
6 changes: 6 additions & 0 deletions src/content/docs/ko/guides/integrations-guide/vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ export default defineConfig({

### 함수 번들링 구성

:::caution[사용되지 않음]
`functionPerRoute` 옵션은 더 이상 사용되지 않으며 Astro 5에서 완전히 제거될 예정입니다. 또한 이 옵션은 i18n 도메인 및 요청 리라이 등 일부 Astro 기능과 호환되지 않습니다.

`functionPerRoute: true`를 활성화한 경우, 가능한 한 빨리 이 구성 옵션을 제거하는 것이 좋습니다.
:::

Vercel 어댑터는 기본적으로 모든 경로를 단일 함수로 결합합니다.

`functionPerRoute` 옵션을 사용하여 빌드를 각 경로에 대한 개별 함수로 나눌 수 있습니다. 이렇게 하면 각 함수의 크기가 줄어들어 개별 함수의 크기 제한을 초과할 가능성이 줄어듭니다. 또한, 코드 시작이 더 빠릅니다.
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/ko/reference/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ return Astro.rewrite(new Request(new URL("../", Astro.url), {

`new URL(Astro.request.url)`을 수행하는 것과 동일합니다.

정적 사이트 및 `server` 또는 `hybrid` 출력을 사용하는 주문형 렌더링 사이트에서 [site](/ko/reference/configuration-reference/#site)가 구성되지 않은 경우 개발 모드에서 `Astro.url``localhost`가 됩니다.

```astro
<h1>The current URL is: {Astro.url}</h1>
<h1>The current URL pathname is: {Astro.url.pathname}</h1>
Expand Down
19 changes: 13 additions & 6 deletions src/content/docs/ko/reference/configuration-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,10 @@ const dogs = defineCollection({
export const collections = { blog, dogs };
```

:::note
로더는 [`_`로 시작하는 파일을 자동으로 제외](/ko/guides/routing/#페이지-제외)하지 않습니다. 이러한 파일을 제외하려면 `pattern: '**\/[^_]*.md'`와 같은 정규 표현식을 사용하세요.
:::

#### Content Layer API로 쿼리 및 렌더링하기

컬렉션은 [콘텐츠 컬렉션과 동일한 방식으로 쿼리](/ko/guides/content-collections/#컬렉션-쿼리)할 수 있습니다:
Expand Down Expand Up @@ -1854,7 +1858,7 @@ export const collections = { countries };
const blog = defineCollection({
// 콘텐츠 레이어의 경우 더 이상 `type`을 정의하지 않습니다.
type: 'content',
loader: glob({ pattern: "**\/*.md", base: "./src/data/blog" }),
loader: glob({ pattern: '**\/[^_]*.md', base: "./src/data/blog" }),
schema: z.object({
title: z.string(),
description: z.string(),
Expand Down Expand Up @@ -1885,12 +1889,15 @@ export const collections = { countries };
```astro ins={4,9} del={3,8}
// src/pages/index.astro
---
import { getEntry } from 'astro:content';
import { getEntry, render } from 'astro:content';
const post = await getEntry('blog', params.slug);
const { Content, headings } = await post.render();
const { Content, headings } = await render(post);
import { getEntry } from 'astro:content';
import { getEntry, render } from 'astro:content';
const post = await getEntry('blog', params.slug);
const { Content, headings } = await post.render();
const { Content, headings } = await render(post);
---
<Content />
```

Expand Down
6 changes: 5 additions & 1 deletion src/content/docs/zh-cn/editor-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import ReadMore from '~/components/ReadMore.astro';

## JetBrains IDE

Astro 的初始支持已经在 WebStorm 2023.1 中推出。你可以通过 [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/20959-astro) 或在 IDE 的插件选项卡中搜索“Astro”来安装官方插件。此插件包括诸如语法高亮、代码补全和格式化之类的功能,并计划在未来添加更多高级功能。它还可用于所有其他[支持 JavaScript 的 JetBrains IDE](https://www.jetbrains.com/products/#lang=js&type=ide)
[Webstorm](https://www.jetbrains.com/webstorm/) 是一个 JavaScript 和 TypeScript IDE,从 2024.2 版本开始支持 Astro 语言服务器。此更新带来了语法高亮、代码补全和格式化等功能。

通过 [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/20959-astro) 安装官方插件,或在 IDE 的插件标签页中搜索 "Astro"。你可以在 `Settings | Languages & Frameworks | TypeScript | Astro` 中切换语言服务器。

有关 Webstorm 中 Astro 支持的更多信息,请查看[官方 Webstorm Astro 文档](https://www.jetbrains.com/help/webstorm/astro.html)

## 其他代码编辑器

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const myVariable = env.MY_VARIABLE;
你可以使用 `Runtime` 来为 `runtime` 对象添加类型:

```ts title="src/env.d.ts"
/// <reference types="astro/client" />
/// <reference path="../.astro/types.d.ts" />

type Runtime = import('@astrojs/cloudflare').Runtime<Env>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ const {

```ts title="src/env.d.ts"
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

type NetlifyLocals = import('@astrojs/netlify').NetlifyLocals

Expand Down
7 changes: 6 additions & 1 deletion src/content/docs/zh-cn/guides/integrations-guide/vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ export default defineConfig({

### 函数打包配置

:::caution[已废弃]
`functionPerRoute` 选项已被弃用,并将在 Astro 5 中完全删除。此外,此选项与一些 Astro 功能不兼容,例如 i18n 域和请求重写。

如果你当前已启用 `functionPerRoute: true`,我们建议尽快删除此配置选项。
:::

Vercel 适配器默认将所有路由组合成一个函数。

你也可以使用 `functionPerRoute` 选项将构建拆分为每个路由一个函数。这样可以减少每个函数的大小,这意味着你不太可能超过单个函数的大小限制。并且,代码启动更快。
Expand Down Expand Up @@ -419,7 +425,6 @@ export default defineConfig({

```ts
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

type EdgeLocals = import('@astrojs/vercel').EdgeLocals

Expand Down
3 changes: 2 additions & 1 deletion src/content/docs/zh-cn/guides/middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ export const onRequest = (context, next) => {
要给 `Astro.locals` 内的信息定义类型,也就是在 `.astro` 文件和中间件代码中能提供自动补全,在 `env.d.ts` 文件中声明一个全局命名空间:

```ts title="src/env.d.ts"
/// <reference types="astro/client" />
/// <reference path="../.astro/types.d.ts" />

declare namespace App {
interface Locals {
user: {
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/zh-cn/guides/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Astro 中包含三个可扩展的 `tsconfig.json` 模板:`base`、`strict` 和
此外,我们的模板在 `src` 文件夹中包含一个名为 `env.d.ts` 的文件,它为你的项目提供 [Vite 的客户端类型](https://cn.vitejs.dev/guide/features.html#client-types)

```typescript title="env.d.ts"
/// <reference types="astro/client" />
/// <reference path="../.astro/types.d.ts" />
```

### TypeScript 编辑器插件
Expand Down
7 changes: 0 additions & 7 deletions src/content/docs/zh-cn/install-and-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,6 @@ Astro 将在一个单独的文件夹(默认为 `dist/`)中构建你的网站
}
```

最后,创建 `src/env.d.ts`,让 TypeScript 知道 Astro 项目中可用的环境类型:

```ts title="src/env.d.ts"
/// <reference types="astro/client" />
```

阅读 Astro 的 [TypeScript 设置指南](/zh-cn/guides/typescript/#设置) 以获取更多信息。

7. 接下来
Expand All @@ -411,7 +405,6 @@ Astro 将在一个单独的文件夹(默认为 `dist/`)中构建你的网站
- src/
- pages/
- index.astro
- env.d.ts
- astro.config.mjs
- package-lock.json 或 `yarn.lock``pnpm-lock.yaml` 等。
- package.json
Expand Down
4 changes: 3 additions & 1 deletion src/content/docs/zh-cn/reference/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Commands
docs Open documentation in your web browser.
info List info about your current Astro setup.
preview Preview your build locally.
sync Generate content collection types.
sync Generate TypeScript types for all Astro modules.
preferences Configure user preferences.
telemetry Configure telemetry settings.

Expand Down Expand Up @@ -216,6 +216,8 @@ Global Flags

- `astro:content` 模块用于 [内容集合 API](/zh-cn/guides/content-collections/)
- `astro:db` 模块用于 [Astro DB](/zh-cn/guides/astro-db/)
- `astro:env` 模块用于 [实验性的 Astro Env](/zh-cn/reference/configuration-reference/#experimentalenv)
- `astro:actions` 模块用于 [实验性的 Astro Actions](/zh-cn/reference/configuration-reference/#experimentalactions)

## `astro add`

Expand Down

0 comments on commit 612850f

Please sign in to comment.