Skip to content
Merged
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
15 changes: 15 additions & 0 deletions src/content/docs/ko/reference/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Flags
--host <custom-address> Expose on a network IP address at <custom-address>
--open Automatically open the app in the browser on server start
--force Clear the content layer cache, forcing a full rebuild.
--ignore-lock Start the dev server even if another one is already running, without checking or writing the lock file.
--allowed-hosts Specify a comma-separated list of allowed hosts or allow any hostname.
--help (-h) See all available flags.
```
Expand Down Expand Up @@ -215,6 +216,20 @@ astro dev --background --force

<ReadMore>자동 에이전트 감지 및 상태 확인 엔드포인트에 대한 자세한 내용은 [AI 코딩 에이전트를 위한 백그라운드 모드](/ko/guides/build-with-ai/#백그라운드-모드)를 참조하세요.</ReadMore>

#### `--ignore-lock`

<p><Since v="7.1.0" /></p>

다른 실행 중인 개발 서버를 감지하는 데 사용되는 잠금 파일을 확인하거나 기록하지 않고 개발 서버를 시작합니다. 이를 통해 오류를 발생시키는 대신, 동일한 프로젝트에서 이미 실행 중인 개발 서버와 함께 새 개발 서버를 시작할 수 있습니다.

```shell
astro dev --ignore-lock --port 4322
```

새로 시작한 서버는 `astro dev stop`, `astro dev status`, `astro dev logs`에서 추적되지 않습니다.

`--background`(AI 코딩 에이전트가 실행한 경우 포함) 또는 `--force`와 함께 사용하면 오류가 발생합니다. 두 옵션 모두 잠금 파일에 의존하기 때문입니다.

<h3>하위 명령어</h3>

<p><Since v="7.0.0" /></p>
Expand Down
28 changes: 27 additions & 1 deletion src/content/docs/ko/reference/content-loader-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Astro의 [`glob()`](#glob-로더) 및 [`file()`](#file-로더) 로더는 로컬

`glob()` 로더는 파일 시스템의 모든 위치에 있는 파일 디렉터리에서 엔트리를 생성합니다. 지원되는 파일 형식은 Markdown, MDX, Markdoc, JSON, YAML, TOML 파일입니다.

이 로더는 `pattern`, `base` (선택 사항), `generateId` (선택 사항), `retainBody` (선택 사항) 속성을 가진 객체를 인자로 받습니다.
이 로더는 `pattern`, `base` (선택 사항), `generateId` (선택 사항), `retainBody` (선택 사항), `deferRender` (선택 사항) 속성을 가진 객체를 인자로 받습니다.

```ts title="src/content.config.ts"
import { defineCollection } from 'astro:content';
Expand Down Expand Up @@ -124,6 +124,32 @@ Markdown 파일의 경우 렌더링된 본문은 여전히 [`entry.rendered.html

MDX 컬렉션의 경우 저장소에 더 이상 본문이 보존되지 않으므로 컬렉션 크기가 크게 줄어듭니다.

#### `deferRender`

<p>

**타입:** `boolean`<br />
**기본값:** `false`
<Since v="7.1.0" />
</p>

Markdown 엔트리의 렌더링을 페이지에서 실제로 렌더링될 때까지 지연할지 여부입니다. `false`(기본값)인 경우 콘텐츠 동기화 중에 즉시 렌더링됩니다. 이 옵션은 MDX, Markdoc 및 데이터 엔트리(예: JSON, YAML)에는 적용되지 않습니다.

기본적으로 `glob()` 로더는 동기화 중에 각 Markdown 엔트리를 렌더링하고, 생성된 HTML을 데이터 저장소에 저장합니다. 이를 통해 렌더링된 콘텐츠를 캐시하여 여러 빌드에서 재사용할 수 있습니다. 하지만 렌더링 결과가 원본보다 훨씬 큰 대규모 컬렉션의 경우, 렌더링된 HTML을 모두 한 번에 메모리에 저장하면 빌드 중 메모리가 부족해질 수 있습니다.

`deferRender`가 `true`이면 `.mdx` 파일에서 이미 사용하는 것과 동일한 온디맨드 렌더링 방식을 사용하여, 각 엔트리가 페이지에서 실제로 렌더링될 때까지 렌더링을 미룹니다. 이렇게 하면 `astro build` 중 메모리 사용량을 일정하게 유지할 수 있지만, 렌더링된 HTML은 더 이상 데이터 저장소에 캐시되지 않습니다.

```ts title="src/content.config.ts"
const docs = defineCollection({
/* 빌드 중 메모리 부족을 방지하기 위해 대규모 Markdown 컬렉션의 렌더링을 지연합니다. */
loader: glob({
pattern: '**/*.md',
base: './src/data/docs',
deferRender: true,
}),
});
```

### `file()` 로더

<p>
Expand Down
40 changes: 40 additions & 0 deletions src/content/docs/ko/reference/integrations-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,10 @@ CSP 지시어를 `meta` 요소로 삽입할지, 응답 `header`로 삽입할지,

##### `SSRManifest.csp.scriptHashes`

:::caution[사용 중단]
대신 [`scriptDirective`](#ssrmanifestcspscriptdirective)를 사용하세요. 이 속성에는 일반 `script-src` 지시어에 해당하는 해시만 포함됩니다. 향후 메이저 버전에서 제거될 예정입니다.
:::

<p>

**타입:** `string[]`
Expand All @@ -2504,6 +2508,10 @@ CSP 지시어를 `meta` 요소로 삽입할지, 응답 `header`로 삽입할지,

##### `SSRManifest.csp.scriptResources`

:::caution[사용 중단]
대신 [`scriptDirective`](#ssrmanifestcspscriptdirective)를 사용하세요. 이 속성에는 일반 `script-src` 지시어에 해당하는 소스만 포함됩니다. 향후 메이저 버전에서 제거될 예정입니다.
:::

<p>

**타입:** `string[]`
Expand All @@ -2513,15 +2521,33 @@ CSP 지시어를 `meta` 요소로 삽입할지, 응답 `header`로 삽입할지,

##### `SSRManifest.csp.isStrictDynamic`

:::caution[사용 중단]
대신 [`scriptDirective.strictDynamic`](#ssrmanifestcspscriptdirective)을 사용하세요. 향후 메이저 버전에서 제거될 예정입니다.
:::

<p>

**타입:** `boolean`
</p>

[설정에서 동적 스크립트 삽입 지원이 활성화되었는지 여부](/ko/reference/configuration-reference/#securitycspscriptdirectivestrictdynamic)를 결정합니다.

##### `SSRManifest.csp.scriptDirective`

<p>

**타입:** `{ resources: Array<string | { resource: string; kind: 'element' | 'attribute' | 'default' }>; hashes: Array<string | { hash: string; kind: 'element' | 'attribute' | 'default' }>; strictDynamic: boolean }`<br />
<Since v="7.1.0" />
</p>

`script-src` 관련 지시어에 대한 소스, 해시, 그리고 [`'strict-dynamic'`](/ko/reference/configuration-reference/#securitycspscriptdirectivestrictdynamic) 지원 여부를 설명합니다. 각 소스와 해시는 `kind` 속성을 사용해 보다 구체적인 지시어를 대상으로 지정할 수 있습니다. `script-src-elem`에는 `'element'`를, `script-src-attr`에는 `'attribute'`를, `script-src`에는 `'default'`를 사용하세요. (`'default'`는 일반 문자열을 사용하는 것과 동일합니다.)

##### `SSRManifest.csp.styleHashes`

:::caution[사용 중단]
대신 [`styleDirective`](#ssrmanifestcspstyledirective)를 사용하세요. 이 속성에는 일반 `style-src` 지시어에 해당하는 해시만 포함됩니다. 향후 메이저 버전에서 제거될 예정입니다.
:::

<p>

**타입:** `string[]`
Expand All @@ -2531,13 +2557,27 @@ CSP 지시어를 `meta` 요소로 삽입할지, 응답 `header`로 삽입할지,

##### `SSRManifest.csp.styleResources`

:::caution[사용 중단]
대신 [`styleDirective`](#ssrmanifestcspstyledirective)를 사용하세요. 이 속성에는 일반 `style-src` 지시어에 해당하는 소스만 포함됩니다. 향후 메이저 버전에서 제거될 예정입니다.
:::

<p>

**타입:** `string[]`
</p>

[설정된 스타일 리소스](/ko/reference/configuration-reference/#securitycspstyledirectiveresources)와 [삽입된 스타일 리소스](/ko/reference/api-reference/#cspinsertstyleresource)를 결합한 유효한 소스 목록을 지정합니다.

##### `SSRManifest.csp.styleDirective`

<p>

**타입:** `{ resources: Array<string | { resource: string; kind: 'element' | 'attribute' | 'default' }>; hashes: Array<string | { hash: string; kind: 'element' | 'attribute' | 'default' }> }`<br />
<Since v="7.1.0" />
</p>

`style-src` 관련 지시어에 대한 소스와 해시를 설명합니다. 각 소스와 해시는 `kind` 속성을 사용해 보다 구체적인 지시어를 대상으로 지정할 수 있습니다. `style-src-elem`에는 `'element'`를, `style-src-attr`에는 `'attribute'`를, `style-src`에는 `'default'`를 사용하세요. (`'default'`는 일반 문자열을 사용하는 것과 동일합니다.)

##### `SSRManifest.csp.directives`

<p>
Expand Down
8 changes: 2 additions & 6 deletions src/content/docs/ko/reference/logger-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export default defineConfig({
다음 예시는 필수 `write()` 함수를 구현한 [`AstroLoggerDestination` 객체](#astrologgerdestination)를 반환하는 가장 단순한 로거를 구현합니다.

```ts title="@org/custom-logger/index.ts"
import type {
AstroLoggerLevel,
AstroLoggerDestination,
AstroLoggerMessage
} from "astro";
import type { AstroLoggerLevel, AstroLoggerDestination } from "astro";
import { matchesLevel } from "astro/logger";

type LoggerOptions = {
Expand All @@ -55,7 +51,7 @@ type LoggerOptions = {
function orgLogger(options: LoggerOptions = {}): AstroLoggerDestination {
const { level = 'info' } = options;
return {
write(message: AstroLoggerMessage) {
write(message) {
// 이 유틸리티를 사용하여 메시지 출력 여부를 판단합니다.
if (matchesLevel(message.level, level)) {
// 메시지를 기록하고 로그 레벨을 반영합니다.
Expand Down
22 changes: 15 additions & 7 deletions src/content/docs/ko/reference/routing-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ const { id } = Astro.params;
```astro title="src/pages/posts/[id].astro" {9}
---
export async function getStaticPaths() {
const response = await fetch('...');
const data = await response.json();
const response = await fetch("...");
const data: any[] = await response.json();

return data.map((post) => {
return {
Expand All @@ -167,6 +167,7 @@ export async function getStaticPaths() {
const { id } = Astro.params;
const { post } = Astro.props;
---

<h1>{id}: {post.name}</h1>
```

Expand All @@ -188,11 +189,12 @@ const { post } = Astro.props;

```astro title="src/pages/[...locale]/[files]/[slug].astro" "routePattern" "getLocalizedData"
---
import type { GetStaticPathsOptions } from "astro";
import { getLocalizedData } from "../../../utils/i18n";

export async function getStaticPaths({ routePattern }) {
const response = await fetch('...');
const data = await response.json();
export async function getStaticPaths({ routePattern }: GetStaticPathsOptions) {
const response = await fetch("...");
const data: any[] = await response.json();

console.log(routePattern); // [...locale]/[files]/[slug]

Expand All @@ -219,14 +221,19 @@ const { locale, files, slug } = Astro.params;

```astro title="src/pages/pokemon/[page].astro"
---
export async function getStaticPaths({ paginate }) {
import type { GetStaticPathsOptions } from "astro";

export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
// fetch(), getCollection() 등으로 데이터 로드
const response = await fetch(`https://pokeapi.co/api/v2/pokemon?limit=150`);
const result = await response.json();
const allPokemon = result.results;

// 모든 항목에 대한 페이지가 매겨진 경로 컬렉션을 반환
return paginate(allPokemon, { pageSize: 10 });
return paginate(allPokemon, {
pageSize: 10,
format: (url) => `${url}.html`,
});
}

const { page } = Astro.props;
Expand All @@ -239,6 +246,7 @@ const { page } = Astro.props;
- `pageSize` - 페이지당 표시되는 항목 수(기본값 `10`)
- `params` - 동적 라우트 생성을 위한 추가 매개변수 전달
- `props` - 각 페이지에서 사용할 수 있는 추가 props 전달
- `format` - **v7.1.0 버전부터 사용 가능.** 렌더링되기 전에 계산된 URL을 원하는 형태로 변경할 수 있는 함수

`paginate()`는 `[page].astro` 또는 `[...page].astro`의 파일 이름을 가정합니다. `page` 매개변수는 URL에서 페이지 번호가 됩니다:

Expand Down
Loading