@docusaurus/plugin-content-docs 0.0.0-4836 → 0.0.0-4839

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/index.js CHANGED
@@ -138,12 +138,12 @@ async function pluginContentDocs(context, options) {
138
138
  // TODO tags should be a sub route of the version route
139
139
  async function createTagsListPage() {
140
140
  const tagsProp = Object.values(versionTags).map((tagValue) => ({
141
- name: tagValue.label,
141
+ label: tagValue.label,
142
142
  permalink: tagValue.permalink,
143
143
  count: tagValue.docIds.length,
144
144
  }));
145
145
  // Only create /tags page if there are tags.
146
- if (Object.keys(tagsProp).length > 0) {
146
+ if (tagsProp.length > 0) {
147
147
  const tagsPropPath = await createData(`${(0, utils_1.docuHash)(`tags-list-${version.versionName}-prop`)}.json`, JSON.stringify(tagsProp, null, 2));
148
148
  addRoute({
149
149
  path: version.tagsPath,
package/lib/props.d.ts CHANGED
@@ -11,5 +11,5 @@ export declare function toVersionMetadataProp(pluginId: string, loadedVersion: L
11
11
  export declare function toTagDocListProp({ allTagsPath, tag, docs, }: {
12
12
  allTagsPath: string;
13
13
  tag: VersionTag;
14
- docs: Pick<DocMetadata, 'id' | 'title' | 'description' | 'permalink'>[];
14
+ docs: DocMetadata[];
15
15
  }): PropTagDocList;
package/lib/props.js CHANGED
@@ -104,10 +104,11 @@ function toTagDocListProp({ allTagsPath, tag, docs, }) {
104
104
  }));
105
105
  }
106
106
  return {
107
- name: tag.label,
107
+ label: tag.label,
108
108
  permalink: tag.permalink,
109
- docs: toDocListProp(),
110
109
  allTagsPath,
110
+ count: tag.docIds.length,
111
+ items: toDocListProp(),
111
112
  };
112
113
  }
113
114
  exports.toTagDocListProp = toTagDocListProp;
package/lib/types.d.ts CHANGED
@@ -5,8 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { Sidebars } from './sidebars/types';
8
- import type { BrokenMarkdownLink, Tag } from '@docusaurus/utils';
8
+ import type { BrokenMarkdownLink } from '@docusaurus/utils';
9
9
  import type { VersionMetadata, LastUpdateData, DocMetadata, CategoryGeneratedIndexMetadata } from '@docusaurus/plugin-content-docs';
10
+ import type { Tag } from '@docusaurus/types';
10
11
  export declare type DocFile = {
11
12
  contentPath: string;
12
13
  filePath: string;
@@ -22,7 +23,7 @@ export declare type VersionTag = Tag & {
22
23
  docIds: string[];
23
24
  };
24
25
  export declare type VersionTags = {
25
- [key: string]: VersionTag;
26
+ [permalink: string]: VersionTag;
26
27
  };
27
28
  export declare type LoadedVersion = VersionMetadata & {
28
29
  mainDocId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-docs",
3
- "version": "0.0.0-4836",
3
+ "version": "0.0.0-4839",
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-4836",
27
- "@docusaurus/logger": "0.0.0-4836",
28
- "@docusaurus/mdx-loader": "0.0.0-4836",
29
- "@docusaurus/utils": "0.0.0-4836",
30
- "@docusaurus/utils-validation": "0.0.0-4836",
26
+ "@docusaurus/core": "0.0.0-4839",
27
+ "@docusaurus/logger": "0.0.0-4839",
28
+ "@docusaurus/mdx-loader": "0.0.0-4839",
29
+ "@docusaurus/utils": "0.0.0-4839",
30
+ "@docusaurus/utils-validation": "0.0.0-4839",
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.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@docusaurus/module-type-aliases": "0.0.0-4836",
43
- "@docusaurus/types": "0.0.0-4836",
42
+ "@docusaurus/module-type-aliases": "0.0.0-4839",
43
+ "@docusaurus/types": "0.0.0-4839",
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": "9f5e74fd2fa4695a5c69ee02ad12d59f2fc4c621"
59
+ "gitHead": "9e77b44561516ba299e3f93d4e6d0c47c687494d"
60
60
  }
package/src/index.ts CHANGED
@@ -228,13 +228,13 @@ export default async function pluginContentDocs(
228
228
  const tagsProp: PropTagsListPage['tags'] = Object.values(
229
229
  versionTags,
230
230
  ).map((tagValue) => ({
231
- name: tagValue.label,
231
+ label: tagValue.label,
232
232
  permalink: tagValue.permalink,
233
233
  count: tagValue.docIds.length,
234
234
  }));
235
235
 
236
236
  // Only create /tags page if there are tags.
237
- if (Object.keys(tagsProp).length > 0) {
237
+ if (tagsProp.length > 0) {
238
238
  const tagsPropPath = await createData(
239
239
  `${docuHash(`tags-list-${version.versionName}-prop`)}.json`,
240
240
  JSON.stringify(tagsProp, null, 2),
@@ -7,7 +7,8 @@
7
7
 
8
8
  declare module '@docusaurus/plugin-content-docs' {
9
9
  import type {MDXOptions} from '@docusaurus/mdx-loader';
10
- import type {ContentPaths, Tag, FrontMatterTag} from '@docusaurus/utils';
10
+ import type {ContentPaths, FrontMatterTag} from '@docusaurus/utils';
11
+ import type {TagsListItem, TagModule, Tag} from '@docusaurus/types';
11
12
  import type {Required} from 'utility-types';
12
13
 
13
14
  export type Assets = {
@@ -483,25 +484,14 @@ declare module '@docusaurus/plugin-content-docs' {
483
484
  export type PropSidebar = import('./sidebars/types').PropSidebar;
484
485
  export type PropSidebars = import('./sidebars/types').PropSidebars;
485
486
 
486
- export type PropTagDocListDoc = {
487
- id: string;
488
- title: string;
489
- description: string;
490
- permalink: string;
491
- };
492
- export type PropTagDocList = {
493
- allTagsPath: string;
494
- name: string; // normalized name/label of the tag
495
- permalink: string; // pathname of the tag
496
- docs: PropTagDocListDoc[];
497
- };
487
+ export type PropTagDocListDoc = Pick<
488
+ DocMetadata,
489
+ 'id' | 'title' | 'description' | 'permalink'
490
+ >;
491
+ export type PropTagDocList = TagModule & {items: PropTagDocListDoc[]};
498
492
 
499
493
  export type PropTagsListPage = {
500
- tags: {
501
- name: string;
502
- permalink: string;
503
- count: number;
504
- }[];
494
+ tags: TagsListItem[];
505
495
  };
506
496
  }
507
497
 
package/src/props.ts CHANGED
@@ -137,7 +137,7 @@ export function toTagDocListProp({
137
137
  }: {
138
138
  allTagsPath: string;
139
139
  tag: VersionTag;
140
- docs: Pick<DocMetadata, 'id' | 'title' | 'description' | 'permalink'>[];
140
+ docs: DocMetadata[];
141
141
  }): PropTagDocList {
142
142
  function toDocListProp(): PropTagDocListDoc[] {
143
143
  const list = _.compact(
@@ -154,9 +154,10 @@ export function toTagDocListProp({
154
154
  }
155
155
 
156
156
  return {
157
- name: tag.label,
157
+ label: tag.label,
158
158
  permalink: tag.permalink,
159
- docs: toDocListProp(),
160
159
  allTagsPath,
160
+ count: tag.docIds.length,
161
+ items: toDocListProp(),
161
162
  };
162
163
  }
package/src/types.ts CHANGED
@@ -8,13 +8,14 @@
8
8
  /// <reference types="@docusaurus/module-type-aliases" />
9
9
 
10
10
  import type {Sidebars} from './sidebars/types';
11
- import type {BrokenMarkdownLink, Tag} from '@docusaurus/utils';
11
+ import type {BrokenMarkdownLink} from '@docusaurus/utils';
12
12
  import type {
13
13
  VersionMetadata,
14
14
  LastUpdateData,
15
15
  DocMetadata,
16
16
  CategoryGeneratedIndexMetadata,
17
17
  } from '@docusaurus/plugin-content-docs';
18
+ import type {Tag} from '@docusaurus/types';
18
19
 
19
20
  export type DocFile = {
20
21
  contentPath: string; // /!\ may be localized
@@ -33,7 +34,7 @@ export type VersionTag = Tag & {
33
34
  docIds: string[];
34
35
  };
35
36
  export type VersionTags = {
36
- [key: string]: VersionTag;
37
+ [permalink: string]: VersionTag;
37
38
  };
38
39
 
39
40
  export type LoadedVersion = VersionMetadata & {