chore(ui): remove dead forge exports and unused useForgeProvider hook
- Remove useForgeProvider React hook (dead; only imperative getForgeProviderForDirectory was used, by tests) - Remove toLookupOptions export from useForgeLookup (only used within file) - Remove ForgeEditForm barrel re-export from forge/actions/index (imported directly by ForgeEntityActions) - Strip forge/index.ts barrel to only actually-consumed exports (buildForgeProvider, ForgeIssue, ForgeCommit, ForgeFileChange, mapGithubPr) - Remove ForgeTimelineSection/ForgeChecksSection from views barrel (imported directly by ForgeEntityDetailView)
This commit is contained in:
@@ -14,6 +14,5 @@ export { ForgeStateActions } from './ForgeStateActions';
|
||||
export { ForgeReviewActions } from './ForgeReviewActions';
|
||||
export { ForgeDraftToggle } from './ForgeDraftToggle';
|
||||
export { ForgeMetadataEditor } from './ForgeMetadataEditor';
|
||||
export { ForgeEditForm } from './ForgeEditForm';
|
||||
export { ForgeEntityActions } from './ForgeEntityActions';
|
||||
export { ForgeCreateIssueDialog } from './ForgeCreateIssueDialog';
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface ForgeLookupOption {
|
||||
}
|
||||
|
||||
/** Resolve the dropdown option shape for a given provider/kind result. */
|
||||
export const toLookupOptions = (
|
||||
const toLookupOptions = (
|
||||
kind: ForgeLookupKind,
|
||||
users: ForgeUser[],
|
||||
labels: ForgeLabel[],
|
||||
|
||||
@@ -8,6 +8,4 @@
|
||||
export { ForgeMetadataChips } from './ForgeMetadataChips';
|
||||
export { ForgeCommitsSection } from './ForgeCommitsSection';
|
||||
export { ForgeFilesDiffSection } from './ForgeFilesDiffSection';
|
||||
export { ForgeTimelineSection } from './ForgeTimelineSection';
|
||||
export { ForgeChecksSection } from './ForgeChecksSection';
|
||||
export { ForgeEntityDetailView } from './ForgeEntityDetailView';
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { resolveGitProvider, useGitProvider, buildGitProviderHosts } from '@/lib/gitProvider';
|
||||
import { resolveGitProvider, buildGitProviderHosts } from '@/lib/gitProvider';
|
||||
import type { GitProviderHosts } from '@/lib/gitProvider';
|
||||
import { useRuntimeAPIs } from '@/hooks/useRuntimeAPIs';
|
||||
import { getRegisteredRuntimeAPIs } from '@/contexts/runtimeAPIRegistry';
|
||||
import { buildForgeProvider } from '@/lib/forge/adapters';
|
||||
import type { ForgeProvider } from '@/lib/forge/provider';
|
||||
@@ -23,26 +21,7 @@ const buildProviderHosts = (): GitProviderHosts => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolve the forge provider for `directory` reactively: the provider kind is
|
||||
* detected from the directory's remotes via `useGitProvider`, and the provider
|
||||
* adapters are built from the registered runtime APIs. Returns null for 'other'
|
||||
* providers (no forge-backed UI) and for kinds whose runtime API is missing.
|
||||
*/
|
||||
export const useForgeProvider = (directory: string | null | undefined): ForgeProvider | null => {
|
||||
const kind = useGitProvider(directory);
|
||||
const runtimeApis = useRuntimeAPIs();
|
||||
const apis = useMemo(
|
||||
() => ({ github: runtimeApis.github, gitlab: runtimeApis.gitlab, gitea: runtimeApis.gitea }),
|
||||
[runtimeApis.github, runtimeApis.gitlab, runtimeApis.gitea],
|
||||
);
|
||||
return useMemo(
|
||||
() => (kind && kind !== 'other' ? buildForgeProvider(kind, apis) : null),
|
||||
[kind, apis],
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Imperative counterpart of `useForgeProvider` for non-React code paths.
|
||||
* Resolve the forge provider for `directory` for non-React code paths.
|
||||
* Resolves the directory's provider from the auth stores' connected accounts
|
||||
* and the runtime's registered APIs in one async step.
|
||||
*/
|
||||
|
||||
@@ -8,89 +8,15 @@
|
||||
*/
|
||||
|
||||
export type {
|
||||
ForgeProviderKind,
|
||||
ForgeChecksCapability,
|
||||
ForgeReviewsCapability,
|
||||
ForgeProviderCapabilities,
|
||||
ForgeUser,
|
||||
ForgeLabel,
|
||||
ForgeMilestone,
|
||||
ForgeRepoRef,
|
||||
ForgeEntityState,
|
||||
ForgeIssue,
|
||||
ForgeBranchRef,
|
||||
ForgePullRequest,
|
||||
ForgeComment,
|
||||
ForgeTimelineEventType,
|
||||
ForgeTimelineEvent,
|
||||
ForgeCommit,
|
||||
ForgeFileChange,
|
||||
ForgeCheckState,
|
||||
ForgeCheckKind,
|
||||
ForgeCheckAnnotation,
|
||||
ForgeCheck,
|
||||
ForgeChecksSummary,
|
||||
ForgeReview,
|
||||
} from './types';
|
||||
|
||||
export type {
|
||||
ForgePullRequestsResult,
|
||||
ForgePullRequestContext,
|
||||
ForgeIssuesResult,
|
||||
ForgeIssueDetail,
|
||||
ForgeCommitsResult,
|
||||
ForgeTimelineResult,
|
||||
ForgeChecksResult,
|
||||
ForgeUsersResult,
|
||||
ForgeLabelsResult,
|
||||
ForgeMilestonesResult,
|
||||
ForgeBranchesResult,
|
||||
ForgeTagsResult,
|
||||
ForgeProvider,
|
||||
} from './provider';
|
||||
|
||||
export {
|
||||
stateOf,
|
||||
mapCheckRunState,
|
||||
firstLine,
|
||||
normalizeEventType,
|
||||
mapGithubUser,
|
||||
mapGithubAssignee,
|
||||
mapGithubPr,
|
||||
mapGithubIssue,
|
||||
mapGithubIssueComment,
|
||||
mapGithubReviewComment,
|
||||
mapGithubCheckSummary,
|
||||
mapGithubContext,
|
||||
mapGithubRepoRef,
|
||||
mapGithubCommits,
|
||||
mapGithubTimelineEvents,
|
||||
mapGitlabUser,
|
||||
mapGitlabMember,
|
||||
mapGitlabMr,
|
||||
mapGitlabIssue,
|
||||
mapGitlabNoteComment,
|
||||
mapGitlabContext,
|
||||
mapGitlabRepoRef,
|
||||
mapGitlabCommits,
|
||||
mapGitlabTimelineEvents,
|
||||
mapGiteaUser,
|
||||
mapGiteaAssignee,
|
||||
mapGiteaPr,
|
||||
mapGiteaIssue,
|
||||
mapGiteaComment,
|
||||
mapGiteaContext,
|
||||
mapGiteaRepoRef,
|
||||
mapGiteaCommits,
|
||||
mapGiteaStatuses,
|
||||
mapGiteaReviewsToEvents,
|
||||
mapStatusState,
|
||||
aggregateStatusState,
|
||||
} from './normalize';
|
||||
|
||||
export {
|
||||
buildForgeProvider,
|
||||
createGithubForgeProvider,
|
||||
createGitlabForgeProvider,
|
||||
createGiteaForgeProvider,
|
||||
} from './adapters';
|
||||
|
||||
export {
|
||||
mapGithubPr,
|
||||
} from './normalize';
|
||||
|
||||
Reference in New Issue
Block a user