mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
refactor: reduce exported members of docusaurus router (#6651)
This commit is contained in:
parent
cfef4755da
commit
acf4ae8f96
6 changed files with 7 additions and 12 deletions
|
@ -240,12 +240,8 @@ declare module '@docusaurus/Translate' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@docusaurus/router' {
|
declare module '@docusaurus/router' {
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies, no-restricted-syntax
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
export * from 'react-router-dom';
|
export {useHistory, useLocation, Redirect, matchPath} from 'react-router-dom';
|
||||||
}
|
|
||||||
declare module '@docusaurus/history' {
|
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies, no-restricted-syntax
|
|
||||||
export * from 'history';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@docusaurus/useDocusaurusContext' {
|
declare module '@docusaurus/useDocusaurusContext' {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import {useEffect, useRef} from 'react';
|
import {useEffect, useRef} from 'react';
|
||||||
import {useHistory} from '@docusaurus/router';
|
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;
|
type HistoryBlockHandler = (location: Location, action: Action) => void | false;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import {useEffect} from 'react';
|
import {useEffect} from 'react';
|
||||||
import {useLocation} from '@docusaurus/router';
|
import {useLocation} from '@docusaurus/router';
|
||||||
import type {Location} from '@docusaurus/history';
|
import type {Location} from 'history';
|
||||||
import {usePrevious} from './usePrevious';
|
import {usePrevious} from './usePrevious';
|
||||||
import {useDynamicCallback} from './reactUtils';
|
import {useDynamicCallback} from './reactUtils';
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import nprogress from 'nprogress';
|
||||||
import clientLifecyclesDispatcher from './client-lifecycles-dispatcher';
|
import clientLifecyclesDispatcher from './client-lifecycles-dispatcher';
|
||||||
import preload from './preload';
|
import preload from './preload';
|
||||||
import normalizeLocation from './normalizeLocation';
|
import normalizeLocation from './normalizeLocation';
|
||||||
import type {Location} from '@docusaurus/history';
|
import type {Location} from 'history';
|
||||||
|
|
||||||
import './nprogress.css';
|
import './nprogress.css';
|
||||||
|
|
||||||
|
|
|
@ -5,5 +5,4 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
export {useHistory, useLocation, Redirect, matchPath} from 'react-router-dom';
|
||||||
export * from 'react-router-dom';
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* 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.
|
// Memoize previously normalized pathnames.
|
||||||
const pathnames: Record<string, string> = {};
|
const pathnames: Record<string, string> = {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue