Skip to content

Conversation

takker99
Copy link
Owner

@takker99 takker99 commented Aug 10, 2025

This PR refactors the API exports to remove all namespace exports and use unique identifiers for each API method. Previously, API routes were structured to match the REST endpoint hierarchy, with each endpoint exported as a namespace (e.g., pages.project.title.get()). This allowed method chaining but caused several issues:

  • Documentation for namespace exports was not properly rendered on jsr.io, sometimes resulting in 404 errors.
  • The method chain style (e.g., pages.project.title.get()) was rarely used in practice.
  • Tree-shaking was ineffective, leading to unnecessarily large bundle sizes.

Changes in this PR:

  • All namespace exports are removed.
  • Each endpoint now exports functions with unique, collision-free identifiers (e.g., getPage).
  • Intermediate route files and api.ts re-export these functions directly, without wrapping them in namespaces.

BREAKING CHANGE:
Consumers must now import API methods as individual functions rather than accessing them via namespaces. This improves documentation compatibility and enables better tree-shaking for smaller bundles.

…r API methods

BREAKING CHANGE: All API methods are now exported as unique identifiers instead of namespace exports. This improves documentation compatibility and enables better tree-shaking.
@takker99 takker99 merged commit ce95916 into main Aug 10, 2025
5 checks passed
@takker99 takker99 deleted the remove-namespace branch August 10, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant