Skip to content

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

Description

@cryptodev-2s

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 fix(platform-api-docs): prefer source over build output when deduplicating #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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions