| 334 | |
| 335 | |
| 336 | def _package_exports(package_json: Path) -> list[tuple[str, Path]]: |
| 337 | data = json.loads(package_json.read_text(encoding="utf-8")) |
| 338 | package_name = data["name"] |
| 339 | exports = data["exports"] |
| 340 | modules: list[tuple[str, Path]] = [] |
| 341 | |
| 342 | for export_path, export_config in exports.items(): |
| 343 | if not isinstance(export_config, dict) or "types" not in export_config: |
| 344 | continue |
| 345 | import_path = package_name if export_path == "." else f"{package_name}/{export_path.removeprefix('./')}" |
| 346 | modules.append((import_path, package_json.parent / export_config["types"])) |
| 347 | |
| 348 | return modules |
| 349 | |
| 350 | |
| 351 | def _slug(import_path: str) -> str: |