Skip to content

Commit a06cf5c

Browse files
I18n (ja) : rust compiler page (#13853)
Co-authored-by: Shinya Fujino <shf0811@gmail.com>
1 parent 10109f7 commit a06cf5c

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: 試験的なRustコンパイラー
3+
sidebar:
4+
label: Rustコンパイラー
5+
i18nReady: true
6+
---
7+
8+
import Since from '~/components/Since.astro'
9+
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'
10+
11+
<p>
12+
13+
**Type:** `boolean`<br />
14+
**Default:** `false`<br />
15+
<Since v="6.0.0" />
16+
</p>
17+
18+
AstroファイルにRustベースの新しいコンパイラーを使用できるようにします。このコンパイラーはより高速で、エラーメッセージがわかりやすく、モダンなJavaScript・TypeScript・CSSの機能に対して全般的に優れたサポートを提供します。
19+
20+
将来のメジャーバージョンでは、Astroはデフォルトでこの新しいコンパイラーを使用するようになりますが、`experimental.rustCompiler`フラグを使用することで、いち早く将来の動作を試すことができます。
21+
22+
コンパイラーへのフィードバックや開発状況を確認するには、[Astroの新しいコンパイラーに関するRFC](https://github.com/withastro/roadmap/discussions/1306)をご参照ください。
23+
24+
## 使い方
25+
26+
この試験的なフラグは特定の使い方を必要とせず、Astroがプロジェクトに使用するコンパイラーにのみ影響します。
27+
28+
Rustコンパイラーを有効にするには、`astro.config.mjs`に以下を追加します。
29+
30+
```js title="astro.config.mjs" ins={4-6}
31+
import { defineConfig } from "astro/config";
32+
33+
export default defineConfig({
34+
experimental: {
35+
rustCompiler: true
36+
}
37+
});
38+
```
39+
40+
次に、`@astrojs/compiler-rs`パッケージをプロジェクトにインストールします。
41+
42+
<PackageManagerTabs>
43+
<Fragment slot="npm">
44+
```shell
45+
npm install @astrojs/compiler-rs
46+
```
47+
</Fragment>
48+
<Fragment slot="pnpm">
49+
```shell
50+
pnpm add @astrojs/compiler-rs
51+
```
52+
</Fragment>
53+
<Fragment slot="yarn">
54+
```shell
55+
yarn add @astrojs/compiler-rs
56+
```
57+
</Fragment>
58+
</PackageManagerTabs>
59+
60+
### 動作の違いについて
61+
62+
AstroのGoコンパイラーとは異なり、この試験的なRustコンパイラーは無効なHTML構造を修正しません。たとえば、以下のようなパターンはそのまま出力され、自動修正されなくなります。
63+
64+
- `<p><div>Bad nesting</div></p>``p`タグから`div`を除去する代わりに)
65+
- `<p>My paragraph` (閉じタグ`</p>`を補完する代わりに)
66+
67+
そのため、Astroファイルに無効なHTMLが含まれている場合、Rustコンパイラーによる出力が以前のコンパイラーと異なる場合や、ビルド時にエラーが発生する場合があります。
68+
69+
## 制限事項
70+
71+
現時点では、Rustコンパイラーはdevツールバーの監査が正しく機能するために必要なメタデータを出力しません。

0 commit comments

Comments
 (0)