@docusaurus/core 0.0.0-4768 → 0.0.0-4771

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.
package/lib/choosePort.js CHANGED
@@ -22,7 +22,7 @@ const execOptions = {
22
22
  stdio: [
23
23
  'pipe',
24
24
  'pipe',
25
- 'ignore', // stderr
25
+ 'ignore',
26
26
  ],
27
27
  };
28
28
  // Clears console
@@ -32,20 +32,17 @@ function clearConsole() {
32
32
  // Gets process id of what is on port
33
33
  function getProcessIdOnPort(port) {
34
34
  return (0, child_process_1.execSync)(`lsof -i:${port} -P -t -sTCP:LISTEN`, execOptions)
35
- .toString()
36
35
  .split('\n')[0]
37
36
  .trim();
38
37
  }
39
38
  // Gets process command
40
39
  function getProcessCommand(processId) {
41
40
  const command = (0, child_process_1.execSync)(`ps -o command -p ${processId} | sed -n 2p`, execOptions);
42
- return command.toString().replace(/\n$/, '');
41
+ return command.replace(/\n$/, '');
43
42
  }
44
43
  // Gets directory of a process from its process id
45
44
  function getDirectoryOfProcessById(processId) {
46
- return (0, child_process_1.execSync)(`lsof -p ${processId} | awk '$4=="cwd" {for (i=9; i<=NF; i++) printf "%s ", $i}'`, execOptions)
47
- .toString()
48
- .trim();
45
+ return (0, child_process_1.execSync)(`lsof -p ${processId} | awk '$4=="cwd" {for (i=9; i<=NF; i++) printf "%s ", $i}'`, execOptions).trim();
49
46
  }
50
47
  // Gets process on port
51
48
  function getProcessForPort(port) {
@@ -30,6 +30,7 @@ export default function ComponentCreator(path, hash) {
30
30
  const chunkNames = routesChunkNames[chunkNamesKey];
31
31
  const optsModules = [];
32
32
  const optsWebpack = [];
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
34
  const optsLoader = {};
34
35
  /* Prepare opts data that react-loadable needs
35
36
  https://github.com/jamiebuilds/react-loadable#declaring-which-modules-are-being-loaded
@@ -21,6 +21,11 @@ function addBaseUrl(siteUrl, baseUrl, url, { forcePrependBaseUrl = false, absolu
21
21
  if (forcePrependBaseUrl) {
22
22
  return baseUrl + url.replace(/^\//, '');
23
23
  }
24
+ // /baseUrl -> /baseUrl/
25
+ // https://github.com/facebook/docusaurus/issues/6315
26
+ if (url === baseUrl.replace(/\/$/, '')) {
27
+ return baseUrl;
28
+ }
24
29
  // We should avoid adding the baseurl twice if it's already there
25
30
  const shouldAddBaseUrl = !url.startsWith(baseUrl);
26
31
  const basePath = shouldAddBaseUrl ? baseUrl + url.replace(/^\//, '') : url;
@@ -4,6 +4,7 @@
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
- export default function useGlobalData(): Record<string, unknown>;
8
- export declare function useAllPluginInstancesData<T = unknown>(pluginName: string): Record<string, T>;
9
- export declare function usePluginData<T = unknown>(pluginName: string, pluginId?: string): T;
7
+ import type { GlobalData } from '@docusaurus/types';
8
+ export default function useGlobalData(): GlobalData;
9
+ export declare function useAllPluginInstancesData(pluginName: string): GlobalData[string];
10
+ export declare function usePluginData(pluginName: string, pluginId?: string): GlobalData[string][string];
@@ -5,4 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { RouteChunksTree } from '@docusaurus/types';
8
- export default function flat(target: RouteChunksTree): Record<string, string>;
8
+ export default function flat(target: RouteChunksTree): {
9
+ [keyPath: string]: string;
10
+ };
@@ -6,7 +6,9 @@
6
6
  */
7
7
  import type { RouteConfig, ReportingSeverity } from '@docusaurus/types';
8
8
  export declare function handleBrokenLinks({ allCollectedLinks, onBrokenLinks, routes, baseUrl, outDir, }: {
9
- allCollectedLinks: Record<string, string[]>;
9
+ allCollectedLinks: {
10
+ [location: string]: string[];
11
+ };
10
12
  onBrokenLinks: ReportingSeverity;
11
13
  routes: RouteConfig[];
12
14
  baseUrl: string;
@@ -4,7 +4,7 @@
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 type { LoadContext, PluginConfig, RouteConfig, ThemeConfig, LoadedPlugin } from '@docusaurus/types';
7
+ import type { LoadContext, PluginConfig, RouteConfig, GlobalData, ThemeConfig, LoadedPlugin } from '@docusaurus/types';
8
8
  export declare function sortConfig(routeConfigs: RouteConfig[], baseUrl?: string): void;
9
9
  export declare function loadPlugins({ pluginConfigs, context, }: {
10
10
  pluginConfigs: PluginConfig[];
@@ -12,6 +12,6 @@ export declare function loadPlugins({ pluginConfigs, context, }: {
12
12
  }): Promise<{
13
13
  plugins: LoadedPlugin[];
14
14
  pluginsRouteConfigs: RouteConfig[];
15
- globalData: unknown;
15
+ globalData: GlobalData;
16
16
  themeConfigTranslated: ThemeConfig;
17
17
  }>;
@@ -25,9 +25,17 @@ export declare function localizePluginTranslationFile({ siteDir, plugin, locale,
25
25
  plugin: InitializedPlugin;
26
26
  translationFile: TranslationFile;
27
27
  }): Promise<TranslationFile>;
28
- export declare function getPluginsDefaultCodeTranslationMessages(plugins: InitializedPlugin[]): Promise<Record<string, string>>;
28
+ export declare function getPluginsDefaultCodeTranslationMessages(plugins: InitializedPlugin[]): Promise<{
29
+ [msgId: string]: string;
30
+ }>;
29
31
  export declare function applyDefaultCodeTranslations({ extractedCodeTranslations, defaultCodeMessages, }: {
30
- extractedCodeTranslations: Record<string, TranslationMessage>;
31
- defaultCodeMessages: Record<string, string>;
32
- }): Record<string, TranslationMessage>;
32
+ extractedCodeTranslations: {
33
+ [msgId: string]: TranslationMessage;
34
+ };
35
+ defaultCodeMessages: {
36
+ [msgId: string]: string;
37
+ };
38
+ }): {
39
+ [msgId: string]: TranslationMessage;
40
+ };
33
41
  export {};
@@ -10,7 +10,9 @@ export declare function globSourceCodeFilePaths(dirPaths: string[]): Promise<str
10
10
  export declare function extractSiteSourceCodeTranslations(siteDir: string, plugins: InitializedPlugin[], babelOptions: TransformOptions, extraSourceCodeFilePaths?: string[]): Promise<TranslationFileContent>;
11
11
  declare type SourceCodeFileTranslations = {
12
12
  sourceCodeFilePath: string;
13
- translations: Record<string, TranslationMessage>;
13
+ translations: {
14
+ [msgId: string]: TranslationMessage;
15
+ };
14
16
  warnings: string[];
15
17
  };
16
18
  export declare function extractAllSourceCodeFileTranslations(sourceCodeFilePaths: string[], babelOptions: TransformOptions): Promise<SourceCodeFileTranslations[]>;
@@ -4,6 +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
- import type { DocusaurusPluginVersionInformation } from '@docusaurus/types';
7
+ import type { PluginVersionInformation } from '@docusaurus/types';
8
8
  export declare function getPackageJsonVersion(packageJsonPath: string): Promise<string | undefined>;
9
- export declare function getPluginVersion(pluginPath: string, siteDir: string): Promise<DocusaurusPluginVersionInformation>;
9
+ export declare function getPluginVersion(pluginPath: string, siteDir: string): Promise<PluginVersionInformation>;
@@ -8,5 +8,7 @@ import type { Configuration } from 'webpack';
8
8
  import type { Props } from '@docusaurus/types';
9
9
  export declare const clientDir: string;
10
10
  export declare function excludeJS(modulePath: string): boolean;
11
- export declare function getDocusaurusAliases(): Promise<Record<string, string>>;
11
+ export declare function getDocusaurusAliases(): Promise<{
12
+ [aliasName: string]: string;
13
+ }>;
12
14
  export declare function createBaseConfig(props: Props, isServer: boolean, minify?: boolean): Promise<Configuration>;
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-4768",
4
+ "version": "0.0.0-4771",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.17.8",
42
42
  "@babel/runtime-corejs3": "^7.17.8",
43
43
  "@babel/traverse": "^7.17.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4768",
45
- "@docusaurus/logger": "0.0.0-4768",
46
- "@docusaurus/mdx-loader": "0.0.0-4768",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4771",
45
+ "@docusaurus/logger": "0.0.0-4771",
46
+ "@docusaurus/mdx-loader": "0.0.0-4771",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4768",
49
- "@docusaurus/utils-common": "0.0.0-4768",
50
- "@docusaurus/utils-validation": "0.0.0-4768",
48
+ "@docusaurus/utils": "0.0.0-4771",
49
+ "@docusaurus/utils-common": "0.0.0-4771",
50
+ "@docusaurus/utils-validation": "0.0.0-4771",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.4",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.4",
@@ -106,8 +106,8 @@
106
106
  "webpackbar": "^5.0.2"
107
107
  },
108
108
  "devDependencies": {
109
- "@docusaurus/module-type-aliases": "0.0.0-4768",
110
- "@docusaurus/types": "0.0.0-4768",
109
+ "@docusaurus/module-type-aliases": "0.0.0-4771",
110
+ "@docusaurus/types": "0.0.0-4771",
111
111
  "@types/detect-port": "^1.3.2",
112
112
  "@types/nprogress": "^0.2.0",
113
113
  "@types/react-dom": "^17.0.14",
@@ -128,5 +128,5 @@
128
128
  "engines": {
129
129
  "node": ">=14"
130
130
  },
131
- "gitHead": "4a89ff667d4a8896c47c4f946796cf3f58d219dc"
131
+ "gitHead": "1b462b797e77b4a018e3c1ebb36ec87521ad4d07"
132
132
  }