@docusaurus/plugin-content-docs 0.0.0-4536 → 0.0.0-4542

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/lastUpdate.js CHANGED
@@ -10,6 +10,7 @@ exports.getFileLastUpdate = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const shelljs_1 = (0, tslib_1.__importDefault)(require("shelljs"));
12
12
  const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
13
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
13
14
  const GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX = /^(?<timestamp>\d+),(?<author>.+)$/;
14
15
  let showedGitRequirementError = false;
15
16
  async function getFileLastUpdate(filePath) {
@@ -36,7 +37,13 @@ async function getFileLastUpdate(filePath) {
36
37
  }
37
38
  return null;
38
39
  }
39
- const result = shelljs_1.default.exec(`git log -1 --format=%ct,%an "${filePath}"`, {
40
+ if (!shelljs_1.default.test('-f', filePath)) {
41
+ throw new Error(`Retrieval of git history failed at "${filePath}" because the file does not exist.`);
42
+ }
43
+ const fileBasename = path_1.default.basename(filePath);
44
+ const fileDirname = path_1.default.dirname(filePath);
45
+ const result = shelljs_1.default.exec(`git log --max-count=1 --format=%ct,%an -- "${fileBasename}"`, {
46
+ cwd: fileDirname,
40
47
  silent: true,
41
48
  });
42
49
  if (result.code !== 0) {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export * from '../constants';
8
+ export { filterVersions, getDefaultVersionBanner, getVersionBadge, getVersionBanner, getVersionsFilePath, readVersionsFile, readVersionNames, } from '../versions';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.readVersionNames = exports.readVersionsFile = exports.getVersionsFilePath = exports.getVersionBanner = exports.getVersionBadge = exports.getDefaultVersionBanner = exports.filterVersions = void 0;
10
+ const tslib_1 = require("tslib");
11
+ // APIs available to Node.js
12
+ (0, tslib_1.__exportStar)(require("../constants"), exports);
13
+ var versions_1 = require("../versions");
14
+ Object.defineProperty(exports, "filterVersions", { enumerable: true, get: function () { return versions_1.filterVersions; } });
15
+ Object.defineProperty(exports, "getDefaultVersionBanner", { enumerable: true, get: function () { return versions_1.getDefaultVersionBanner; } });
16
+ Object.defineProperty(exports, "getVersionBadge", { enumerable: true, get: function () { return versions_1.getVersionBadge; } });
17
+ Object.defineProperty(exports, "getVersionBanner", { enumerable: true, get: function () { return versions_1.getVersionBanner; } });
18
+ Object.defineProperty(exports, "getVersionsFilePath", { enumerable: true, get: function () { return versions_1.getVersionsFilePath; } });
19
+ Object.defineProperty(exports, "readVersionsFile", { enumerable: true, get: function () { return versions_1.readVersionsFile; } });
20
+ Object.defineProperty(exports, "readVersionNames", { enumerable: true, get: function () { return versions_1.readVersionNames; } });
@@ -61,6 +61,32 @@ async function processSidebar(unprocessedSidebar, params) {
61
61
  }
62
62
  async function processItem(item) {
63
63
  if (item.type === 'category') {
64
+ // If the current category doesn't have subitems, we render a normal doc link instead.
65
+ if (item.items.length === 0) {
66
+ if (!item.link) {
67
+ throw new Error(`Sidebar category ${item.label} has neither any subitem nor a link. This makes this item not able to link to anything.`);
68
+ }
69
+ switch (item.link.type) {
70
+ case 'doc':
71
+ return [
72
+ {
73
+ type: 'doc',
74
+ label: item.label,
75
+ id: item.link.id,
76
+ },
77
+ ];
78
+ case 'generated-index':
79
+ return [
80
+ {
81
+ type: 'link',
82
+ label: item.label,
83
+ href: item.link.permalink,
84
+ },
85
+ ];
86
+ default:
87
+ throw new Error('Unexpected sidebar category link type');
88
+ }
89
+ }
64
90
  return [await processCategoryItem(item)];
65
91
  }
66
92
  if (item.type === 'autogenerated') {
@@ -19,6 +19,11 @@ export declare type SidebarItemDoc = SidebarItemBase & {
19
19
  label?: string;
20
20
  id: string;
21
21
  };
22
+ export declare type SidebarItemHtml = SidebarItemBase & {
23
+ type: 'html';
24
+ value: string;
25
+ defaultStyle?: boolean;
26
+ };
22
27
  export declare type SidebarItemLink = SidebarItemBase & {
23
28
  type: 'link';
24
29
  href: string;
@@ -64,7 +69,7 @@ export declare type SidebarItemCategoryConfig = Expand<Optional<SidebarItemCateg
64
69
  export declare type SidebarCategoriesShorthand = {
65
70
  [sidebarCategory: string]: SidebarItemConfig[];
66
71
  };
67
- export declare type SidebarItemConfig = SidebarItemDoc | SidebarItemLink | SidebarItemAutogenerated | SidebarItemCategoryConfig | string | SidebarCategoriesShorthand;
72
+ export declare type SidebarItemConfig = SidebarItemDoc | SidebarItemHtml | SidebarItemLink | SidebarItemAutogenerated | SidebarItemCategoryConfig | string | SidebarCategoriesShorthand;
68
73
  export declare type SidebarConfig = SidebarCategoriesShorthand | SidebarItemConfig[];
69
74
  export declare type SidebarsConfig = {
70
75
  [sidebarId: string]: SidebarConfig;
@@ -73,7 +78,7 @@ export declare type NormalizedSidebarItemCategory = Expand<SidebarItemCategoryBa
73
78
  items: NormalizedSidebarItem[];
74
79
  link?: SidebarItemCategoryLink;
75
80
  }>;
76
- export declare type NormalizedSidebarItem = SidebarItemDoc | SidebarItemLink | NormalizedSidebarItemCategory | SidebarItemAutogenerated;
81
+ export declare type NormalizedSidebarItem = SidebarItemDoc | SidebarItemHtml | SidebarItemLink | NormalizedSidebarItemCategory | SidebarItemAutogenerated;
77
82
  export declare type NormalizedSidebar = NormalizedSidebarItem[];
78
83
  export declare type NormalizedSidebars = {
79
84
  [sidebarId: string]: NormalizedSidebar;
@@ -86,7 +91,7 @@ export declare type SidebarItemCategoryWithLink = Required<SidebarItemCategory,
86
91
  export declare type SidebarItemCategoryWithGeneratedIndex = SidebarItemCategoryWithLink & {
87
92
  link: SidebarItemCategoryLinkGeneratedIndex;
88
93
  };
89
- export declare type SidebarItem = SidebarItemDoc | SidebarItemLink | SidebarItemCategory;
94
+ export declare type SidebarItem = SidebarItemDoc | SidebarItemHtml | SidebarItemLink | SidebarItemCategory;
90
95
  export declare type SidebarNavigationItem = SidebarItemDoc | SidebarItemCategoryWithLink;
91
96
  export declare type Sidebar = SidebarItem[];
92
97
  export declare type SidebarItemType = SidebarItem['type'];
@@ -100,7 +105,8 @@ export declare type PropSidebarItemCategory = Expand<SidebarItemCategoryBase & {
100
105
  export declare type PropSidebarItemLink = SidebarItemLink & {
101
106
  docId?: string;
102
107
  };
103
- export declare type PropSidebarItem = PropSidebarItemLink | PropSidebarItemCategory;
108
+ export declare type PropSidebarItemHtml = SidebarItemHtml;
109
+ export declare type PropSidebarItem = PropSidebarItemLink | PropSidebarItemCategory | PropSidebarItemHtml;
104
110
  export declare type PropSidebar = PropSidebarItem[];
105
111
  export declare type PropSidebars = {
106
112
  [sidebarId: string]: PropSidebar;
@@ -28,6 +28,11 @@ const sidebarItemDocSchema = sidebarItemBaseSchema.append({
28
28
  id: utils_validation_1.Joi.string().required(),
29
29
  label: utils_validation_1.Joi.string(),
30
30
  });
31
+ const sidebarItemHtmlSchema = sidebarItemBaseSchema.append({
32
+ type: 'html',
33
+ value: utils_validation_1.Joi.string().required(),
34
+ defaultStyle: utils_validation_1.Joi.boolean().default(false),
35
+ });
31
36
  const sidebarItemLinkSchema = sidebarItemBaseSchema.append({
32
37
  type: 'link',
33
38
  href: utils_validation_1.URISchema.required(),
@@ -93,6 +98,7 @@ const sidebarItemSchema = utils_validation_1.Joi.object()
93
98
  is: utils_validation_1.Joi.string().valid('doc', 'ref').required(),
94
99
  then: sidebarItemDocSchema,
95
100
  },
101
+ { is: 'html', then: sidebarItemHtmlSchema },
96
102
  { is: 'autogenerated', then: sidebarItemAutogeneratedSchema },
97
103
  { is: 'category', then: sidebarItemCategorySchema },
98
104
  {
package/lib/versions.d.ts CHANGED
@@ -5,11 +5,35 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { VersionMetadata } from './types';
8
- import type { PluginOptions } from '@docusaurus/plugin-content-docs';
8
+ import type { PluginOptions, VersionBanner } from '@docusaurus/plugin-content-docs';
9
9
  import type { LoadContext } from '@docusaurus/types';
10
10
  export declare function getVersionedDocsDirPath(siteDir: string, pluginId: string): string;
11
11
  export declare function getVersionedSidebarsDirPath(siteDir: string, pluginId: string): string;
12
12
  export declare function getVersionsFilePath(siteDir: string, pluginId: string): string;
13
+ export declare function readVersionsFile(siteDir: string, pluginId: string): Promise<string[] | null>;
14
+ export declare function readVersionNames(siteDir: string, options: Pick<PluginOptions, 'id' | 'disableVersioning' | 'includeCurrentVersion'>): Promise<string[]>;
15
+ export declare function getDefaultVersionBanner({ versionName, versionNames, lastVersionName, }: {
16
+ versionName: string;
17
+ versionNames: string[];
18
+ lastVersionName: string;
19
+ }): VersionBanner | null;
20
+ export declare function getVersionBanner({ versionName, versionNames, lastVersionName, options, }: {
21
+ versionName: string;
22
+ versionNames: string[];
23
+ lastVersionName: string;
24
+ options: Pick<PluginOptions, 'versions'>;
25
+ }): VersionBanner | null;
26
+ export declare function getVersionBadge({ versionName, versionNames, options, }: {
27
+ versionName: string;
28
+ versionNames: string[];
29
+ options: Pick<PluginOptions, 'versions'>;
30
+ }): boolean;
31
+ /**
32
+ * Filter versions according to provided options.
33
+ * Note: we preserve the order in which versions are provided;
34
+ * the order of the onlyIncludeVersions array does not matter
35
+ */
36
+ export declare function filterVersions(versionNamesUnfiltered: string[], options: Pick<PluginOptions, 'onlyIncludeVersions'>): string[];
13
37
  export declare function readVersionsMetadata({ context, options, }: {
14
38
  context: Pick<LoadContext, 'siteDir' | 'baseUrl' | 'i18n'>;
15
39
  options: Pick<PluginOptions, 'id' | 'path' | 'sidebarPath' | 'routeBasePath' | 'tagsBasePath' | 'includeCurrentVersion' | 'disableVersioning' | 'lastVersion' | 'versions' | 'onlyIncludeVersions' | 'editUrl' | 'editCurrentVersion'>;
package/lib/versions.js CHANGED
@@ -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.getDocsDirPaths = exports.readVersionsMetadata = exports.getVersionsFilePath = exports.getVersionedSidebarsDirPath = exports.getVersionedDocsDirPath = void 0;
9
+ exports.getDocsDirPaths = exports.readVersionsMetadata = exports.filterVersions = exports.getVersionBadge = exports.getVersionBanner = exports.getDefaultVersionBanner = exports.readVersionNames = exports.readVersionsFile = exports.getVersionsFilePath = exports.getVersionedSidebarsDirPath = exports.getVersionedDocsDirPath = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const path_1 = (0, tslib_1.__importDefault)(require("path"));
12
12
  const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
@@ -56,6 +56,7 @@ async function readVersionsFile(siteDir, pluginId) {
56
56
  }
57
57
  return null;
58
58
  }
59
+ exports.readVersionsFile = readVersionsFile;
59
60
  async function readVersionNames(siteDir, options) {
60
61
  const versionFileContent = await readVersionsFile(siteDir, options.id);
61
62
  if (!versionFileContent && options.disableVersioning) {
@@ -74,6 +75,7 @@ async function readVersionNames(siteDir, options) {
74
75
  }
75
76
  return versions;
76
77
  }
78
+ exports.readVersionNames = readVersionNames;
77
79
  function getDocsDirPathLocalized({ siteDir, locale, pluginId, versionName, }) {
78
80
  return (0, utils_1.getPluginI18nPath)({
79
81
  siteDir,
@@ -150,6 +152,7 @@ function getDefaultVersionBanner({ versionName, versionNames, lastVersionName, }
150
152
  // Older versions: display unmaintained banner
151
153
  return 'unmaintained';
152
154
  }
155
+ exports.getDefaultVersionBanner = getDefaultVersionBanner;
153
156
  function getVersionBanner({ versionName, versionNames, lastVersionName, options, }) {
154
157
  var _a;
155
158
  const versionBannerOption = (_a = options.versions[versionName]) === null || _a === void 0 ? void 0 : _a.banner;
@@ -162,6 +165,7 @@ function getVersionBanner({ versionName, versionNames, lastVersionName, options,
162
165
  lastVersionName,
163
166
  });
164
167
  }
168
+ exports.getVersionBanner = getVersionBanner;
165
169
  function getVersionBadge({ versionName, versionNames, options, }) {
166
170
  var _a;
167
171
  const versionBadgeOption = (_a = options.versions[versionName]) === null || _a === void 0 ? void 0 : _a.badge;
@@ -171,6 +175,7 @@ function getVersionBadge({ versionName, versionNames, options, }) {
171
175
  const versionBadgeDefault = versionNames.length !== 1;
172
176
  return versionBadgeOption !== null && versionBadgeOption !== void 0 ? versionBadgeOption : versionBadgeDefault;
173
177
  }
178
+ exports.getVersionBadge = getVersionBadge;
174
179
  function getVersionClassName({ versionName, options, }) {
175
180
  var _a;
176
181
  const versionClassNameOption = (_a = options.versions[versionName]) === null || _a === void 0 ? void 0 : _a.className;
@@ -297,6 +302,7 @@ function filterVersions(versionNamesUnfiltered, options) {
297
302
  }
298
303
  return versionNamesUnfiltered;
299
304
  }
305
+ exports.filterVersions = filterVersions;
300
306
  async function readVersionsMetadata({ context, options, }) {
301
307
  var _a;
302
308
  const versionNamesUnfiltered = await readVersionNames(context.siteDir, options);
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-docs",
3
- "version": "0.0.0-4536",
3
+ "version": "0.0.0-4542",
4
4
  "description": "Docs plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
7
7
  "./client": "./lib/client/index.js",
8
+ "./server": "./lib/server/index.js",
8
9
  ".": "./lib/index.js"
9
10
  },
10
11
  "types": "src/plugin-content-docs.d.ts",
@@ -22,11 +23,11 @@
22
23
  },
23
24
  "license": "MIT",
24
25
  "dependencies": {
25
- "@docusaurus/core": "0.0.0-4536",
26
- "@docusaurus/logger": "0.0.0-4536",
27
- "@docusaurus/mdx-loader": "0.0.0-4536",
28
- "@docusaurus/utils": "0.0.0-4536",
29
- "@docusaurus/utils-validation": "0.0.0-4536",
26
+ "@docusaurus/core": "0.0.0-4542",
27
+ "@docusaurus/logger": "0.0.0-4542",
28
+ "@docusaurus/mdx-loader": "0.0.0-4542",
29
+ "@docusaurus/utils": "0.0.0-4542",
30
+ "@docusaurus/utils-validation": "0.0.0-4542",
30
31
  "combine-promises": "^1.1.0",
31
32
  "fs-extra": "^10.0.0",
32
33
  "import-fresh": "^3.2.2",
@@ -39,8 +40,8 @@
39
40
  "webpack": "^5.68.0"
40
41
  },
41
42
  "devDependencies": {
42
- "@docusaurus/module-type-aliases": "0.0.0-4536",
43
- "@docusaurus/types": "0.0.0-4536",
43
+ "@docusaurus/module-type-aliases": "0.0.0-4542",
44
+ "@docusaurus/types": "0.0.0-4542",
44
45
  "@types/js-yaml": "^4.0.0",
45
46
  "@types/picomatch": "^2.2.1",
46
47
  "commander": "^5.1.0",
@@ -56,5 +57,5 @@
56
57
  "engines": {
57
58
  "node": ">=14"
58
59
  },
59
- "gitHead": "a9d652056b10bf55db1bc1392672752a8b6250a7"
60
+ "gitHead": "681dde74d0f947b69f54858c12e7e8199b856714"
60
61
  }
package/src/lastUpdate.ts CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  import shell from 'shelljs';
9
9
  import logger from '@docusaurus/logger';
10
+ import path from 'path';
10
11
 
11
12
  type FileLastUpdateData = {timestamp?: number; author?: string};
12
13
 
@@ -43,9 +44,21 @@ export async function getFileLastUpdate(
43
44
  return null;
44
45
  }
45
46
 
46
- const result = shell.exec(`git log -1 --format=%ct,%an "${filePath}"`, {
47
- silent: true,
48
- });
47
+ if (!shell.test('-f', filePath)) {
48
+ throw new Error(
49
+ `Retrieval of git history failed at "${filePath}" because the file does not exist.`,
50
+ );
51
+ }
52
+
53
+ const fileBasename = path.basename(filePath);
54
+ const fileDirname = path.dirname(filePath);
55
+ const result = shell.exec(
56
+ `git log --max-count=1 --format=%ct,%an -- "${fileBasename}"`,
57
+ {
58
+ cwd: fileDirname, // this is needed: https://github.com/facebook/docusaurus/pull/5048
59
+ silent: true,
60
+ },
61
+ );
49
62
  if (result.code !== 0) {
50
63
  throw new Error(
51
64
  `Retrieval of git history failed at "${filePath}" with exit code ${result.code}: ${result.stderr}`,
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ // APIs available to Node.js
9
+ export * from '../constants';
10
+
11
+ export {
12
+ filterVersions,
13
+ getDefaultVersionBanner,
14
+ getVersionBadge,
15
+ getVersionBanner,
16
+ getVersionsFilePath,
17
+ readVersionsFile,
18
+ readVersionNames,
19
+ } from '../versions';
@@ -117,6 +117,34 @@ async function processSidebar(
117
117
  item: NormalizedSidebarItem,
118
118
  ): Promise<SidebarItem[]> {
119
119
  if (item.type === 'category') {
120
+ // If the current category doesn't have subitems, we render a normal doc link instead.
121
+ if (item.items.length === 0) {
122
+ if (!item.link) {
123
+ throw new Error(
124
+ `Sidebar category ${item.label} has neither any subitem nor a link. This makes this item not able to link to anything.`,
125
+ );
126
+ }
127
+ switch (item.link.type) {
128
+ case 'doc':
129
+ return [
130
+ {
131
+ type: 'doc',
132
+ label: item.label,
133
+ id: item.link.id,
134
+ },
135
+ ];
136
+ case 'generated-index':
137
+ return [
138
+ {
139
+ type: 'link',
140
+ label: item.label,
141
+ href: item.link.permalink,
142
+ },
143
+ ];
144
+ default:
145
+ throw new Error('Unexpected sidebar category link type');
146
+ }
147
+ }
120
148
  return [await processCategoryItem(item)];
121
149
  }
122
150
  if (item.type === 'autogenerated') {
@@ -27,6 +27,12 @@ export type SidebarItemDoc = SidebarItemBase & {
27
27
  id: string;
28
28
  };
29
29
 
30
+ export type SidebarItemHtml = SidebarItemBase & {
31
+ type: 'html';
32
+ value: string;
33
+ defaultStyle?: boolean;
34
+ };
35
+
30
36
  export type SidebarItemLink = SidebarItemBase & {
31
37
  type: 'link';
32
38
  href: string;
@@ -87,6 +93,7 @@ export type SidebarCategoriesShorthand = {
87
93
 
88
94
  export type SidebarItemConfig =
89
95
  | SidebarItemDoc
96
+ | SidebarItemHtml
90
97
  | SidebarItemLink
91
98
  | SidebarItemAutogenerated
92
99
  | SidebarItemCategoryConfig
@@ -108,6 +115,7 @@ export type NormalizedSidebarItemCategory = Expand<
108
115
 
109
116
  export type NormalizedSidebarItem =
110
117
  | SidebarItemDoc
118
+ | SidebarItemHtml
111
119
  | SidebarItemLink
112
120
  | NormalizedSidebarItemCategory
113
121
  | SidebarItemAutogenerated;
@@ -131,6 +139,7 @@ export type SidebarItemCategoryWithGeneratedIndex =
131
139
 
132
140
  export type SidebarItem =
133
141
  | SidebarItemDoc
142
+ | SidebarItemHtml
134
143
  | SidebarItemLink
135
144
  | SidebarItemCategory;
136
145
 
@@ -158,7 +167,12 @@ export type PropSidebarItemLink = SidebarItemLink & {
158
167
  docId?: string;
159
168
  };
160
169
 
161
- export type PropSidebarItem = PropSidebarItemLink | PropSidebarItemCategory;
170
+ export type PropSidebarItemHtml = SidebarItemHtml;
171
+
172
+ export type PropSidebarItem =
173
+ | PropSidebarItemLink
174
+ | PropSidebarItemCategory
175
+ | PropSidebarItemHtml;
162
176
  export type PropSidebar = PropSidebarItem[];
163
177
  export type PropSidebars = {
164
178
  [sidebarId: string]: PropSidebar;
@@ -12,6 +12,7 @@ import type {
12
12
  SidebarItemBase,
13
13
  SidebarItemAutogenerated,
14
14
  SidebarItemDoc,
15
+ SidebarItemHtml,
15
16
  SidebarItemLink,
16
17
  SidebarItemCategoryConfig,
17
18
  SidebarItemCategoryLink,
@@ -48,6 +49,12 @@ const sidebarItemDocSchema = sidebarItemBaseSchema.append<SidebarItemDoc>({
48
49
  label: Joi.string(),
49
50
  });
50
51
 
52
+ const sidebarItemHtmlSchema = sidebarItemBaseSchema.append<SidebarItemHtml>({
53
+ type: 'html',
54
+ value: Joi.string().required(),
55
+ defaultStyle: Joi.boolean().default(false),
56
+ });
57
+
51
58
  const sidebarItemLinkSchema = sidebarItemBaseSchema.append<SidebarItemLink>({
52
59
  type: 'link',
53
60
  href: URISchema.required(),
@@ -117,6 +124,7 @@ const sidebarItemSchema: Joi.Schema<SidebarItemConfig> = Joi.object()
117
124
  is: Joi.string().valid('doc', 'ref').required(),
118
125
  then: sidebarItemDocSchema,
119
126
  },
127
+ {is: 'html', then: sidebarItemHtmlSchema},
120
128
  {is: 'autogenerated', then: sidebarItemAutogeneratedSchema},
121
129
  {is: 'category', then: sidebarItemCategorySchema},
122
130
  {
package/src/versions.ts CHANGED
@@ -85,7 +85,7 @@ function ensureValidVersionArray(
85
85
  versionArray.forEach(ensureValidVersionString);
86
86
  }
87
87
 
88
- async function readVersionsFile(
88
+ export async function readVersionsFile(
89
89
  siteDir: string,
90
90
  pluginId: string,
91
91
  ): Promise<string[] | null> {
@@ -98,7 +98,7 @@ async function readVersionsFile(
98
98
  return null;
99
99
  }
100
100
 
101
- async function readVersionNames(
101
+ export async function readVersionNames(
102
102
  siteDir: string,
103
103
  options: Pick<
104
104
  PluginOptions,
@@ -257,7 +257,7 @@ function getVersionEditUrls({
257
257
  };
258
258
  }
259
259
 
260
- function getDefaultVersionBanner({
260
+ export function getDefaultVersionBanner({
261
261
  versionName,
262
262
  versionNames,
263
263
  lastVersionName,
@@ -280,7 +280,7 @@ function getDefaultVersionBanner({
280
280
  return 'unmaintained';
281
281
  }
282
282
 
283
- function getVersionBanner({
283
+ export function getVersionBanner({
284
284
  versionName,
285
285
  versionNames,
286
286
  lastVersionName,
@@ -302,7 +302,7 @@ function getVersionBanner({
302
302
  });
303
303
  }
304
304
 
305
- function getVersionBadge({
305
+ export function getVersionBadge({
306
306
  versionName,
307
307
  versionNames,
308
308
  options,
@@ -531,10 +531,10 @@ function checkVersionsOptions(
531
531
  * Note: we preserve the order in which versions are provided;
532
532
  * the order of the onlyIncludeVersions array does not matter
533
533
  */
534
- function filterVersions(
534
+ export function filterVersions(
535
535
  versionNamesUnfiltered: string[],
536
536
  options: Pick<PluginOptions, 'onlyIncludeVersions'>,
537
- ) {
537
+ ): string[] {
538
538
  if (options.onlyIncludeVersions) {
539
539
  return versionNamesUnfiltered.filter((name) =>
540
540
  (options.onlyIncludeVersions || []).includes(name),