Emitter framework: make the language-specific Alloy peer dependencies optional

オープン 初心者向け
#12,476 コメント 1 件 リアクション 2 件 担当者 2 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@timotheeguerin がすでに取り組んでいます。

2026年11月4日 から。

  • #12495 @copilot-swe-agent による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp, python, typescript
領域
tooling

調査の方向性

修正は、エミッターフレームワークの package.json にあります。そこでは Alloy 言語の peer が peerDependenciesMeta なしで宣言されています。@alloy-js/csharp、@alloy-js/python、@alloy-js/typescript を optional に設定し、@alloy-js/core と @typespec/compiler は必須のままにしてください。エミッター作成者向けのドキュメントページがまだ正しく読めるか確認し、そのうえで TypeScript パッケージだけをインストールしたときに peer の不足に関する警告が出ないことを確認してください。

索引モデルが issue の本文から書いたものです。

説明

emitter-framework feature triaged:core
Clear and concise description of the problem

@typespec/emitter-framework declares all of its Alloy language packages as peer dependencies, with no peerDependenciesMeta, so every one of them is required:

"peerDependencies": {
  "@alloy-js/core": "...",
  "@alloy-js/csharp": "...",
  "@alloy-js/python": "...",
  "@alloy-js/typescript": "...",
  "@typespec/compiler": "..."
}

An emitter for a single language therefore gets the other languages' packages too: package managers that install peers automatically (npm 7+, pnpm by default) download them, and the others print a missing-peer warning. A TypeScript-only emitter installs about 32 MB of C# and Python packages (27 MB and 4.8 MB unpacked) that it never loads.

Each language package is used by exactly one entry point (0.21.0, runtime imports in dist/src):

Entry point @alloy-js packages imported
@typespec/emitter-framework (root) core
@typespec/emitter-framework/typescript core, typescript
@typespec/emitter-framework/csharp core, csharp
@typespec/emitter-framework/python core, python
@typespec/emitter-framework/testing core/testing

I checked that an emitter that imports from the root and from /typescript generates and runs correctly with @alloy-js/csharp and @alloy-js/python absent. The same peers and the missing peerDependenciesMeta are on main and in 0.22.0-dev.1.

The emitter framework docs already tell emitter authors to install the packages they use as peers (npm install --save-peer @alloy-js/core @alloy-js/typescript @typespec/emitter-framework), so making the language packages optional would not change that workflow.

Proposal

Mark the language-specific peers as optional, keeping @alloy-js/core and @typespec/compiler required:

"peerDependenciesMeta": {
  "@alloy-js/csharp": { "optional": true },
  "@alloy-js/python": { "optional": true },
  "@alloy-js/typescript": { "optional": true }
}
Checklist
  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
主要言語
Java
スター
5.9k
フォーク
421
平均マージ
2日 3時間
マージ済み PR(30日)
176

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/typespec のほかの issue

microsoft/typespec の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。