Skip to content

feat(ApiLink): export resolveApiLink for shared resolution logic#92

Open
viktorkombov wants to merge 3 commits into
masterfrom
vkombov/export-resolve-api-link
Open

feat(ApiLink): export resolveApiLink for shared resolution logic#92
viktorkombov wants to merge 3 commits into
masterfrom
vkombov/export-resolve-api-link

Conversation

@viktorkombov

Copy link
Copy Markdown
Collaborator

Moves all resolution logic (URL construction, index lookup, display label computation) from ApiLink.astro into api-link-index.ts as a new exported resolveApiLink() function. ApiLink.astro becomes a thin renderer that just calls it and outputs HTML.

Also exports the prop types (ApiLinkProps, SassLinkProps, TypeDocLinkProps) and result type (ApiLinkResult), and adds the ./components/mdx/ApiLink/api-link-index package export.

Why: docs-template's LLM markdown generator needs to convert <ApiLink> MDX source text into markdown links at build time, using identical resolution logic to the component. Without this, the logic would have to be duplicated and maintained separately.

@viktorkombov viktorkombov added the ❌ status: awaiting-test PRs awaiting manual verification label Jun 18, 2026
Comment thread src/components/mdx/ApiLink/api-link-index.ts Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes <ApiLink /> resolution logic (URL construction, ApiLink index lookup, and label computation) into a new exported resolveApiLink() function so the same behavior can be reused by non-Astro tooling (e.g., docs-template’s build-time Markdown generator).

Changes:

  • Refactors ApiLink.astro into a thin renderer that delegates all link resolution to resolveApiLink().
  • Adds exported prop/result types (ApiLinkProps, SassLinkProps, TypeDocLinkProps, ApiLinkResult) alongside the new resolver in api-link-index.ts.
  • Exposes ./components/mdx/ApiLink/api-link-index via package.json exports for external consumers.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/components/mdx/ApiLink/ApiLink.astro Removes in-component resolution logic and renders based on resolveApiLink() results.
src/components/mdx/ApiLink/api-link-index.ts Introduces exported resolveApiLink() and related public types to share resolution logic across renderers.
package.json Adds a package export for api-link-index.ts to allow external import of the shared resolver/types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/mdx/ApiLink/ApiLink.astro Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

❌ status: awaiting-test PRs awaiting manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants