Skip to content

Commit

Permalink
refactor: reduce exported members of docusaurus router
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Feb 10, 2022
1 parent fbbec7f commit 376675d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
8 changes: 2 additions & 6 deletions packages/docusaurus-module-type-aliases/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,8 @@ declare module '@docusaurus/Translate' {
}

declare module '@docusaurus/router' {
// eslint-disable-next-line import/no-extraneous-dependencies, no-restricted-syntax
export * from 'react-router-dom';
}
declare module '@docusaurus/history' {
// eslint-disable-next-line import/no-extraneous-dependencies, no-restricted-syntax
export * from 'history';
// eslint-disable-next-line import/no-extraneous-dependencies
export {useHistory, useLocation, Redirect, matchPath} from 'react-router-dom';
}

declare module '@docusaurus/useDocusaurusContext' {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-common/src/utils/historyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import {useEffect, useRef} from 'react';
import {useHistory} from '@docusaurus/router';
import type {Location, Action} from '@docusaurus/history';
import type {Location, Action} from 'history';

type HistoryBlockHandler = (location: Location, action: Action) => void | false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import {useEffect} from 'react';
import {useLocation} from '@docusaurus/router';
import type {Location} from '@docusaurus/history';
import type {Location} from 'history';
import {usePrevious} from './usePrevious';
import {useDynamicCallback} from './reactUtils';

Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus/src/client/PendingNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import nprogress from 'nprogress';
import clientLifecyclesDispatcher from './client-lifecycles-dispatcher';
import preload from './preload';
import normalizeLocation from './normalizeLocation';
import type {Location} from '@docusaurus/history';
import type {Location} from 'history';

import './nprogress.css';

Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus/src/client/exports/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
* LICENSE file in the root directory of this source tree.
*/

// eslint-disable-next-line no-restricted-syntax
export * from 'react-router-dom';
export {useHistory, useLocation, Redirect, matchPath} from 'react-router-dom';
2 changes: 1 addition & 1 deletion packages/docusaurus/src/client/normalizeLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import type {Location} from '@docusaurus/history';
import type {Location} from 'history';

// Memoize previously normalized pathnames.
const pathnames: Record<string, string> = {};
Expand Down

0 comments on commit 376675d

Please sign in to comment.