Emitter framework: make the language-specific Alloy peer dependencies optional
维护者通常 1 天内回复
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- csharp, python, typescript
- 领域
- tooling
调研方向
修复位于 emitter 框架的 package.json 中,那里声明 Alloy 语言 peer 时没有设置 peerDependenciesMeta。将 @alloy-js/csharp、@alloy-js/python 和 @alloy-js/typescript 标记为可选,同时保持 @alloy-js/core 和 @typespec/compiler 为必需。检查面向 emitter 作者的文档页面是否仍然准确,然后确认只安装 TypeScript 包时不会产生缺失 peer 的警告。
由索引模型根据 Issue 内容生成。
描述
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 小时
- 30 天内合并 PR
- 176
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/typespec 的其他 Issue
-
bug emitter:client:csharp
难度 2/5 1-3 小时 新手友好度 84/100
microsoft/typespec#12572 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Make website build cross-platform compatible可能已有人在做 @pcbeingused333 今天认领。 未关闭bug meta:website
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/typespec#12550 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Upgrade C# generator Roslyn to 5.9.0可能已有人在做 @ArthurMa1978 于 7 天前认领。 未关闭emitter:client:csharp feature
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/typespec#12445 · 2 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug emitter:client:python
难度 2/5 1-3 小时 新手友好度 75/100
microsoft/typespec#12360 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
[Bug]: http-client-js reports `unknown-encoding` for a raw `bytes` body可能已有人在做 @Roxen-AS 于 21 天前认领。 未关闭bug emitter:client:js
难度 2/5 1-3 小时 新手友好度 74/100
microsoft/typespec#12356 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 microsoft/typespec 的全部 Issue
相似的 Issue
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)未关闭
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration可能已有人在做 @amalsaidov 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
area/ai area/backend component/zeebe kind/task
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
spAnser/reacharound#38 ·