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

Đang mở Phù hợp với người mới
#12,476 1 bình luận 2 reaction 2 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@timotheeguerin đang làm issue này rồi.

Từ ngày 4/11/2026.

  • #12495 của @copilot-swe-agent — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
tooling

Hướng nghiên cứu

Bản sửa nằm trong package.json của framework emitter, nơi các peer ngôn ngữ Alloy được khai báo mà không có peerDependenciesMeta. Đánh dấu @alloy-js/csharp, @alloy-js/python và @alloy-js/typescript là tùy chọn (optional), đồng thời giữ @alloy-js/core và @typespec/compiler là bắt buộc. Kiểm tra xem trang tài liệu dành cho tác giả emitter còn đọc đúng hay không, rồi xác nhận rằng khi chỉ cài gói TypeScript thì không có cảnh báo peer bị thiếu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Java
Star
5.9k
Fork
421
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
176

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/typespec

Tất cả issue của microsoft/typespec

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.