@docusaurus/plugin-content-docs 0.0.0-4769 → 0.0.0-4772

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.
@@ -5,7 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { GlobalPluginData, GlobalVersion, GetActivePluginOptions, ActivePlugin, ActiveDocContext, DocVersionSuggestions } from '@docusaurus/plugin-content-docs/client';
8
- export declare function getActivePlugin(allPluginDatas: Record<string, GlobalPluginData>, pathname: string, options?: GetActivePluginOptions): ActivePlugin | undefined;
8
+ export declare function getActivePlugin(allPluginData: {
9
+ [pluginId: string]: GlobalPluginData;
10
+ }, pathname: string, options?: GetActivePluginOptions): ActivePlugin | undefined;
9
11
  export declare const getLatestVersion: (data: GlobalPluginData) => GlobalVersion;
10
12
  export declare const getActiveVersion: (data: GlobalPluginData, pathname: string) => GlobalVersion | undefined;
11
13
  export declare const getActiveDocContext: (data: GlobalPluginData, pathname: string) => ActiveDocContext;
@@ -12,8 +12,8 @@ const router_1 = require("@docusaurus/router");
12
12
  // get the data of the plugin that is currently "active"
13
13
  // ie the docs of that plugin are currently browsed
14
14
  // it is useful to support multiple docs plugin instances
15
- function getActivePlugin(allPluginDatas, pathname, options = {}) {
16
- const activeEntry = Object.entries(allPluginDatas)
15
+ function getActivePlugin(allPluginData, pathname, options = {}) {
16
+ const activeEntry = Object.entries(allPluginData)
17
17
  // Route sorting: '/android/foo' should match '/android' instead of '/'
18
18
  .sort((a, b) => b[1].path.localeCompare(a[1].path))
19
19
  .find(([, pluginData]) => !!(0, router_1.matchPath)(pathname, {
@@ -25,7 +25,7 @@ function getActivePlugin(allPluginDatas, pathname, options = {}) {
25
25
  ? { pluginId: activeEntry[0], pluginData: activeEntry[1] }
26
26
  : undefined;
27
27
  if (!activePlugin && options.failfast) {
28
- throw new Error(`Can't find active docs plugin for "${pathname}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(allPluginDatas)
28
+ throw new Error(`Can't find active docs plugin for "${pathname}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(allPluginData)
29
29
  .map((plugin) => plugin.path)
30
30
  .join(', ')}`);
31
31
  }
@@ -5,7 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { GlobalPluginData, GlobalVersion, ActivePlugin, ActiveDocContext, DocVersionSuggestions, GetActivePluginOptions } from '@docusaurus/plugin-content-docs/client';
8
- export declare const useAllDocsData: () => Record<string, GlobalPluginData>;
8
+ export declare const useAllDocsData: () => {
9
+ [pluginId: string]: GlobalPluginData;
10
+ };
9
11
  export declare const useDocsData: (pluginId: string | undefined) => GlobalPluginData;
10
12
  export declare const useActivePlugin: (options?: GetActivePluginOptions) => ActivePlugin | undefined;
11
13
  export declare const useActivePluginAndVersion: (options?: GetActivePluginOptions) => {
package/lib/docs.d.ts CHANGED
@@ -39,5 +39,7 @@ export declare function getDocIds(doc: DocMetadataBase): [string, string];
39
39
  export declare function createDocsByIdIndex<Doc extends {
40
40
  id: string;
41
41
  unversionedId: string;
42
- }>(docs: Doc[]): Record<string, Doc>;
42
+ }>(docs: Doc[]): {
43
+ [docId: string]: Doc;
44
+ };
43
45
  export {};
@@ -5,4 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { DocFrontMatter } from './types';
8
- export declare function validateDocFrontMatter(frontMatter: Record<string, unknown>): DocFrontMatter;
8
+ export declare function validateDocFrontMatter(frontMatter: {
9
+ [key: string]: unknown;
10
+ }): DocFrontMatter;
@@ -5,4 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { NormalizedSidebars, ProcessedSidebars, SidebarProcessorParams, CategoryMetadataFile } from './types';
8
- export declare function processSidebars(unprocessedSidebars: NormalizedSidebars, categoriesMetadata: Record<string, CategoryMetadataFile>, params: SidebarProcessorParams): Promise<ProcessedSidebars>;
8
+ export declare function processSidebars(unprocessedSidebars: NormalizedSidebars, categoriesMetadata: {
9
+ [filePath: string]: CategoryMetadataFile;
10
+ }, params: SidebarProcessorParams): Promise<ProcessedSidebars>;
@@ -29,7 +29,7 @@ function toSidebarItemsGeneratorVersion(version) {
29
29
  // Handle the generation of autogenerated sidebar items and other
30
30
  // post-processing checks
31
31
  async function processSidebar(unprocessedSidebar, categoriesMetadata, params) {
32
- const { sidebarItemsGenerator, numberPrefixParser, docs, version, sidebarOptions, } = params;
32
+ const { sidebarItemsGenerator, numberPrefixParser, docs, version } = params;
33
33
  // Just a minor lazy transformation optimization
34
34
  const getSidebarItemsGeneratorDocsAndVersion = lodash_1.default.memoize(() => ({
35
35
  docs: docs.map(toSidebarItemsGeneratorDoc),
@@ -42,7 +42,6 @@ async function processSidebar(unprocessedSidebar, categoriesMetadata, params) {
42
42
  defaultSidebarItemsGenerator: generator_1.DefaultSidebarItemsGenerator,
43
43
  isCategoryIndex: docs_1.isCategoryIndex,
44
44
  ...getSidebarItemsGeneratorDocsAndVersion(),
45
- options: sidebarOptions,
46
45
  categoriesMetadata,
47
46
  });
48
47
  // Process again... weird but sidebar item generated might generate some
@@ -8,12 +8,16 @@ import type { Optional, Required } from 'utility-types';
8
8
  import type { DocMetadataBase, VersionMetadata } from '../types';
9
9
  import type { NumberPrefixParser, SidebarOptions, CategoryIndexMatcher } from '@docusaurus/plugin-content-docs';
10
10
  import type { Slugger } from '@docusaurus/utils';
11
- declare type Expand<T extends Record<string, unknown>> = {
11
+ declare type Expand<T extends {
12
+ [x: string]: unknown;
13
+ }> = {
12
14
  [P in keyof T]: T[P];
13
15
  };
14
16
  export declare type SidebarItemBase = {
15
17
  className?: string;
16
- customProps?: Record<string, unknown>;
18
+ customProps?: {
19
+ [key: string]: unknown;
20
+ };
17
21
  };
18
22
  export declare type SidebarItemDoc = SidebarItemBase & {
19
23
  type: 'doc' | 'ref';
@@ -138,7 +142,9 @@ export declare type CategoryMetadataFile = {
138
142
  collapsible?: boolean;
139
143
  className?: string;
140
144
  link?: SidebarItemCategoryLinkConfig | null;
141
- customProps?: Record<string, unknown>;
145
+ customProps?: {
146
+ [key: string]: unknown;
147
+ };
142
148
  };
143
149
  export declare type SidebarItemsGeneratorDoc = Pick<DocMetadataBase, 'id' | 'unversionedId' | 'frontMatter' | 'source' | 'sourceDirName' | 'sidebarPosition'>;
144
150
  export declare type SidebarItemsGeneratorVersion = Pick<VersionMetadata, 'versionName' | 'contentPath'>;
@@ -148,8 +154,9 @@ export declare type SidebarItemsGeneratorArgs = {
148
154
  docs: SidebarItemsGeneratorDoc[];
149
155
  numberPrefixParser: NumberPrefixParser;
150
156
  isCategoryIndex: CategoryIndexMatcher;
151
- categoriesMetadata: Record<string, CategoryMetadataFile>;
152
- options: SidebarOptions;
157
+ categoriesMetadata: {
158
+ [filePath: string]: CategoryMetadataFile;
159
+ };
153
160
  };
154
161
  export declare type SidebarItemsGenerator = (generatorArgs: SidebarItemsGeneratorArgs) => Promise<NormalizedSidebar>;
155
162
  export declare type SidebarItemsGeneratorOptionArgs = {
@@ -13,8 +13,12 @@ export declare function collectSidebarCategories(sidebar: Sidebar): SidebarItemC
13
13
  export declare function collectSidebarLinks(sidebar: Sidebar): SidebarItemLink[];
14
14
  export declare function collectSidebarDocIds(sidebar: Sidebar): string[];
15
15
  export declare function collectSidebarNavigation(sidebar: Sidebar): SidebarNavigationItem[];
16
- export declare function collectSidebarsDocIds(sidebars: Sidebars): Record<string, string[]>;
17
- export declare function collectSidebarsNavigations(sidebars: Sidebars): Record<string, SidebarNavigationItem[]>;
16
+ export declare function collectSidebarsDocIds(sidebars: Sidebars): {
17
+ [sidebarId: string]: string[];
18
+ };
19
+ export declare function collectSidebarsNavigations(sidebars: Sidebars): {
20
+ [sidebarId: string]: SidebarNavigationItem[];
21
+ };
18
22
  export declare type SidebarNavigation = {
19
23
  sidebarName: string | undefined;
20
24
  previous: SidebarNavigationItem | undefined;
@@ -45,4 +49,6 @@ export declare type SidebarsUtils = {
45
49
  };
46
50
  export declare function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils;
47
51
  export declare function toDocNavigationLink(doc: DocMetadataBase): DocNavLink;
48
- export declare function toNavigationLink(navigationItem: SidebarNavigationItem | undefined, docsById: Record<string, DocMetadataBase>): DocNavLink | undefined;
52
+ export declare function toNavigationLink(navigationItem: SidebarNavigationItem | undefined, docsById: {
53
+ [docId: string]: DocMetadataBase;
54
+ }): DocNavLink | undefined;
@@ -5,5 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { NormalizedSidebars, CategoryMetadataFile } from './types';
8
- export declare function validateSidebars(sidebars: Record<string, unknown>): asserts sidebars is NormalizedSidebars;
8
+ export declare function validateSidebars(sidebars: {
9
+ [sidebarId: string]: unknown;
10
+ }): asserts sidebars is NormalizedSidebars;
9
11
  export declare function validateCategoryMetadataFile(unsafeContent: unknown): CategoryMetadataFile;
package/lib/types.d.ts CHANGED
@@ -46,7 +46,9 @@ export declare type DocFrontMatter = {
46
46
  sidebar_label?: string;
47
47
  sidebar_position?: number;
48
48
  sidebar_class_name?: string;
49
- sidebar_custom_props?: Record<string, unknown>;
49
+ sidebar_custom_props?: {
50
+ [key: string]: unknown;
51
+ };
50
52
  displayed_sidebar?: string | null;
51
53
  pagination_label?: string;
52
54
  custom_edit_url?: string | null;
@@ -69,7 +71,9 @@ export declare type DocMetadataBase = LastUpdateData & {
69
71
  sidebarPosition?: number;
70
72
  editUrl?: string | null;
71
73
  tags: Tag[];
72
- frontMatter: DocFrontMatter & Record<string, unknown>;
74
+ frontMatter: DocFrontMatter & {
75
+ [key: string]: unknown;
76
+ };
73
77
  };
74
78
  export declare type DocNavLink = {
75
79
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-docs",
3
- "version": "0.0.0-4769",
3
+ "version": "0.0.0-4772",
4
4
  "description": "Docs plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@docusaurus/core": "0.0.0-4769",
27
- "@docusaurus/logger": "0.0.0-4769",
28
- "@docusaurus/mdx-loader": "0.0.0-4769",
29
- "@docusaurus/utils": "0.0.0-4769",
30
- "@docusaurus/utils-validation": "0.0.0-4769",
26
+ "@docusaurus/core": "0.0.0-4772",
27
+ "@docusaurus/logger": "0.0.0-4772",
28
+ "@docusaurus/mdx-loader": "0.0.0-4772",
29
+ "@docusaurus/utils": "0.0.0-4772",
30
+ "@docusaurus/utils-validation": "0.0.0-4772",
31
31
  "combine-promises": "^1.1.0",
32
32
  "fs-extra": "^10.0.1",
33
33
  "import-fresh": "^3.3.0",
@@ -39,8 +39,8 @@
39
39
  "webpack": "^5.70.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@docusaurus/module-type-aliases": "0.0.0-4769",
43
- "@docusaurus/types": "0.0.0-4769",
42
+ "@docusaurus/module-type-aliases": "0.0.0-4772",
43
+ "@docusaurus/types": "0.0.0-4772",
44
44
  "@types/js-yaml": "^4.0.5",
45
45
  "@types/picomatch": "^2.3.0",
46
46
  "commander": "^5.1.0",
@@ -56,5 +56,5 @@
56
56
  "engines": {
57
57
  "node": ">=14"
58
58
  },
59
- "gitHead": "b104c515859e1872c4eccba6cea866558f7f6332"
59
+ "gitHead": "50ef1fb8e19a46e43c122d625c8bff2110546260"
60
60
  }
@@ -17,7 +17,7 @@ function getCategoryGeneratedIndexMetadata({
17
17
  }: {
18
18
  category: SidebarItemCategoryWithGeneratedIndex;
19
19
  sidebarsUtils: SidebarsUtils;
20
- docsById: Record<string, DocMetadataBase>;
20
+ docsById: {[docId: string]: DocMetadataBase};
21
21
  }): CategoryGeneratedIndexMetadata {
22
22
  const {sidebarName, previous, next} =
23
23
  sidebarsUtils.getCategoryGeneratedIndexNavigation(category.link.permalink);
@@ -23,11 +23,11 @@ import type {
23
23
  // ie the docs of that plugin are currently browsed
24
24
  // it is useful to support multiple docs plugin instances
25
25
  export function getActivePlugin(
26
- allPluginDatas: Record<string, GlobalPluginData>,
26
+ allPluginData: {[pluginId: string]: GlobalPluginData},
27
27
  pathname: string,
28
28
  options: GetActivePluginOptions = {},
29
29
  ): ActivePlugin | undefined {
30
- const activeEntry = Object.entries(allPluginDatas)
30
+ const activeEntry = Object.entries(allPluginData)
31
31
  // Route sorting: '/android/foo' should match '/android' instead of '/'
32
32
  .sort((a, b) => b[1].path.localeCompare(a[1].path))
33
33
  .find(
@@ -46,7 +46,7 @@ export function getActivePlugin(
46
46
  if (!activePlugin && options.failfast) {
47
47
  throw new Error(
48
48
  `Can't find active docs plugin for "${pathname}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(
49
- allPluginDatas,
49
+ allPluginData,
50
50
  )
51
51
  .map((plugin) => plugin.path)
52
52
  .join(', ')}`,
@@ -31,7 +31,7 @@ const StableEmptyObject = {};
31
31
  // Not using useAllPluginInstancesData() because in blog-only mode, docs hooks
32
32
  // are still used by the theme. We need a fail-safe fallback when the docs
33
33
  // plugin is not in use
34
- export const useAllDocsData = (): Record<string, GlobalPluginData> =>
34
+ export const useAllDocsData = (): {[pluginId: string]: GlobalPluginData} =>
35
35
  useGlobalData()['docusaurus-plugin-content-docs'] ?? StableEmptyObject;
36
36
 
37
37
  export const useDocsData = (pluginId: string | undefined): GlobalPluginData =>
package/src/deps.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  declare module 'remark-admonitions' {
9
- type Options = Record<string, unknown>;
9
+ type Options = {[key: string]: unknown};
10
10
 
11
11
  const plugin: (options?: Options) => void;
12
12
  export = plugin;
package/src/docs.ts CHANGED
@@ -424,7 +424,7 @@ export function getDocIds(doc: DocMetadataBase): [string, string] {
424
424
  // to "id")
425
425
  export function createDocsByIdIndex<
426
426
  Doc extends {id: string; unversionedId: string},
427
- >(docs: Doc[]): Record<string, Doc> {
427
+ >(docs: Doc[]): {[docId: string]: Doc} {
428
428
  return Object.fromEntries(
429
429
  docs.flatMap((doc) => [
430
430
  [doc.unversionedId, doc],
@@ -41,8 +41,8 @@ const DocFrontMatterSchema = Joi.object<DocFrontMatter>({
41
41
  ...FrontMatterTOCHeadingLevels,
42
42
  }).unknown();
43
43
 
44
- export function validateDocFrontMatter(
45
- frontMatter: Record<string, unknown>,
46
- ): DocFrontMatter {
44
+ export function validateDocFrontMatter(frontMatter: {
45
+ [key: string]: unknown;
46
+ }): DocFrontMatter {
47
47
  return validateFrontMatter(frontMatter, DocFrontMatterSchema);
48
48
  }
package/src/globalData.ts CHANGED
@@ -40,7 +40,7 @@ function toGlobalDataGeneratedIndex(
40
40
  function toGlobalSidebars(
41
41
  sidebars: Sidebars,
42
42
  version: LoadedVersion,
43
- ): Record<string, GlobalSidebar> {
43
+ ): {[sidebarId: string]: GlobalSidebar} {
44
44
  const {getFirstLink} = createSidebarsUtils(sidebars);
45
45
  return _.mapValues(sidebars, (sidebar, sidebarId) => {
46
46
  const firstLink = getFirstLink(sidebarId);
package/src/index.ts CHANGED
@@ -56,7 +56,6 @@ import type {
56
56
  PropTagsListPage,
57
57
  PluginOptions,
58
58
  } from '@docusaurus/plugin-content-docs';
59
- import type {GlobalPluginData} from '@docusaurus/plugin-content-docs/client';
60
59
  import {createSidebarsUtils} from './sidebars/utils';
61
60
  import {getCategoryGeneratedIndexMetadataList} from './categoryGeneratedIndex';
62
61
 
@@ -293,7 +292,7 @@ export default async function pluginContentDocs(
293
292
  // TODO tags should be a sub route of the version route
294
293
  await Promise.all(loadedVersions.map(createVersionTagsRoutes));
295
294
 
296
- setGlobalData<GlobalPluginData>({
295
+ setGlobalData({
297
296
  path: normalizeUrl([baseUrl, options.routeBasePath]),
298
297
  versions: loadedVersions.map(toGlobalDataVersion),
299
298
  breadcrumbs,
@@ -68,7 +68,7 @@ declare module '@docusaurus/plugin-content-docs' {
68
68
  };
69
69
  export type VersionsOptions = {
70
70
  lastVersion?: string;
71
- versions: Record<string, VersionOptions>;
71
+ versions: {[versionName: string]: VersionOptions};
72
72
  onlyIncludeVersions?: string[];
73
73
  };
74
74
  export type SidebarOptions = {
@@ -89,7 +89,7 @@ declare module '@docusaurus/plugin-content-docs' {
89
89
  docTagDocListComponent: string;
90
90
  docTagsListComponent: string;
91
91
  docCategoryGeneratedIndexComponent: string;
92
- admonitions: Record<string, unknown>;
92
+ admonitions: {[key: string]: unknown};
93
93
  disableVersioning: boolean;
94
94
  includeCurrentVersion: boolean;
95
95
  sidebarItemsGenerator: import('./sidebars/types').SidebarItemsGeneratorOption;
@@ -282,7 +282,7 @@ declare module '@docusaurus/plugin-content-docs/client' {
282
282
  export type ActiveDocContext = {
283
283
  activeVersion?: GlobalVersion;
284
284
  activeDoc?: GlobalDoc;
285
- alternateDocVersions: Record<string, GlobalDoc>;
285
+ alternateDocVersions: {[versionName: string]: GlobalDoc};
286
286
  };
287
287
  export type GlobalDoc = {
288
288
  id: string;
@@ -297,7 +297,7 @@ declare module '@docusaurus/plugin-content-docs/client' {
297
297
  path: string;
298
298
  mainDocId: string; // home doc (if docs homepage configured), or first doc
299
299
  docs: GlobalDoc[];
300
- sidebars?: Record<string, GlobalSidebar>;
300
+ sidebars?: {[sidebarId: string]: GlobalSidebar};
301
301
  };
302
302
 
303
303
  export type GlobalSidebarLink = {
@@ -322,7 +322,7 @@ declare module '@docusaurus/plugin-content-docs/client' {
322
322
  };
323
323
  export type GetActivePluginOptions = {failfast?: boolean}; // use fail-fast option if you know for sure one plugin instance is active
324
324
 
325
- export const useAllDocsData: () => Record<string, GlobalPluginData>;
325
+ export const useAllDocsData: () => {[pluginId: string]: GlobalPluginData};
326
326
  export const useDocsData: (pluginId?: string) => GlobalPluginData;
327
327
  export const useActivePlugin: (
328
328
  options?: GetActivePluginOptions,
@@ -48,16 +48,10 @@ function toSidebarItemsGeneratorVersion(
48
48
  // post-processing checks
49
49
  async function processSidebar(
50
50
  unprocessedSidebar: NormalizedSidebar,
51
- categoriesMetadata: Record<string, CategoryMetadataFile>,
51
+ categoriesMetadata: {[filePath: string]: CategoryMetadataFile},
52
52
  params: SidebarProcessorParams,
53
53
  ): Promise<ProcessedSidebar> {
54
- const {
55
- sidebarItemsGenerator,
56
- numberPrefixParser,
57
- docs,
58
- version,
59
- sidebarOptions,
60
- } = params;
54
+ const {sidebarItemsGenerator, numberPrefixParser, docs, version} = params;
61
55
 
62
56
  // Just a minor lazy transformation optimization
63
57
  const getSidebarItemsGeneratorDocsAndVersion = _.memoize(() => ({
@@ -74,7 +68,6 @@ async function processSidebar(
74
68
  defaultSidebarItemsGenerator: DefaultSidebarItemsGenerator,
75
69
  isCategoryIndex,
76
70
  ...getSidebarItemsGeneratorDocsAndVersion(),
77
- options: sidebarOptions,
78
71
  categoriesMetadata,
79
72
  });
80
73
  // Process again... weird but sidebar item generated might generate some
@@ -113,7 +106,7 @@ async function processSidebar(
113
106
 
114
107
  export async function processSidebars(
115
108
  unprocessedSidebars: NormalizedSidebars,
116
- categoriesMetadata: Record<string, CategoryMetadataFile>,
109
+ categoriesMetadata: {[filePath: string]: CategoryMetadataFile},
117
110
  params: SidebarProcessorParams,
118
111
  ): Promise<ProcessedSidebars> {
119
112
  const processedSidebars = await combinePromises(
@@ -15,11 +15,11 @@ import type {
15
15
  import type {Slugger} from '@docusaurus/utils';
16
16
 
17
17
  // Makes all properties visible when hovering over the type
18
- type Expand<T extends Record<string, unknown>> = {[P in keyof T]: T[P]};
18
+ type Expand<T extends {[x: string]: unknown}> = {[P in keyof T]: T[P]};
19
19
 
20
20
  export type SidebarItemBase = {
21
21
  className?: string;
22
- customProps?: Record<string, unknown>;
22
+ customProps?: {[key: string]: unknown};
23
23
  };
24
24
 
25
25
  export type SidebarItemDoc = SidebarItemBase & {
@@ -216,7 +216,7 @@ export type CategoryMetadataFile = {
216
216
  collapsible?: boolean;
217
217
  className?: string;
218
218
  link?: SidebarItemCategoryLinkConfig | null;
219
- customProps?: Record<string, unknown>;
219
+ customProps?: {[key: string]: unknown};
220
220
 
221
221
  // TODO should we allow "items" here? how would this work? would an
222
222
  // "autogenerated" type be allowed?
@@ -247,8 +247,7 @@ export type SidebarItemsGeneratorArgs = {
247
247
  docs: SidebarItemsGeneratorDoc[];
248
248
  numberPrefixParser: NumberPrefixParser;
249
249
  isCategoryIndex: CategoryIndexMatcher;
250
- categoriesMetadata: Record<string, CategoryMetadataFile>;
251
- options: SidebarOptions;
250
+ categoriesMetadata: {[filePath: string]: CategoryMetadataFile};
252
251
  };
253
252
  export type SidebarItemsGenerator = (
254
253
  generatorArgs: SidebarItemsGeneratorArgs,
@@ -107,15 +107,15 @@ export function collectSidebarNavigation(
107
107
  });
108
108
  }
109
109
 
110
- export function collectSidebarsDocIds(
111
- sidebars: Sidebars,
112
- ): Record<string, string[]> {
110
+ export function collectSidebarsDocIds(sidebars: Sidebars): {
111
+ [sidebarId: string]: string[];
112
+ } {
113
113
  return _.mapValues(sidebars, collectSidebarDocIds);
114
114
  }
115
115
 
116
- export function collectSidebarsNavigations(
117
- sidebars: Sidebars,
118
- ): Record<string, SidebarNavigationItem[]> {
116
+ export function collectSidebarsNavigations(sidebars: Sidebars): {
117
+ [sidebarId: string]: SidebarNavigationItem[];
118
+ } {
119
119
  return _.mapValues(sidebars, collectSidebarNavigation);
120
120
  }
121
121
 
@@ -360,7 +360,7 @@ export function toDocNavigationLink(doc: DocMetadataBase): DocNavLink {
360
360
 
361
361
  export function toNavigationLink(
362
362
  navigationItem: SidebarNavigationItem | undefined,
363
- docsById: Record<string, DocMetadataBase>,
363
+ docsById: {[docId: string]: DocMetadataBase},
364
364
  ): DocNavLink | undefined {
365
365
  function getDocById(docId: string) {
366
366
  const doc = docsById[docId];
@@ -149,9 +149,9 @@ function validateSidebarItem(
149
149
  }
150
150
  }
151
151
 
152
- export function validateSidebars(
153
- sidebars: Record<string, unknown>,
154
- ): asserts sidebars is NormalizedSidebars {
152
+ export function validateSidebars(sidebars: {
153
+ [sidebarId: string]: unknown;
154
+ }): asserts sidebars is NormalizedSidebars {
155
155
  Object.values(sidebars as NormalizedSidebars).forEach((sidebar) => {
156
156
  sidebar.forEach(validateSidebarItem);
157
157
  });
@@ -269,7 +269,7 @@ function getVersionTranslationFiles(version: LoadedVersion): TranslationFiles {
269
269
  }
270
270
  function translateVersion(
271
271
  version: LoadedVersion,
272
- translationFiles: Record<string, TranslationFile>,
272
+ translationFiles: {[fileName: string]: TranslationFile},
273
273
  ): LoadedVersion {
274
274
  const versionTranslations =
275
275
  translationFiles[getVersionFileName(version.versionName)]!.content;
@@ -289,7 +289,7 @@ function getVersionsTranslationFiles(
289
289
  }
290
290
  function translateVersions(
291
291
  versions: LoadedVersion[],
292
- translationFiles: Record<string, TranslationFile>,
292
+ translationFiles: {[fileName: string]: TranslationFile},
293
293
  ): LoadedVersion[] {
294
294
  return versions.map((version) => translateVersion(version, translationFiles));
295
295
  }
@@ -303,7 +303,7 @@ export function translateLoadedContent(
303
303
  loadedContent: LoadedContent,
304
304
  translationFiles: TranslationFile[],
305
305
  ): LoadedContent {
306
- const translationFilesMap: Record<string, TranslationFile> = _.keyBy(
306
+ const translationFilesMap: {[fileName: string]: TranslationFile} = _.keyBy(
307
307
  translationFiles,
308
308
  (f) => f.path,
309
309
  );
package/src/types.ts CHANGED
@@ -59,7 +59,7 @@ export type DocFrontMatter = {
59
59
  sidebar_label?: string;
60
60
  sidebar_position?: number;
61
61
  sidebar_class_name?: string;
62
- sidebar_custom_props?: Record<string, unknown>;
62
+ sidebar_custom_props?: {[key: string]: unknown};
63
63
  displayed_sidebar?: string | null;
64
64
  pagination_label?: string;
65
65
  custom_edit_url?: string | null;
@@ -83,7 +83,7 @@ export type DocMetadataBase = LastUpdateData & {
83
83
  sidebarPosition?: number;
84
84
  editUrl?: string | null;
85
85
  tags: Tag[];
86
- frontMatter: DocFrontMatter & Record<string, unknown>;
86
+ frontMatter: DocFrontMatter & {[key: string]: unknown};
87
87
  };
88
88
 
89
89
  export type DocNavLink = {