@docusaurus/core 0.0.0-5980 → 0.0.0-5982

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 (80) hide show
  1. package/lib/babel/preset.js +1 -1
  2. package/lib/client/App.d.ts +0 -2
  3. package/lib/client/BaseUrlIssueBanner/index.d.ts +0 -1
  4. package/lib/client/BrokenLinksContext.d.ts +0 -1
  5. package/lib/client/SiteMetadataDefaults.d.ts +0 -1
  6. package/lib/client/exports/BrowserOnly.d.ts +0 -2
  7. package/lib/client/exports/ErrorBoundary.d.ts +0 -1
  8. package/lib/client/exports/Head.d.ts +0 -2
  9. package/lib/client/exports/Interpolate.d.ts +0 -1
  10. package/lib/client/exports/Link.d.ts +0 -1
  11. package/lib/client/exports/Translate.d.ts +0 -2
  12. package/lib/client/exports/useBaseUrl.d.ts +0 -1
  13. package/lib/client/exports/useBrokenLinks.d.ts +0 -1
  14. package/lib/client/hasHydratedDataAttribute.d.ts +0 -1
  15. package/lib/client/theme-fallback/Error/index.d.ts +0 -2
  16. package/lib/client/theme-fallback/Layout/index.d.ts +0 -2
  17. package/lib/client/theme-fallback/Loading/index.d.ts +0 -1
  18. package/lib/client/theme-fallback/NotFound/index.d.ts +0 -1
  19. package/lib/client/theme-fallback/Root/index.d.ts +0 -2
  20. package/lib/client/theme-fallback/SiteMetadata/index.d.ts +0 -1
  21. package/lib/commands/build.js +1 -2
  22. package/lib/commands/clear.js +1 -2
  23. package/lib/commands/deploy.js +1 -2
  24. package/lib/commands/external.js +1 -2
  25. package/lib/commands/serve.js +1 -2
  26. package/lib/commands/start/start.js +1 -2
  27. package/lib/commands/start/utils.js +2 -3
  28. package/lib/commands/start/watcher.js +5 -6
  29. package/lib/commands/start/webpack.js +1 -2
  30. package/lib/commands/swizzle/actions.js +4 -4
  31. package/lib/commands/swizzle/common.js +7 -7
  32. package/lib/commands/swizzle/components.js +5 -6
  33. package/lib/commands/swizzle/config.js +2 -3
  34. package/lib/commands/swizzle/context.js +1 -2
  35. package/lib/commands/swizzle/index.js +1 -2
  36. package/lib/commands/swizzle/prompts.js +4 -5
  37. package/lib/commands/swizzle/tables.js +2 -3
  38. package/lib/commands/swizzle/themes.js +5 -6
  39. package/lib/commands/writeHeadingIds.js +1 -2
  40. package/lib/commands/writeTranslations.js +1 -2
  41. package/lib/server/brokenLinks.js +1 -2
  42. package/lib/server/clientModules.js +1 -2
  43. package/lib/server/codegen/codegen.js +1 -2
  44. package/lib/server/codegen/codegenRoutes.js +4 -5
  45. package/lib/server/config.js +1 -2
  46. package/lib/server/configValidation.js +2 -2
  47. package/lib/server/getHostPort.js +1 -2
  48. package/lib/server/htmlTags.js +1 -2
  49. package/lib/server/i18n.js +2 -3
  50. package/lib/server/plugins/actions.js +1 -2
  51. package/lib/server/plugins/configs.js +1 -2
  52. package/lib/server/plugins/init.js +1 -2
  53. package/lib/server/plugins/moduleShorthand.d.ts +0 -1
  54. package/lib/server/plugins/moduleShorthand.js +2 -3
  55. package/lib/server/plugins/pluginIds.js +1 -2
  56. package/lib/server/plugins/plugins.js +2 -3
  57. package/lib/server/plugins/pluginsUtils.js +7 -8
  58. package/lib/server/plugins/presets.js +1 -2
  59. package/lib/server/plugins/routeConfig.js +2 -3
  60. package/lib/server/plugins/synthetic.js +2 -3
  61. package/lib/server/routes.js +2 -3
  62. package/lib/server/site.js +4 -5
  63. package/lib/server/siteMetadata.js +3 -4
  64. package/lib/server/storage.js +1 -2
  65. package/lib/server/translations/translations.js +9 -10
  66. package/lib/server/translations/translationsExtractor.js +4 -5
  67. package/lib/server/utils.js +1 -2
  68. package/lib/ssg.d.ts +0 -1
  69. package/lib/ssg.js +3 -4
  70. package/lib/templates/templates.js +3 -4
  71. package/lib/webpack/aliases/index.js +4 -5
  72. package/lib/webpack/base.js +3 -3
  73. package/lib/webpack/client.js +2 -3
  74. package/lib/webpack/configure.js +3 -4
  75. package/lib/webpack/minification.js +1 -2
  76. package/lib/webpack/plugins/StaticDirectoriesCopyPlugin.js +1 -2
  77. package/lib/webpack/server.js +1 -1
  78. package/lib/webpack/utils.d.ts +1 -2
  79. package/lib/webpack/utils.js +8 -8
  80. package/package.json +10 -10
@@ -6,6 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = babelPresets;
9
10
  const tslib_1 = require("tslib");
10
11
  const path_1 = tslib_1.__importDefault(require("path"));
11
12
  function getTransformOptions(isServer) {
@@ -77,4 +78,3 @@ function babelPresets(api) {
77
78
  const callerName = api.caller((caller) => caller?.name);
78
79
  return getTransformOptions(callerName === 'server');
79
80
  }
80
- exports.default = babelPresets;
@@ -4,7 +4,5 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
7
  import '@generated/client-modules';
10
8
  export default function App(): JSX.Element;
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  import './styles.module.css';
9
8
  /**
10
9
  * We want to help the users with a bad baseUrl configuration (very common
@@ -4,7 +4,6 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
7
  import { type ReactNode } from 'react';
9
8
  import type { BrokenLinks } from '@docusaurus/useBrokenLinks';
10
9
  export type StatefulBrokenLinks = BrokenLinks & {
@@ -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
- /// <reference types="react" />
8
7
  export default function SiteMetadataDefaults(): JSX.Element;
@@ -4,7 +4,5 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
7
  import type { Props } from '@docusaurus/BrowserOnly';
10
8
  export default function BrowserOnly({ children, fallback, }: Props): JSX.Element | null;
@@ -4,7 +4,6 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
7
  import React, { type ReactNode } from 'react';
9
8
  import type { Props } from '@docusaurus/ErrorBoundary';
10
9
  type State = {
@@ -4,7 +4,5 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
7
  import type { Props } from '@docusaurus/Head';
10
8
  export default function Head(props: Props): JSX.Element;
@@ -4,7 +4,6 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
7
  import { type ReactNode } from 'react';
9
8
  import type { InterpolateProps, InterpolateValues } from '@docusaurus/Interpolate';
10
9
  export declare function interpolate<Str extends string>(text: Str, values?: InterpolateValues<Str, string | number>): string;
@@ -4,7 +4,6 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
7
  import React from 'react';
9
8
  import type { Props } from '@docusaurus/Link';
10
9
  declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
@@ -4,8 +4,6 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
7
  import { type InterpolateValues } from '@docusaurus/Interpolate';
10
8
  import type { TranslateParam, TranslateProps } from '@docusaurus/Translate';
11
9
  export declare function translate<Str extends string>({ message, id }: TranslateParam<Str>, values?: InterpolateValues<Str, string | number>): string;
@@ -4,7 +4,6 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
7
  import type { BaseUrlOptions, BaseUrlUtils } from '@docusaurus/useBaseUrl';
9
8
  import type { RouterType } from '@docusaurus/types';
10
9
  export declare function addBaseUrl({ siteUrl, baseUrl, url, options: { forcePrependBaseUrl, absolute }, router, }: {
@@ -4,6 +4,5 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
7
  import type { BrokenLinks } from '@docusaurus/useBrokenLinks';
9
8
  export default function useBrokenLinks(): BrokenLinks;
@@ -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
- /// <reference types="react" />
8
7
  export default function HasHydratedDataAttribute(): JSX.Element;
@@ -4,7 +4,5 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
7
  import type { Props } from '@theme/Error';
10
8
  export default function Error({ error, tryAgain }: Props): JSX.Element;
@@ -4,7 +4,5 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
7
  import type { Props } from '@theme/Layout';
10
8
  export default function Layout({ children }: Props): JSX.Element;
@@ -4,6 +4,5 @@
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
- /// <reference types="react" />
8
7
  import type { LoadingComponentProps } from 'react-loadable';
9
8
  export default function Loading({ error, retry, pastDelay, }: LoadingComponentProps): JSX.Element | null;
@@ -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
- /// <reference types="react" />
8
7
  export default function NotFound(): JSX.Element;
@@ -4,7 +4,5 @@
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
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
7
  import type { Props } from '@theme/Root';
10
8
  export default function Root({ children }: Props): JSX.Element;
@@ -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
- /// <reference types="react" />
8
7
  export default function SiteMetadata(): JSX.Element | null;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.build = void 0;
9
+ exports.build = build;
10
10
  const tslib_1 = require("tslib");
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -72,7 +72,6 @@ forceTerminate = true) {
72
72
  }
73
73
  }));
74
74
  }
75
- exports.build = build;
76
75
  async function getLocalesToBuild({ siteDir, cliOptions, }) {
77
76
  if (cliOptions.locale) {
78
77
  return [cliOptions.locale];
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.clear = void 0;
9
+ exports.clear = clear;
10
10
  const tslib_1 = require("tslib");
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -42,4 +42,3 @@ async function clear(siteDirParam = '.') {
42
42
  }));
43
43
  await Promise.all([generatedFolder, buildFolder, ...cacheFolders].map(removePath));
44
44
  }
45
- exports.clear = clear;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.deploy = void 0;
9
+ exports.deploy = deploy;
10
10
  const tslib_1 = require("tslib");
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -196,4 +196,3 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
196
196
  await runDeploy(outDir);
197
197
  }
198
198
  }
199
- exports.deploy = deploy;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.externalCommand = void 0;
9
+ exports.externalCommand = externalCommand;
10
10
  const tslib_1 = require("tslib");
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const site_1 = require("../server/site");
@@ -20,4 +20,3 @@ async function externalCommand(cli) {
20
20
  plugin.extendCli?.(cli);
21
21
  });
22
22
  }
23
- exports.externalCommand = externalCommand;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.serve = void 0;
9
+ exports.serve = serve;
10
10
  const tslib_1 = require("tslib");
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const http_1 = tslib_1.__importDefault(require("http"));
@@ -89,4 +89,3 @@ async function serve(siteDirParam = '.', cliOptions = {}) {
89
89
  (0, openBrowser_1.default)(url);
90
90
  }
91
91
  }
92
- exports.serve = serve;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.start = void 0;
9
+ exports.start = start;
10
10
  const tslib_1 = require("tslib");
11
11
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
12
12
  const openBrowser_1 = tslib_1.__importDefault(require("react-dev-utils/openBrowser"));
@@ -44,4 +44,3 @@ async function start(siteDirParam = '.', cliOptions = {}) {
44
44
  (0, openBrowser_1.default)(reloadableSite.getOpenUrl());
45
45
  }
46
46
  }
47
- exports.start = start;
@@ -6,7 +6,8 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createReloadableSite = exports.createOpenUrlContext = void 0;
9
+ exports.createOpenUrlContext = createOpenUrlContext;
10
+ exports.createReloadableSite = createReloadableSite;
10
11
  const tslib_1 = require("tslib");
11
12
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
13
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
@@ -33,7 +34,6 @@ async function createOpenUrlContext({ cliOptions, }) {
33
34
  };
34
35
  return { host, port, getOpenUrl };
35
36
  }
36
- exports.createOpenUrlContext = createOpenUrlContext;
37
37
  async function createLoadSiteParams({ siteDirParam, cliOptions, }) {
38
38
  const siteDir = await fs_extra_1.default.realpath(siteDirParam);
39
39
  return {
@@ -89,4 +89,3 @@ async function createReloadableSite(startParams) {
89
89
  };
90
90
  return { get, getOpenUrl, reload, reloadPlugin, openUrlContext };
91
91
  }
92
- exports.createReloadableSite = createReloadableSite;
@@ -6,7 +6,11 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.setupSiteFileWatchers = exports.getPluginPathsToWatch = exports.getSitePathsToWatch = exports.watch = exports.createPollingOptions = void 0;
9
+ exports.createPollingOptions = createPollingOptions;
10
+ exports.watch = watch;
11
+ exports.getSitePathsToWatch = getSitePathsToWatch;
12
+ exports.getPluginPathsToWatch = getPluginPathsToWatch;
13
+ exports.setupSiteFileWatchers = setupSiteFileWatchers;
10
14
  const tslib_1 = require("tslib");
11
15
  const path_1 = tslib_1.__importDefault(require("path"));
12
16
  const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
@@ -19,7 +23,6 @@ function createPollingOptions(cliOptions) {
19
23
  : undefined,
20
24
  };
21
25
  }
22
- exports.createPollingOptions = createPollingOptions;
23
26
  /**
24
27
  * Watch file system paths for changes and emit events
25
28
  * Returns an async handle to stop watching
@@ -34,7 +37,6 @@ function watch(params, callback) {
34
37
  fsWatcher.on('all', (name, eventPath) => callback({ name, path: eventPath }));
35
38
  return () => fsWatcher.close();
36
39
  }
37
- exports.watch = watch;
38
40
  function getSitePathsToWatch({ props }) {
39
41
  return [
40
42
  // TODO we should also watch all imported modules!
@@ -43,7 +45,6 @@ function getSitePathsToWatch({ props }) {
43
45
  props.localizationDir,
44
46
  ];
45
47
  }
46
- exports.getSitePathsToWatch = getSitePathsToWatch;
47
48
  function getPluginPathsToWatch({ siteDir, plugin, }) {
48
49
  const normalizeToSiteDir = (filepath) => {
49
50
  if (filepath && path_1.default.isAbsolute(filepath)) {
@@ -55,7 +56,6 @@ function getPluginPathsToWatch({ siteDir, plugin, }) {
55
56
  .filter(Boolean)
56
57
  .map(normalizeToSiteDir);
57
58
  }
58
- exports.getPluginPathsToWatch = getPluginPathsToWatch;
59
59
  function setupSiteFileWatchers({ props, cliOptions, }, callback) {
60
60
  const { siteDir } = props;
61
61
  const pollingOptions = createPollingOptions(cliOptions);
@@ -75,4 +75,3 @@ function setupSiteFileWatchers({ props, cliOptions, }, callback) {
75
75
  }, (event) => callback({ plugin, event }));
76
76
  });
77
77
  }
78
- exports.setupSiteFileWatchers = setupSiteFileWatchers;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createWebpackDevServer = void 0;
9
+ exports.createWebpackDevServer = createWebpackDevServer;
10
10
  const tslib_1 = require("tslib");
11
11
  const path_1 = tslib_1.__importDefault(require("path"));
12
12
  const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
@@ -130,4 +130,3 @@ async function createWebpackDevServer({ props, cliOptions, openUrlContext, }) {
130
130
  const devServerConfig = (0, webpack_merge_1.default)([defaultDevServerConfig, config.devServer].filter(Boolean));
131
131
  return new webpack_dev_server_1.default(devServerConfig, compiler);
132
132
  }
133
- exports.createWebpackDevServer = createWebpackDevServer;
@@ -6,7 +6,10 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.wrap = exports.eject = exports.getAction = exports.SwizzleActions = void 0;
9
+ exports.SwizzleActions = void 0;
10
+ exports.getAction = getAction;
11
+ exports.eject = eject;
12
+ exports.wrap = wrap;
10
13
  const tslib_1 = require("tslib");
11
14
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
15
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -24,7 +27,6 @@ async function getAction(componentConfig, options) {
24
27
  }
25
28
  return (0, prompts_1.askSwizzleAction)(componentConfig);
26
29
  }
27
- exports.getAction = getAction;
28
30
  async function isDir(dirPath) {
29
31
  return ((await fs_extra_1.default.pathExists(dirPath)) && (await fs_extra_1.default.stat(dirPath)).isDirectory());
30
32
  }
@@ -65,7 +67,6 @@ async function eject({ siteDir, themePath, componentName, typescript, }) {
65
67
  }));
66
68
  return { createdFiles };
67
69
  }
68
- exports.eject = eject;
69
70
  async function wrap({ siteDir, themePath, componentName: themeComponentName, typescript, importType = 'original', }) {
70
71
  const isDirectory = await isDir(path_1.default.join(themePath, themeComponentName));
71
72
  // Top/Parent/ComponentName => ComponentName
@@ -104,4 +105,3 @@ export default function ${wrapperComponentName}(props) {
104
105
  await fs_extra_1.default.outputFile(toPath, content);
105
106
  return { createdFiles: [toPath] };
106
107
  }
107
- exports.wrap = wrap;
@@ -6,7 +6,13 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.findClosestValue = exports.findStringIgnoringCase = exports.normalizeOptions = exports.actionStatusSuffix = exports.actionStatusColor = exports.actionStatusLabel = exports.PartiallySafeHint = exports.SwizzleActionsStatuses = exports.SwizzleActions = void 0;
9
+ exports.PartiallySafeHint = exports.SwizzleActionsStatuses = exports.SwizzleActions = void 0;
10
+ exports.actionStatusLabel = actionStatusLabel;
11
+ exports.actionStatusColor = actionStatusColor;
12
+ exports.actionStatusSuffix = actionStatusSuffix;
13
+ exports.normalizeOptions = normalizeOptions;
14
+ exports.findStringIgnoringCase = findStringIgnoringCase;
15
+ exports.findClosestValue = findClosestValue;
10
16
  const tslib_1 = require("tslib");
11
17
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
12
18
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
@@ -21,7 +27,6 @@ exports.PartiallySafeHint = logger_1.default.red('*');
21
27
  function actionStatusLabel(status) {
22
28
  return lodash_1.default.capitalize(status);
23
29
  }
24
- exports.actionStatusLabel = actionStatusLabel;
25
30
  const SwizzleActionStatusColors = {
26
31
  safe: logger_1.default.green,
27
32
  unsafe: logger_1.default.yellow,
@@ -31,11 +36,9 @@ function actionStatusColor(status, str) {
31
36
  const colorFn = SwizzleActionStatusColors[status];
32
37
  return colorFn(str);
33
38
  }
34
- exports.actionStatusColor = actionStatusColor;
35
39
  function actionStatusSuffix(status, options = {}) {
36
40
  return ` (${actionStatusColor(status, actionStatusLabel(status))}${options.partiallySafe ? exports.PartiallySafeHint : ''})`;
37
41
  }
38
- exports.actionStatusSuffix = actionStatusSuffix;
39
42
  function normalizeOptions(options) {
40
43
  return {
41
44
  typescript: options.typescript ?? false,
@@ -47,12 +50,9 @@ function normalizeOptions(options) {
47
50
  config: options.config ?? undefined,
48
51
  };
49
52
  }
50
- exports.normalizeOptions = normalizeOptions;
51
53
  function findStringIgnoringCase(str, values) {
52
54
  return values.find((v) => v.toLowerCase() === str.toLowerCase());
53
55
  }
54
- exports.findStringIgnoringCase = findStringIgnoringCase;
55
56
  function findClosestValue(str, values, maxLevenshtein = 3) {
56
57
  return values.find((v) => (0, leven_1.default)(v, str) <= maxLevenshtein);
57
58
  }
58
- exports.findClosestValue = findClosestValue;
@@ -6,7 +6,11 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getComponentName = exports.getThemeComponents = exports.listComponentNames = exports.readComponentNames = exports.getMissingIntermediateComponentFolderNames = void 0;
9
+ exports.getMissingIntermediateComponentFolderNames = getMissingIntermediateComponentFolderNames;
10
+ exports.readComponentNames = readComponentNames;
11
+ exports.listComponentNames = listComponentNames;
12
+ exports.getThemeComponents = getThemeComponents;
13
+ exports.getComponentName = getComponentName;
10
14
  const tslib_1 = require("tslib");
11
15
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
16
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -37,7 +41,6 @@ function getMissingIntermediateComponentFolderNames(componentNames) {
37
41
  const expandedComponentNames = lodash_1.default.uniq(componentNames.flatMap((componentName) => getAllIntermediatePaths(componentName)));
38
42
  return lodash_1.default.difference(expandedComponentNames, componentNames);
39
43
  }
40
- exports.getMissingIntermediateComponentFolderNames = getMissingIntermediateComponentFolderNames;
41
44
  const skipReadDirNames = ['__test__', '__tests__', '__mocks__', '__fixtures__'];
42
45
  async function readComponentNames(themePath) {
43
46
  if (!(await fs_extra_1.default.pathExists(themePath))) {
@@ -71,7 +74,6 @@ async function readComponentNames(themePath) {
71
74
  const componentNames = componentFiles.map((f) => f.componentName);
72
75
  return sortComponentNames(componentNames);
73
76
  }
74
- exports.readComponentNames = readComponentNames;
75
77
  function listComponentNames(themeComponents) {
76
78
  if (themeComponents.all.length === 0) {
77
79
  return 'No component to swizzle.';
@@ -81,7 +83,6 @@ function listComponentNames(themeComponents) {
81
83
  ${(0, tables_1.helpTables)()}
82
84
  `;
83
85
  }
84
- exports.listComponentNames = listComponentNames;
85
86
  async function getThemeComponents({ themeName, themePath, swizzleConfig, }) {
86
87
  const FallbackSwizzleActionStatus = 'unsafe';
87
88
  const FallbackSwizzleComponentDescription = 'N/A';
@@ -151,7 +152,6 @@ async function getThemeComponents({ themeName, themePath, swizzleConfig, }) {
151
152
  hasAllSafeAction,
152
153
  };
153
154
  }
154
- exports.getThemeComponents = getThemeComponents;
155
155
  // Returns a valid value if recovering is possible
156
156
  function handleInvalidComponentNameParam({ componentNameParam, themeComponents, }) {
157
157
  // Trying to recover invalid value
@@ -198,4 +198,3 @@ async function getComponentName({ componentNameParam, themeComponents, list, })
198
198
  : await (0, prompts_1.askComponentName)(themeComponents);
199
199
  return componentName;
200
200
  }
201
- exports.getComponentName = getComponentName;
@@ -6,7 +6,8 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getThemeSwizzleConfig = exports.normalizeSwizzleConfig = void 0;
9
+ exports.normalizeSwizzleConfig = normalizeSwizzleConfig;
10
+ exports.getThemeSwizzleConfig = getThemeSwizzleConfig;
10
11
  const tslib_1 = require("tslib");
11
12
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
12
13
  const utils_validation_1 = require("@docusaurus/utils-validation");
@@ -63,7 +64,6 @@ function normalizeSwizzleConfig(unsafeSwizzleConfig) {
63
64
  });
64
65
  return swizzleConfig;
65
66
  }
66
- exports.normalizeSwizzleConfig = normalizeSwizzleConfig;
67
67
  const FallbackSwizzleConfig = {
68
68
  components: {},
69
69
  };
@@ -81,4 +81,3 @@ function getThemeSwizzleConfig(themeName, plugins) {
81
81
  }
82
82
  return FallbackSwizzleConfig;
83
83
  }
84
- exports.getThemeSwizzleConfig = getThemeSwizzleConfig;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.initSwizzleContext = void 0;
9
+ exports.initSwizzleContext = initSwizzleContext;
10
10
  const site_1 = require("../../server/site");
11
11
  const init_1 = require("../../server/plugins/init");
12
12
  const configs_1 = require("../../server/plugins/configs");
@@ -21,4 +21,3 @@ async function initSwizzleContext(siteDir, options) {
21
21
  })),
22
22
  };
23
23
  }
24
- exports.initSwizzleContext = initSwizzleContext;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.swizzle = void 0;
9
+ exports.swizzle = swizzle;
10
10
  const tslib_1 = require("tslib");
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
@@ -145,4 +145,3 @@ Ejected name=${componentName} from name=${themeName} to path=${result.createdFil
145
145
  await executeAction();
146
146
  return process.exit(0);
147
147
  }
148
- exports.swizzle = swizzle;
@@ -6,7 +6,10 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.askSwizzleAction = exports.askSwizzleDangerousComponent = exports.askComponentName = exports.askThemeName = void 0;
9
+ exports.askThemeName = askThemeName;
10
+ exports.askComponentName = askComponentName;
11
+ exports.askSwizzleDangerousComponent = askSwizzleDangerousComponent;
12
+ exports.askSwizzleAction = askSwizzleAction;
10
13
  const tslib_1 = require("tslib");
11
14
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
12
15
  const prompts_1 = tslib_1.__importDefault(require("prompts"));
@@ -26,7 +29,6 @@ async function askThemeName(themeNames) {
26
29
  }
27
30
  return themeName;
28
31
  }
29
- exports.askThemeName = askThemeName;
30
32
  async function askComponentName(themeComponents) {
31
33
  function formatComponentName(componentName) {
32
34
  const anySafe = themeComponents.hasAnySafeAction(componentName);
@@ -64,7 +66,6 @@ ${common_1.PartiallySafeHint} = not safe for all swizzle actions
64
66
  }
65
67
  return componentName;
66
68
  }
67
- exports.askComponentName = askComponentName;
68
69
  async function askSwizzleDangerousComponent() {
69
70
  const { switchToDanger } = (await (0, prompts_1.default)({
70
71
  type: 'select',
@@ -84,7 +85,6 @@ async function askSwizzleDangerousComponent() {
84
85
  }
85
86
  return !!switchToDanger;
86
87
  }
87
- exports.askSwizzleDangerousComponent = askSwizzleDangerousComponent;
88
88
  async function askSwizzleAction(componentConfig) {
89
89
  const { action } = (await (0, prompts_1.default)({
90
90
  type: 'select',
@@ -107,4 +107,3 @@ async function askSwizzleAction(componentConfig) {
107
107
  }
108
108
  return action;
109
109
  }
110
- exports.askSwizzleAction = askSwizzleAction;
@@ -6,7 +6,8 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.themeComponentsTable = exports.helpTables = void 0;
9
+ exports.helpTables = helpTables;
10
+ exports.themeComponentsTable = themeComponentsTable;
10
11
  const tslib_1 = require("tslib");
11
12
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
12
13
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
@@ -89,7 +90,6 @@ ${statusTable()}
89
90
 
90
91
  ${logger_1.default.bold('Swizzle guide')}: https://docusaurus.io/docs/swizzling`;
91
92
  }
92
- exports.helpTables = helpTables;
93
93
  function themeComponentsTable(themeComponents) {
94
94
  const table = new cli_table3_1.default({
95
95
  head: [
@@ -110,4 +110,3 @@ function themeComponentsTable(themeComponents) {
110
110
  ${table.toString()}
111
111
  `;
112
112
  }
113
- exports.themeComponentsTable = themeComponentsTable;