Skip to content

Subpath binding: generate per-subpath @module("pkg/sub") from the exports map (@mui/material/styles, date-fns/*, per-part Radix) #147

Description

@jagguji

Split out from #104 (PR resolving the main exports/typesVersions entry).

Scope

#104's fix resolves the main (.) types entry from the exports map, so packages whose types live only behind exports now bind. It does not iterate the map's subpath entries.

Modern libraries expose distinct modules per subpath — @mui/material/styles, date-fns/format, per-part Radix (@radix-ui/react-dialog re-exported subpaths) — each with its own .d.ts behind an exports["./sub"] condition. Today those are never bound.

Suggested direction

  • Iterate the exports map's .-prefixed keys (skipping wildcards / non-type conditions).
  • For each subpath, resolve its types condition (the exportsTypeTargets helper from Entry resolution ignores package.json exports map, subpaths, and typesVersions #104 already does the per-node resolution) and generate bindings stamped @module("pkg/sub") instead of @module("pkg").
  • Decide the output shape: one combined output vs. one module per subpath, and how from is threaded through cli.mjs/emit.

Why deferred

This is a larger feature than the main-entry fix — it changes the generator from one module to many and touches cli.mjs + emit's @module stamping, so it wants its own design pass and fixtures rather than riding along on the resolution fix.

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