(package_root: Path, output_dir: Path)
| 427 | |
| 428 | |
| 429 | def generate(package_root: Path, output_dir: Path) -> int: |
| 430 | package_json = package_root / "package.json" |
| 431 | if not package_json.is_file(): |
| 432 | raise SystemExit(f"package.json not found: {package_json}") |
| 433 | |
| 434 | modules = [ |
| 435 | _parse_declaration_file(types_path, import_path) for import_path, types_path in _package_exports(package_json) |
| 436 | ] |
| 437 | |
| 438 | reset_output_dir(output_dir) |
| 439 | _write_index(output_dir, modules) |
| 440 | for position, module in enumerate(modules, start=2): |
| 441 | _write_module(output_dir, module, position) |
| 442 | return len(modules) |
| 443 | |
| 444 | |
| 445 | def main() -> None: |
no test coverage detected