Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

platform-api-docs: `scan` strategy misses ESM-only packages, which ship `.d.ts` rather than `.d.cts`

未关闭 适合新手
#10,472 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
documentation

调研方向

从 packages/platform-api-docs/src/generate.ts 第 393 行附近开始,检查扫描 glob 及其去重行为。在匹配两种声明扩展名后运行一次全新的 yarn build;当两种扩展名都存在时,ESM-only 包能够被包含且不会生成重复文档,即表示完成。

由索引模型根据 Issue 内容生成。

描述

platform-api-docs's scan strategy reads published declaration files with this glob (generate.ts):

node_modules/@metamask/*/dist/**/*.d.cts

That only matches CommonJS declaration files. A package published ESM-only emits .d.ts, so it is skipped silently: no warning, it just contributes nothing to the docs.

Current impact: none

Worth stating plainly so this isn't over-prioritised. Measured on main with a fresh yarn build:

  • 654 .d.cts files still match, so the glob is not dead.
  • 112 of 150 @metamask packages with a dist would be missed (they ship only .d.ts).
  • 99 of those are workspace symlinks, already covered by the packages/*/src scan, and since #10085 source is preferred over build output anyway.
  • The remaining 13 are real npm dependencies: abi-utils, action-utils, api-specs, browser-passworder, create-release-branch, eth-json-rpc-infura, eth-sig-util, metamask-eth-abis, nonce-tracker, object-multiplex, scure-bip39, snaps-registry, swappable-obj-proxy.
  • Zero of those 13 contain messenger types, so nothing is missing from the docs today.

Why file it anyway

The monorepo is migrating to ESM-only (#9536 did platform-api-docs itself). As published @metamask packages follow, their declaration files become .d.ts and this glob stops seeing them. The failure mode is a silent omission rather than an error, which is the part that makes it worth fixing before it bites.

Suggested fix

Match both extensions, e.g. **/*.d.cts and **/*.d.ts, keeping them in the same call so the exclusion scoping established in #10085 is preserved. Note that a package shipping both would then be matched twice, so it is worth checking that deduplication resolves that the way we want.

主要语言
TypeScript
星标
414
派生
309
平均合并
1 天 4 小时
30 天内合并 PR
388

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MetaMask/core 的其他 Issue

查看 MetaMask/core 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。