@docusaurus/core 0.0.0-4623 → 0.0.0-4626

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bin/beforeCli.mjs +1 -3
  2. package/lib/babel/preset.d.ts +1 -2
  3. package/lib/client/App.d.ts +1 -2
  4. package/lib/client/App.js +1 -2
  5. package/lib/client/exports/BrowserOnly.d.ts +1 -2
  6. package/lib/client/exports/BrowserOnly.js +1 -2
  7. package/lib/client/exports/ComponentCreator.d.ts +1 -2
  8. package/lib/client/exports/ComponentCreator.js +1 -2
  9. package/lib/client/exports/ErrorBoundary.d.ts +2 -2
  10. package/lib/client/exports/ErrorBoundary.js +1 -2
  11. package/lib/client/exports/Head.d.ts +1 -2
  12. package/lib/client/exports/Head.js +1 -2
  13. package/lib/client/exports/renderRoutes.d.ts +1 -2
  14. package/lib/client/exports/renderRoutes.js +1 -2
  15. package/lib/client/exports/useDocusaurusContext.d.ts +1 -2
  16. package/lib/client/exports/useDocusaurusContext.js +1 -2
  17. package/lib/client/flat.d.ts +1 -2
  18. package/lib/client/flat.js +1 -2
  19. package/lib/client/normalizeLocation.d.ts +1 -2
  20. package/lib/client/normalizeLocation.js +1 -2
  21. package/lib/client/prefetch.d.ts +1 -2
  22. package/lib/client/prefetch.js +1 -2
  23. package/lib/client/theme-fallback/Error/index.d.ts +1 -2
  24. package/lib/client/theme-fallback/Error/index.js +1 -2
  25. package/lib/client/theme-fallback/Layout/index.d.ts +1 -2
  26. package/lib/client/theme-fallback/Layout/index.js +1 -2
  27. package/lib/client/theme-fallback/NotFound/index.d.ts +1 -2
  28. package/lib/client/theme-fallback/NotFound/index.js +1 -2
  29. package/lib/client/theme-fallback/Root/index.d.ts +1 -2
  30. package/lib/client/theme-fallback/Root/index.js +1 -2
  31. package/lib/server/loadSetup.d.ts +1 -2
  32. package/lib/server/loadSetup.js +2 -2
  33. package/lib/webpack/plugins/ChunkAssetPlugin.d.ts +1 -2
  34. package/lib/webpack/plugins/CleanWebpackPlugin.d.ts +1 -2
  35. package/package.json +10 -10
package/bin/beforeCli.mjs CHANGED
@@ -36,7 +36,7 @@ const {
36
36
  *
37
37
  * cache data is stored in `~/.config/configstore/update-notifier-@docusaurus`
38
38
  */
39
- async function beforeCli() {
39
+ export default async function beforeCli() {
40
40
  const notifier = updateNotifier({
41
41
  pkg: {
42
42
  name,
@@ -134,5 +134,3 @@ async function beforeCli() {
134
134
  process.exit(1);
135
135
  }
136
136
  }
137
-
138
- export default beforeCli;
@@ -5,5 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { ConfigAPI, TransformOptions } from '@babel/core';
8
- declare function babelPresets(api: ConfigAPI): TransformOptions;
9
- export default babelPresets;
8
+ export default function babelPresets(api: ConfigAPI): TransformOptions;
@@ -6,5 +6,4 @@
6
6
  */
7
7
  /// <reference types="react" />
8
8
  import './client-lifecycles-dispatcher';
9
- declare function App(): JSX.Element;
10
- export default App;
9
+ export default function App(): JSX.Element;
package/lib/client/App.js CHANGED
@@ -16,7 +16,7 @@ import './client-lifecycles-dispatcher';
16
16
  // TODO, quick fix for CSS insertion order
17
17
  import ErrorBoundary from '@docusaurus/ErrorBoundary';
18
18
  import Error from '@theme/Error';
19
- function App() {
19
+ export default function App() {
20
20
  return (<ErrorBoundary fallback={Error}>
21
21
  <DocusaurusContextProvider>
22
22
  <BrowserContextProvider>
@@ -30,4 +30,3 @@ function App() {
30
30
  </DocusaurusContextProvider>
31
31
  </ErrorBoundary>);
32
32
  }
33
- export default App;
@@ -5,8 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  /// <reference types="react" />
8
- declare function BrowserOnly({ children, fallback, }: {
8
+ export default function BrowserOnly({ children, fallback, }: {
9
9
  children: () => JSX.Element;
10
10
  fallback?: JSX.Element;
11
11
  }): JSX.Element | null;
12
- export default BrowserOnly;
@@ -8,7 +8,7 @@ import React, { isValidElement } from 'react';
8
8
  import useIsBrowser from '@docusaurus/useIsBrowser';
9
9
  // Similar comp to the one described here:
10
10
  // https://www.joshwcomeau.com/react/the-perils-of-rehydration/#abstractions
11
- function BrowserOnly({ children, fallback, }) {
11
+ export default function BrowserOnly({ children, fallback, }) {
12
12
  const isBrowser = useIsBrowser();
13
13
  if (isBrowser) {
14
14
  if (typeof children !== 'function' &&
@@ -20,4 +20,3 @@ Current type: ${isValidElement(children) ? 'React element' : typeof children}`);
20
20
  }
21
21
  return fallback || null;
22
22
  }
23
- export default BrowserOnly;
@@ -5,5 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import Loadable from 'react-loadable';
8
- declare function ComponentCreator(path: string, hash: string): ReturnType<typeof Loadable>;
9
- export default ComponentCreator;
8
+ export default function ComponentCreator(path: string, hash: string): ReturnType<typeof Loadable>;
@@ -10,7 +10,7 @@ import Loading from '@theme/Loading';
10
10
  import routesChunkNames from '@generated/routesChunkNames';
11
11
  import registry from '@generated/registry';
12
12
  import flat from '../flat';
13
- function ComponentCreator(path, hash) {
13
+ export default function ComponentCreator(path, hash) {
14
14
  // 404 page
15
15
  if (path === '*') {
16
16
  return Loadable({
@@ -76,4 +76,3 @@ function ComponentCreator(path, hash) {
76
76
  },
77
77
  });
78
78
  }
79
- export default ComponentCreator;
@@ -10,9 +10,9 @@ import type { Props } from '@docusaurus/ErrorBoundary';
10
10
  interface State {
11
11
  error: Error | null;
12
12
  }
13
- declare class ErrorBoundary extends React.Component<Props, State> {
13
+ export default class ErrorBoundary extends React.Component<Props, State> {
14
14
  constructor(props: Props);
15
15
  componentDidCatch(error: Error): void;
16
16
  render(): ReactNode;
17
17
  }
18
- export default ErrorBoundary;
18
+ export {};
@@ -7,7 +7,7 @@
7
7
  import React from 'react';
8
8
  import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
9
9
  import DefaultFallback from '@theme/Error';
10
- class ErrorBoundary extends React.Component {
10
+ export default class ErrorBoundary extends React.Component {
11
11
  constructor(props) {
12
12
  super(props);
13
13
  this.state = { error: null };
@@ -34,4 +34,3 @@ class ErrorBoundary extends React.Component {
34
34
  null);
35
35
  }
36
36
  }
37
- export default ErrorBoundary;
@@ -7,5 +7,4 @@
7
7
  /// <reference types="@docusaurus/module-type-aliases" />
8
8
  /// <reference types="react" />
9
9
  import type { Props } from '@docusaurus/Head';
10
- declare function Head(props: Props): JSX.Element;
11
- export default Head;
10
+ export default function Head(props: Props): JSX.Element;
@@ -6,7 +6,6 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { Helmet } from 'react-helmet-async';
9
- function Head(props) {
9
+ export default function Head(props) {
10
10
  return <Helmet {...props}/>;
11
11
  }
12
- export default Head;
@@ -4,5 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { renderRoutes } from 'react-router-config';
8
- export default renderRoutes;
7
+ export { renderRoutes as default } from 'react-router-config';
@@ -4,5 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { renderRoutes } from 'react-router-config';
8
- export default renderRoutes;
7
+ export { renderRoutes as default } from 'react-router-config';
@@ -5,5 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { DocusaurusContext } from '@docusaurus/types';
8
- declare function useDocusaurusContext(): DocusaurusContext;
9
- export default useDocusaurusContext;
8
+ export default function useDocusaurusContext(): DocusaurusContext;
@@ -6,7 +6,6 @@
6
6
  */
7
7
  import { useContext } from 'react';
8
8
  import { Context } from './docusaurusContext';
9
- function useDocusaurusContext() {
9
+ export default function useDocusaurusContext() {
10
10
  return useContext(Context);
11
11
  }
12
- export default useDocusaurusContext;
@@ -5,5 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { RouteChunksTree } from '@docusaurus/types';
8
- declare function flat(target: RouteChunksTree): Record<string, string>;
9
- export default flat;
8
+ export default function flat(target: RouteChunksTree): Record<string, string>;
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  const isTree = (x) => typeof x === 'object' && !!x && Object.keys(x).length > 0;
8
- function flat(target) {
8
+ export default function flat(target) {
9
9
  const delimiter = '.';
10
10
  const output = {};
11
11
  function step(object, prefix) {
@@ -23,4 +23,3 @@ function flat(target) {
23
23
  step(target);
24
24
  return output;
25
25
  }
26
- export default flat;
@@ -5,5 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { Location } from 'history';
8
- declare function normalizeLocation<T extends Location>(location: T): T;
9
- export default normalizeLocation;
8
+ export default function normalizeLocation<T extends Location>(location: T): T;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  // Memoize previously normalized pathnames.
8
8
  const pathnames = {};
9
- function normalizeLocation(location) {
9
+ export default function normalizeLocation(location) {
10
10
  if (pathnames[location.pathname]) {
11
11
  return {
12
12
  ...location,
@@ -24,4 +24,3 @@ function normalizeLocation(location) {
24
24
  pathname,
25
25
  };
26
26
  }
27
- export default normalizeLocation;
@@ -4,5 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- declare function prefetch(url: string): Promise<void>;
8
- export default prefetch;
7
+ export default function prefetch(url: string): Promise<void>;
@@ -55,7 +55,7 @@ const supportedPrefetchStrategy = support('prefetch')
55
55
  ? linkPrefetchStrategy
56
56
  : xhrPrefetchStrategy;
57
57
  const preFetched = {};
58
- function prefetch(url) {
58
+ export default function prefetch(url) {
59
59
  return new Promise((resolve) => {
60
60
  if (preFetched[url]) {
61
61
  resolve();
@@ -69,4 +69,3 @@ function prefetch(url) {
69
69
  .catch(() => { }); // 404s are logged to the console anyway.
70
70
  });
71
71
  }
72
- export default prefetch;
@@ -7,5 +7,4 @@
7
7
  /// <reference types="@docusaurus/module-type-aliases" />
8
8
  /// <reference types="react" />
9
9
  import type { Props } from '@theme/Error';
10
- declare function Error({ error, tryAgain }: Props): JSX.Element;
11
- export default Error;
10
+ export default function Error({ error, tryAgain }: Props): JSX.Element;
@@ -24,7 +24,7 @@ function ErrorDisplay({ error, tryAgain }) {
24
24
  </button>
25
25
  </div>);
26
26
  }
27
- function Error({ error, tryAgain }) {
27
+ export default function Error({ error, tryAgain }) {
28
28
  // We wrap the error in its own error boundary because the layout can actually
29
29
  // throw too... Only the ErrorDisplay component is simple enough to be
30
30
  // considered safe to never throw
@@ -37,4 +37,3 @@ function Error({ error, tryAgain }) {
37
37
  </Layout>
38
38
  </ErrorBoundary>);
39
39
  }
40
- export default Error;
@@ -7,5 +7,4 @@
7
7
  /// <reference types="@docusaurus/module-type-aliases" />
8
8
  /// <reference types="react" />
9
9
  import type { Props } from '@theme/Layout';
10
- declare function Layout({ children, title, description }: Props): JSX.Element;
11
- export default Layout;
10
+ export default function Layout({ children, title, description, }: Props): JSX.Element;
@@ -8,7 +8,7 @@ import React from 'react';
8
8
  import Head from '@docusaurus/Head';
9
9
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
10
10
  import useBaseUrl from '@docusaurus/useBaseUrl';
11
- function Layout({ children, title, description }) {
11
+ export default function Layout({ children, title, description, }) {
12
12
  const context = useDocusaurusContext();
13
13
  const { siteConfig } = context;
14
14
  const { favicon, tagline, title: defaultTitle } = siteConfig;
@@ -23,4 +23,3 @@ function Layout({ children, title, description }) {
23
23
  {children}
24
24
  </>);
25
25
  }
26
- export default Layout;
@@ -5,5 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  /// <reference types="react" />
8
- declare function NotFound(): JSX.Element;
9
- export default NotFound;
8
+ export default function NotFound(): JSX.Element;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import Layout from '@theme/Layout';
9
- function NotFound() {
9
+ export default function NotFound() {
10
10
  return (<Layout title="Page Not Found">
11
11
  <div style={{
12
12
  display: 'flex',
@@ -19,4 +19,3 @@ function NotFound() {
19
19
  </div>
20
20
  </Layout>);
21
21
  }
22
- export default NotFound;
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { ReactNode } from 'react';
8
- declare function Root({ children }: {
8
+ export default function Root({ children }: {
9
9
  children: ReactNode;
10
10
  }): ReactNode;
11
- export default Root;
@@ -11,7 +11,6 @@
11
11
  // and these providers won't reset state when we navigate
12
12
  //
13
13
  // See https://github.com/facebook/docusaurus/issues/3919
14
- function Root({ children }) {
14
+ export default function Root({ children }) {
15
15
  return children;
16
16
  }
17
- export default Root;
@@ -5,5 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { Props } from '@docusaurus/types';
8
- declare const loadSetup: (name: string) => Promise<Props>;
9
- export default loadSetup;
8
+ export default function loadSetup(name: string): Promise<Props>;
@@ -10,7 +10,7 @@ const tslib_1 = require("tslib");
10
10
  const path_1 = (0, tslib_1.__importDefault)(require("path"));
11
11
  const index_1 = require("./index");
12
12
  // Helper methods to setup dummy/fake projects.
13
- const loadSetup = async (name) => {
13
+ async function loadSetup(name) {
14
14
  const fixtures = path_1.default.join(__dirname, '__tests__', '__fixtures__');
15
15
  const simpleSite = path_1.default.join(fixtures, 'simple-site');
16
16
  const customSite = path_1.default.join(fixtures, 'custom-site');
@@ -21,5 +21,5 @@ const loadSetup = async (name) => {
21
21
  default:
22
22
  return (0, index_1.load)(simpleSite);
23
23
  }
24
- };
24
+ }
25
25
  exports.default = loadSetup;
@@ -16,7 +16,6 @@ import { type Compiler } from 'webpack';
16
16
  *
17
17
  * "gca" stands for "get chunk asset"
18
18
  */
19
- declare class ChunkAssetPlugin {
19
+ export default class ChunkAssetPlugin {
20
20
  apply(compiler: Compiler): void;
21
21
  }
22
- export default ChunkAssetPlugin;
@@ -54,7 +54,7 @@ export interface Options {
54
54
  */
55
55
  cleanOnceBeforeBuildPatterns?: string[];
56
56
  }
57
- declare class CleanWebpackPlugin {
57
+ export default class CleanWebpackPlugin {
58
58
  private readonly verbose;
59
59
  private readonly cleanStaleWebpackAssets;
60
60
  private readonly protectWebpackAssets;
@@ -76,4 +76,3 @@ declare class CleanWebpackPlugin {
76
76
  handleDone(stats: Stats): void;
77
77
  removeFiles(patterns: string[]): void;
78
78
  }
79
- export default CleanWebpackPlugin;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "0.0.0-4623",
4
+ "version": "0.0.0-4626",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.17.2",
42
42
  "@babel/runtime-corejs3": "^7.17.2",
43
43
  "@babel/traverse": "^7.17.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4623",
45
- "@docusaurus/logger": "0.0.0-4623",
46
- "@docusaurus/mdx-loader": "0.0.0-4623",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4626",
45
+ "@docusaurus/logger": "0.0.0-4626",
46
+ "@docusaurus/mdx-loader": "0.0.0-4626",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4623",
49
- "@docusaurus/utils-common": "0.0.0-4623",
50
- "@docusaurus/utils-validation": "0.0.0-4623",
48
+ "@docusaurus/utils": "0.0.0-4626",
49
+ "@docusaurus/utils-common": "0.0.0-4626",
50
+ "@docusaurus/utils-validation": "0.0.0-4626",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.1",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.2",
@@ -105,8 +105,8 @@
105
105
  "webpackbar": "^5.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "0.0.0-4623",
109
- "@docusaurus/types": "0.0.0-4623",
108
+ "@docusaurus/module-type-aliases": "0.0.0-4626",
109
+ "@docusaurus/types": "0.0.0-4626",
110
110
  "@types/detect-port": "^1.3.2",
111
111
  "@types/nprogress": "^0.2.0",
112
112
  "@types/react-dom": "^17.0.11",
@@ -126,5 +126,5 @@
126
126
  "engines": {
127
127
  "node": ">=14"
128
128
  },
129
- "gitHead": "97710505efdb9fceea33bd2dbb8eaa2860e391a1"
129
+ "gitHead": "1a36de8f473e7e7f79779e64748d47745068c89f"
130
130
  }